3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 16:12:42 +01:00

Fix 1.18 spawner entity

Dieser Commit ist enthalten in:
Nassim Jahnke 2021-11-10 17:31:52 +01:00
Ursprung a49c395486
Commit 3a87eb463a
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -53,7 +53,10 @@ public final class WorldPackets {
map(Type.POSITION1_14);
handler(wrapper -> {
final short id = wrapper.read(Type.UNSIGNED_BYTE);
wrapper.write(Type.VAR_INT, BlockEntityIds.newId(id));
final int newId = BlockEntityIds.newId(id);
wrapper.write(Type.VAR_INT, newId);
handleSpawners(newId, wrapper.passthrough(Type.NBT));
});
}
});
@ -120,6 +123,8 @@ public final class WorldPackets {
Via.getPlatform().getLogger().warning("Unknown block entity: " + id);
}
handleSpawners(typeId, tag);
final byte packedXZ = (byte) ((xTag.asInt() & 15) << 4 | (zTag.asInt() & 15));
blockEntities.add(new BlockEntityImpl(packedXZ, yTag.asShort(), typeId, tag));
}
@ -208,4 +213,15 @@ public final class WorldPackets {
}
});
}
private static void handleSpawners(int typeId, final CompoundTag tag) {
if (typeId == 8) {
final CompoundTag entity = tag.get("SpawnData");
if (entity != null) {
final CompoundTag spawnData = new CompoundTag();
tag.put("SpawnData", spawnData);
spawnData.put("entity", entity);
}
}
}
}