Skip to content

Commit

Permalink
Fix mob spawner entity data translation in 1.8->1.9
Browse files Browse the repository at this point in the history
Closes #126
  • Loading branch information
FlorianMichael committed Apr 29, 2024
1 parent 459f403 commit cb4ef9f
Showing 1 changed file with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,17 @@ public static void register(Protocol1_8To1_9 protocol) {
protocol.registerClientbound(ClientboundPackets1_9.BLOCK_ENTITY_DATA, new PacketHandlers() {
@Override
public void register() {
map(Type.POSITION1_8);
map(Type.UNSIGNED_BYTE);
map(Type.NAMED_COMPOUND_TAG);
map(Type.POSITION1_8); // Position
map(Type.UNSIGNED_BYTE); // Action
map(Type.NAMED_COMPOUND_TAG); // Tag
handler(wrapper -> {
CompoundTag tag = wrapper.get(Type.NAMED_COMPOUND_TAG, 0);
if (tag != null && tag.contains("SpawnData")) {
CompoundTag spawnData = tag.get("SpawnData");
if (spawnData.contains("id")) {
String entity = (String) spawnData.get("id").getValue();
tag.remove("SpawnData");
tag.put("entityId", new StringTag(entity));
}
final CompoundTag tag = wrapper.get(Type.NAMED_COMPOUND_TAG, 0);

final CompoundTag spawnData = tag.remove("SpawnData");
if (spawnData != null && spawnData.contains("id")) {
final StringTag id = spawnData.remove("id");
if (id == null) return;
tag.put("EntityId", id);
}
});
}
Expand Down

0 comments on commit cb4ef9f

Please sign in to comment.