3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-20 06:50:09 +01:00

Don't tie biome translation to Bedrock chunk section size

This allows biomes to be translated even if the block count is empty. Fixes some biome glitching.
Dieser Commit ist enthalten in:
Camotoy 2021-11-25 11:59:25 -05:00
Ursprung 8f1acf17f9
Commit ec34510417

Datei anzeigen

@ -315,7 +315,7 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator<Clientbo
// At this point we're dealing with Bedrock chunk sections // At this point we're dealing with Bedrock chunk sections
int dimensionOffset = (overworld ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT) >> 4; int dimensionOffset = (overworld ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT) >> 4;
for (int i = 0; i < sectionCount; i++) { for (int i = 0; i < chunkSize; i++) {
int biomeYOffset = dimensionOffset + i; int biomeYOffset = dimensionOffset + i;
if (biomeYOffset < yOffset) { if (biomeYOffset < yOffset) {
// Ignore this biome section since it goes above or below the height of the Java world // Ignore this biome section since it goes above or below the height of the Java world
@ -328,14 +328,14 @@ public class JavaLevelChunkWithLightTranslator extends PacketTranslator<Clientbo
// As of 1.17.10, Bedrock hardcodes to always read 32 biome sections // As of 1.17.10, Bedrock hardcodes to always read 32 biome sections
// As of 1.18, this hardcode was lowered to 25 // As of 1.18, this hardcode was lowered to 25
if (session.getUpstream().getProtocolVersion() >= Bedrock_v475.V475_CODEC.getProtocolVersion()) { if (session.getUpstream().getProtocolVersion() >= Bedrock_v475.V475_CODEC.getProtocolVersion()) {
int remainingEmptyBiomes = 25 - sectionCount; int remainingEmptyBiomes = 25 - chunkSize;
for (int i = 0; i < remainingEmptyBiomes; i++) { for (int i = 0; i < remainingEmptyBiomes; i++) {
// A header that says to carry on the biome data from the previous chunk // A header that says to carry on the biome data from the previous chunk
// This notably fixes biomes in the End // This notably fixes biomes in the End
byteBuf.writeByte((127 << 1) | 1); byteBuf.writeByte((127 << 1) | 1);
} }
} else { } else {
int remainingEmptyBiomes = 32 - sectionCount; int remainingEmptyBiomes = 32 - chunkSize;
for (int i = 0; i < remainingEmptyBiomes; i++) { for (int i = 0; i < remainingEmptyBiomes; i++) {
byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA); byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA);
} }