Reimplement usage of Item#doesSneakBypassUse() (#6114)
This commit is contained in:
parent
862289cf56
commit
ff7a2fe4d6
2 changed files with 13 additions and 11 deletions
|
@ -72,7 +72,7 @@
|
|||
}
|
||||
|
||||
return p_178893_1_.equals(this.field_178895_c) && flag;
|
||||
@@ -257,17 +264,25 @@
|
||||
@@ -257,17 +264,24 @@
|
||||
return ActionResultType.FAIL;
|
||||
} else {
|
||||
ItemStack itemstack = p_217292_1_.func_184586_b(p_217292_3_);
|
||||
|
@ -87,9 +87,10 @@
|
|||
return ActionResultType.SUCCESS;
|
||||
} else {
|
||||
boolean flag = !p_217292_1_.func_184614_ca().func_190926_b() || !p_217292_1_.func_184592_cb().func_190926_b();
|
||||
boolean flag1 = p_217292_1_.func_70093_af() && flag;
|
||||
+ if (event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.DENY) flag1 = true;
|
||||
if (!flag1 && p_217292_2_.func_180495_p(blockpos).func_215687_a(p_217292_2_, p_217292_1_, p_217292_3_, p_217292_4_)) {
|
||||
- boolean flag1 = p_217292_1_.func_70093_af() && flag;
|
||||
- if (!flag1 && p_217292_2_.func_180495_p(blockpos).func_215687_a(p_217292_2_, p_217292_1_, p_217292_3_, p_217292_4_)) {
|
||||
+ boolean flag1 = !(p_217292_1_.func_70093_af() && flag) || (p_217292_1_.func_184614_ca().doesSneakBypassUse(p_217292_2_,blockpos,p_217292_1_) && p_217292_1_.func_184592_cb().doesSneakBypassUse(p_217292_2_,blockpos,p_217292_1_));
|
||||
+ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && flag1 && p_217292_2_.func_180495_p(blockpos).func_215687_a(p_217292_2_, p_217292_1_, p_217292_3_, p_217292_4_)) {
|
||||
this.field_78774_b.func_147297_a(new CPlayerTryUseItemOnBlockPacket(p_217292_3_, p_217292_4_));
|
||||
return ActionResultType.SUCCESS;
|
||||
} else {
|
||||
|
@ -98,7 +99,7 @@
|
|||
if (!itemstack.func_190926_b() && !p_217292_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b())) {
|
||||
ItemUseContext itemusecontext = new ItemUseContext(p_217292_1_, p_217292_3_, p_217292_4_);
|
||||
ActionResultType actionresulttype;
|
||||
@@ -298,11 +313,14 @@
|
||||
@@ -298,11 +312,14 @@
|
||||
if (p_187101_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b())) {
|
||||
return ActionResultType.PASS;
|
||||
} else {
|
||||
|
@ -113,7 +114,7 @@
|
|||
}
|
||||
|
||||
return actionresult.func_188397_a();
|
||||
@@ -327,6 +345,9 @@
|
||||
@@ -327,6 +344,9 @@
|
||||
public ActionResultType func_187097_a(PlayerEntity p_187097_1_, Entity p_187097_2_, Hand p_187097_3_) {
|
||||
this.func_78750_j();
|
||||
this.field_78774_b.func_147297_a(new CUseEntityPacket(p_187097_2_, p_187097_3_));
|
||||
|
@ -123,7 +124,7 @@
|
|||
return this.field_78779_k == GameType.SPECTATOR ? ActionResultType.PASS : p_187097_1_.func_190775_a(p_187097_2_, p_187097_3_);
|
||||
}
|
||||
|
||||
@@ -334,6 +355,9 @@
|
||||
@@ -334,6 +354,9 @@
|
||||
this.func_78750_j();
|
||||
Vec3d vec3d = p_187102_3_.func_216347_e().func_178786_a(p_187102_2_.field_70165_t, p_187102_2_.field_70163_u, p_187102_2_.field_70161_v);
|
||||
this.field_78774_b.func_147297_a(new CUseEntityPacket(p_187102_2_, p_187102_4_, vec3d));
|
||||
|
|
|
@ -122,7 +122,7 @@
|
|||
int i = p_187250_3_.func_190916_E();
|
||||
int j = p_187250_3_.func_77952_i();
|
||||
ActionResult<ItemStack> actionresult = p_187250_3_.func_77957_a(p_187250_2_, p_187250_1_, p_187250_4_);
|
||||
@@ -285,12 +310,20 @@
|
||||
@@ -285,12 +310,19 @@
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
} else {
|
||||
|
@ -134,9 +134,10 @@
|
|||
+ if (result != ActionResultType.PASS) return result;
|
||||
+ }
|
||||
boolean flag = !p_219441_1_.func_184614_ca().func_190926_b() || !p_219441_1_.func_184592_cb().func_190926_b();
|
||||
boolean flag1 = p_219441_1_.func_70093_af() && flag;
|
||||
+ if (event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.DENY) flag1 = true;
|
||||
if (!flag1 && blockstate.func_215687_a(p_219441_2_, p_219441_1_, p_219441_4_, p_219441_5_)) {
|
||||
- boolean flag1 = p_219441_1_.func_70093_af() && flag;
|
||||
- if (!flag1 && blockstate.func_215687_a(p_219441_2_, p_219441_1_, p_219441_4_, p_219441_5_)) {
|
||||
+ boolean flag1 = !(p_219441_1_.func_70093_af() && flag) || (p_219441_1_.func_184614_ca().doesSneakBypassUse(p_219441_2_,blockpos,p_219441_1_) && p_219441_1_.func_184592_cb().doesSneakBypassUse(p_219441_2_,blockpos,p_219441_1_));
|
||||
+ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && flag1 && blockstate.func_215687_a(p_219441_2_, p_219441_1_, p_219441_4_, p_219441_5_)) {
|
||||
return ActionResultType.SUCCESS;
|
||||
} else if (!p_219441_3_.func_190926_b() && !p_219441_1_.func_184811_cZ().func_185141_a(p_219441_3_.func_77973_b())) {
|
||||
- ItemUseContext itemusecontext = new ItemUseContext(p_219441_1_, p_219441_4_, p_219441_5_);
|
||||
|
|
Loading…
Reference in a new issue