From 3c5ecd0854ca5bbd73dfac606edd62df51e7ebf4 Mon Sep 17 00:00:00 2001 From: EvilSeph Date: Thu, 14 Jul 2011 15:05:43 -0400 Subject: [PATCH] Fixed missing BiomeBase.SKY to Biome.SKY mapping. Thanks mikeprimm! --- .../craftbukkit/CraftChunkSnapshot.java | 30 ++-------------- .../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 3337093aa4..d53a74c120 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 9adf897b9c..5835a6f387 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() {