forked from GeyserMC/Geyser
Add support for 3D biomes; fix Nether biome display
This commit is contained in:
parent
c804a6edfb
commit
81651cfac5
1 changed files with 17 additions and 14 deletions
|
@ -70,24 +70,27 @@ public class BiomeTranslator {
|
||||||
return bedrockData;
|
return bedrockData;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int z = 0; z < 16; z += 4) {
|
for (int y = 0; y < 16; y += 4) {
|
||||||
for (int x = 0; x < 16; x += 4) {
|
for (int z = 0; z < 16; z += 4) {
|
||||||
byte biomeId = biomeID(biomeData, x, z);
|
for (int x = 0; x < 16; x += 4) {
|
||||||
fillArray(z, x, bedrockData, biomeId);
|
byte biomeId = biomeID(biomeData, x, y, z);
|
||||||
fillArray(z + 1, x, bedrockData, biomeId);
|
int offset = ((z + (y / 4)) << 4) | x;
|
||||||
fillArray(z + 2, x, bedrockData, biomeId);
|
Arrays.fill(bedrockData, offset, offset + 4, biomeId);
|
||||||
fillArray(z + 3, x, bedrockData, biomeId);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return bedrockData;
|
return bedrockData;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void fillArray(int z, int x, byte[] legacyBiomeData, int biomeId) {
|
private static byte biomeID(int[] biomeData, int x, int y, int z) {
|
||||||
int offset = (z << 4) | x;
|
int biomeId = biomeData[((y >> 2) & 63) << 4 | ((z >> 2) & 3) << 2 | ((x >> 2) & 3)];
|
||||||
Arrays.fill(legacyBiomeData, offset, offset + 4, (byte) biomeId);
|
if (biomeId == 0) {
|
||||||
}
|
biomeId = 42; // Ocean
|
||||||
|
} else if (biomeId >= 40 && biomeId <= 43) { // Java has multiple End dimensions that Bedrock doesn't recognize
|
||||||
private static byte biomeID(int[] biomeData, int x, int z) {
|
biomeId = 9;
|
||||||
return (byte) biomeData[((z >> 2) & 3) << 2 | ((x >> 2) & 3)];
|
} else if (biomeId >= 170) { // Nether biomes. Dunno why it's like this :microjang:
|
||||||
|
biomeId = biomeId + 8;
|
||||||
|
}
|
||||||
|
return (byte) biomeId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue