Fix onBlockClicked handler firing twice and Item.onArmorTick in the wrong place (#4037)

This commit is contained in:
TechnicianLP authored and mezz committed 2017-06-24 01:01:28 -07:00
1 parent d769d83224
commit f670ec4f0b
2 files changed
+27 -30

No files matched your search

@@ -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<ItemStack> 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));
@@ -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_)