3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-24 15:20:25 +01:00

Add best-fit replacement biomes for custom biomes

Dieser Commit ist enthalten in:
Camotoy 2021-07-27 22:52:07 -04:00
Ursprung 8c96c3b11d
Commit a5beebdffa
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F

Datei anzeigen

@ -50,9 +50,46 @@ public class BiomeTranslator {
CompoundTag biomeTag = (CompoundTag) tag;
String javaIdentifier = ((StringTag) biomeTag.get("name")).getValue();
int bedrockId = Registries.BIOME_IDENTIFIERS.get().getOrDefault(javaIdentifier, 0);
int bedrockId = Registries.BIOME_IDENTIFIERS.get().getOrDefault(javaIdentifier, -1);
int javaId = ((IntTag) biomeTag.get("id")).getValue();
if (bedrockId == -1) {
// There is no matching Bedrock variation for this biome; let's set the closest match based on biome category
String category = ((StringTag) ((CompoundTag) biomeTag.get("element")).get("category")).getValue();
String replacementBiome;
switch (category) {
case "extreme_hills":
replacementBiome = "minecraft:mountains";
break;
case "icy":
replacementBiome = "minecraft:ice_spikes";
break;
case "mushroom":
replacementBiome = "minecraft:mushroom_fields";
break;
case "nether":
replacementBiome = "minecraft:nether_wastes";
break;
default:
replacementBiome = "minecraft:ocean"; // Typically ID 0 so a good default
break;
case "taiga":
case "jungle":
case "mesa":
case "plains":
case "savanna":
case "the_end":
case "beach":
case "ocean":
case "desert":
case "river":
case "swamp":
replacementBiome = "minecraft:" + category;
break;
}
bedrockId = Registries.BIOME_IDENTIFIERS.get().getInt(replacementBiome);
}
if (javaId != bedrockId) {
// When we see the Java ID, we should instead apply the Bedrock ID
biomeTranslations.put(javaId, bedrockId);