diff options
author | Jacob Martin <jjm_223@hotmail.com> | 2016-12-03 10:51:53 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2016-12-03 10:58:18 +1100 |
commit | b64d8524968ef0984bb78dd026192e83b56149d8 (patch) | |
tree | 4274eb18558bf2efade4097f4f6d8eaa8b4d3ca7 /nms-patches | |
parent | 9beb0c9968c228788c7bbc446316ccd20e6a0c15 (diff) | |
download | craftbukkit-b64d8524968ef0984bb78dd026192e83b56149d8.tar craftbukkit-b64d8524968ef0984bb78dd026192e83b56149d8.tar.gz craftbukkit-b64d8524968ef0984bb78dd026192e83b56149d8.tar.lz craftbukkit-b64d8524968ef0984bb78dd026192e83b56149d8.tar.xz craftbukkit-b64d8524968ef0984bb78dd026192e83b56149d8.zip |
#326: Convert BlockMeta to handle older serialized items.
Diffstat (limited to 'nms-patches')
-rw-r--r-- | nms-patches/DataInspectorBlockEntity.patch | 12 | ||||
-rw-r--r-- | nms-patches/ItemStack.patch | 27 |
2 files changed, 29 insertions, 10 deletions
diff --git a/nms-patches/DataInspectorBlockEntity.patch b/nms-patches/DataInspectorBlockEntity.patch new file mode 100644 index 00000000..182ddf44 --- /dev/null +++ b/nms-patches/DataInspectorBlockEntity.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/server/DataInspectorBlockEntity.java ++++ b/net/minecraft/server/DataInspectorBlockEntity.java +@@ -32,7 +32,8 @@ + boolean flag; + + if (s1 == null) { +- DataInspectorBlockEntity.a.warn("Unable to resolve BlockEntity for ItemInstance: {}", new Object[] { s}); ++ // CraftBukkit - Remove unnecessary warning (occurs when deserializing a Shulker Box item) ++ // DataInspectorBlockEntity.a.warn("Unable to resolve BlockEntity for ItemInstance: {}", new Object[] { s}); + flag = false; + } else { + flag = !nbttagcompound2.hasKey("id"); diff --git a/nms-patches/ItemStack.patch b/nms-patches/ItemStack.patch index 98cf9d84..10ffe646 100644 --- a/nms-patches/ItemStack.patch +++ b/nms-patches/ItemStack.patch @@ -20,18 +20,15 @@ public final class ItemStack { public static final ItemStack a = new ItemStack((Item) null); -@@ -46,28 +59,49 @@ +@@ -46,28 +59,56 @@ this.item = item; this.damage = j; this.count = i; + // CraftBukkit start - Pass to setData to do filtering + if (MinecraftServer.getServer() != null) { + this.setData(j); -+ NBTTagCompound savedStack = new NBTTagCompound(); -+ this.save(savedStack); -+ MinecraftServer.getServer().getDataConverterManager().a(DataConverterTypes.ITEM_INSTANCE, savedStack); // PAIL: convert -+ this.load(savedStack); + } ++ this.convertStack(); + // CraftBukkit end if (this.damage < 0) { - this.damage = 0; @@ -41,6 +38,16 @@ this.F(); } ++ // Called to run this stack through the data converter to handle older storage methods and serialized items ++ public void convertStack() { ++ if (MinecraftServer.getServer() != null) { ++ NBTTagCompound savedStack = new NBTTagCompound(); ++ this.save(savedStack); ++ MinecraftServer.getServer().getDataConverterManager().a(DataConverterTypes.ITEM_INSTANCE, savedStack); // PAIL: convert ++ this.load(savedStack); ++ } ++ } ++ private void F() { + if (this.g && this == ItemStack.a) throw new AssertionError("TRAP"); // CraftBukkit this.g = this.isEmpty(); @@ -75,7 +82,7 @@ this.F(); } -@@ -94,11 +128,138 @@ +@@ -94,11 +135,138 @@ } public EnumInteractionResult placeItem(EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) { @@ -215,7 +222,7 @@ return enuminteractionresult; } -@@ -122,7 +283,7 @@ +@@ -122,7 +290,7 @@ nbttagcompound.setByte("Count", (byte) this.count); nbttagcompound.setShort("Damage", (short) this.damage); if (this.tag != null) { @@ -224,7 +231,7 @@ } return nbttagcompound; -@@ -157,11 +318,30 @@ +@@ -157,11 +325,30 @@ } public void setData(int i) { @@ -257,7 +264,7 @@ } public int k() { -@@ -205,6 +385,11 @@ +@@ -205,6 +392,11 @@ entityhuman.b(StatisticList.c(this.item)); } @@ -269,7 +276,7 @@ this.damage = 0; } -@@ -509,6 +694,12 @@ +@@ -509,6 +701,12 @@ nbttaglist.add(nbttagcompound); } |