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:
Ursprung
7a99aa0ddf
Commit
8c95e26189
@ -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
|
||||||
|
@ -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.
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren