Biome clean up & fixes

Change BiomeType to an interface.
Do not longer use invalid biomes of Bukkit Biome enum.
Add a common unknown biome type.
This commit is contained in:
aumgn
2012-04-10 13:09:47 +02:00
parent 2ed92dafad
commit e86dc2c90b
6 changed files with 79 additions and 56 deletions

View File

@ -23,14 +23,18 @@ import org.spout.api.generator.biome.BiomeType;
/**
* @author zml2008
*/
public class SpoutBiomeType extends com.sk89q.worldedit.BiomeType {
public class SpoutBiomeType implements com.sk89q.worldedit.BiomeType {
private final BiomeType type;
public SpoutBiomeType(BiomeType type) {
super(type.getName().toLowerCase().replace(" ", ""));
this.type = type;
}
@Override
public String getName() {
return type.getName().toLowerCase().replace(" ", "");
}
public BiomeType getSpoutBiome() {
return type;
}

View File

@ -206,11 +206,12 @@ public class SpoutWorld extends LocalWorld {
BiomeGenerator gen = (BiomeGenerator) world.getGenerator();
return new SpoutBiomeType(gen.getBiome(pt.getBlockX(), pt.getBlockZ(), world.getSeed()));
}
return new BiomeType("Unknown");
return BiomeType.UNKNOWN;
}
public void setBiome(Vector2D pt, BiomeType biome) {
if (world.getGenerator() instanceof BiomeGenerator) {
if (biome instanceof SpoutBiomeType &&
world.getGenerator() instanceof BiomeGenerator) {
BiomeGenerator gen = (BiomeGenerator) world.getGenerator();
gen.setBiome(new Vector3(pt.getBlockX(), 0, pt.getBlockZ()), ((SpoutBiomeType) biome).getSpoutBiome());
}