mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix null block entity console spam, which caused the world to be invisible
This was a rare bug that only happened on very few servers, and from what I gathered, only 1.8 servers using ViaVersion.
This commit is contained in:
parent
392b0b5727
commit
c13bbcda85
3 changed files with 5 additions and 6 deletions
|
@ -44,13 +44,12 @@ public abstract class BlockEntityTranslator {
|
||||||
|
|
||||||
public abstract com.nukkitx.nbt.tag.CompoundTag getDefaultBedrockTag(String bedrockId, int x, int y, int z);
|
public abstract com.nukkitx.nbt.tag.CompoundTag getDefaultBedrockTag(String bedrockId, int x, int y, int z);
|
||||||
|
|
||||||
public com.nukkitx.nbt.tag.CompoundTag getBlockEntityTag(CompoundTag tag) {
|
public com.nukkitx.nbt.tag.CompoundTag getBlockEntityTag(String id, CompoundTag tag) {
|
||||||
int x = Integer.parseInt(String.valueOf(tag.getValue().get("x").getValue()));
|
int x = Integer.parseInt(String.valueOf(tag.getValue().get("x").getValue()));
|
||||||
int y = Integer.parseInt(String.valueOf(tag.getValue().get("y").getValue()));
|
int y = Integer.parseInt(String.valueOf(tag.getValue().get("y").getValue()));
|
||||||
int z = Integer.parseInt(String.valueOf(tag.getValue().get("z").getValue()));
|
int z = Integer.parseInt(String.valueOf(tag.getValue().get("z").getValue()));
|
||||||
|
|
||||||
CompoundTagBuilder tagBuilder = getConstantBedrockTag(BlockEntityUtils.getBedrockBlockEntityId(
|
CompoundTagBuilder tagBuilder = getConstantBedrockTag(BlockEntityUtils.getBedrockBlockEntityId(id), x, y, z).toBuilder();
|
||||||
String.valueOf(tag.get("id").getValue())), x, y, z).toBuilder();
|
|
||||||
translateTag(tag).forEach(tagBuilder::tag);
|
translateTag(tag).forEach(tagBuilder::tag);
|
||||||
return tagBuilder.buildRootTag();
|
return tagBuilder.buildRootTag();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,12 +45,12 @@ public class JavaUpdateTileEntityTranslator extends PacketTranslator<ServerUpdat
|
||||||
if (id.equalsIgnoreCase("Sign")) {
|
if (id.equalsIgnoreCase("Sign")) {
|
||||||
// Delay so chunks can finish sending
|
// Delay so chunks can finish sending
|
||||||
session.getConnector().getGeneralThreadPool().schedule(() ->
|
session.getConnector().getGeneralThreadPool().schedule(() ->
|
||||||
BlockEntityUtils.updateBlockEntity(session, translator.getBlockEntityTag(packet.getNbt()), packet.getPosition()),
|
BlockEntityUtils.updateBlockEntity(session, translator.getBlockEntityTag("Sign", packet.getNbt()), packet.getPosition()),
|
||||||
5,
|
5,
|
||||||
TimeUnit.SECONDS
|
TimeUnit.SECONDS
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
BlockEntityUtils.updateBlockEntity(session, translator.getBlockEntityTag(packet.getNbt()), packet.getPosition());
|
BlockEntityUtils.updateBlockEntity(session, translator.getBlockEntityTag(id, packet.getNbt()), packet.getPosition());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class ChunkUtils {
|
||||||
|
|
||||||
String id = BlockEntityUtils.getBedrockBlockEntityId(tagName);
|
String id = BlockEntityUtils.getBedrockBlockEntityId(tagName);
|
||||||
BlockEntityTranslator blockEntityTranslator = BlockEntityUtils.getBlockEntityTranslator(id);
|
BlockEntityTranslator blockEntityTranslator = BlockEntityUtils.getBlockEntityTranslator(id);
|
||||||
bedrockBlockEntities[i] = blockEntityTranslator.getBlockEntityTag(tag);
|
bedrockBlockEntities[i] = blockEntityTranslator.getBlockEntityTag(tagName, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
chunkData.blockEntities = bedrockBlockEntities;
|
chunkData.blockEntities = bedrockBlockEntities;
|
||||||
|
|
Loading…
Reference in a new issue