Better estimate for new biome data size

This commit is contained in:
Camotoy 2021-07-15 20:51:13 -04:00
parent 3b55826d70
commit db1563aa79
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F
2 changed files with 3 additions and 2 deletions

View file

@ -82,7 +82,7 @@ public class JavaChunkDataTranslator extends PacketTranslator<ServerChunkDataPac
size += (section != null ? section : session.getBlockMappings().getEmptyChunkSection()).estimateNetworkSize();
}
if (NEW_BIOME_WRITE) {
size += session.getBlockMappings().getEmptyChunkSection().estimateNetworkSize() * 32;
size += ChunkUtils.EMPTY_CHUNK_DATA.length; // Consists only of biome data
} else {
size += 256; // Biomes pre-1.18
}

View file

@ -81,7 +81,7 @@ public class ChunkUtils {
private static final int MAXIMUM_ACCEPTED_HEIGHT = 256;
private static final int MAXIMUM_ACCEPTED_HEIGHT_OVERWORLD = GeyserConnector.getInstance().getConfig().isExtendedWorldHeight() ? 384 : MAXIMUM_ACCEPTED_HEIGHT;
private static final byte[] EMPTY_CHUNK_DATA;
public static final byte[] EMPTY_CHUNK_DATA;
public static final byte[] EMPTY_BIOME_DATA;
static {
@ -105,6 +105,7 @@ public class ChunkUtils {
EMPTY_CHUNK_DATA = new byte[byteBuf.readableBytes()];
byteBuf.readBytes(EMPTY_CHUNK_DATA);
System.out.println(EMPTY_CHUNK_DATA.length);
} finally {
byteBuf.release();
}