3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-24 15:20:19 +01:00

Fix 1.18 spawner entity/block entity update

Dieser Commit ist enthalten in:
Nassim Jahnke 2021-11-10 17:34:04 +01:00
Ursprung 5695726d9a
Commit b36052465f
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -102,10 +102,10 @@ public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_1
}
ParticleMappings mappings = protocol.getMappingData().getParticleMappings();
if (id == mappings.getBlockId() || id == mappings.getFallingDustId()) {
if (mappings.isBlockParticle(id)) {
int data = wrapper.passthrough(Type.VAR_INT);
wrapper.set(Type.VAR_INT, 0, protocol.getMappingData().getNewBlockStateId(data));
} else if (id == mappings.getItemId()) {
} else if (mappings.isItemParticle(id)) {
handleItemToClient(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM));
}
@ -136,7 +136,9 @@ public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_1
return;
}
handleSpawner(id, tag);
wrapper.write(Type.UNSIGNED_BYTE, (short) mappedId);
wrapper.write(Type.NBT, tag);
});
}
});
@ -176,7 +178,14 @@ public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_1
continue;
}
final CompoundTag tag = blockEntity.tag() != null ? blockEntity.tag() : new CompoundTag();
final CompoundTag tag;
if (blockEntity.tag() != null) {
tag = blockEntity.tag();
handleSpawner(blockEntity.typeId(), tag);
} else {
tag = new CompoundTag();
}
blockEntityTags.add(tag);
tag.put("x", new IntTag((oldChunk.getX() << 4) + blockEntity.sectionX()));
tag.put("y", new IntTag(blockEntity.y()));
@ -219,4 +228,14 @@ public final class BlockItemPackets1_18 extends ItemRewriter<Protocol1_17_1To1_1
protocol.cancelClientbound(ClientboundPackets1_18.SET_SIMULATION_DISTANCE);
}
private void handleSpawner(final int typeId, final CompoundTag tag) {
if (typeId == 8) {
final CompoundTag spawnData = tag.get("SpawnData");
final CompoundTag entity;
if (spawnData != null && (entity = spawnData.get("entity")) != null) {
tag.put("SpawnData", entity);
}
}
}
}