From 595ec6472690de62195d62b7dd3b5cb7e4118b32 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 19 Jul 2018 10:12:55 +1000 Subject: [PATCH] SPIGOT-4049: Books lose NBT data --- nms-patches/ItemStack.patch | 2 +- .../java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nms-patches/ItemStack.patch b/nms-patches/ItemStack.patch index deb30027fe..8232f07802 100644 --- a/nms-patches/ItemStack.patch +++ b/nms-patches/ItemStack.patch @@ -27,7 +27,7 @@ + // Called to run this stack through the data converter to handle older storage methods and serialized items + public void convertStack() { -+ if (MinecraftServer.getServer() != null) { ++ if (false && MinecraftServer.getServer() != null) { // Skip for now, causes more issues than it solves + // Don't convert some things - both the old and new data values are valid + // Conversion would make getting then impossible + if (this.item == Blocks.PUMPKIN.getItem() || this.item == Blocks.GRASS.getItem() || this.item == Blocks.SNOW.getItem()) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java index c3e3bba25b..dfd6e66bff 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -466,10 +466,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable { @Overridden void applyToItem(NBTTagCompound itemTag) { if (hasDisplayName()) { - setDisplayTag(itemTag, NAME.NBT, new NBTTagString(CraftChatMessage.fromComponent(displayName))); // SPIGOT-4041: Should be JSON, but we're still aggressively converting stacks & old+new are both valid + setDisplayTag(itemTag, NAME.NBT, new NBTTagString(CraftChatMessage.toJSON(displayName))); } if (hasLocalizedName()){ - setDisplayTag(itemTag, LOCNAME.NBT, new NBTTagString(CraftChatMessage.fromComponent(locName))); // SPIGOT-4041: Should be JSON, but we're still aggressively converting stacks & old+new are both valid + setDisplayTag(itemTag, LOCNAME.NBT, new NBTTagString(CraftChatMessage.toJSON(locName))); } if (hasLore()) {