From 9c17815e1af1bfe3b5c1053712e337b3233bbebc Mon Sep 17 00:00:00 2001 From: ted80-PC Date: Tue, 7 May 2013 21:33:36 +0200 Subject: [PATCH] added layer zoom --- .../world/WorldProviderPromised.java | 2 + .../biomesoplenty/world/layer/BiomeLayer.java | 5 + .../world/layer/BiomeLayerZoom.java | 148 ++++++++++++++++++ 3 files changed, 155 insertions(+) create mode 100644 src/minecraft/biomesoplenty/world/layer/BiomeLayerZoom.java diff --git a/src/minecraft/biomesoplenty/world/WorldProviderPromised.java b/src/minecraft/biomesoplenty/world/WorldProviderPromised.java index 23c2132ae..6522268f7 100644 --- a/src/minecraft/biomesoplenty/world/WorldProviderPromised.java +++ b/src/minecraft/biomesoplenty/world/WorldProviderPromised.java @@ -21,7 +21,9 @@ public class WorldProviderPromised extends WorldProvider public void registerWorldChunkManager() { if (Biomes.promisedLand.isPresent()) + { this.worldChunkMgr = new WorldChunkManagerHell(Biomes.promisedLand.get(), 0.8F, 0.1F); + } //this.worldChunkMgr = new WorldChunkManagerPromised(worldObj); this.dimensionId = BOPConfiguration.promisedLandDimID; } diff --git a/src/minecraft/biomesoplenty/world/layer/BiomeLayer.java b/src/minecraft/biomesoplenty/world/layer/BiomeLayer.java index 7454b4eaf..6713770a8 100644 --- a/src/minecraft/biomesoplenty/world/layer/BiomeLayer.java +++ b/src/minecraft/biomesoplenty/world/layer/BiomeLayer.java @@ -16,6 +16,11 @@ public abstract class BiomeLayer { BiomeLayer obj = new BiomeLayerCreate(1L); + for(int i = 0; i < 4; i++) + { + obj = new BiomeLayerZoom(2000L + i, (BiomeLayer)(obj)); + } + return new BiomeLayer[] {}; } diff --git a/src/minecraft/biomesoplenty/world/layer/BiomeLayerZoom.java b/src/minecraft/biomesoplenty/world/layer/BiomeLayerZoom.java new file mode 100644 index 000000000..d978a869a --- /dev/null +++ b/src/minecraft/biomesoplenty/world/layer/BiomeLayerZoom.java @@ -0,0 +1,148 @@ +package biomesoplenty.world.layer; + +public class BiomeLayerZoom extends BiomeLayer +{ + public BiomeLayerZoom(long par1, BiomeLayer par3GenLayer) + { + super(par1); + super.parent = par3GenLayer; + } + + 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.modeOrRandom(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; + } + + /** + * Chooses one of the two inputs randomly. + */ + protected int choose(int par1, int par2) + { + return this.nextInt(2) == 0 ? par1 : par2; + } + + /** + * returns the mode (most frequently occuring number) or a random number from the 4 integers provided + */ + protected int modeOrRandom(int par1, int par2, int par3, int par4) + { + if (par2 == par3 && par3 == par4) + { + return par2; + } + else if (par1 == par2 && par1 == par3) + { + return par1; + } + else if (par1 == par2 && par1 == par4) + { + return par1; + } + else if (par1 == par3 && par1 == par4) + { + return par1; + } + else if (par1 == par2 && par3 != par4) + { + return par1; + } + else if (par1 == par3 && par2 != par4) + { + return par1; + } + else if (par1 == par4 && par2 != par3) + { + return par1; + } + else if (par2 == par1 && par3 != par4) + { + return par2; + } + else if (par2 == par3 && par1 != par4) + { + return par2; + } + else if (par2 == par4 && par1 != par3) + { + return par2; + } + else if (par3 == par1 && par2 != par4) + { + return par3; + } + else if (par3 == par2 && par1 != par4) + { + return par3; + } + else if (par3 == par4 && par1 != par2) + { + return par3; + } + else if (par4 == par1 && par2 != par3) + { + return par3; + } + else if (par4 == par2 && par1 != par3) + { + return par3; + } + else if (par4 == par3 && par1 != par2) + { + return par3; + } + else + { + int i1 = this.nextInt(4); + return i1 == 0 ? par1 : (i1 == 1 ? par2 : (i1 == 2 ? par3 : par4)); + } + } + + public static BiomeLayer func_75915_a(long par0, BiomeLayer par2GenLayer, int par3) + { + Object object = par2GenLayer; + + for (int k = 0; k < par3; ++k) + { + object = new BiomeLayerZoom(par0 + (long)k, (BiomeLayer)object); + } + + return (BiomeLayer)object; + } +}