From 87f083460caaacdcfab556801e9512fc899ad63b Mon Sep 17 00:00:00 2001 From: Matsv Date: Sat, 2 Apr 2016 15:02:41 +0200 Subject: [PATCH 1/2] Fix custom named spawneggs --- .../ViaVersion/protocols/protocol1_9to1_8/ItemRewriter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/ItemRewriter.java b/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/ItemRewriter.java index 630881353..41247c6e3 100644 --- a/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/ItemRewriter.java +++ b/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/ItemRewriter.java @@ -136,6 +136,7 @@ public class ItemRewriter { } public static void toServer(Item item) { + System.out.println(item); if (item != null) { if (item.getId() == Material.MONSTER_EGG.getId() && item.getData() == 0) { CompoundTag tag = item.getTag(); @@ -147,8 +148,9 @@ public class ItemRewriter { if (ENTTIY_NAME_TO_ID.containsKey(id.getValue())) data = ENTTIY_NAME_TO_ID.get(id.getValue()); } + tag.remove("EntityTag"); } - item.setTag(null); + item.setTag(tag); item.setData((short) data); } if (item.getId() == Material.POTION.getId()) { From ed0d5a7cfbeda621be5c478fc376ffd1fca89c49 Mon Sep 17 00:00:00 2001 From: Matsv Date: Sat, 2 Apr 2016 15:06:10 +0200 Subject: [PATCH 2/2] Fix NBT for potions --- .../protocols/protocol1_9to1_8/ItemRewriter.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/ItemRewriter.java b/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/ItemRewriter.java index 41247c6e3..7aecc9032 100644 --- a/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/ItemRewriter.java +++ b/src/main/java/us/myles/ViaVersion/protocols/protocol1_9to1_8/ItemRewriter.java @@ -136,7 +136,6 @@ public class ItemRewriter { } public static void toServer(Item item) { - System.out.println(item); if (item != null) { if (item.getId() == Material.MONSTER_EGG.getId() && item.getData() == 0) { CompoundTag tag = item.getTag(); @@ -162,10 +161,12 @@ public class ItemRewriter { if (POTION_NAME_TO_ID.containsKey(potionName)) { data = POTION_NAME_TO_ID.get(potionName); } + tag.remove("Potion"); } - item.setTag(null); + item.setTag(tag); item.setData((short) data); } + //Splash potion if (item.getId() == 438) { CompoundTag tag = item.getTag(); int data = 0; @@ -176,8 +177,9 @@ public class ItemRewriter { if (POTION_NAME_TO_ID.containsKey(potionName)) { data = POTION_NAME_TO_ID.get(potionName) + 8192; } + tag.remove("Potion"); } - item.setTag(null); + item.setTag(tag); item.setData((short) data); } }