From a5ffda5d66b0b415c7c3115e1749e1a4d09eca5e Mon Sep 17 00:00:00 2001 From: LexManos Date: Sat, 28 May 2016 18:20:05 -0700 Subject: [PATCH] Close player's inventory to prevent potential dupe issues on some modded items. Closes #1431 --- .../entity/player/EntityPlayer.java.patch | 56 ++++++++++--------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index 682a8da4a..84d1061fa 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -67,7 +67,11 @@ if (this.func_70005_c_().equals("Notch")) { this.func_146097_a(new ItemStack(Items.field_151034_e, 1), true, false); -@@ -592,6 +603,9 @@ +@@ -589,9 +600,13 @@ + + if (!this.field_70170_p.func_82736_K().func_82766_b("keepInventory") && !this.func_175149_v()) + { ++ this.func_71053_j(); //Force the screen closed before droping inventory, this will cause the held item to drop and 'bag' items to finalize. this.field_71071_by.func_70436_m(); } @@ -77,7 +81,7 @@ if (p_70645_1_ != null) { this.field_70159_w = (double)(-MathHelper.func_76134_b((this.field_70739_aP + this.field_70177_z) * 0.017453292F) * 0.1F); -@@ -680,13 +694,26 @@ +@@ -680,13 +695,26 @@ @Nullable public EntityItem func_71040_bB(boolean p_71040_1_) { @@ -106,7 +110,7 @@ } @Nullable -@@ -751,14 +778,22 @@ +@@ -751,14 +779,22 @@ @Nullable public ItemStack func_184816_a(EntityItem p_184816_1_) { @@ -130,7 +134,7 @@ if (f > 1.0F) { int i = EnchantmentHelper.func_185293_e(this); -@@ -808,12 +843,13 @@ +@@ -808,12 +844,13 @@ f /= 5.0F; } @@ -146,7 +150,7 @@ } public void func_70037_a(NBTTagCompound p_70037_1_) -@@ -849,6 +885,16 @@ +@@ -849,6 +886,16 @@ this.field_82248_d = p_70037_1_.func_74767_n("SpawnForced"); } @@ -163,7 +167,7 @@ this.field_71100_bB.func_75112_a(p_70037_1_); this.field_71075_bZ.func_75095_b(p_70037_1_); -@@ -881,6 +927,23 @@ +@@ -881,6 +928,23 @@ p_70014_1_.func_74757_a("SpawnForced", this.field_82248_d); } @@ -187,7 +191,7 @@ this.field_71100_bB.func_75117_b(p_70014_1_); this.field_71075_bZ.func_75091_a(p_70014_1_); p_70014_1_.func_74782_a("EnderItems", this.field_71078_a.func_70487_g()); -@@ -888,6 +951,7 @@ +@@ -888,6 +952,7 @@ public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -195,7 +199,7 @@ if (this.func_180431_b(p_70097_1_)) { return false; -@@ -970,6 +1034,7 @@ +@@ -970,6 +1035,7 @@ if (this.field_184627_bm.field_77994_a <= 0) { EnumHand enumhand = this.func_184600_cs(); @@ -203,7 +207,7 @@ if (enumhand == EnumHand.MAIN_HAND) { -@@ -1005,7 +1070,10 @@ +@@ -1005,7 +1071,10 @@ { if (!this.func_180431_b(p_70665_1_)) { @@ -215,7 +219,7 @@ p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_); float f = p_70665_2_; p_70665_2_ = Math.max(p_70665_2_ - this.func_110139_bj(), 0.0F); -@@ -1071,6 +1139,7 @@ +@@ -1071,6 +1140,7 @@ } else { @@ -223,7 +227,7 @@ ItemStack itemstack = p_184822_2_ != null ? p_184822_2_.func_77946_l() : null; if (!p_184822_1_.func_184230_a(this, p_184822_2_, p_184822_3_)) -@@ -1086,6 +1155,7 @@ +@@ -1086,6 +1156,7 @@ { if (p_184822_2_.field_77994_a <= 0 && !this.field_71075_bZ.field_75098_d) { @@ -231,7 +235,7 @@ this.func_184611_a(p_184822_3_, (ItemStack)null); } -@@ -1101,6 +1171,7 @@ +@@ -1101,6 +1172,7 @@ { if (p_184822_2_.field_77994_a <= 0 && !this.field_71075_bZ.field_75098_d) { @@ -239,7 +243,7 @@ this.func_184611_a(p_184822_3_, (ItemStack)null); } else if (p_184822_2_.field_77994_a < itemstack.field_77994_a && this.field_71075_bZ.field_75098_d) -@@ -1127,6 +1198,7 @@ +@@ -1127,6 +1199,7 @@ public void func_71059_n(Entity p_71059_1_) { @@ -247,7 +251,7 @@ if (p_71059_1_.func_70075_an()) { if (!p_71059_1_.func_85031_j(this)) -@@ -1326,6 +1398,7 @@ +@@ -1326,6 +1399,7 @@ if (itemstack1.field_77994_a <= 0) { this.func_184611_a(EnumHand.MAIN_HAND, (ItemStack)null); @@ -255,7 +259,7 @@ } } -@@ -1414,6 +1487,8 @@ +@@ -1414,6 +1488,8 @@ public EntityPlayer.SleepResult func_180469_a(BlockPos p_180469_1_) { @@ -264,7 +268,7 @@ if (!this.field_70170_p.field_72995_K) { if (this.func_70608_bn() || !this.func_70089_S()) -@@ -1453,9 +1528,10 @@ +@@ -1453,9 +1529,10 @@ this.func_70105_a(0.2F, 0.2F); @@ -278,7 +282,7 @@ float f = 0.5F; float f1 = 0.5F; -@@ -1518,13 +1594,14 @@ +@@ -1518,13 +1595,14 @@ public void func_70999_a(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_) { @@ -296,7 +300,7 @@ if (blockpos == null) { -@@ -1533,6 +1610,10 @@ +@@ -1533,6 +1611,10 @@ this.func_70107_b((double)((float)blockpos.func_177958_n() + 0.5F), (double)((float)blockpos.func_177956_o() + 0.1F), (double)((float)blockpos.func_177952_p() + 0.5F)); } @@ -307,7 +311,7 @@ this.field_71083_bS = false; -@@ -1551,15 +1632,16 @@ +@@ -1551,15 +1633,16 @@ private boolean func_175143_p() { @@ -327,7 +331,7 @@ { if (!p_180467_2_) { -@@ -1574,16 +1656,17 @@ +@@ -1574,16 +1657,17 @@ } else { @@ -348,7 +352,7 @@ switch (enumfacing) { -@@ -1623,16 +1706,24 @@ +@@ -1623,16 +1707,24 @@ public BlockPos func_180470_cg() { @@ -375,7 +379,7 @@ if (p_180473_1_ != null) { this.field_71077_c = p_180473_1_; -@@ -1827,6 +1918,10 @@ +@@ -1827,6 +1919,10 @@ super.func_180430_e(p_180430_1_, p_180430_2_); } @@ -386,7 +390,7 @@ } protected void func_71061_d_() -@@ -2027,6 +2122,18 @@ +@@ -2027,6 +2123,18 @@ this.field_175152_f = p_71049_1_.field_175152_f; this.field_71078_a = p_71049_1_.field_71078_a; this.func_184212_Q().func_187227_b(field_184827_bp, p_71049_1_.func_184212_Q().func_187225_a(field_184827_bp)); @@ -405,7 +409,7 @@ } protected boolean func_70041_e_() -@@ -2126,7 +2233,10 @@ +@@ -2126,7 +2234,10 @@ public ITextComponent func_145748_c_() { @@ -417,7 +421,7 @@ itextcomponent.func_150256_b().func_150241_a(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/msg " + this.func_70005_c_() + " ")); itextcomponent.func_150256_b().func_150209_a(this.func_174823_aP()); itextcomponent.func_150256_b().func_179989_a(this.func_70005_c_()); -@@ -2135,7 +2245,7 @@ +@@ -2135,7 +2246,7 @@ public float func_70047_e() { @@ -426,7 +430,7 @@ if (this.func_70608_bn()) { -@@ -2346,6 +2456,161 @@ +@@ -2346,6 +2457,161 @@ return (float)this.func_110148_a(SharedMonsterAttributes.field_188792_h).func_111126_e(); }