From 2d40afa3a1d9e57a4402d4bdb862c16b9420c7e7 Mon Sep 17 00:00:00 2001 From: Mats Date: Mon, 7 Mar 2016 19:58:07 +0100 Subject: [PATCH] Change DataInputstream / Outputstream to readNBT / writeNBT --- .../ViaVersion/transformers/OutgoingTransformer.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java b/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java index f58c7a6f2..e3dd9e96e 100644 --- a/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java +++ b/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java @@ -677,21 +677,18 @@ public class OutgoingTransformer { if (action == 1) { // update spawner try { int index = input.readerIndex(); - DataInputStream stream = new DataInputStream(new ByteBufInputStream(input)); - CompoundTag tag = (CompoundTag) NBTIO.readTag(stream); + CompoundTag tag = PacketUtil.readNBT(input); if (tag != null && tag.contains("EntityId")) { String entity = (String) tag.get("EntityId").getValue(); CompoundTag spawn = new CompoundTag("SpawnData"); spawn.put(new StringTag("id", entity)); tag.put(spawn); - DataOutputStream out = new DataOutputStream(new ByteBufOutputStream(output)); - NBTIO.writeTag(out, tag); + PacketUtil.writeNBT(output,tag); } else if (tag != null) { // EntityID does not exist CompoundTag spawn = new CompoundTag("SpawnData"); spawn.put(new StringTag("id", "AreaEffectCloud")); //Make spawners show up as empty when no EntityId is given. tag.put(spawn); - DataOutputStream out = new DataOutputStream(new ByteBufOutputStream(output)); - NBTIO.writeTag(out, tag); + PacketUtil.writeNBT(output,spawn); } else { //There doesn't exist any NBT tag input.readerIndex(index); output.writeBytes(input, input.readableBytes());