From f670ec4f0bc8ddaf282d7d304b28992e53610ab5 Mon Sep 17 00:00:00 2001 From: TechnicianLP Date: Sat, 24 Jun 2017 10:01:28 +0200 Subject: [PATCH] Fix onBlockClicked handler firing twice and Item.onArmorTick in the wrong place (#4037) --- .../multiplayer/PlayerControllerMP.java.patch | 26 +++++++--------- .../entity/player/InventoryPlayer.java.patch | 31 +++++++++---------- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch index 475ea0719a..f83e117ab8 100644 --- a/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch +++ b/patches/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java.patch @@ -66,17 +66,15 @@ func_178891_a(this.field_78776_a, this, p_180511_1_, p_180511_2_); this.field_78781_i = 5; } -@@ -222,6 +230,9 @@ +@@ -221,6 +229,7 @@ + { this.field_78774_b.func_147297_a(new CPacketPlayerDigging(CPacketPlayerDigging.Action.ABORT_DESTROY_BLOCK, this.field_178895_c, p_180511_2_)); } - -+ this.field_78774_b.func_147297_a(new CPacketPlayerDigging(CPacketPlayerDigging.Action.START_DESTROY_BLOCK, p_180511_1_, p_180511_2_)); + net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.field_78776_a.field_71439_g, p_180511_1_, p_180511_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(this.field_78776_a.field_71439_g, func_78757_d() + 1)); -+ + IBlockState iblockstate = this.field_78776_a.field_71441_e.func_180495_p(p_180511_1_); this.field_78776_a.func_193032_ao().func_193294_a(this.field_78776_a.field_71441_e, p_180511_1_, iblockstate, 0.0F); - this.field_78774_b.func_147297_a(new CPacketPlayerDigging(CPacketPlayerDigging.Action.START_DESTROY_BLOCK, p_180511_1_, p_180511_2_)); -@@ -229,9 +240,11 @@ +@@ -229,9 +238,11 @@ if (flag && this.field_78770_f == 0.0F) { @@ -88,7 +86,7 @@ if (flag && iblockstate.func_185903_a(this.field_78776_a.field_71439_g, this.field_78776_a.field_71439_g.field_70170_p, p_180511_1_) >= 1.0F) { this.func_187103_a(p_180511_1_); -@@ -297,7 +310,7 @@ +@@ -297,7 +308,7 @@ if (this.field_78780_h % 4.0F == 0.0F) { @@ -97,7 +95,7 @@ this.field_78776_a.func_147118_V().func_147682_a(new PositionedSoundRecord(soundtype.func_185846_f(), SoundCategory.NEUTRAL, (soundtype.func_185843_a() + 1.0F) / 8.0F, soundtype.func_185847_b() * 0.5F, p_180512_1_)); } -@@ -350,7 +363,7 @@ +@@ -350,7 +361,7 @@ if (!this.field_85183_f.func_190926_b() && !itemstack.func_190926_b()) { @@ -106,7 +104,7 @@ } return p_178893_1_.equals(this.field_178895_c) && flag; -@@ -382,13 +395,29 @@ +@@ -382,13 +393,29 @@ } else { @@ -138,7 +136,7 @@ } if (!flag && itemstack.func_77973_b() instanceof ItemBlock) -@@ -404,7 +433,7 @@ +@@ -404,7 +431,7 @@ this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItemOnBlock(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2)); @@ -147,7 +145,7 @@ { if (itemstack.func_190926_b()) { -@@ -430,14 +459,20 @@ +@@ -430,14 +457,20 @@ { int i = itemstack.func_77960_j(); int j = itemstack.func_190916_E(); @@ -169,7 +167,7 @@ } } } -@@ -466,6 +501,8 @@ +@@ -466,6 +499,8 @@ } else { @@ -178,7 +176,7 @@ int i = itemstack.func_190916_E(); ActionResult actionresult = itemstack.func_77957_a(p_187101_2_, p_187101_1_, p_187101_3_); ItemStack itemstack1 = actionresult.func_188398_b(); -@@ -473,6 +510,10 @@ +@@ -473,6 +508,10 @@ if (itemstack1 != itemstack || itemstack1.func_190916_E() != i) { p_187101_1_.func_184611_a(p_187101_3_, itemstack1); @@ -189,7 +187,7 @@ } return actionresult.func_188397_a(); -@@ -509,6 +550,9 @@ +@@ -509,6 +548,9 @@ this.func_78750_j(); Vec3d vec3d = new Vec3d(p_187102_3_.field_72307_f.field_72450_a - p_187102_2_.field_70165_t, p_187102_3_.field_72307_f.field_72448_b - p_187102_2_.field_70163_u, p_187102_3_.field_72307_f.field_72449_c - p_187102_2_.field_70161_v); this.field_78774_b.func_147297_a(new CPacketUseEntity(p_187102_2_, p_187102_4_, vec3d)); diff --git a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch index 2209a1a2b7..1a81925bcd 100644 --- a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch @@ -1,21 +1,6 @@ --- ../src-base/minecraft/net/minecraft/entity/player/InventoryPlayer.java +++ ../src-work/minecraft/net/minecraft/entity/player/InventoryPlayer.java -@@ -110,6 +110,14 @@ - this.func_184430_d(i); - } - } -+ -+ for (ItemStack is : field_70460_b) // FORGE: Tick armor on animation ticks -+ { -+ if (!is.func_190926_b()) -+ { -+ is.func_77973_b().onArmorTick(field_70458_d.field_70170_p, field_70458_d, is); -+ } -+ } - } - - public void func_184430_d(int p_184430_1_) -@@ -293,7 +301,8 @@ +@@ -293,7 +293,8 @@ if (itemstack.func_190926_b()) { @@ -25,3 +10,17 @@ if (p_191973_2_.func_77942_o()) { +@@ -364,6 +365,13 @@ + } + } + } ++ for (ItemStack is : field_70460_b) // FORGE: Tick armor on animation ticks ++ { ++ if (!is.func_190926_b()) ++ { ++ is.func_77973_b().onArmorTick(field_70458_d.field_70170_p, field_70458_d, is); ++ } ++ } + } + + public boolean func_70441_a(ItemStack p_70441_1_)