Use BiomeType here

This commit is contained in:
Jesse Boyd 2019-04-05 03:17:21 +11:00
parent 33f5322fda
commit 95c819684c
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 9 additions and 7 deletions

View File

@ -9,6 +9,7 @@ import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import java.util.*; import java.util.*;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import org.bukkit.ChunkSnapshot; import org.bukkit.ChunkSnapshot;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
@ -55,16 +56,16 @@ public class BukkitChunk_All_ReadonlySnapshot extends FaweChunk {
} }
@Override @Override
public byte[] getBiomeArray() { public BiomeType[] getBiomeArray() {
if (!hasBiomes || next.biomes == null) return null; if (!hasBiomes || next.biomes == null) return null;
BukkitImplAdapter adapter = getParent().getAdapter(); BukkitImplAdapter adapter = getParent().getAdapter();
byte[] biomes = Arrays.copyOf(next.biomes, next.biomes.length); BiomeType[] biomes = Arrays.copyOf(next.biomes, next.biomes.length);
int index = 0; int index = 0;
for (int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {
for (int x = 0; x < 16; x++, index++) { for (int x = 0; x < 16; x++, index++) {
if (biomes[index] != 0) { if (biomes[index] != null) {
Biome biome = snapshot.getBiome(x, z); Biome biome = snapshot.getBiome(x, z);
biomes[index] = (byte) adapter.getBiomeId(biome); biomes[index] = adapter.adapt(biome);
} }
} }
} }
@ -140,7 +141,7 @@ public class BukkitChunk_All_ReadonlySnapshot extends FaweChunk {
} }
@Override @Override
public void setBiome(int x, int z, byte biome) { public void setBiome(int x, int z, BiomeType biome) {
throw new UnsupportedOperationException("Read only"); throw new UnsupportedOperationException("Read only");
} }

View File

@ -22,6 +22,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
@ -230,9 +231,9 @@ public class BukkitQueue_All extends BukkitQueue_0<ChunkSnapshot, ChunkSnapshot,
} }
@Override @Override
public int getBiome(ChunkSnapshot chunkSnapshot, int x, int z) { public BiomeType getBiome(ChunkSnapshot chunkSnapshot, int x, int z) {
Biome biome = chunkSnapshot.getBiome(x & 15, z & 15); Biome biome = chunkSnapshot.getBiome(x & 15, z & 15);
return getAdapter().getBiomeId(biome); return getAdapter().adapt(biome);
} }
@Override @Override