From 7bbd1a66069f8e7f943fd9e78737200b66d40353 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Fri, 17 Jun 2016 10:40:58 -0400 Subject: [PATCH] Fix broken EntityItem merging for Items with capabilities --- .../entity/item/EntityItem.java.patch | 21 ++++++++++++++----- .../net/minecraft/item/ItemStack.java.patch | 21 ++++++++++++++++++- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch index 6ef711174..8adc92b8e 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch @@ -47,7 +47,18 @@ this.func_70106_y(); } } -@@ -280,6 +296,7 @@ +@@ -196,6 +212,10 @@ + { + return false; + } ++ else if (!itemstack.areCapsCompatible(itemstack1)) ++ { ++ return false; ++ } + else + { + itemstack1.field_77994_a += itemstack.field_77994_a; +@@ -280,6 +300,7 @@ p_70014_1_.func_74777_a("Health", (short)this.field_70291_e); p_70014_1_.func_74777_a("Age", (short)this.field_70292_b); p_70014_1_.func_74777_a("PickupDelay", (short)this.field_145804_b); @@ -55,7 +66,7 @@ if (this.func_145800_j() != null) { -@@ -320,20 +337,23 @@ +@@ -320,20 +341,23 @@ NBTTagCompound nbttagcompound = p_70037_1_.func_74775_l("Item"); this.func_92058_a(ItemStack.func_77949_a(nbttagcompound)); @@ -84,7 +95,7 @@ { if (itemstack.func_77973_b() == Item.func_150898_a(Blocks.field_150364_r)) { -@@ -370,6 +390,7 @@ +@@ -370,6 +394,7 @@ } } @@ -92,7 +103,7 @@ if (!this.func_174814_R()) { this.field_70170_p.func_184148_a((EntityPlayer)null, p_70100_1_.field_70165_t, p_70100_1_.field_70163_u, p_70100_1_.field_70161_v, SoundEvents.field_187638_cR, SoundCategory.PLAYERS, 0.2F, ((this.field_70146_Z.nextFloat() - this.field_70146_Z.nextFloat()) * 0.7F + 1.0F) * 2.0F); -@@ -416,11 +437,6 @@ +@@ -416,11 +441,6 @@ if (itemstack == null) { @@ -104,7 +115,7 @@ return new ItemStack(Blocks.field_150348_b); } else -@@ -494,6 +510,6 @@ +@@ -494,6 +514,6 @@ public void func_174870_v() { this.func_174871_r(); diff --git a/patches/minecraft/net/minecraft/item/ItemStack.java.patch b/patches/minecraft/net/minecraft/item/ItemStack.java.patch index 8d9ed7a16..136028c51 100644 --- a/patches/minecraft/net/minecraft/item/ItemStack.java.patch +++ b/patches/minecraft/net/minecraft/item/ItemStack.java.patch @@ -234,7 +234,7 @@ this.field_151002_e = p_150996_1_; } -@@ -991,4 +1026,26 @@ +@@ -991,4 +1026,45 @@ return false; } } @@ -259,5 +259,24 @@ + NBTTagCompound ret = new NBTTagCompound(); + this.func_77955_b(ret); + return ret; ++ } ++ ++ public boolean areCapsCompatible(ItemStack other) ++ { ++ if (this.capabilities == null) ++ { ++ if (other.capabilities == null) ++ { ++ return true; ++ } ++ else ++ { ++ return other.capabilities.areCompatible(null); ++ } ++ } ++ else ++ { ++ return this.capabilities.areCompatible(other.capabilities); ++ } + } }