mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 01:55:47 +01:00
Fix 1.18 spawner entity
This commit is contained in:
parent
a49c395486
commit
3a87eb463a
@ -53,7 +53,10 @@ public final class WorldPackets {
|
|||||||
map(Type.POSITION1_14);
|
map(Type.POSITION1_14);
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
final short id = wrapper.read(Type.UNSIGNED_BYTE);
|
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);
|
Via.getPlatform().getLogger().warning("Unknown block entity: " + id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleSpawners(typeId, tag);
|
||||||
|
|
||||||
final byte packedXZ = (byte) ((xTag.asInt() & 15) << 4 | (zTag.asInt() & 15));
|
final byte packedXZ = (byte) ((xTag.asInt() & 15) << 4 | (zTag.asInt() & 15));
|
||||||
blockEntities.add(new BlockEntityImpl(packedXZ, yTag.asShort(), typeId, tag));
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user