diff options
author | EvilSeph <evilseph@gmail.com> | 2011-07-14 15:05:43 -0400 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2011-07-14 15:05:43 -0400 |
commit | 3c5ecd0854ca5bbd73dfac606edd62df51e7ebf4 (patch) | |
tree | 0eba731f3f3b2d6ca4dfb294c5d3561a65c00a08 /src/main/java | |
parent | cc94325b285e548c3f692b35d920348bbb781d1a (diff) | |
download | craftbukkit-3c5ecd0854ca5bbd73dfac606edd62df51e7ebf4.tar craftbukkit-3c5ecd0854ca5bbd73dfac606edd62df51e7ebf4.tar.gz craftbukkit-3c5ecd0854ca5bbd73dfac606edd62df51e7ebf4.tar.lz craftbukkit-3c5ecd0854ca5bbd73dfac606edd62df51e7ebf4.tar.xz craftbukkit-3c5ecd0854ca5bbd73dfac606edd62df51e7ebf4.zip |
Fixed missing BiomeBase.SKY to Biome.SKY mapping. Thanks mikeprimm!
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java | 30 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java | 34 |
2 files changed, 35 insertions, 29 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java index 3337093a..d53a74c1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java @@ -2,6 +2,7 @@ package org.bukkit.craftbukkit; import org.bukkit.ChunkSnapshot; import org.bukkit.block.Biome; +import org.bukkit.craftbukkit.block.CraftBlock; import net.minecraft.server.BiomeBase; /** @@ -137,34 +138,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { * @return Biome at given coordinate */ public Biome getBiome(int x, int z) { - BiomeBase base = biome[x << 4 | z]; - - if (base == BiomeBase.RAINFOREST) { - return Biome.RAINFOREST; - } else if (base == BiomeBase.SWAMPLAND) { - return Biome.SWAMPLAND; - } else if (base == BiomeBase.SEASONAL_FOREST) { - return Biome.SEASONAL_FOREST; - } else if (base == BiomeBase.FOREST) { - return Biome.FOREST; - } else if (base == BiomeBase.SAVANNA) { - return Biome.SAVANNA; - } else if (base == BiomeBase.SHRUBLAND) { - return Biome.SHRUBLAND; - } else if (base == BiomeBase.TAIGA) { - return Biome.TAIGA; - } else if (base == BiomeBase.DESERT) { - return Biome.DESERT; - } else if (base == BiomeBase.PLAINS) { - return Biome.PLAINS; - } else if (base == BiomeBase.ICE_DESERT) { - return Biome.ICE_DESERT; - } else if (base == BiomeBase.TUNDRA) { - return Biome.TUNDRA; - } else if (base == BiomeBase.HELL) { - return Biome.HELL; - } - return null; + return CraftBlock.biomeBaseToBiome(biome[x << 4 | z]); } /** diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index 9adf897b..5835a6f3 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -330,7 +330,39 @@ public class CraftBlock implements Block { } public Biome getBiome() { - return getWorld().getBiome(x, z); + return biomeBaseToBiome(chunk.getHandle().world.getWorldChunkManager().getBiome(x, z)); + } + + public static final Biome biomeBaseToBiome(BiomeBase base) { + if (base == BiomeBase.RAINFOREST) { + return Biome.RAINFOREST; + } else if (base == BiomeBase.SWAMPLAND) { + return Biome.SWAMPLAND; + } else if (base == BiomeBase.SEASONAL_FOREST) { + return Biome.SEASONAL_FOREST; + } else if (base == BiomeBase.FOREST) { + return Biome.FOREST; + } else if (base == BiomeBase.SAVANNA) { + return Biome.SAVANNA; + } else if (base == BiomeBase.SHRUBLAND) { + return Biome.SHRUBLAND; + } else if (base == BiomeBase.TAIGA) { + return Biome.TAIGA; + } else if (base == BiomeBase.DESERT) { + return Biome.DESERT; + } else if (base == BiomeBase.PLAINS) { + return Biome.PLAINS; + } else if (base == BiomeBase.ICE_DESERT) { + return Biome.ICE_DESERT; + } else if (base == BiomeBase.TUNDRA) { + return Biome.TUNDRA; + } else if (base == BiomeBase.HELL) { + return Biome.HELL; + } else if (base == BiomeBase.SKY) { + return Biome.SKY; + } + + return null; } public double getTemperature() { |