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

Handle the server sending invalid biome IDs in chunks

Should hopefully address #2400 - the Java client handles invalid biome IDs and simply complains in its logs.
Dieser Commit ist enthalten in:
Camotoy 2021-07-31 16:34:24 -04:00
Ursprung a197f60446
Commit 3d50155ee3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F

Datei anzeigen

@ -92,9 +92,12 @@ public class BiomeTranslator {
bedrockId = Registries.BIOME_IDENTIFIERS.get().getInt(replacementBiome); bedrockId = Registries.BIOME_IDENTIFIERS.get().getInt(replacementBiome);
} }
if (javaId != bedrockId) { // When we see the Java ID, we should instead apply the Bedrock ID
// When we see the Java ID, we should instead apply the Bedrock ID biomeTranslations.put(javaId, bedrockId);
biomeTranslations.put(javaId, bedrockId);
if (javaId == 0) {
// Matches Java behavior when it sees an invalid biome - it just replaces it with ID 0
biomeTranslations.defaultReturnValue(bedrockId);
} }
} }
} }
@ -132,8 +135,8 @@ public class BiomeTranslator {
int x = i & 3; int x = i & 3;
int y = (i >> 4) & 3; int y = (i >> 4) & 3;
int z = (i >> 2) & 3; int z = (i >> 2) & 3;
// Get the Bedrock biome ID override, or this ID if it's the same // Get the Bedrock biome ID override
int biomeId = biomeTranslations.getOrDefault(javaId, javaId); int biomeId = biomeTranslations.get(javaId);
int idx = storage.idFor(biomeId); int idx = storage.idFor(biomeId);
// Convert biome coordinates into block coordinates // Convert biome coordinates into block coordinates
// Bedrock expects a full 4096 blocks // Bedrock expects a full 4096 blocks