diff --git a/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java b/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java index 99be058f2..099c695a6 100644 --- a/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java +++ b/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java @@ -624,14 +624,28 @@ public class OutgoingTransformer { output.writeByte(action); if (action == 1) { // update spawner try { + int index = input.readerIndex(); DataInputStream stream = new DataInputStream(new ByteBufInputStream(input)); CompoundTag tag = (CompoundTag) NBTIO.readTag(stream); - 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); + 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); + } + 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); + } + else { //There doesn't exist any NBT tag + input.readerIndex(index); + output.writeBytes(input, input.readableBytes()); + } } catch (IOException e) { e.printStackTrace(); }