Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 16:12:46 +01:00
Fix some cases of empty tags being needed
Dieser Commit ist enthalten in:
Ursprung
abea0131e4
Commit
c54624fb26
@ -43,12 +43,16 @@ public abstract class BlockEntityTranslator {
|
||||
public abstract void translateTag(NbtMapBuilder builder, CompoundTag tag, int blockState);
|
||||
|
||||
public NbtMap getBlockEntityTag(GeyserSession session, BlockEntityType type, int x, int y, int z, CompoundTag tag, int blockState) {
|
||||
NbtMapBuilder tagBuilder = getConstantBedrockTag(BlockEntityUtils.getBedrockBlockEntityId(type), x, y, z);
|
||||
NbtMapBuilder tagBuilder = getConstantBedrockTag(type, x, y, z);
|
||||
translateTag(tagBuilder, tag, blockState);
|
||||
return tagBuilder.build();
|
||||
}
|
||||
|
||||
protected NbtMapBuilder getConstantBedrockTag(String bedrockId, int x, int y, int z) {
|
||||
public static NbtMapBuilder getConstantBedrockTag(BlockEntityType type, int x, int y, int z) {
|
||||
return getConstantBedrockTag(BlockEntityUtils.getBedrockBlockEntityId(type), x, y, z);
|
||||
}
|
||||
|
||||
public static NbtMapBuilder getConstantBedrockTag(String bedrockId, int x, int y, int z) {
|
||||
return NbtMap.builder()
|
||||
.putInt("x", x)
|
||||
.putInt("y", y)
|
||||
|
@ -393,10 +393,9 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator<Clientbo
|
||||
for (BlockEntityInfo blockEntity : blockEntities) {
|
||||
BlockEntityType type = blockEntity.getType();
|
||||
CompoundTag tag = blockEntity.getNbt();
|
||||
if (type == null || tag == null) {
|
||||
if (type == null) {
|
||||
// As an example: ViaVersion will send -1 if it cannot find the block entity type
|
||||
// Vanilla Minecraft gracefully handles this
|
||||
// Since 1.20.5: tags sent here can be null, at which point the block entity is not translated
|
||||
continue;
|
||||
}
|
||||
int x = blockEntity.getX(); // Relative to chunk
|
||||
@ -421,8 +420,13 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator<Clientbo
|
||||
continue;
|
||||
}
|
||||
|
||||
BlockEntityTranslator blockEntityTranslator = BlockEntityUtils.getBlockEntityTranslator(type);
|
||||
bedrockBlockEntities.add(blockEntityTranslator.getBlockEntityTag(session, type, x + chunkBlockX, y, z + chunkBlockZ, tag, blockState));
|
||||
if (tag != null) {
|
||||
BlockEntityTranslator blockEntityTranslator = BlockEntityUtils.getBlockEntityTranslator(type);
|
||||
bedrockBlockEntities.add(blockEntityTranslator.getBlockEntityTag(session, type, x + chunkBlockX, y, z + chunkBlockZ, tag, blockState));
|
||||
} else {
|
||||
// Since 1.20.5, tags can be null, but Bedrock still needs a default tag to render the item
|
||||
bedrockBlockEntities.add(BlockEntityTranslator.getConstantBedrockTag(type, x + chunkBlockX, y, z + chunkBlockZ).build());
|
||||
}
|
||||
|
||||
// Check for custom skulls
|
||||
// TODO: The tag layout follows new format (profille, etc...)
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren