Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-09-08 22:02:50 +02:00
Fix mob spawners when no EntityId is given
Dieser Commit ist enthalten in:
Ursprung
6e0554f4a4
Commit
99ceb9ae79
@ -624,14 +624,29 @@ public class OutgoingTransformer {
|
|||||||
output.writeByte(action);
|
output.writeByte(action);
|
||||||
if (action == 1) { // update spawner
|
if (action == 1) { // update spawner
|
||||||
try {
|
try {
|
||||||
|
int index = input.readerIndex();
|
||||||
DataInputStream stream = new DataInputStream(new ByteBufInputStream(input));
|
DataInputStream stream = new DataInputStream(new ByteBufInputStream(input));
|
||||||
CompoundTag tag = (CompoundTag) NBTIO.readTag(stream);
|
CompoundTag tag = (CompoundTag) NBTIO.readTag(stream);
|
||||||
String entity = (String) tag.get("EntityId").getValue();
|
if(tag != null && tag.contains("EntityId")) {
|
||||||
CompoundTag spawn = new CompoundTag("SpawnData");
|
String entity = (String) tag.get("EntityId").getValue();
|
||||||
spawn.put(new StringTag("id", entity));
|
System.out.println("EntityID: " + entity);
|
||||||
tag.put(spawn);
|
CompoundTag spawn = new CompoundTag("SpawnData");
|
||||||
DataOutputStream out = new DataOutputStream(new ByteBufOutputStream(output));
|
spawn.put(new StringTag("id", entity));
|
||||||
NBTIO.writeTag(out, tag);
|
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) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren