3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-07-30 10:58:02 +02:00

Fix biome and chunk size preconditions

Dieser Commit ist enthalten in:
Nassim Jahnke 2023-09-27 14:35:20 +10:00
Ursprung 215cbc6310
Commit b4720c723a
3 geänderte Dateien mit 5 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -37,7 +37,7 @@ public class EntityTrackerBase implements EntityTracker, ClientEntityIdChangeLis
private final UserConnection connection;
private final EntityType playerType;
private int clientEntityId = -1;
private int currentWorldSectionHeight = 16;
private int currentWorldSectionHeight = -1;
private int currentMinY;
private String currentWorld;
private int biomesSent = -1;

Datei anzeigen

@ -44,8 +44,8 @@ public final class WorldPackets {
protocol.registerClientbound(ClientboundPackets1_18.CHUNK_DATA, wrapper -> {
final EntityTracker tracker = protocol.getEntityRewriter().tracker(wrapper.user());
Preconditions.checkArgument(tracker.biomesSent() != 0, "Biome count not set");
Preconditions.checkArgument(tracker.currentWorldSectionHeight() != 0, "Section height not set");
Preconditions.checkArgument(tracker.biomesSent() != -1, "Biome count not set");
Preconditions.checkArgument(tracker.currentWorldSectionHeight() != -1, "Section height not set");
final Chunk1_18Type chunkType = new Chunk1_18Type(tracker.currentWorldSectionHeight(),
MathUtil.ceilLog2(protocol.getMappingData().getBlockStateMappings().mappedSize()),
MathUtil.ceilLog2(tracker.biomesSent()));

Datei anzeigen

@ -172,8 +172,8 @@ public class BlockRewriter<C extends ClientboundPacketType> {
public PacketHandler chunkDataHandler1_19(ChunkTypeSupplier chunkTypeSupplier, @Nullable Consumer<BlockEntity> blockEntityHandler) {
return wrapper -> {
final EntityTracker tracker = protocol.getEntityRewriter().tracker(wrapper.user());
Preconditions.checkArgument(tracker.biomesSent() != 0, "Biome count not set");
Preconditions.checkArgument(tracker.currentWorldSectionHeight() != 0, "Section height not set");
Preconditions.checkArgument(tracker.biomesSent() != -1, "Biome count not set");
Preconditions.checkArgument(tracker.currentWorldSectionHeight() != -1, "Section height not set");
final Type<Chunk> chunkType = chunkTypeSupplier.supply(tracker.currentWorldSectionHeight(),
MathUtil.ceilLog2(protocol.getMappingData().getBlockStateMappings().mappedSize()),
MathUtil.ceilLog2(tracker.biomesSent()));