From 96ea682660af88b104f15a561a4bc2130a752ba1 Mon Sep 17 00:00:00 2001 From: ted80-PC Date: Thu, 9 May 2013 10:48:24 +0200 Subject: [PATCH] fixed missing snow --- .../biomesoplenty/world/ChunkProviderBOP.java | 23 +++++- .../biomesoplenty/world/layer/BiomeLayer.java | 13 ++-- .../world/layer/BiomeLayerFuzzyZoom.java | 73 +++++++++++++++++++ 3 files changed, 102 insertions(+), 7 deletions(-) create mode 100644 src/minecraft/biomesoplenty/world/layer/BiomeLayerFuzzyZoom.java diff --git a/src/minecraft/biomesoplenty/world/ChunkProviderBOP.java b/src/minecraft/biomesoplenty/world/ChunkProviderBOP.java index 3829b6f9c..79525bb1c 100644 --- a/src/minecraft/biomesoplenty/world/ChunkProviderBOP.java +++ b/src/minecraft/biomesoplenty/world/ChunkProviderBOP.java @@ -358,7 +358,6 @@ public class ChunkProviderBOP implements IChunkProvider * generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the * size. */ - @SuppressWarnings("unused") private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) { ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7); @@ -585,6 +584,28 @@ public class ChunkProviderBOP implements IChunkProvider biomegenbase.decorate(this.worldObj, this.rand, k, l); SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand); + k += 8; + l += 8; + + doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ICE); + for (k1 = 0; doGen && k1 < 16; ++k1) + { + for (l1 = 0; l1 < 16; ++l1) + { + i2 = this.worldObj.getPrecipitationHeight(k + k1, l + l1); + + if (this.worldObj.isBlockFreezable(k1 + k, i2 - 1, l1 + l)) + { + this.worldObj.setBlock(k1 + k, i2 - 1, l1 + l, Block.ice.blockID, 0, 2); + } + + if (this.worldObj.canSnowAt(k1 + k, i2, l1 + l)) + { + this.worldObj.setBlock(k1 + k, i2, l1 + l, Block.snow.blockID, 0, 2); + } + } + } + MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag)); BlockSand.fallInstantly = false; diff --git a/src/minecraft/biomesoplenty/world/layer/BiomeLayer.java b/src/minecraft/biomesoplenty/world/layer/BiomeLayer.java index d29deea67..add38a918 100644 --- a/src/minecraft/biomesoplenty/world/layer/BiomeLayer.java +++ b/src/minecraft/biomesoplenty/world/layer/BiomeLayer.java @@ -15,21 +15,22 @@ public abstract class BiomeLayer public static BiomeLayer[] initializeAllBiomeGenerators(long seed, WorldType worldtype) { BiomeLayer obj = new BiomeLayerCreate(1L); + obj = new BiomeLayerFuzzyZoom(2000L, (BiomeLayer)(obj)); for(int i = 0; i < 3; i++) { obj = new BiomeLayerZoom(2000L + i, (BiomeLayer)(obj)); } - BiomeLayer obj2 = obj; - obj2 = new BiomeLayerZoom(1000L, (BiomeLayer)(obj2)); - obj2 = new BiomeLayerBiomes(200L, ((BiomeLayer)(obj2)), worldtype); + obj = BiomeLayerZoom.func_75915_a(1000L, ((BiomeLayer)(obj)), 0); + obj = new BiomeLayerBiomes(200L, ((BiomeLayer)(obj)), worldtype); + obj = BiomeLayerZoom.func_75915_a(1000L, ((BiomeLayer)(obj)), 2); - BiomeLayerVoronoiZoom genlayervoronoizoom = new BiomeLayerVoronoiZoom(10L, ((BiomeLayer)(obj2))); - ((BiomeLayer)(obj2)).initWorldGenSeed(seed); + BiomeLayerVoronoiZoom genlayervoronoizoom = new BiomeLayerVoronoiZoom(10L, ((BiomeLayer)(obj))); + ((BiomeLayer)(obj)).initWorldGenSeed(seed); genlayervoronoizoom.initWorldGenSeed(seed); - return (new BiomeLayer[] { obj2, genlayervoronoizoom }); + return (new BiomeLayer[] { obj, genlayervoronoizoom }); //genlayervoronoizoom } public BiomeLayer(long seed) diff --git a/src/minecraft/biomesoplenty/world/layer/BiomeLayerFuzzyZoom.java b/src/minecraft/biomesoplenty/world/layer/BiomeLayerFuzzyZoom.java new file mode 100644 index 000000000..8cfa83097 --- /dev/null +++ b/src/minecraft/biomesoplenty/world/layer/BiomeLayerFuzzyZoom.java @@ -0,0 +1,73 @@ +package biomesoplenty.world.layer; + +public class BiomeLayerFuzzyZoom extends BiomeLayer +{ + public BiomeLayerFuzzyZoom(long par1, BiomeLayer par3GenLayer) + { + super(par1); + super.parent = par3GenLayer; + } + + /** + * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall + * amounts, or biomeList[] indices based on the particular GenLayer subclass. + */ + public int[] getInts(int par1, int par2, int par3, int par4) + { + int i1 = par1 >> 1; + int j1 = par2 >> 1; + int k1 = (par3 >> 1) + 3; + int l1 = (par4 >> 1) + 3; + int[] aint = this.parent.getInts(i1, j1, k1, l1); + int[] aint1 = LayerIntCache.getIntCache(k1 * 2 * l1 * 2); + int i2 = k1 << 1; + int j2; + + for (int k2 = 0; k2 < l1 - 1; ++k2) + { + j2 = k2 << 1; + int l2 = j2 * i2; + int i3 = aint[0 + (k2 + 0) * k1]; + int j3 = aint[0 + (k2 + 1) * k1]; + + for (int k3 = 0; k3 < k1 - 1; ++k3) + { + this.initChunkSeed((long)(k3 + i1 << 1), (long)(k2 + j1 << 1)); + int l3 = aint[k3 + 1 + (k2 + 0) * k1]; + int i4 = aint[k3 + 1 + (k2 + 1) * k1]; + aint1[l2] = i3; + aint1[l2++ + i2] = this.choose(i3, j3); + aint1[l2] = this.choose(i3, l3); + aint1[l2++ + i2] = this.choose(i3, l3, j3, i4); + i3 = l3; + j3 = i4; + } + } + + int[] aint2 = LayerIntCache.getIntCache(par3 * par4); + + for (j2 = 0; j2 < par4; ++j2) + { + System.arraycopy(aint1, (j2 + (par2 & 1)) * (k1 << 1) + (par1 & 1), aint2, j2 * par3, par3); + } + + return aint2; + } + + /** + * randomly choose between the two args + */ + protected int choose(int par1, int par2) + { + return this.nextInt(2) == 0 ? par1 : par2; + } + + /** + * randomly choose between the four args + */ + protected int choose(int par1, int par2, int par3, int par4) + { + int i1 = this.nextInt(4); + return i1 == 0 ? par1 : (i1 == 1 ? par2 : (i1 == 2 ? par3 : par4)); + } +}