Add Item#getNBTShareTag (#3342)

* Add Item#getNBTShareTag

* Update comment
This commit is contained in:
Raoul 2016-10-30 18:24:14 +01:00 committed by cpw
parent 5f9034d95b
commit 56e347d05a
2 changed files with 26 additions and 3 deletions

View File

@ -60,7 +60,7 @@
return p_77621_1_.func_147447_a(vec3d, vec3d1, p_77621_3_, !p_77621_3_, false);
}
@@ -426,11 +433,580 @@
@@ -426,11 +433,592 @@
return false;
}
@ -142,6 +142,18 @@
+ }
+
+ /**
+ * Override this method to change the NBT data being sent to the client.
+ * You should ONLY override this when you have no other choice, as this might change behavior client side!
+ *
+ * @param stack The stack to send the NBT tag for
+ * @return The NBT tag
+ */
+ public NBTTagCompound getNBTShareTag(ItemStack stack)
+ {
+ return stack.func_77978_p();
+ }
+
+ /**
+ * 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!
@ -641,7 +653,7 @@
public static void func_150900_l()
{
func_179214_a(Blocks.field_150348_b, (new ItemMultiTexture(Blocks.field_150348_b, Blocks.field_150348_b, new Function<ItemStack, String>()
@@ -962,6 +1538,10 @@
@@ -962,6 +1550,10 @@
private final float field_78011_i;
private final int field_78008_j;
@ -652,7 +664,7 @@
private ToolMaterial(int p_i1874_3_, int p_i1874_4_, float p_i1874_5_, float p_i1874_6_, int p_i1874_7_)
{
this.field_78001_f = p_i1874_3_;
@@ -996,9 +1576,36 @@
@@ -996,9 +1588,36 @@
return this.field_78008_j;
}

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/network/PacketBuffer.java
+++ ../src-work/minecraft/net/minecraft/network/PacketBuffer.java
@@ -333,7 +333,7 @@
if (p_150788_1_.func_77973_b().func_77645_m() || p_150788_1_.func_77973_b().func_77651_p())
{
- nbttagcompound = p_150788_1_.func_77978_p();
+ nbttagcompound = p_150788_1_.func_77973_b().getNBTShareTag(p_150788_1_);
}
this.func_150786_a(nbttagcompound);