From bd9096ef6d6d4fcd39d81ae0db9ec9f311816691 Mon Sep 17 00:00:00 2001 From: Myles Date: Sat, 16 Dec 2017 22:17:12 +0000 Subject: [PATCH] Flat item should only write NBT when id != 0 --- .../ViaVersion/api/type/types/minecraft/FlatItemType.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/FlatItemType.java b/common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/FlatItemType.java index a12df526d..f47cbd634 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/FlatItemType.java +++ b/common/src/main/java/us/myles/ViaVersion/api/type/types/minecraft/FlatItemType.java @@ -18,7 +18,9 @@ public class FlatItemType extends BaseItemType { Item item = new Item(); item.setId(id); item.setAmount(buffer.readByte()); - item.setTag(Type.NBT.read(buffer)); + if (id != 0) { + item.setTag(Type.NBT.read(buffer)); + } return item; } } @@ -30,7 +32,9 @@ public class FlatItemType extends BaseItemType { } else { buffer.writeShort(object.getId()); buffer.writeByte(object.getAmount()); - Type.NBT.write(buffer, object.getTag()); + if (object.getId() != 0) { + Type.NBT.write(buffer, object.getTag()); + } } } }