From 3f4ee9ab563b38d69a596b556bfd1989f8c7b7b2 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Thu, 15 Sep 2011 15:57:37 -0500 Subject: [PATCH] Added support back in for biome temperature and rainfall in snapshots. --- .../org/bukkit/craftbukkit/CraftChunk.java | 18 ++++++++++++------ .../bukkit/craftbukkit/CraftChunkSnapshot.java | 6 +++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index b02b3d3745..c03f1c7a5b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -164,9 +164,12 @@ public class CraftChunk implements Chunk { if (includeBiomeTempRain) { biomeTemp = new double[256]; biomeRain = new double[256]; - //System.arraycopy(wcm.temperature, 0, biomeTemp, 0, biomeTemp.length); - //System.arraycopy(wcm.rain, 0, biomeRain, 0, biomeRain.length); - // TODO: Figure out new snapshot stuff + float[] dat = wcm.a((float[]) null, getX() << 4, getZ() << 4, 16, 16); + for(int i = 0; i < 256; i++) + biomeTemp[i] = dat[i]; + dat = wcm.b((float[]) null, getX() << 4, getZ() << 4, 16, 16); + for(int i = 0; i < 256; i++) + biomeRain[i] = dat[i]; } } World world = getWorld(); @@ -219,9 +222,12 @@ public class CraftChunk implements Chunk { if (includeBiomeTempRain) { biomeTemp = new double[256]; biomeRain = new double[256]; - //System.arraycopy(wcm.temperature, 0, biomeTemp, 0, biomeTemp.length); - //System.arraycopy(wcm.rain, 0, biomeRain, 0, biomeRain.length); - // TODO: Figure out new snapshot stuff + float[] dat = wcm.a((float[]) null, x << 4, z << 4, 16, 16); + for(int i = 0; i < 256; i++) + biomeTemp[i] = dat[i]; + dat = wcm.b((float[]) null, x << 4, z << 4, 16, 16); + for(int i = 0; i < 256; i++) + biomeRain[i] = dat[i]; } } return new EmptyChunkSnapshot(x, z, world.getName(), world.getFullTime(), biome, biomeTemp, biomeRain); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java index d53a74c120..2b14f37ed3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java @@ -138,7 +138,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { * @return Biome at given coordinate */ public Biome getBiome(int x, int z) { - return CraftBlock.biomeBaseToBiome(biome[x << 4 | z]); + return CraftBlock.biomeBaseToBiome(biome[z << 4 | x]); } /** @@ -149,7 +149,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { * @return temperature at given coordinate */ public double getRawBiomeTemperature(int x, int z) { - return biomeTemp[x << 4 | z]; + return biomeTemp[z << 4 | x]; } /** @@ -160,7 +160,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { * @return rainfall at given coordinate */ public double getRawBiomeRainfall(int x, int z) { - return biomeRain[x << 4 | z]; + return biomeRain[z << 4 | x]; } /**