From 6367c15d324b537013df71590d64b418765e519d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristi=C4=81ns=20Mic=C4=ABtis?= Date: Wed, 27 Jun 2018 21:27:24 +0300 Subject: [PATCH] Added Item#readNBTShareTag(ItemStack, NBTTagCompound) (#4932) --- .../net/minecraft/item/Item.java.patch | 19 +++++++++++++++---- .../minecraft/network/PacketBuffer.java.patch | 9 +++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index edf9f9c9d..810dbd0bd 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -68,7 +68,7 @@ CreativeTabs creativetabs = this.func_77640_w(); return creativetabs != null && (p_194125_1_ == CreativeTabs.field_78027_g || p_194125_1_ == creativetabs); } -@@ -435,11 +441,746 @@ +@@ -435,11 +441,757 @@ return false; } @@ -170,6 +170,17 @@ + } + + /** ++ * Override this method to decide what to do with the NBT data received from getNBTShareTag(). ++ * ++ * @param stack The stack that received NBT ++ * @param nbt Received NBT, can be null ++ */ ++ public void readNBTShareTag(ItemStack stack, @Nullable NBTTagCompound nbt) ++ { ++ stack.func_77982_d(nbt); ++ } ++ ++ /** + * Called before a block is broken. Return true to prevent default block harvesting. + * + * Note: In SMP, this is called on both client and server sides! @@ -815,7 +826,7 @@ public static void func_150900_l() { func_179214_a(Blocks.field_150350_a, new ItemAir(Blocks.field_150350_a)); -@@ -999,6 +1740,8 @@ +@@ -999,6 +1751,8 @@ private final float field_78010_h; private final float field_78011_i; private final int field_78008_j; @@ -824,7 +835,7 @@ private ToolMaterial(int p_i1874_3_, int p_i1874_4_, float p_i1874_5_, float p_i1874_6_, int p_i1874_7_) { -@@ -1034,6 +1777,7 @@ +@@ -1034,6 +1788,7 @@ return this.field_78008_j; } @@ -832,7 +843,7 @@ public Item func_150995_f() { if (this == WOOD) -@@ -1057,5 +1801,21 @@ +@@ -1057,5 +1812,21 @@ return this == DIAMOND ? Items.field_151045_i : null; } } diff --git a/patches/minecraft/net/minecraft/network/PacketBuffer.java.patch b/patches/minecraft/net/minecraft/network/PacketBuffer.java.patch index 3b58a5f07..f2f417666 100755 --- a/patches/minecraft/net/minecraft/network/PacketBuffer.java.patch +++ b/patches/minecraft/net/minecraft/network/PacketBuffer.java.patch @@ -9,3 +9,12 @@ } this.func_150786_a(nbttagcompound); +@@ -358,7 +358,7 @@ + int j = this.readByte(); + int k = this.readShort(); + ItemStack itemstack = new ItemStack(Item.func_150899_d(i), j, k); +- itemstack.func_77982_d(this.func_150793_b()); ++ itemstack.func_77973_b().readNBTShareTag(itemstack, this.func_150793_b()); + return itemstack; + } + }