3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-09-08 13:52:50 +02:00

Take biome data from same indexes as Mojang ("middle" of 4x4x4 areas)

Dieser Commit ist enthalten in:
KennyTV 2019-12-07 11:31:00 +01:00
Ursprung decb20d2d1
Commit 68a18df969

Datei anzeigen

@ -86,19 +86,19 @@ public class WorldPackets {
if (chunk.isGroundUp()) {
int[] biomeData = chunk.getBiomeData();
int[] newBiomeData = new int[1024];
// Now in 4x4x4 areas (x, then z, then y)
// Set the x/z data
int i = 0;
for (int z = 1; z <= 16; z += 4) {
for (int x = 1; x <= 16; x += 4) {
int biome = biomeData[(x * z) - 1];
// Extend it on the y axis
for (int y = 0; y < 1024; y += 16) {
newBiomeData[i + y] = biome;
}
i++;
// Now in 4x4x4 areas - take the biome of each "middle"
for (int i = 0; i < 4; ++i) {
for (int j = 0; j < 4; ++j) {
int x = (j << 2) + 2;
int z = (i << 2) + 2;
int oldIndex = (z << 4 | x);
newBiomeData[i << 2 | j] = biomeData[oldIndex];
}
}
// ... and copy it to the new y layers
for (int i = 1; i < 64; ++i) {
System.arraycopy(newBiomeData, 0, newBiomeData, i * 16, 16);
}
chunk.setBiomeData(newBiomeData);
}