Stormister Posted August 1, 2015 Posted August 1, 2015 SOLVED: I learned some more about ChunkPrimer and found out that I need to actually set the blocks through that sort of like the old Block array. AKA I needed to change the Block array in generateTerrain to ChunkPrimer If anybody knows anything about the way 1.8 handles chunk generation this would be super helpful because I have been staring at this issue for the past 5 hours with no solutions. I have a custom dimension based off of the Sky Dimension that Mojang didn't implement. It's pretty close to the original in terms of generation. However since updating to 1.8 the dimension simply doesn't generate any terrain. It spawns a platform to spawn on and nothing else but air. I originally thought that the culprit was in the provideChunk method: ChunkPrimer chunkprimer = new ChunkPrimer(); rand.setSeed((long)i * 0x4f9939f508L + (long)j * 0x1ef1565bd5L); Block blocks[] = new Block[32768]; biomesForGeneration = worldObj.getWorldChunkManager().loadBlockGeneratorData(biomesForGeneration, i * 16, j * 16, 16, 16); double ad[] = ChunkManagerOld.temperature; generateTerrain(i, j, blocks, biomesForGeneration, ad); replaceBlocksForBiome(i, j, blocks, biomesForGeneration); field_902_u.generate(this, worldObj, i, j, blocks); Chunk chunk = new Chunk(worldObj, chunkprimer, i, j); byte abyte1[] = chunk.getBiomeArray(); for (int k = 0; k < abyte1.length; k++) { abyte1[k] = (byte)biomesForGeneration[k].biomeID; } chunk.generateSkylightMap(); return chunk; If you'll notice, I had to insert a "ChunkPrimer" object into the constructor for the Chunk object. However previously I could use my Block array instead. Using the block array gives an error since that parameter does not exist in Chunk anymore. Am I doing something wrong with ChunkPrimer? Is there something I'm missing in the ChunkProviderHeaven file in general? I'll try to include all the related files here but if I miss anything let me know. ChunkProviderHeaven: package com.stormister.rediscovered; import java.util.List; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockFlower.EnumFlowerType; import net.minecraft.block.BlockSand; import net.minecraft.block.material.Material; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import net.minecraft.util.IProgressUpdate; import net.minecraft.world.SpawnerAnimals; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkPrimer; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.MapGenBase; import net.minecraft.world.gen.feature.WorldGenCactus; import net.minecraft.world.gen.feature.WorldGenClay; import net.minecraft.world.gen.feature.WorldGenDeadBush; import net.minecraft.world.gen.feature.WorldGenFire; import net.minecraft.world.gen.feature.WorldGenFlowers; import net.minecraft.world.gen.feature.WorldGenHellLava; import net.minecraft.world.gen.feature.WorldGenLakes; import net.minecraft.world.gen.feature.WorldGenLiquids; import net.minecraft.world.gen.feature.WorldGenMinable; import net.minecraft.world.gen.feature.WorldGenPumpkin; import net.minecraft.world.gen.feature.WorldGenReed; import net.minecraft.world.gen.feature.WorldGenTallGrass; import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.terraingen.PopulateChunkEvent; public class ChunkProviderHeaven implements IChunkProvider { private Random rand; private NoiseOctavesBeta field_912_k; private NoiseOctavesBeta field_911_l; private NoiseOctavesBeta field_910_m; private NoiseOctavesBeta field_909_n; private NoiseOctavesBeta field_908_o; public NoiseOctavesBeta field_922_a; public NoiseOctavesBeta field_921_b; public NoiseOctavesBeta mobSpawnerNoise; private World worldObj; private double field_4180_q[]; private double sandNoise[]; private double gravelNoise[]; private double stoneNoise[]; private MapGenSky field_902_u; private BiomeGenBase biomesForGeneration[]; private int worldtype; double field_4185_d[]; double field_4184_e[]; double field_4183_f[]; double field_4182_g[]; double field_4181_h[]; int field_914_i[][]; private double generatedTemperatures[]; private boolean nether; public ChunkProviderHeaven(World world, long l) { sandNoise = new double[256]; gravelNoise = new double[256]; stoneNoise = new double[256]; field_902_u = new MapGenSkyCaves(); field_914_i = new int[32][32]; worldObj = world; rand = new Random(l); nether = false; field_912_k = new NoiseOctavesBeta(rand, 16); field_911_l = new NoiseOctavesBeta(rand, 16); field_910_m = new NoiseOctavesBeta(rand, ; field_909_n = new NoiseOctavesBeta(rand, 4); field_908_o = new NoiseOctavesBeta(rand, 4); field_922_a = new NoiseOctavesBeta(rand, 10); field_921_b = new NoiseOctavesBeta(rand, 16); mobSpawnerNoise = new NoiseOctavesBeta(rand, ; } public void generateTerrain(int i, int j, Block blocks[], BiomeGenBase abiomegenbase[], double ad[]) { byte byte0 = 2; int k = byte0 + 1; byte byte1 = 33; int l = byte0 + 1; field_4180_q = func_4061_a(field_4180_q, i * byte0, 0, j * byte0, k, byte1, l); for(int i1 = 0; i1 < byte0; i1++) { for(int j1 = 0; j1 < byte0; j1++) { for(int k1 = 0; k1 < 32; k1++) { double d = 0.25D; double d1 = field_4180_q[((i1 + 0) * l + (j1 + 0)) * byte1 + (k1 + 0)]; double d2 = field_4180_q[((i1 + 0) * l + (j1 + 1)) * byte1 + (k1 + 0)]; double d3 = field_4180_q[((i1 + 1) * l + (j1 + 0)) * byte1 + (k1 + 0)]; double d4 = field_4180_q[((i1 + 1) * l + (j1 + 1)) * byte1 + (k1 + 0)]; double d5 = (field_4180_q[((i1 + 0) * l + (j1 + 0)) * byte1 + (k1 + 1)] - d1) * d; double d6 = (field_4180_q[((i1 + 0) * l + (j1 + 1)) * byte1 + (k1 + 1)] - d2) * d; double d7 = (field_4180_q[((i1 + 1) * l + (j1 + 0)) * byte1 + (k1 + 1)] - d3) * d; double d8 = (field_4180_q[((i1 + 1) * l + (j1 + 1)) * byte1 + (k1 + 1)] - d4) * d; for(int l1 = 0; l1 < 4; l1++) { double d9 = 0.125D; double d10 = d1; double d11 = d2; double d12 = (d3 - d1) * d9; double d13 = (d4 - d2) * d9; for(int i2 = 0; i2 < 8; i2++) { int j2 = i2 + i1 * 8 << 11 | 0 + j1 * 8 << 7 | k1 * 4 + l1; char c = '\200'; double d14 = 0.125D; double d15 = d10; double d16 = (d11 - d10) * d14; for(int k2 = 0; k2 < 8; k2++) { Block l2 = Blocks.air; if(d15 > 0.0D) { l2 = Blocks.stone; } blocks[j2] = l2; j2 += c; d15 += d16; } d10 += d12; d11 += d13; } d1 += d5; d2 += d6; d3 += d7; d4 += d8; } } } } } public void replaceBlocksForBiome(int i, int j, Block blocks[], BiomeGenBase abiomegenbase[]) { byte byte0 = 64; double d = 0.03125D; sandNoise = field_909_n.generateNoiseOctaves(sandNoise, i * 16, j * 16, 0.0D, 16, 16, 1, d, d, 1.0D); gravelNoise = field_909_n.generateNoiseOctaves(gravelNoise, i * 16, 109.0134D, j * 16, 16, 1, 16, d, 1.0D, d); stoneNoise = field_908_o.generateNoiseOctaves(stoneNoise, i * 16, j * 16, 0.0D, 16, 16, 1, d * 2D, d * 2D, d * 2D); for(int k = 0; k < 16; k++) { for(int l = 0; l < 16; l++) { BiomeGenBase biomegenbase = abiomegenbase[k + l * 16]; boolean flag = sandNoise[k + l * 16] + rand.nextDouble() * 0.20000000000000001D > 0.0D; boolean flag1 = gravelNoise[k + l * 16] + rand.nextDouble() * 0.20000000000000001D > 3D; int i1 = (int)(stoneNoise[k + l * 16] / 3D + 3D + rand.nextDouble() * 0.25D); int j1 = -1; Block byte1 = biomegenbase.topBlock.getBlock(); Block byte2 = biomegenbase.fillerBlock.getBlock(); for(int k1 = 127; k1 >= 0; k1--) { int l1 = (l * 16 + k) * 128 + k1; Block byte3 = blocks[l1]; if(byte3 == Blocks.air) { j1 = -1; continue; } if(byte3 != Blocks.stone) { continue; } if(j1 == -1) { if(i1 <= 0) { byte1 = biomegenbase.topBlock.getBlock(); byte2 = biomegenbase.fillerBlock.getBlock(); } else if(k1 >= byte0 - 4 && k1 <= byte0 + 1) { byte1 = biomegenbase.topBlock.getBlock(); byte2 = biomegenbase.fillerBlock.getBlock(); } blocks[l1] = byte1; j1 = i1; continue; } if(j1 <= 0) { continue; } j1--; blocks[l1] = byte2; if(j1 == 0 && byte2 == Blocks.sand) { j1 = rand.nextInt(4); byte2 = Blocks.sandstone; } } } } } public Chunk loadChunk(int par1, int par2) { return provideChunk(par1, par2); } public Chunk provideChunk(int i, int j) { ChunkPrimer chunkprimer = new ChunkPrimer(); rand.setSeed((long)i * 0x4f9939f508L + (long)j * 0x1ef1565bd5L); Block blocks[] = new Block[32768]; biomesForGeneration = worldObj.getWorldChunkManager().loadBlockGeneratorData(biomesForGeneration, i * 16, j * 16, 16, 16); double ad[] = ChunkManagerOld.temperature; generateTerrain(i, j, blocks, biomesForGeneration, ad); replaceBlocksForBiome(i, j, blocks, biomesForGeneration); field_902_u.generate(this, worldObj, i, j, blocks); Chunk chunk = new Chunk(worldObj, chunkprimer, i, j); byte abyte1[] = chunk.getBiomeArray(); for (int k = 0; k < abyte1.length; k++) { abyte1[k] = (byte)biomesForGeneration[k].biomeID; } chunk.generateSkylightMap(); return chunk; } private double[] func_4061_a(double ad[], int i, int j, int k, int l, int i1, int j1) { if(ad == null) { ad = new double[l * i1 * j1]; } double d = 684.41200000000003D; double d1 = 684.41200000000003D; double ad1[] = ChunkManagerOld.temperature; double ad2[] = ChunkManagerOld.humidity; field_4182_g = field_922_a.generateNoiseOctaves(field_4182_g, i, k, l, j1, 1.121D, 1.121D, 0.5D); field_4181_h = field_921_b.generateNoiseOctaves(field_4181_h, i, k, l, j1, 200D, 200D, 0.5D); d *= 2D; field_4185_d = field_910_m.generateNoiseOctaves(field_4185_d, i, j, k, l, i1, j1, d / 80D, d1 / 160D, d / 80D); field_4184_e = field_912_k.generateNoiseOctaves(field_4184_e, i, j, k, l, i1, j1, d, d1, d); field_4183_f = field_911_l.generateNoiseOctaves(field_4183_f, i, j, k, l, i1, j1, d, d1, d); int k1 = 0; int l1 = 0; int i2 = 16 / l; for(int j2 = 0; j2 < l; j2++) { int k2 = j2 * i2 + i2 / 2; for(int l2 = 0; l2 < j1; l2++) { int i3 = l2 * i2 + i2 / 2; double d3; if(nether) { double d2 = ad1[k2 * 16 + i3]; d3 = ad2[k2 * 16 + i3] * d2; } else { d3 = 0.5D; } double d4 = 1.0D - d3; d4 *= d4; d4 *= d4; d4 = 1.0D - d4; double d5 = (field_4182_g[l1] + 256D) / 512D; d5 *= d4; if(d5 > 1.0D) { d5 = 1.0D; } double d6 = field_4181_h[l1] / 8000D; if(d6 < 0.0D) { d6 = -d6 * 0.29999999999999999D; } d6 = d6 * 3D - 2D; if(d6 > 1.0D) { d6 = 1.0D; } d6 /= 8D; d6 = 0.0D; if(d5 < 0.0D) { d5 = 0.0D; } d5 += 0.5D; d6 = (d6 * (double)i1) / 16D; l1++; double d7 = (double)i1 / 2D; for(int j3 = 0; j3 < i1; j3++) { double d8 = 0.0D; double d9 = (((double)j3 - d7) * 8D) / d5; if(d9 < 0.0D) { d9 *= -1D; } double d10 = field_4184_e[k1] / 512D; double d11 = field_4183_f[k1] / 512D; double d12 = (field_4185_d[k1] / 10D + 1.0D) / 2D; if(d12 < 0.0D) { d8 = d10; } else if(d12 > 1.0D) { d8 = d11; } else { d8 = d10 + (d11 - d10) * d12; } d8 -= 8D; int k3 = 32; if(j3 > i1 - k3) { double d13 = (float)(j3 - (i1 - k3)) / ((float)k3 - 1.0F); d8 = d8 * (1.0D - d13) + -30D * d13; } k3 = 8; if(j3 < k3) { double d14 = (float)(k3 - j3) / ((float)k3 - 1.0F); d8 = d8 * (1.0D - d14) + -30D * d14; } ad[k1] = d8; k1++; } } } return ad; } public boolean chunkExists(int par1, int par2) { return true; } @Override public void populate(IChunkProvider ichunkprovider, int i, int j) { BlockSand.fallInstantly = true; int k = i * 16; int l = j * 16; //TODO BiomeGenBase biomegenbase = worldObj.getWorldChunkManager().func_180300_a(new BlockPos(k + 16, 64, l + 16), null); rand.setSeed(worldObj.getSeed()); long l1 = (rand.nextLong() / 2L) * 2L + 1L; long l2 = (rand.nextLong() / 2L) * 2L + 1L; rand.setSeed((long)i * l1 + (long)j * l2 ^ worldObj.getSeed()); double d = 0.25D; MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(ichunkprovider, worldObj, rand, i, j, false)); if (rand.nextInt(4) == 0) { int i1 = k + rand.nextInt(16) + 8; worldObj.getClass(); int l4 = rand.nextInt(128); int i8 = l + rand.nextInt(16) + 8; (new WorldGenLakes(Blocks.water)).generate(worldObj, rand, new BlockPos(i1, l4, i8)); } if (rand.nextInt( == 0) { int j1 = k + rand.nextInt(16) + 8; worldObj.getClass(); int i5 = rand.nextInt(rand.nextInt(120) + ; int j8 = l + rand.nextInt(16) + 8; if (i5 < 64 || rand.nextInt(10) == 0) { } } for (int k1 = 0; k1 < 8; k1++) { int j5 = k + rand.nextInt(16) + 8; worldObj.getClass(); int k8 = rand.nextInt(128); int i13 = l + rand.nextInt(16) + 8; } for (int i2 = 0; i2 < 10; i2++) { int k5 = k + rand.nextInt(16); worldObj.getClass(); int l8 = rand.nextInt(128); int j13 = l + rand.nextInt(16); (new WorldGenClay(32)).generate(worldObj, rand, new BlockPos(k5, l8, j13)); } for (int j2 = 0; j2 < 20; j2++) { int l5 = k + rand.nextInt(16); worldObj.getClass(); int i9 = rand.nextInt(128); int k13 = l + rand.nextInt(16); (new WorldGenMinable(Blocks.dirt.getDefaultState(), 32)).generate(worldObj, rand, new BlockPos(l5, i9, k13)); } for (int k2 = 0; k2 < 10; k2++) { int i6 = k + rand.nextInt(16); worldObj.getClass(); int j9 = rand.nextInt(128); int l13 = l + rand.nextInt(16); } for (int i3 = 0; i3 < 20; i3++) { int j6 = k + rand.nextInt(16); worldObj.getClass(); int k9 = rand.nextInt(128); int i14 = l + rand.nextInt(16); } for (int j3 = 0; j3 < 20; j3++) { int k6 = k + rand.nextInt(16); worldObj.getClass(); int l9 = rand.nextInt(64); int j14 = l + rand.nextInt(16); (new WorldGenMinable(Blocks.iron_ore.getDefaultState(), ).generate(worldObj, rand, new BlockPos(k6, l9, j14)); } for (int k3 = 0; k3 < 2; k3++) { int l6 = k + rand.nextInt(16); worldObj.getClass(); int i10 = rand.nextInt(32); int k14 = l + rand.nextInt(16); (new WorldGenMinable(Blocks.gold_ore.getDefaultState(), ).generate(worldObj, rand, new BlockPos(l6, i10, k14)); } for (int l3 = 0; l3 < 8; l3++) { int i7 = k + rand.nextInt(16); worldObj.getClass(); int j10 = rand.nextInt(16); int l14 = l + rand.nextInt(16); } for (int i4 = 0; i4 < 1; i4++) { int j7 = k + rand.nextInt(16); worldObj.getClass(); int k10 = rand.nextInt(16); int i15 = l + rand.nextInt(16); (new WorldGenMinable(Blocks.diamond_ore.getDefaultState(), 7)).generate(worldObj, rand, new BlockPos(j7, k10, i15)); } for (int j4 = 0; j4 < 1; j4++) { int k7 = k + rand.nextInt(16); worldObj.getClass(); worldObj.getClass(); int l10 = rand.nextInt(16) + rand.nextInt(16); int j15 = l + rand.nextInt(16); (new WorldGenMinable(Blocks.lapis_ore.getDefaultState(), 6)).generate(worldObj, rand, new BlockPos(k7, l10, j15)); } d = 0.5D; int l7 = 0; if (rand.nextInt(10) == 0) { l7++; } // TREES for (int i11 = 0; i11 < l7; i11++) { int k15 = k + rand.nextInt(16) + 8; int j18 = l + rand.nextInt(16) + 8; WorldGenerator worldgenerator = biomegenbase.genBigTreeChance(rand); //worldgenerator.setScale(1.0D, 1.0D, 1.0D); worldgenerator.generate(worldObj, rand, new BlockPos(k15, worldObj.getChunkFromChunkCoords(k15 >> 4, j18 >> 4).getHeight(k15 & 15, j18 & 15), j18)); } for (int i11 = 0; i11 < l7; i11++) { int k15 = k + rand.nextInt(16) + 8; int j18 = l + rand.nextInt(16) + 8; (new WorldGenCherryTrees(true)).generate(worldObj, rand, new BlockPos(k15, worldObj.getChunkFromChunkCoords(k15 >> 4, j18 >> 4).getHeight(k15 & 15, j18 & 15), j18)); } for (int j11 = 0; j11 < 2; j11++) { int l15 = k + rand.nextInt(16) + 8; worldObj.getClass(); int k18 = rand.nextInt(128); int i21 = l + rand.nextInt(16) + 8; (new WorldGenFlowers(Blocks.yellow_flower, EnumFlowerType.DANDELION)).generate(worldObj, rand, new BlockPos(l15, k18, i21)); } if (rand.nextInt(2) == 0) { int k11 = k + rand.nextInt(16) + 8; worldObj.getClass(); int i16 = rand.nextInt(128); int l18 = l + rand.nextInt(16) + 8; // (new WorldGenFlowers(mod_Rediscovered.Rose, EnumFlowerType.POPPY)).generate(worldObj, rand, new BlockPos(k11, i16, l18)); } if (rand.nextInt(4) == 0) { int l11 = k + rand.nextInt(16) + 8; worldObj.getClass(); int j16 = rand.nextInt(128); int i19 = l + rand.nextInt(16) + 8; } if (rand.nextInt( == 0) { int i12 = k + rand.nextInt(16) + 8; worldObj.getClass(); int k16 = rand.nextInt(128); int j19 = l + rand.nextInt(16) + 8; } for (int j12 = 0; j12 < 10; j12++) { int l16 = k + rand.nextInt(16) + 8; worldObj.getClass(); int k19 = rand.nextInt(128); int j21 = l + rand.nextInt(16) + 8; (new WorldGenReed()).generate(worldObj, rand, new BlockPos(l16, k19, j21)); } if (rand.nextInt(32) == 0) { int k12 = k + rand.nextInt(16) + 8; worldObj.getClass(); int i17 = rand.nextInt(128); int l19 = l + rand.nextInt(16) + 8; } int l12 = 0; if (biomegenbase == BiomeGenBase.desert) { l12 += 10; } for (int j17 = 0; j17 < l12; j17++) { int i20 = k + rand.nextInt(16) + 8; worldObj.getClass(); int k21 = rand.nextInt(128); int k22 = l + rand.nextInt(16) + 8; (new WorldGenCactus()).generate(worldObj, rand, new BlockPos(i20, k21, k22)); } for (int k17 = 0; k17 < 50; k17++) { int j20 = k + rand.nextInt(16) + 8; worldObj.getClass(); int l21 = rand.nextInt(rand.nextInt(120) + ; int l22 = l + rand.nextInt(16) + 8; (new WorldGenLiquids(Blocks.flowing_water)).generate(worldObj, rand, new BlockPos(j20, l21, l22)); } for (int l17 = 0; l17 < 20; l17++) { int k20 = k + rand.nextInt(16) + 8; worldObj.getClass(); int i22 = rand.nextInt(rand.nextInt(rand.nextInt(112) + + ; int i23 = l + rand.nextInt(16) + 8; } for (int i18 = 0; i18 < 16; i18++) { for (int l20 = 0; l20 < 16; l20++) { //Fix this later int j22 = worldObj.getPrecipitationHeight(new BlockPos(k + i18, 70, l + l20)).getY(); //SNOW HEIGHT if (j22 > 70 && j22 < 96) { worldObj.setBlockState(new BlockPos(i18 + k, j22, l20 + l), Blocks.snow_layer.getDefaultState()); } } } BlockSand.fallInstantly = false; } public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) { return true; } public boolean unloadQueuedChunks() { return false; } public boolean unload100OldestChunks() { return false; } public boolean canSave() { return true; } public String makeString() { return "RandomLevelSource"; } public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) { BiomeGenBase var5 = this.worldObj.getBiomeGenForCoords(new BlockPos(par2, 64, par4)); return var5 == null ? null : var5.getSpawnableList(par1EnumCreatureType); } public int getLoadedChunkCount() { return 0; } public void saveExtraData() {} public void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_) {} @Override public Chunk provideChunk(BlockPos blockPosIn) { return this.provideChunk(blockPosIn.getX(), blockPosIn.getZ()); } @Override public boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_, int p_177460_3_, int p_177460_4_) { return true; } @Override public List func_177458_a(EnumCreatureType p_177458_1_, BlockPos p_177458_2_) { return null; } @Override public BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position) { return null; } } ChunkManagerOld: package com.stormister.rediscovered; import java.util.ArrayList; import java.util.List; import java.util.Random; import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeCache; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.WorldChunkManager; import net.minecraft.world.gen.layer.IntCache; public class ChunkManagerOld extends WorldChunkManager { private BiomeCache biomeCache; private List biomesToSpawnIn; private static OldNoiseGeneratorOctaves2 field_4194_e; private static OldNoiseGeneratorOctaves2 field_4193_f; private static OldNoiseGeneratorOctaves2 field_4192_g; public static double temperature[]; public static double humidity[]; public static double field_4196_c[]; private static int biomeLookupTable[] = new int[4096]; protected ChunkManagerOld() { this.biomeCache = new BiomeCache(this); this.biomesToSpawnIn = new ArrayList(); this.biomesToSpawnIn.addAll(allowedBiomes); } public ChunkManagerOld(World par1World, boolean remote) { this(); long seed = par1World.getSeed(); if(remote) { generateBiomeLookup(); field_4194_e = new OldNoiseGeneratorOctaves2(new Random(seed * 9871L), 4); field_4193_f = new OldNoiseGeneratorOctaves2(new Random(seed * 39811L), 4); field_4192_g = new OldNoiseGeneratorOctaves2(new Random(seed * 0x84a59L), 2); } } public static double[] getColdTemperatures(double ad[], int i, int j, int k, int l) { if(ad == null || ad.length < k * l) { ad = new double[k * l]; } ad = field_4194_e.func_4112_a(ad, i, j, k, l, 0.02500000037252903D, 0.02500000037252903D, 0.25D); field_4196_c = field_4192_g.func_4112_a(field_4196_c, i, j, k, l, 0.25D, 0.25D, 0.58823529411764708D); int i1 = 0; for(int j1 = 0; j1 < k; j1++) { for(int k1 = 0; k1 < l; k1++) { double d = field_4196_c[i1] * 1.1000000000000001D + 0.5D; double d1 = 0.01D; double d2 = 1.0D - d1; double d3 = (ad[i1] * 0.14999999999999999D + 0.69999999999999996D) * d2 + d * d1; d3 = 1.0D - (1.0D - d3) * (1.0D - d3); if(d3 < 0.0D) { d3 = 0.0D; } if(d3 > 1.0D) { d3 = 1.0D; } ad[i1] = d3; i1++; } } return ad; } public static int[] getBiomesGens(int par1, int par2, int par3, int par4) { int[] abiomegenbase = new int[par3 * par4]; temperature = field_4194_e.func_4112_a(temperature, par1, par2, par3, par3, 0.02500000037252903D, 0.02500000037252903D, 0.25D); humidity = field_4193_f.func_4112_a(humidity, par1, par2, par3, par3, 0.05000000074505806D, 0.05000000074505806D, 0.33333333333333331D); field_4196_c = field_4192_g.func_4112_a(field_4196_c, par1, par2, par3, par3, 0.25D, 0.25D, 0.58823529411764708D); int i1 = 0; for(int j1 = 0; j1 < par3; j1++) { for(int k1 = 0; k1 < par4; k1++) { double d = field_4196_c[i1] * 1.1000000000000001D + 0.5D; double d1 = 0.01D; double d2 = 1.0D - d1; double d3 = (temperature[i1] * 0.14999999999999999D + 0.69999999999999996D) * d2 + d * d1; d1 = 0.002D; d2 = 1.0D - d1; double d4 = (humidity[i1] * 0.14999999999999999D + 0.5D) * d2 + d * d1; d3 = 1.0D - (1.0D - d3) * (1.0D - d3); if(d3 < 0.0D) { d3 = 0.0D; } if(d4 < 0.0D) { d4 = 0.0D; } if(d3 > 1.0D) { d3 = 1.0D; } if(d4 > 1.0D) { d4 = 1.0D; } temperature[i1] = d3; humidity[i1] = d4; abiomegenbase[i1++] = getBiomeFromLookup(d3, d4); } } return abiomegenbase; } public static int getBiomeFromLookup(double d, double d1) { int i = (int)(d * 63D); int j = (int)(d1 * 63D); return biomeLookupTable[i + j * 64]; } public void generateBiomeLookup() { for(int i = 0; i < 64; i++) { for(int j = 0; j < 64; j++) { biomeLookupTable[i + j * 64] = getBetaBiomes((float)i / 63F, (float)j / 63F); } } } public int getBetaBiomes(float f, float f1) { return mod_Rediscovered.heaven.biomeID; } public int getDefaultBiomes(float temp, float rain) { rain *= temp; if(temp < 0.2F) { if(rain < 0.1F) { return BiomeGenBase.icePlains.biomeID; } else { return BiomeGenBase.coldTaiga.biomeID; } } if(temp < 0.4F) { if(rain < 0.1F) { return BiomeGenBase.coldTaiga.biomeID; } if(rain < 0.2F) { return BiomeGenBase.icePlains.biomeID; } else { return BiomeGenBase.coldTaiga.biomeID; } } if(temp < 0.5F) { if(rain < 0.1F) { return BiomeGenBase.megaTaiga.biomeID; } if(rain < 0.2F) { return BiomeGenBase.forest.biomeID; } else { return BiomeGenBase.megaTaiga.biomeID; } } if(temp < 0.7F) { if(rain < 0.3F) { return BiomeGenBase.forest.biomeID; } if(rain < 0.5F) { return BiomeGenBase.plains.biomeID; } if(rain < 0.7F) { return BiomeGenBase.plains.biomeID; } else { return BiomeGenBase.swampland.biomeID; } } if(temp < 0.8F) { if(rain < 0.2F) { return BiomeGenBase.plains.biomeID; } if(rain < 0.5F) { return BiomeGenBase.forest.biomeID; } if(rain < 0.7F) { return BiomeGenBase.forest.biomeID; } else { return BiomeGenBase.swampland.biomeID; } } if(rain < 0.2F) { if(temp < 0.9F) { return BiomeGenBase.savanna.biomeID; } else { return BiomeGenBase.desert.biomeID; } } if(rain < 0.3F) { return BiomeGenBase.savanna.biomeID; } if(rain < 0.4F) { return BiomeGenBase.plains.biomeID; } if(rain < 0.7F) { return BiomeGenBase.forest.biomeID; } if(rain < 0.8F) { return BiomeGenBase.jungleEdge.biomeID; } else { return BiomeGenBase.jungle.biomeID; } } @Override public List getBiomesToSpawnIn() { return this.biomesToSpawnIn; } @Override public BiomeGenBase func_180300_a(BlockPos p_180300_1_, BiomeGenBase p_180300_2_) { return this.biomeCache.func_180284_a(p_180300_1_.getX(), p_180300_1_.getZ(), p_180300_2_); } @Override public float[] getRainfall(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) { IntCache.resetIntCache(); if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5) { par1ArrayOfFloat = new float[par4 * par5]; } int var6[] = getBiomesGens(par2, par3, par4, par5); for (int var7 = 0; var7 < par4 * par5; ++var7) { float var8 = (float)BiomeGenBase.getBiome(var6[var7]).getIntRainfall() / 65536.0F; if (var8 > 1.0F) { var8 = 1.0F; } par1ArrayOfFloat[var7] = var8; } return par1ArrayOfFloat; } @Override public float getTemperatureAtHeight(float par1, int par2) { return par1; } /*public float[] getTemperatures(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) { IntCache.resetIntCache(); if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5) { par1ArrayOfFloat = new float[par4 * par5]; } int var6[] = getBiomesGens(par2, par3, par4, par5); for (int var7 = 0; var7 < par4 * par5; ++var7) { float var8 = (float)BiomeGenBase.func_150568_d(var6[var7]).getIntTemperature() / 65536.0F; if (var8 > 1.0F) { var8 = 1.0F; } par1ArrayOfFloat[var7] = var8; } return par1ArrayOfFloat; }*/ @Override public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) { IntCache.resetIntCache(); if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) { par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5]; } int var6[] = getBiomesGens(par2, par3, par4, par5); for (int var7 = 0; var7 < par4 * par5; ++var7) { par1ArrayOfBiomeGenBase[var7] = BiomeGenBase.getBiome(var6[var7]); } return par1ArrayOfBiomeGenBase; } @Override public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) { return this.getBiomeGenAt(par1ArrayOfBiomeGenBase, par2, par3, par4, par5, true); } @Override public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5, boolean par6) { IntCache.resetIntCache(); if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) { par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5]; } if (par6 && par4 == 16 && par5 == 16 && (par2 & 15) == 0 && (par3 & 15) == 0) { BiomeGenBase[] var9 = this.biomeCache.getCachedBiomes(par2, par3); System.arraycopy(var9, 0, par1ArrayOfBiomeGenBase, 0, par4 * par5); return par1ArrayOfBiomeGenBase; } else { int var7[] = getBiomesGens(par2, par3, par4, par5); for (int var8 = 0; var8 < par4 * par5; ++var8) { par1ArrayOfBiomeGenBase[var8] = BiomeGenBase.getBiome(var7[var8]); } return par1ArrayOfBiomeGenBase; } } @Override public boolean areBiomesViable(int par1, int par2, int par3, List par4List) { return false; } //TODO Maybe not keep @Override public BlockPos findBiomePosition(int x, int z, int range, List biomes, Random random) { return null; } @Override public void cleanupCache() { this.biomeCache.cleanupCache(); } } MapGenSky: package com.stormister.rediscovered; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; public class MapGenSky { protected int range; protected Random rand; protected World worldObj; public MapGenSky() { range = 8; rand = new Random(); } public void generate(IChunkProvider ichunkprovider, World world, int i, int j, Block blocks[]) { int k = range; worldObj = world; rand.setSeed(worldObj.getSeed()); long l = (rand.nextLong() / 2L) * 2L + 1L; long l1 = (rand.nextLong() / 2L) * 2L + 1L; for(int i1 = i - k; i1 <= i + k; i1++) { for(int j1 = j - k; j1 <= j + k; j1++) { rand.setSeed((long)i1 * l + (long)j1 * l1 ^ worldObj.getSeed()); recursiveGenerate(worldObj, i1, j1, i, j, blocks); } } } public void populate(World world, int i, int j) { int k = range; worldObj = world; rand.setSeed(worldObj.getSeed()); long l = (rand.nextLong() / 2L) * 2L + 1L; long l1 = (rand.nextLong() / 2L) * 2L + 1L; for(int i1 = i - k; i1 <= i + k; i1++) { for(int j1 = j - k; j1 <= j + k; j1++) { rand.setSeed((long)i1 * l + (long)j1 * l1 ^ worldObj.getSeed()); double[] found = find(world, i1, j1); if(found != null) { populator(worldObj, found[0], found[1], found[2], i, j); } } } } protected void recursiveGenerate(World world, int i, int j, int k, int l, Block blocks[]) { } protected void populator(World world, double centerX, double centerY, double centerZ, int chunkX, int chunkY) { } public double[] find(World world, int bx, int by) { return null; } } MapGenSkyCaves: package com.stormister.rediscovered; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.gen.MapGenBase; // Referenced classes of package net.minecraft.src: // MapGenBase, MathHelper, Block, BlockGrass, // World public class MapGenSkyCaves extends MapGenSky { public MapGenSkyCaves() { } protected void func_870_a(int i, int j, Block[] blocks, double d, double d1, double d2) { releaseEntitySkin(i, j, blocks, d, d1, d2, 1.0F + rand.nextFloat() * 6F, 0.0F, 0.0F, -1, -1, 0.5D); } protected void releaseEntitySkin(int i, int j, Block[] blocks, double d, double d1, double d2, float f, float f1, float f2, int k, int l, double d3) { double d4 = i * 16 + 8; double d5 = j * 16 + 8; float f3 = 0.0F; float f4 = 0.0F; Random random = new Random(rand.nextLong()); if(l <= 0) { int i1 = range * 16 - 16; l = i1 - random.nextInt(i1 / 4); } boolean flag = false; if(k == -1) { k = l / 2; flag = true; } int j1 = random.nextInt(l / 2) + l / 4; boolean flag1 = random.nextInt(6) == 0; for(; k < l; k++) { double d6 = 1.5D + (double)(MathHelper.sin(((float)k * 3.141593F) / (float)l) * f * 1.0F); double d7 = d6 * d3; float f5 = MathHelper.cos(f2); float f6 = MathHelper.sin(f2); d += MathHelper.cos(f1) * f5; d1 += f6; d2 += MathHelper.sin(f1) * f5; if(flag1) { f2 *= 0.92F; } else { f2 *= 0.7F; } f2 += f4 * 0.1F; f1 += f3 * 0.1F; f4 *= 0.9F; f3 *= 0.75F; f4 += (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 2.0F; f3 += (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 4F; if(!flag && k == j1 && f > 1.0F) { releaseEntitySkin(i, j, blocks, d, d1, d2, random.nextFloat() * 0.5F + 0.5F, f1 - 1.570796F, f2 / 3F, k, l, 1.0D); releaseEntitySkin(i, j, blocks, d, d1, d2, random.nextFloat() * 0.5F + 0.5F, f1 + 1.570796F, f2 / 3F, k, l, 1.0D); return; } if(!flag && random.nextInt(4) == 0) { continue; } double d8a = d - d4; double d9a = d2 - d5; double d10a = l - k; double d11 = f + 2.0F + 16F; if((d8a * d8a + d9a * d9a) - d10a * d10a > d11 * d11) { return; } if(d < d4 - 16D - d6 * 2D || d2 < d5 - 16D - d6 * 2D || d > d4 + 16D + d6 * 2D || d2 > d5 + 16D + d6 * 2D) { continue; } int d8 = MathHelper.floor_double(d - d6) - i * 16 - 1; int k1 = (MathHelper.floor_double(d + d6) - i * 16) + 1; int d9 = MathHelper.floor_double(d1 - d7) - 1; int l1 = MathHelper.floor_double(d1 + d7) + 1; int d10 = MathHelper.floor_double(d2 - d6) - j * 16 - 1; int i2 = (MathHelper.floor_double(d2 + d6) - j * 16) + 1; if(d8 < 0) { d8 = 0; } if(k1 > 16) { k1 = 16; } if(d9 < 1) { d9 = 1; } if(l1 > 120) { l1 = 120; } if(d10 < 0) { d10 = 0; } if(i2 > 16) { i2 = 16; } boolean flag2 = false; for(int j2 = d8; !flag2 && j2 < k1; j2++) { for(int l2 = d10; !flag2 && l2 < i2; l2++) { for(int i3 = l1 + 1; !flag2 && i3 >= d9 - 1; i3--) { int j3 = (j2 * 16 + l2) * 128 + i3; if(i3 < 0 || i3 >= 128) { continue; } if(blocks[j3] == Blocks.flowing_water || blocks[j3] == Blocks.water) { flag2 = true; } if(i3 != d9 - 1 && j2 != d8 && j2 != k1 - 1 && l2 != d10 && l2 != i2 - 1) { i3 = d9; } } } } if(flag2) { continue; } for(int k2 = d8; k2 < k1; k2++) { double d12 = (((double)(k2 + i * 16) + 0.5D) - d) / d6; label0: for(int k3 = d10; k3 < i2; k3++) { double d13 = (((double)(k3 + j * 16) + 0.5D) - d2) / d6; int l3 = (k2 * 16 + k3) * 128 + l1; boolean flag3 = false; if(d12 * d12 + d13 * d13 >= 1.0D) { continue; } int i4 = l1 - 1; do { if(i4 < d9) { continue label0; } double d14 = (((double)i4 + 0.5D) - d1) / d7; if(d14 > -0.69999999999999996D && d12 * d12 + d14 * d14 + d13 * d13 < 1.0D) { Block byte0 = blocks[l3]; if(byte0 == Blocks.grass) { flag3 = true; } if(byte0 == Blocks.stone || byte0 == Blocks.dirt || byte0 == Blocks.grass) { if(i4 < 10) { blocks[l3] = Blocks.flowing_lava; } else { blocks[l3] = Blocks.air; if(flag3 && blocks[l3 - 1] == Blocks.dirt) { blocks[l3 - 1] = Blocks.grass; } } } } l3--; i4--; } while(true); } } if(flag) { break; } } } protected void recursiveGenerate(World world, int i, int j, int k, int l, Block[] blocks) { int i1 = rand.nextInt(rand.nextInt(rand.nextInt(40) + 1) + 1); if(rand.nextInt(15) != 0) { i1 = 0; } for(int j1 = 0; j1 < i1; j1++) { double d = i * 16 + rand.nextInt(16); double d1 = rand.nextInt(rand.nextInt(120) + ; double d2 = j * 16 + rand.nextInt(16); int k1 = 1; if(rand.nextInt(4) == 0) { func_870_a(k, l, blocks, d, d1, d2); k1 += rand.nextInt(4); } for(int l1 = 0; l1 < k1; l1++) { float f = rand.nextFloat() * 3.141593F * 2.0F; float f1 = ((rand.nextFloat() - 0.5F) * 2.0F) / 8F; float f2 = rand.nextFloat() * 2.0F + rand.nextFloat(); releaseEntitySkin(k, l, blocks, d, d1, d2, f2, f, f1, 0, 0, 1.0D); } } } } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.