3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-09-08 22:02:50 +02:00

Merge pull request #166 from StamBoom/master

Change DataInputStream / DataOutputStream to readNBT / writeNBT
Dieser Commit ist enthalten in:
Myles 2016-03-07 19:30:41 +00:00
Commit abb9665813

Datei anzeigen

@ -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());