3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 00:00:41 +01:00

Fix experimental toggle'd biomes not accounting for chunk offset

Dieser Commit ist enthalten in:
Camotoy 2021-07-29 14:35:03 -04:00
Ursprung 7a99aa0ddf
Commit 8c95e26189
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F
2 geänderte Dateien mit 15 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -43,6 +43,9 @@ import org.geysermc.connector.network.translators.world.chunk.ChunkSection;
import org.geysermc.connector.network.translators.world.BiomeTranslator; import org.geysermc.connector.network.translators.world.BiomeTranslator;
import org.geysermc.connector.utils.ChunkUtils; import org.geysermc.connector.utils.ChunkUtils;
import static org.geysermc.connector.utils.ChunkUtils.MINIMUM_ACCEPTED_HEIGHT;
import static org.geysermc.connector.utils.ChunkUtils.MINIMUM_ACCEPTED_HEIGHT_OVERWORLD;
@Translator(packet = ServerChunkDataPacket.class) @Translator(packet = ServerChunkDataPacket.class)
public class JavaChunkDataTranslator extends PacketTranslator<ServerChunkDataPacket> { public class JavaChunkDataTranslator extends PacketTranslator<ServerChunkDataPacket> {
// Caves and cliffs supports 3D biomes by implementing a very similar palette system to blocks // Caves and cliffs supports 3D biomes by implementing a very similar palette system to blocks
@ -100,8 +103,17 @@ public class JavaChunkDataTranslator extends PacketTranslator<ServerChunkDataPac
} }
if (NEW_BIOME_WRITE) { if (NEW_BIOME_WRITE) {
// At this point we're dealing with Bedrock chunk sections
boolean overworld = session.getChunkCache().isExtendedHeight();
int dimensionOffset = (overworld ? MINIMUM_ACCEPTED_HEIGHT_OVERWORLD : MINIMUM_ACCEPTED_HEIGHT) >> 4;
for (int i = 0; i < sectionCount; i++) { for (int i = 0; i < sectionCount; i++) {
BiomeTranslator.toNewBedrockBiome(session, column.getBiomeData(), i).writeToNetwork(byteBuf); int biomeYOffset = dimensionOffset + i;
if (biomeYOffset < yOffset) {
// Ignore this biome section since it goes below the height of the Java world
byteBuf.writeBytes(ChunkUtils.EMPTY_BIOME_DATA);
continue;
}
BiomeTranslator.toNewBedrockBiome(session, column.getBiomeData(), i + (dimensionOffset - yOffset)).writeToNetwork(byteBuf);
} }
// 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

Datei anzeigen

@ -73,9 +73,9 @@ public class ChunkUtils {
/** /**
* The minimum height Bedrock Edition will accept. * The minimum height Bedrock Edition will accept.
*/ */
private static final int MINIMUM_ACCEPTED_HEIGHT = 0; public static final int MINIMUM_ACCEPTED_HEIGHT = 0;
private static final int CAVES_AND_CLIFFS_MINIMUM_HEIGHT = -64; private static final int CAVES_AND_CLIFFS_MINIMUM_HEIGHT = -64;
private static final int MINIMUM_ACCEPTED_HEIGHT_OVERWORLD = GeyserConnector.getInstance().getConfig().isExtendedWorldHeight() ? public static final int MINIMUM_ACCEPTED_HEIGHT_OVERWORLD = GeyserConnector.getInstance().getConfig().isExtendedWorldHeight() ?
CAVES_AND_CLIFFS_MINIMUM_HEIGHT : MINIMUM_ACCEPTED_HEIGHT; CAVES_AND_CLIFFS_MINIMUM_HEIGHT : MINIMUM_ACCEPTED_HEIGHT;
/** /**
* The maximum chunk height Bedrock Edition will accept, from the lowest point to the highest. * The maximum chunk height Bedrock Edition will accept, from the lowest point to the highest.