Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-03 14:50:30 +01:00
Change DataInputstream / Outputstream to readNBT / writeNBT
Dieser Commit ist enthalten in:
Ursprung
a92a7d6e02
Commit
2d40afa3a1
@ -677,21 +677,18 @@ public class OutgoingTransformer {
|
|||||||
if (action == 1) { // update spawner
|
if (action == 1) { // update spawner
|
||||||
try {
|
try {
|
||||||
int index = input.readerIndex();
|
int index = input.readerIndex();
|
||||||
DataInputStream stream = new DataInputStream(new ByteBufInputStream(input));
|
CompoundTag tag = PacketUtil.readNBT(input);
|
||||||
CompoundTag tag = (CompoundTag) NBTIO.readTag(stream);
|
|
||||||
if (tag != null && tag.contains("EntityId")) {
|
if (tag != null && tag.contains("EntityId")) {
|
||||||
String entity = (String) tag.get("EntityId").getValue();
|
String entity = (String) tag.get("EntityId").getValue();
|
||||||
CompoundTag spawn = new CompoundTag("SpawnData");
|
CompoundTag spawn = new CompoundTag("SpawnData");
|
||||||
spawn.put(new StringTag("id", entity));
|
spawn.put(new StringTag("id", entity));
|
||||||
tag.put(spawn);
|
tag.put(spawn);
|
||||||
DataOutputStream out = new DataOutputStream(new ByteBufOutputStream(output));
|
PacketUtil.writeNBT(output,tag);
|
||||||
NBTIO.writeTag(out, tag);
|
|
||||||
} else if (tag != null) { // EntityID does not exist
|
} else if (tag != null) { // EntityID does not exist
|
||||||
CompoundTag spawn = new CompoundTag("SpawnData");
|
CompoundTag spawn = new CompoundTag("SpawnData");
|
||||||
spawn.put(new StringTag("id", "AreaEffectCloud")); //Make spawners show up as empty when no EntityId is given.
|
spawn.put(new StringTag("id", "AreaEffectCloud")); //Make spawners show up as empty when no EntityId is given.
|
||||||
tag.put(spawn);
|
tag.put(spawn);
|
||||||
DataOutputStream out = new DataOutputStream(new ByteBufOutputStream(output));
|
PacketUtil.writeNBT(output,spawn);
|
||||||
NBTIO.writeTag(out, tag);
|
|
||||||
} else { //There doesn't exist any NBT tag
|
} else { //There doesn't exist any NBT tag
|
||||||
input.readerIndex(index);
|
input.readerIndex(index);
|
||||||
output.writeBytes(input, input.readableBytes());
|
output.writeBytes(input, input.readableBytes());
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren