Fix nukkit setbiome

This commit is contained in:
Jesse Boyd 2018-08-22 01:23:22 +10:00
parent 57f61f4f74
commit de52cfc656
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 7 additions and 3 deletions

View File

@ -306,7 +306,7 @@ public class NukkitWorld extends LocalWorld {
@Override @Override
public boolean setBiome(Vector2D position, BaseBiome biome) { public boolean setBiome(Vector2D position, BaseBiome biome) {
getLevel().setBiomeId(position.getBlockX(), position.getBlockZ(), biome.getId()); getLevel().setBiomeId(position.getBlockX(), position.getBlockZ(), (byte) biome.getId());
return true; return true;
} }

View File

@ -83,12 +83,16 @@ public class NukkitChunk extends CharFaweChunk<BaseFullChunk, NukkitQueue> {
if (biomes != null) { if (biomes != null) {
final LocalWorld lw = NukkitUtil.getLocalWorld(world); final LocalWorld lw = NukkitUtil.getLocalWorld(world);
final byte[] biomes = getBiomeArray(); final byte[] biomes = getBiomeArray();
final byte[] nukkitBiomes = chunk.getBiomeIdArray();
int index = 0; int index = 0;
for (int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {
int zz = Z + z; int zz = Z + z;
for (int x = 0; x < 16; x++) { for (int x = 0; x < 16; x++, index++) {
int xx = X + x; int xx = X + x;
lw.setBiome(MutableBlockVector2D.get(xx, zz), FaweCache.getBiome(biomes[index++] & 0xFF)); byte biome = biomes[index];
if (biome == 0) continue;
if (biome == (byte) -1) biome = 0;
nukkitBiomes[index] = biome;
} }
} }
} }