diff --git a/changelog.txt b/changelog.txt index 5e1f878..1cd7fab 100644 --- a/changelog.txt +++ b/changelog.txt @@ -204,3 +204,4 @@ For performance reasons, most of the gravel generation has been removed from the deep underground dimension. Liquid Redstone now generate underground in lakes Added Glowing Ice + Optimized the DU and DV chunk generators diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/dimension/DUChunkGenerator.java b/src/main/java/com/NetherNoah/ParadiseMod/world/dimension/DUChunkGenerator.java index 64154ca..c150819 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/dimension/DUChunkGenerator.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/dimension/DUChunkGenerator.java @@ -164,12 +164,10 @@ public void prepareHeights(int p_185936_1_, int p_185936_2_, ChunkPrimer primer) double d16 = (d11 - d10) * 0.25D; for (int k2 = 0; k2 < 4; ++k2) { IBlockState iblockstate = null; - if (l1 * 8 + i2 < j) { + if (l1 * 8 + i2 < j) iblockstate = WATER; - } - if (d15 > 0.0D) { + if (d15 > 0.0D) iblockstate = STONE; - } int l2 = j2 + j1 * 4; int i3 = i2 + l1 * 8; int j3 = k2 + k1 * 4; @@ -220,25 +218,26 @@ public void buildSurfaces(int p_185937_1_, int p_185937_2_, ChunkPrimer primer, iblockstate1 = STONE; } i1 = l; - if (j1 >= i - 1) { + if (j1 >= i - 1) primer.setBlockState(k, j1, j, iblockstate); - } else { + else { primer.setBlockState(k, j1, j, iblockstate1); if (primer.getBlockState(k, j1 + 1, j) == AIR && blocks[blockType] == DIRT) primer.setBlockState(k, j1, j, GRASS); } - } else if (i1 > 0) { + } + else if (i1 > 0) { --i1; primer.setBlockState(k, j1, j, iblockstate1); } } - } else { - i1 = -1; } - } else { - primer.setBlockState(k, j1, j, BEDROCK); + else + i1 = -1; } + else + primer.setBlockState(k, j1, j, BEDROCK); } } } @@ -256,9 +255,8 @@ public Chunk generateChunk(int x, int z) { Chunk chunk = new Chunk(world, chunkprimer, x, z); Biome[] abiome = world.getBiomeProvider().getBiomes((Biome[]) null, x * 16, z * 16, 16, 16); byte[] abyte = chunk.getBiomeArray(); - for (int i = 0; i < abyte.length; ++i) { + for (int i = 0; i < abyte.length; ++i) abyte[i] = (byte) Biome.getIdForBiome(abiome[i]); - } //biome dependent worldgen for (int cx = 0; cx < 16; ++cx) { @@ -288,6 +286,7 @@ public Chunk generateChunk(int x, int z) { if (cy<=9&&blockToReplace==Blocks.WATER) chunk.setBlockState(new BlockPos(cx,cy,cz), LIQUID_REDSTONE); + if (cy==10&&blockToReplace==Blocks.WATER) chunk.setBlockState(new BlockPos(cx,cy,cz), Misc.glowingObsidian.getDefaultState()); @@ -310,9 +309,8 @@ public Chunk generateChunk(int x, int z) { } //in cold biomes, replace the water with ice - if (blockToReplace==Blocks.WATER&&blockAbove==Blocks.AIR&&(icy||cold)) { + if (blockToReplace==Blocks.WATER&&blockAbove==Blocks.AIR&&(icy||cold)) chunk.setBlockState(new BlockPos(cx, cy, cz),Blocks.ICE.getDefaultState()); - } //replace exposed stone if (blockToReplace==Blocks.STONE) { @@ -340,34 +338,27 @@ public Chunk generateChunk(int x, int z) { private double[] getHeights(double[] p_185938_1_, int p_185938_2_, int p_185938_3_, int p_185938_4_, int p_185938_5_, int p_185938_6_, int p_185938_7_) { - if (p_185938_1_ == null) { + if (p_185938_1_ == null) p_185938_1_ = new double[p_185938_5_ * p_185938_6_ * p_185938_7_]; - } - ChunkGeneratorEvent.InitNoiseField event = new ChunkGeneratorEvent.InitNoiseField(this, p_185938_1_, - p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, p_185938_6_, p_185938_7_); + ChunkGeneratorEvent.InitNoiseField event = new ChunkGeneratorEvent.InitNoiseField(this, p_185938_1_,p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, p_185938_6_, p_185938_7_); MinecraftForge.EVENT_BUS.post(event); if (event.getResult() == Event.Result.DENY) return event.getNoisefield(); double d0 = 684.412D; double d1 = 2053.236D; - noiseData4 = scaleNoise.generateNoiseOctaves(noiseData4, p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, 1, - p_185938_7_, 1.0D, 0.0D, 1.0D); - dr = depthNoise.generateNoiseOctaves(dr, p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, 1, p_185938_7_, - 100.0D, 0.0D, 100.0D); - pnr = perlinNoise1.generateNoiseOctaves(pnr, p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, p_185938_6_, - p_185938_7_, 8.555150000000001D, 34.2206D, 8.555150000000001D); - ar = lperlinNoise1.generateNoiseOctaves(ar, p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, p_185938_6_, - p_185938_7_, 684.412D, 2053.236D, 684.412D); - br = lperlinNoise2.generateNoiseOctaves(br, p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, p_185938_6_, - p_185938_7_, 684.412D, 2053.236D, 684.412D); + noiseData4 = scaleNoise.generateNoiseOctaves(noiseData4, p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, 1,p_185938_7_, 1.0D, 0.0D, 1.0D); + dr = depthNoise.generateNoiseOctaves(dr, p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, 1, p_185938_7_,100.0D, 0.0D, 100.0D); + pnr = perlinNoise1.generateNoiseOctaves(pnr, p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, p_185938_6_,p_185938_7_, 8.555150000000001D, 34.2206D, 8.555150000000001D); + ar = lperlinNoise1.generateNoiseOctaves(ar, p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, p_185938_6_,p_185938_7_, 684.412D, 2053.236D, 684.412D); + br = lperlinNoise2.generateNoiseOctaves(br, p_185938_2_, p_185938_3_, p_185938_4_, p_185938_5_, p_185938_6_,p_185938_7_, 684.412D, 2053.236D, 684.412D); int i = 0; double[] adouble = new double[p_185938_6_]; for (int j = 0; j < p_185938_6_; ++j) { adouble[j] = Math.cos(j * Math.PI * 6.0D / p_185938_6_) * 2.0D; double d2 = j; - if (j > p_185938_6_ / 2) { + if (j > p_185938_6_ / 2) d2 = p_185938_6_ - 1 - j; - } + if (d2 < 4.0D) { d2 = 4.0D - d2; adouble[j] -= d2 * d2 * d2 * 10.0D; @@ -382,13 +373,12 @@ private double[] getHeights(double[] p_185938_1_, int p_185938_2_, int p_185938_ double d6 = br[i] / 512.0D; double d7 = (pnr[i] / 10.0D + 1.0D) / 2.0D; double d8; - if (d7 < 0.0D) { + if (d7 < 0.0D) d8 = d5; - } else if (d7 > 1.0D) { + else if (d7 > 1.0D) d8 = d6; - } else { + else d8 = d5 + (d6 - d5) * d7; - } d8 = d8 - d4; if (k > p_185938_6_ - 4) { double d9 = (k - (p_185938_6_ - 4)) / 3.0F; diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/dimension/DUWorldProvider.java b/src/main/java/com/NetherNoah/ParadiseMod/world/dimension/DUWorldProvider.java index 19fd0ce..630b160 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/dimension/DUWorldProvider.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/dimension/DUWorldProvider.java @@ -10,7 +10,7 @@ public class DUWorldProvider extends WorldProvider{ @Override public void init() { - biomeProvider = new BiomeProvider(this.world.getWorldInfo()); + biomeProvider = new BiomeProvider(world.getWorldInfo()); doesWaterVaporize = false; hasSkyLight = false; nether=true; @@ -53,4 +53,22 @@ public boolean canRespawnHere() { public boolean doesXZShowFog(int par1, int par2) { return true; } + + @Override + public boolean shouldMapSpin(String entity, double x, double z, double rotation) + { + return false; + } + + @Override + public float getSunBrightnessFactor(float par1) + { + return 0.0f; + } + + @Override + public boolean isDaytime() + { + return false; + } } \ No newline at end of file diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/dimension/DVChunkGenerator.java b/src/main/java/com/NetherNoah/ParadiseMod/world/dimension/DVChunkGenerator.java index 4655edc..028f4eb 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/dimension/DVChunkGenerator.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/dimension/DVChunkGenerator.java @@ -7,7 +7,6 @@ import com.NetherNoah.ParadiseMod.init.ModBlocks.Misc; import com.NetherNoah.ParadiseMod.init.ModBlocks.Ores; -import net.minecraft.block.BlockFalling; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.pattern.BlockMatcher; @@ -26,34 +25,34 @@ import net.minecraft.world.gen.feature.WorldGenEndIsland; import net.minecraft.world.gen.feature.WorldGenMinable; import net.minecraft.world.gen.feature.WorldGenerator; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.ForgeEventFactory; +import net.minecraftforge.event.terraingen.ChunkGeneratorEvent; +import net.minecraftforge.event.terraingen.DecorateBiomeEvent; +import net.minecraftforge.event.terraingen.InitNoiseGensEvent; +import net.minecraftforge.event.terraingen.OreGenEvent; +import net.minecraftforge.event.terraingen.TerrainGen; +import net.minecraftforge.fml.common.eventhandler.Event; public class DVChunkGenerator implements IChunkGenerator { - /** RNG. */ private final Random rand; protected static final IBlockState STONE = Misc.VoidStone.getDefaultState(); protected static final IBlockState AIR = Blocks.AIR.getDefaultState(); private NoiseGeneratorOctaves lperlinNoise1; private NoiseGeneratorOctaves lperlinNoise2; private NoiseGeneratorOctaves perlinNoise1; - /** A NoiseGeneratorOctaves used in generating terrain */ public NoiseGeneratorOctaves noiseGen5; - /** A NoiseGeneratorOctaves used in generating terrain */ public NoiseGeneratorOctaves noiseGen6; - /** Reference to the World object. */ private final World world; - /** are map structures going to be generated (e.g. strongholds) */ private final boolean mapFeaturesEnabled; - //private final BlockPos spawnPoint; private NoiseGeneratorSimplex islandNoise; private double[] buffer; - /** The biomes that are used to generate the chunk */ private Biome[] biomesForGeneration; double[] pnr; double[] ar; double[] br; private final WorldGenEndIsland endIslands = new WorldGenEndIsland(); - // temporary variables used during event handling private int chunkX = 0; private int chunkZ = 0; @@ -65,19 +64,13 @@ public class DVChunkGenerator implements IChunkGenerator private final WorldGenBush rubyGen = new WorldGenBush(Crystals.rubyCrystal); //special ores - private final WorldGenerator coalGen = new WorldGenMinable(Ores.CoalOreVoid.getDefaultState(), 28, - BlockMatcher.forBlock(Misc.VoidStone)); - private final WorldGenerator ironGen = new WorldGenMinable(Ores.IronOreVoid.getDefaultState(), 14, - BlockMatcher.forBlock(Misc.VoidStone)); - private final WorldGenerator goldGen = new WorldGenMinable(Ores.GoldOreVoid.getDefaultState(), 7, - BlockMatcher.forBlock(Misc.VoidStone)); - private final WorldGenerator silverGen = new WorldGenMinable(Ores.SilverOreVoid.getDefaultState(), 7, - BlockMatcher.forBlock(Misc.VoidStone)); - private final WorldGenerator RStoneGen = new WorldGenMinable(Misc.RegenerationStone.getDefaultState(), 7, - BlockMatcher.forBlock(Misc.VoidStone)); - - public DVChunkGenerator(World p_i47241_1_, boolean p_i47241_2_, long p_i47241_3_) - { + private final WorldGenerator coalGen = new WorldGenMinable(Ores.CoalOreVoid.getDefaultState(), 28,BlockMatcher.forBlock(Misc.VoidStone)); + private final WorldGenerator ironGen = new WorldGenMinable(Ores.IronOreVoid.getDefaultState(), 14,BlockMatcher.forBlock(Misc.VoidStone)); + private final WorldGenerator goldGen = new WorldGenMinable(Ores.GoldOreVoid.getDefaultState(), 7,BlockMatcher.forBlock(Misc.VoidStone)); + private final WorldGenerator silverGen = new WorldGenMinable(Ores.SilverOreVoid.getDefaultState(), 7,BlockMatcher.forBlock(Misc.VoidStone)); + private final WorldGenerator RStoneGen = new WorldGenMinable(Misc.RegenerationStone.getDefaultState(), 7,BlockMatcher.forBlock(Misc.VoidStone)); + + public DVChunkGenerator(World p_i47241_1_, boolean p_i47241_2_, long p_i47241_3_){ this.world = p_i47241_1_; this.mapFeaturesEnabled = p_i47241_2_; this.rand = new Random(p_i47241_3_); @@ -88,9 +81,8 @@ public DVChunkGenerator(World p_i47241_1_, boolean p_i47241_2_, long p_i47241_3_ this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16); this.islandNoise = new NoiseGeneratorSimplex(this.rand); - net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextEnd ctx = - new net.minecraftforge.event.terraingen.InitNoiseGensEvent.ContextEnd(lperlinNoise1, lperlinNoise2, perlinNoise1, noiseGen5, noiseGen6, islandNoise); - ctx = net.minecraftforge.event.terraingen.TerrainGen.getModdedNoiseGenerators(p_i47241_1_, this.rand, ctx); + InitNoiseGensEvent.ContextEnd ctx = new InitNoiseGensEvent.ContextEnd(lperlinNoise1, lperlinNoise2, perlinNoise1, noiseGen5, noiseGen6, islandNoise); + ctx = TerrainGen.getModdedNoiseGenerators(p_i47241_1_, this.rand, ctx); this.lperlinNoise1 = ctx.getLPerlin1(); this.lperlinNoise2 = ctx.getLPerlin2(); this.perlinNoise1 = ctx.getPerlin(); @@ -99,23 +91,16 @@ public DVChunkGenerator(World p_i47241_1_, boolean p_i47241_2_, long p_i47241_3_ this.islandNoise = ctx.getIsland(); } - /** - * Generates a bare-bones chunk of nothing but stone or ocean blocks, formed, but featureless. - */ - public void setBlocksInChunk(int x, int z, ChunkPrimer primer) - { + public void setBlocksInChunk(int x, int z, ChunkPrimer primer){ int i = 2; int j = 3; int k = 33; int l = 3; this.buffer = this.getHeights(this.buffer, x * 2, 0, z * 2, 3, 33, 3); - for (int i1 = 0; i1 < 2; ++i1) - { - for (int j1 = 0; j1 < 2; ++j1) - { - for (int k1 = 0; k1 < 32; ++k1) - { + for (int i1 = 0; i1 < 2; ++i1){ + for (int j1 = 0; j1 < 2; ++j1){ + for (int k1 = 0; k1 < 32; ++k1){ double d0 = 0.25D; double d1 = this.buffer[((i1 + 0) * 3 + j1 + 0) * 33 + k1 + 0]; double d2 = this.buffer[((i1 + 0) * 3 + j1 + 1) * 33 + k1 + 0]; @@ -126,28 +111,23 @@ public void setBlocksInChunk(int x, int z, ChunkPrimer primer) double d7 = (this.buffer[((i1 + 1) * 3 + j1 + 0) * 33 + k1 + 1] - d3) * 0.25D; double d8 = (this.buffer[((i1 + 1) * 3 + j1 + 1) * 33 + k1 + 1] - d4) * 0.25D; - for (int l1 = 0; l1 < 4; ++l1) - { + for (int l1 = 0; l1 < 4; ++l1){ double d9 = 0.125D; double d10 = d1; double d11 = d2; double d12 = (d3 - d1) * 0.125D; double d13 = (d4 - d2) * 0.125D; - for (int i2 = 0; i2 < 8; ++i2) - { + for (int i2 = 0; i2 < 8; ++i2){ double d14 = 0.125D; double d15 = d10; double d16 = (d11 - d10) * 0.125D; - for (int j2 = 0; j2 < 8; ++j2) - { + for (int j2 = 0; j2 < 8; ++j2){ IBlockState iblockstate = AIR; if (d15 > 0.0D) - { iblockstate = STONE; - } int k2 = i2 + i1 * 8; int l2 = l1 + k1 * 4; @@ -172,38 +152,28 @@ public void setBlocksInChunk(int x, int z, ChunkPrimer primer) public void buildSurfaces(ChunkPrimer primer) { - if (!net.minecraftforge.event.ForgeEventFactory.onReplaceBiomeBlocks(this, this.chunkX, this.chunkZ, primer, this.world)) return; - for (int i = 0; i < 16; ++i) - { - for (int j = 0; j < 16; ++j) - { + if (!ForgeEventFactory.onReplaceBiomeBlocks(this, this.chunkX, this.chunkZ, primer, this.world)) return; + for (int i = 0; i < 16; ++i){ + for (int j = 0; j < 16; ++j){ int k = 1; int l = -1; IBlockState iblockstate = STONE; IBlockState iblockstate1 = STONE; - for (int i1 = 127; i1 >= 0; --i1) - { + for (int i1 = 127; i1 >= 0; --i1){ IBlockState iblockstate2 = primer.getBlockState(i, i1, j); if (iblockstate2.getMaterial() == Material.AIR) - { l = -1; - } - else if (iblockstate2.getBlock() == Blocks.STONE) - { - if (l == -1) - { + + else if (iblockstate2.getBlock() == Blocks.STONE){ + if (l == -1){ l = 1; if (i1 >= 0) - { primer.setBlockState(i, i1, j, iblockstate); - } else - { primer.setBlockState(i, i1, j, iblockstate1); - } } else if (l > 0) { @@ -233,9 +203,7 @@ public Chunk generateChunk(int x, int z) byte[] abyte = chunk.getBiomeArray(); for (int i = 0; i < abyte.length; ++i) - { abyte[i] = (byte)Biome.getIdForBiome(this.biomesForGeneration[i]); - } chunk.generateSkylightMap(); return chunk; @@ -248,14 +216,10 @@ private float getIslandHeightValue(int p_185960_1_, int p_185960_2_, int p_18596 float f2 = 100.0F - MathHelper.sqrt(f * f + f1 * f1) * 8.0F; if (f2 > 80.0F) - { f2 = 80.0F; - } if (f2 < -100.0F) - { f2 = -100.0F; - } for (int i = -12; i <= 12; ++i) { @@ -272,19 +236,13 @@ private float getIslandHeightValue(int p_185960_1_, int p_185960_2_, int p_18596 float f4 = 100.0F - MathHelper.sqrt(f * f + f1 * f1) * f3; if (f4 > 80.0F) - { f4 = 80.0F; - } if (f4 < -100.0F) - { f4 = -100.0F; - } if (f4 > f2) - { f2 = f4; - } } } } @@ -292,21 +250,18 @@ private float getIslandHeightValue(int p_185960_1_, int p_185960_2_, int p_18596 return f2; } - public boolean isIslandChunk(int p_185961_1_, int p_185961_2_) - { + public boolean isIslandChunk(int p_185961_1_, int p_185961_2_){ return (long)p_185961_1_ * (long)p_185961_1_ + (long)p_185961_2_ * (long)p_185961_2_ > 4096L && this.getIslandHeightValue(p_185961_1_, p_185961_2_, 1, 1) >= 0.0F; } private double[] getHeights(double[] p_185963_1_, int p_185963_2_, int p_185963_3_, int p_185963_4_, int p_185963_5_, int p_185963_6_, int p_185963_7_) { - net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField(this, p_185963_1_, p_185963_2_, p_185963_3_, p_185963_4_, p_185963_5_, p_185963_6_, p_185963_7_); - net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); - if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.getNoisefield(); + ChunkGeneratorEvent.InitNoiseField event = new net.minecraftforge.event.terraingen.ChunkGeneratorEvent.InitNoiseField(this, p_185963_1_, p_185963_2_, p_185963_3_, p_185963_4_, p_185963_5_, p_185963_6_, p_185963_7_); + MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() == Event.Result.DENY) return event.getNoisefield(); if (p_185963_1_ == null) - { p_185963_1_ = new double[p_185963_5_ * p_185963_6_ * p_185963_7_]; - } double d0 = 684.412D; double d1 = 684.412D; @@ -332,17 +287,11 @@ private double[] getHeights(double[] p_185963_1_, int p_185963_2_, int p_185963_ double d4; if (d5 < 0.0D) - { d4 = d2; - } else if (d5 > 1.0D) - { d4 = d3; - } else - { d4 = d2 + (d3 - d2) * d5; - } d4 = d4 - 8.0D; d4 = d4 + f; @@ -378,13 +327,11 @@ else if (d5 > 1.0D) @Override public void populate(int x, int z) { - BlockFalling.fallInstantly = false; - net.minecraftforge.event.ForgeEventFactory.onChunkPopulate(true, this, world, rand, x, z, false); + ForgeEventFactory.onChunkPopulate(true, this, world, rand, x, z, false); int i = x * 16; int j = z * 16; BlockPos blockpos = new BlockPos(i, 0, j); - if (net.minecraftforge.event.terraingen.TerrainGen.decorate(world, rand, blockpos, - net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.SHROOM)) { + if (net.minecraftforge.event.terraingen.TerrainGen.decorate(world, rand, blockpos,DecorateBiomeEvent.Decorate.EventType.SHROOM)) { if (rand.nextBoolean()) { //crystals quartzGen.generate(world, rand, @@ -399,20 +346,14 @@ public void populate(int x, int z) blockpos.add(rand.nextInt(16) + 8, rand.nextInt(256), rand.nextInt(16) + 8)); } } - if (net.minecraftforge.event.terraingen.TerrainGen.generateOre(world, rand, coalGen, blockpos, - net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.QUARTZ)) + if (TerrainGen.generateOre(world, rand, coalGen, blockpos,OreGenEvent.GenerateMinable.EventType.QUARTZ)) for (int l1 = 0; l1 < 32; ++l1) { //ores - coalGen.generate(world, rand, - blockpos.add(rand.nextInt(16), rand.nextInt(216) + 20, rand.nextInt(16))); - ironGen.generate(world, rand, - blockpos.add(rand.nextInt(16), rand.nextInt(216) + 20, rand.nextInt(16))); - goldGen.generate(world, rand, - blockpos.add(rand.nextInt(16), rand.nextInt(216) + 20, rand.nextInt(16))); - silverGen.generate(world, rand, - blockpos.add(rand.nextInt(16), rand.nextInt(216) + 20, rand.nextInt(16))); - RStoneGen.generate(world, rand, - blockpos.add(rand.nextInt(16), rand.nextInt(216) + 20, rand.nextInt(16))); + coalGen.generate(world, rand,blockpos.add(rand.nextInt(16), rand.nextInt(216) + 20, rand.nextInt(16))); + ironGen.generate(world, rand,blockpos.add(rand.nextInt(16), rand.nextInt(216) + 20, rand.nextInt(16))); + goldGen.generate(world, rand,blockpos.add(rand.nextInt(16), rand.nextInt(216) + 20, rand.nextInt(16))); + silverGen.generate(world, rand,blockpos.add(rand.nextInt(16), rand.nextInt(216) + 20, rand.nextInt(16))); + RStoneGen.generate(world, rand,blockpos.add(rand.nextInt(16), rand.nextInt(216) + 20, rand.nextInt(16))); } } @@ -428,7 +369,7 @@ public boolean generateStructures(Chunk chunkIn, int x, int z) @Override public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { - return this.world.getBiome(pos).getSpawnableList(creatureType); + return world.getBiome(pos).getSpawnableList(creatureType); } /** @@ -442,8 +383,7 @@ public void recreateStructures(Chunk chunkIn, int x, int z) } @Override - public BlockPos getNearestStructurePos(World worldIn, String structureName, BlockPos position, - boolean findUnexplored) { + public BlockPos getNearestStructurePos(World worldIn, String structureName, BlockPos position,boolean findUnexplored) { return null; } diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/dimension/DVWorldProvider.java b/src/main/java/com/NetherNoah/ParadiseMod/world/dimension/DVWorldProvider.java index 3cbf60e..d1c4fb4 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/dimension/DVWorldProvider.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/dimension/DVWorldProvider.java @@ -62,6 +62,11 @@ public boolean isSkyColored() { return true; } + @Override + public float getSunBrightnessFactor(float par1) + { + return 0.0f; + } @Override @Nullable diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/mapgen/MapGenDUCaves.java b/src/main/java/com/NetherNoah/ParadiseMod/world/mapgen/MapGenDUCaves.java index 562b01c..b39b3b5 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/mapgen/MapGenDUCaves.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/mapgen/MapGenDUCaves.java @@ -2,11 +2,8 @@ import java.util.Random; -import com.NetherNoah.ParadiseMod.init.LiquidRedstone; -import com.NetherNoah.ParadiseMod.init.ModBlocks.Misc; import com.google.common.base.MoreObjects; -import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Biomes; @@ -18,45 +15,36 @@ import net.minecraft.world.chunk.ChunkPrimer; import net.minecraft.world.gen.MapGenBase; -public class MapGenDUCaves extends MapGenBase -{ - protected static final IBlockState LIQUID_REDSTONE = LiquidRedstone.BlockLiquidRedstone.instance.getDefaultState(); +public class MapGenDUCaves extends MapGenBase{ protected static final IBlockState AIR = Blocks.AIR.getDefaultState(); protected static final IBlockState WATER = Blocks.WATER.getDefaultState(); - protected static final IBlockState GLOWING_OBSIDIAN=Misc.glowingObsidian.getDefaultState(); - protected static final IBlockState FLOWING_WATER=Blocks.FLOWING_WATER.getDefaultState(); - protected void addRoom(long p_180703_1_, int p_180703_3_, int p_180703_4_, ChunkPrimer primer, double p_180703_6_, double p_180703_8_, double p_180703_10_) - { + protected void addRoom(long p_180703_1_, int p_180703_3_, int p_180703_4_, ChunkPrimer primer, double p_180703_6_, double p_180703_8_, double p_180703_10_){ this.addTunnel(p_180703_1_, p_180703_3_, p_180703_4_, primer, p_180703_6_, p_180703_8_, p_180703_10_, 1.0F + this.rand.nextFloat() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D); } - protected void addTunnel(long p_180702_1_, int p_180702_3_, int p_180702_4_, ChunkPrimer primer, double p_180702_6_, double p_180702_8_, double p_180702_10_, float p_180702_12_, float p_180702_13_, float p_180702_14_, int p_180702_15_, int p_180702_16_, double p_180702_17_) - { + protected void addTunnel(long p_180702_1_, int p_180702_3_, int p_180702_4_, ChunkPrimer primer, double p_180702_6_, double p_180702_8_, double p_180702_10_, float p_180702_12_, float p_180702_13_, float p_180702_14_, int p_180702_15_, int p_180702_16_, double p_180702_17_){ double d0 = (double)(p_180702_3_ * 16 + 8); double d1 = (double)(p_180702_4_ * 16 + 8); float f = 0.0F; float f1 = 0.0F; Random random = new Random(p_180702_1_); - if (p_180702_16_ <= 0) - { + if (p_180702_16_ <= 0){ int i = this.range * 16 - 16; p_180702_16_ = i - random.nextInt(i / 4); } boolean flag2 = false; - if (p_180702_15_ == -1) - { + if (p_180702_15_ == -1){ p_180702_15_ = p_180702_16_ / 2; flag2 = true; } int j = random.nextInt(p_180702_16_ / 2) + p_180702_16_ / 4; - for (boolean flag = random.nextInt(6) == 0; p_180702_15_ < p_180702_16_; ++p_180702_15_) - { + for (boolean flag = random.nextInt(6) == 0; p_180702_15_ < p_180702_16_; ++p_180702_15_){ double d2 = 1.5D + (double)(MathHelper.sin((float)p_180702_15_ * (float)Math.PI / (float)p_180702_16_) * p_180702_12_); double d3 = d2 * p_180702_17_; float f2 = MathHelper.cos(p_180702_14_); @@ -66,13 +54,9 @@ protected void addTunnel(long p_180702_1_, int p_180702_3_, int p_180702_4_, Chu p_180702_10_ += (double)(MathHelper.sin(p_180702_13_) * f2); if (flag) - { p_180702_14_ = p_180702_14_ * 0.92F; - } else - { p_180702_14_ = p_180702_14_ * 0.7F; - } p_180702_14_ = p_180702_14_ + f1 * 0.1F; p_180702_13_ += f * 0.1F; @@ -81,27 +65,22 @@ protected void addTunnel(long p_180702_1_, int p_180702_3_, int p_180702_4_, Chu f1 = f1 + (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 2.0F; f = f + (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 4.0F; - if (!flag2 && p_180702_15_ == j && p_180702_12_ > 1.0F && p_180702_16_ > 0) - { + if (!flag2 && p_180702_15_ == j && p_180702_12_ > 1.0F && p_180702_16_ > 0){ this.addTunnel(random.nextLong(), p_180702_3_, p_180702_4_, primer, p_180702_6_, p_180702_8_, p_180702_10_, random.nextFloat() * 0.5F + 0.5F, p_180702_13_ - ((float)Math.PI / 2F), p_180702_14_ / 3.0F, p_180702_15_, p_180702_16_, 1.0D); this.addTunnel(random.nextLong(), p_180702_3_, p_180702_4_, primer, p_180702_6_, p_180702_8_, p_180702_10_, random.nextFloat() * 0.5F + 0.5F, p_180702_13_ + ((float)Math.PI / 2F), p_180702_14_ / 3.0F, p_180702_15_, p_180702_16_, 1.0D); return; } - if (flag2 || random.nextInt(4) != 0) - { + if (flag2 || random.nextInt(4) != 0){ double d4 = p_180702_6_ - d0; double d5 = p_180702_10_ - d1; double d6 = (double)(p_180702_16_ - p_180702_15_); double d7 = (double)(p_180702_12_ + 2.0F + 16.0F); if (d4 * d4 + d5 * d5 - d6 * d6 > d7 * d7) - { return; - } - if (p_180702_6_ >= d0 - 16.0D - d2 * 2.0D && p_180702_10_ >= d1 - 16.0D - d2 * 2.0D && p_180702_6_ <= d0 + 16.0D + d2 * 2.0D && p_180702_10_ <= d1 + 16.0D + d2 * 2.0D) - { + if (p_180702_6_ >= d0 - 16.0D - d2 * 2.0D && p_180702_10_ >= d1 - 16.0D - d2 * 2.0D && p_180702_6_ <= d0 + 16.0D + d2 * 2.0D && p_180702_10_ <= d1 + 16.0D + d2 * 2.0D){ int k2 = MathHelper.floor(p_180702_6_ - d2) - p_180702_3_ * 16 - 1; int k = MathHelper.floor(p_180702_6_ + d2) - p_180702_3_ * 16 + 1; int l2 = MathHelper.floor(p_180702_8_ - d3) - 1; @@ -110,213 +89,121 @@ protected void addTunnel(long p_180702_1_, int p_180702_3_, int p_180702_4_, Chu int i1 = MathHelper.floor(p_180702_10_ + d2) - p_180702_4_ * 16 + 1; if (k2 < 0) - { k2 = 0; - } - if (k > 16) - { k = 16; - } - if (l2 < 1) - { l2 = 1; - } - if (l > 248) - { l = 248; - } - if (i3 < 0) - { i3 = 0; - } - if (i1 > 16) - { i1 = 16; - } - - boolean flag3 = false; - - for (int j1 = k2; !flag3 && j1 < k; ++j1) - { - for (int k1 = i3; !flag3 && k1 < i1; ++k1) - { - for (int l1 = l + 1; !flag3 && l1 >= l2 - 1; --l1) - { - if (l1 >= 0 && l1 < 256) - { - if (isOceanBlock(primer, j1, l1, k1, p_180702_3_, p_180702_4_)) - { - flag3 = true; - } + for (int j1 = k2; j1 < k; ++j1){ + for (int k1 = i3; k1 < i1; ++k1){ + for (int l1 = l + 1; l1 >= l2 - 1; --l1){ + if (l1 >= 0 && l1 < 256){ if (l1 != l2 - 1 && j1 != k2 && j1 != k - 1 && k1 != i3 && k1 != i1 - 1) - { l1 = l2; - } } } } } - if (!flag3) - { - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); - - for (int j3 = k2; j3 < k; ++j3) - { - double d10 = ((double)(j3 + p_180702_3_ * 16) + 0.5D - p_180702_6_) / d2; - - for (int i2 = i3; i2 < i1; ++i2) - { - double d8 = ((double)(i2 + p_180702_4_ * 16) + 0.5D - p_180702_10_) / d2; - boolean flag1 = false; - - if (d10 * d10 + d8 * d8 < 1.0D) - { - for (int j2 = l; j2 > l2; --j2) - { - double d9 = ((double)(j2 - 1) + 0.5D - p_180702_8_) / d3; - - if (d9 > -0.7D && d10 * d10 + d9 * d9 + d8 * d8 < 1.0D) - { - IBlockState iblockstate1 = primer.getBlockState(j3, j2, i2); - IBlockState iblockstate2 = (IBlockState)MoreObjects.firstNonNull(primer.getBlockState(j3, j2 + 1, i2), AIR); - - if (isTopBlock(primer, j3, j2, i2, p_180702_3_, p_180702_4_)) - { - flag1 = true; - } - - digBlock(primer, j3, j2, i2, p_180702_3_, p_180702_4_, flag1, iblockstate1, iblockstate2); - } + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + + for (int j3 = k2; j3 < k; ++j3){ + double d10 = ((double)(j3 + p_180702_3_ * 16) + 0.5D - p_180702_6_) / d2; + + for (int i2 = i3; i2 < i1; ++i2){ + double d8 = ((double)(i2 + p_180702_4_ * 16) + 0.5D - p_180702_10_) / d2; + boolean flag1 = false; + + if (d10 * d10 + d8 * d8 < 1.0D){ + for (int j2 = l; j2 > l2; --j2){ + double d9 = ((double)(j2 - 1) + 0.5D - p_180702_8_) / d3; + + if (d9 > -0.7D && d10 * d10 + d9 * d9 + d8 * d8 < 1.0D){ + IBlockState iblockstate1 = primer.getBlockState(j3, j2, i2); + IBlockState iblockstate2 = (IBlockState)MoreObjects.firstNonNull(primer.getBlockState(j3, j2 + 1, i2), AIR); + flag1 = isTopBlock(primer, j3, j2, i2, p_180702_3_, p_180702_4_); + + digBlock(primer, j3, j2, i2, p_180702_3_, p_180702_4_, flag1, iblockstate1, iblockstate2); } - } + } } } if (flag2) - { - break; - } + break; } } } } } - protected boolean canReplaceBlock(IBlockState block1, IBlockState block2) - { + protected boolean canReplaceBlock(IBlockState block1, IBlockState block2){ if (block1.getBlock() == Blocks.STONE) - { return true; - } else if (block1.getBlock() == Blocks.DIRT) - { return true; - } else if (block1.getBlock() == Blocks.GRASS) - { return true; - } else if (block1.getBlock() == Blocks.HARDENED_CLAY) - { return true; - } else if (block1.getBlock() == Blocks.STAINED_HARDENED_CLAY) - { return true; - } else if (block1.getBlock() == Blocks.SANDSTONE) - { return true; - } else if (block1.getBlock() == Blocks.RED_SANDSTONE) - { return true; - } else if (block1.getBlock() == Blocks.MYCELIUM) - { return true; - } else if (block1.getBlock() == Blocks.SNOW_LAYER) - { return true; - } else if (block1.getBlock()==Blocks.FLOWING_WATER||block1.getBlock()==Blocks.WATER) return true; else - { return (block1.getBlock() == Blocks.SAND || block1.getBlock() == Blocks.GRAVEL) && block2.getMaterial() != Material.WATER; - } } /** * Recursively called by generate() */ - protected void recursiveGenerate(World worldIn, int chunkX, int chunkZ, int originalX, int originalZ, ChunkPrimer chunkPrimerIn) - { + protected void recursiveGenerate(World worldIn, int chunkX, int chunkZ, int originalX, int originalZ, ChunkPrimer chunkPrimerIn){ int i = this.rand.nextInt(this.rand.nextInt(this.rand.nextInt(15) + 1) + 1); if (this.rand.nextInt(7) != 0) - { i = 0; - } - for (int j = 0; j < i; ++j) - { + for (int j = 0; j < i; ++j){ double d0 = (double)(chunkX * 16 + this.rand.nextInt(16)); double d1 = (double)this.rand.nextInt(this.rand.nextInt(120) + 8); double d2 = (double)(chunkZ * 16 + this.rand.nextInt(16)); int k = 1; - if (this.rand.nextInt(4) == 0) - { + if (this.rand.nextInt(4) == 0){ this.addRoom(this.rand.nextLong(), originalX, originalZ, chunkPrimerIn, d0, d1, d2); k += this.rand.nextInt(4); } - for (int l = 0; l < k; ++l) - { + for (int l = 0; l < k; ++l){ float f = this.rand.nextFloat() * ((float)Math.PI * 2F); float f1 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F; float f2 = this.rand.nextFloat() * 2.0F + this.rand.nextFloat(); if (this.rand.nextInt(10) == 0) - { f2 *= this.rand.nextFloat() * this.rand.nextFloat() * 3.0F + 1.0F; - } this.addTunnel(this.rand.nextLong(), originalX, originalZ, chunkPrimerIn, d0, d1, d2, f2, f, f1, 0, 0, 1.0D); } } } - - protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) - { - Block block = data.getBlockState(x, y, z).getBlock(); - return false; - } - - //Exception biomes to make sure we generate like vanilla - private boolean isExceptionBiome(Biome biome) - { - if (biome == Biomes.BEACH) return true; - if (biome == Biomes.DESERT) return true; - return false; - } - - //Determine if the block at the specified location is the top block for the biome, we take into account - //Vanilla bugs to make sure that we generate the map the same way vanilla does. - private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) - { - Biome biome = world.getBiome(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); - IBlockState state = data.getBlockState(x, y, z); - return (isExceptionBiome(biome) ? state.getBlock() == Blocks.GRASS : state.getBlock() == biome.topBlock); + + private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ){ + return (data.getBlockState(x, y, z).getBlock() == Blocks.GRASS); } protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop, IBlockState state, IBlockState up) @@ -327,19 +214,21 @@ protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int c if (this.canReplaceBlock(state, up) || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) { + //water generates below level 31 if (y<=31) { data.setBlockState(x, y, z, WATER); return; } - //if this is an ocean biome, fill it with water instead + + //if this is an ocean biome, fill it completely with water instead if (biome==Biomes.OCEAN||biome==Biomes.DEEP_OCEAN&&y-1>=10) { data.setBlockState(x, y, z, WATER); return; } + data.setBlockState(x, y, z, AIR); - if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()){ + if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState()); - } } } } \ No newline at end of file diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/mapgen/MapGenDURavines.java b/src/main/java/com/NetherNoah/ParadiseMod/world/mapgen/MapGenDURavines.java index 3d9ab95..94bc51e 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/mapgen/MapGenDURavines.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/mapgen/MapGenDURavines.java @@ -2,9 +2,6 @@ import java.util.Random; -import com.NetherNoah.ParadiseMod.init.LiquidRedstone; -import com.NetherNoah.ParadiseMod.init.ModBlocks.Misc; - import net.minecraft.block.state.IBlockState; import net.minecraft.init.Biomes; import net.minecraft.init.Blocks; @@ -17,49 +14,39 @@ public class MapGenDURavines extends MapGenBase { - protected static final IBlockState LIQUID_REDSTONE = LiquidRedstone.BlockLiquidRedstone.instance.getDefaultState(); protected static final IBlockState AIR = Blocks.AIR.getDefaultState(); protected static final IBlockState WATER = Blocks.WATER.getDefaultState(); - protected static final IBlockState GLOWING_OBSIDIAN=Misc.glowingObsidian.getDefaultState(); - protected static final IBlockState FLOWING_WATER=Blocks.FLOWING_WATER.getDefaultState(); private final float[] rs = new float[1024]; - protected void addTunnel(long p_180707_1_, int p_180707_3_, int p_180707_4_, ChunkPrimer primer, double p_180707_6_, double p_180707_8_, double p_180707_10_, float p_180707_12_, float p_180707_13_, float p_180707_14_, int p_180707_15_, int p_180707_16_, double p_180707_17_) - { + protected void addTunnel(long p_180707_1_, int p_180707_3_, int p_180707_4_, ChunkPrimer primer, double p_180707_6_, double p_180707_8_, double p_180707_10_, float p_180707_12_, float p_180707_13_, float p_180707_14_, int p_180707_15_, int p_180707_16_, double p_180707_17_){ Random random = new Random(p_180707_1_); double d0 = (double)(p_180707_3_ * 16 + 8); double d1 = (double)(p_180707_4_ * 16 + 8); float f = 0.0F; float f1 = 0.0F; - if (p_180707_16_ <= 0) - { + if (p_180707_16_ <= 0){ int i = this.range * 16 - 16; p_180707_16_ = i - random.nextInt(i / 4); } boolean flag1 = false; - if (p_180707_15_ == -1) - { + if (p_180707_15_ == -1){ p_180707_15_ = p_180707_16_ / 2; flag1 = true; } float f2 = 1.0F; - for (int j = 0; j < 256; ++j) - { + for (int j = 0; j < 256; ++j){ + if (j == 0 || random.nextInt(3) == 0) - { f2 = 1.0F + random.nextFloat() * random.nextFloat(); - } - this.rs[j] = f2 * f2; } - for (; p_180707_15_ < p_180707_16_; ++p_180707_15_) - { + for (; p_180707_15_ < p_180707_16_; ++p_180707_15_){ double d9 = 1.5D + (double)(MathHelper.sin((float)p_180707_15_ * (float)Math.PI / (float)p_180707_16_) * p_180707_12_); double d2 = d9 * p_180707_17_; d9 = d9 * ((double)random.nextFloat() * 0.25D + 0.75D); @@ -77,20 +64,16 @@ protected void addTunnel(long p_180707_1_, int p_180707_3_, int p_180707_4_, Chu f1 = f1 + (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 2.0F; f = f + (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 4.0F; - if (flag1 || random.nextInt(4) != 0) - { + if (flag1 || random.nextInt(4) != 0){ double d3 = p_180707_6_ - d0; double d4 = p_180707_10_ - d1; double d5 = (double)(p_180707_16_ - p_180707_15_); double d6 = (double)(p_180707_12_ + 2.0F + 16.0F); if (d3 * d3 + d4 * d4 - d5 * d5 > d6 * d6) - { return; - } - if (p_180707_6_ >= d0 - 16.0D - d9 * 2.0D && p_180707_10_ >= d1 - 16.0D - d9 * 2.0D && p_180707_6_ <= d0 + 16.0D + d9 * 2.0D && p_180707_10_ <= d1 + 16.0D + d9 * 2.0D) - { + if (p_180707_6_ >= d0 - 16.0D - d9 * 2.0D && p_180707_10_ >= d1 - 16.0D - d9 * 2.0D && p_180707_6_ <= d0 + 16.0D + d9 * 2.0D && p_180707_10_ <= d1 + 16.0D + d9 * 2.0D){ int k2 = MathHelper.floor(p_180707_6_ - d9) - p_180707_3_ * 16 - 1; int k = MathHelper.floor(p_180707_6_ + d9) - p_180707_3_ * 16 + 1; int l2 = MathHelper.floor(p_180707_8_ - d2) - 1; @@ -99,94 +82,49 @@ protected void addTunnel(long p_180707_1_, int p_180707_3_, int p_180707_4_, Chu int i1 = MathHelper.floor(p_180707_10_ + d9) - p_180707_4_ * 16 + 1; if (k2 < 0) - { k2 = 0; - } - if (k > 16) - { k = 16; - } - if (l2 < 1) - { l2 = 1; - } - if (l > 248) - { l = 248; - } - if (i3 < 0) - { i3 = 0; - } - if (i1 > 16) - { i1 = 16; - } - - boolean flag2 = false; - - for (int j1 = k2; !flag2 && j1 < k; ++j1) - { - for (int k1 = i3; !flag2 && k1 < i1; ++k1) - { - for (int l1 = l + 1; !flag2 && l1 >= l2 - 1; --l1) - { - if (l1 >= 0 && l1 < 256) - { - if (isOceanBlock(primer, j1, l1, k1, p_180707_3_, p_180707_4_)) - { - flag2 = true; - } + for (int j1 = k2; j1 < k; ++j1){ + for (int k1 = i3; k1 < i1; ++k1){ + for (int l1 = l + 1; l1 >= l2 - 1; --l1){ + if (l1 >= 0 && l1 < 256){ if (l1 != l2 - 1 && j1 != k2 && j1 != k - 1 && k1 != i3 && k1 != i1 - 1) - { l1 = l2; - } } } } } - if (!flag2) - { - for (int j3 = k2; j3 < k; ++j3) - { - double d10 = ((double)(j3 + p_180707_3_ * 16) + 0.5D - p_180707_6_) / d9; - - for (int i2 = i3; i2 < i1; ++i2) - { - double d7 = ((double)(i2 + p_180707_4_ * 16) + 0.5D - p_180707_10_) / d9; - boolean flag = false; - - if (d10 * d10 + d7 * d7 < 1.0D) - { - for (int j2 = l; j2 > l2; --j2) - { - double d8 = ((double)(j2 - 1) + 0.5D - p_180707_8_) / d2; + for (int j3 = k2; j3 < k; ++j3){ + double d10 = ((double)(j3 + p_180707_3_ * 16) + 0.5D - p_180707_6_) / d9; - if ((d10 * d10 + d7 * d7) * (double)this.rs[j2 - 1] + d8 * d8 / 6.0D < 1.0D) - { - if (isTopBlock(primer, j3, j2, i2, p_180707_3_, p_180707_4_)) - { - flag = true; - } + for (int i2 = i3; i2 < i1; ++i2){ + double d7 = ((double)(i2 + p_180707_4_ * 16) + 0.5D - p_180707_10_) / d9; + boolean flag = false; - digBlock(primer, j3, j2, i2, p_180707_3_, p_180707_4_, flag); - } + if (d10 * d10 + d7 * d7 < 1.0D){ + for (int j2 = l; j2 > l2; --j2){ + double d8 = ((double)(j2 - 1) + 0.5D - p_180707_8_) / d2; + if ((d10 * d10 + d7 * d7) * (double)this.rs[j2 - 1] + d8 * d8 / 6.0D < 1.0D){ + flag = isTopBlock(primer, j3, j2, i2, p_180707_3_, p_180707_4_); + digBlock(primer, j3, j2, i2, p_180707_3_, p_180707_4_, flag); } } } } if (flag1) - { break; - } } } } @@ -196,82 +134,49 @@ protected void addTunnel(long p_180707_1_, int p_180707_3_, int p_180707_4_, Chu /** * Recursively called by generate() */ - protected void recursiveGenerate(World worldIn, int chunkX, int chunkZ, int originalX, int originalZ, ChunkPrimer chunkPrimerIn) - { - if (this.rand.nextInt(50) == 0) - { + protected void recursiveGenerate(World worldIn, int chunkX, int chunkZ, int originalX, int originalZ, ChunkPrimer chunkPrimerIn){ + if (this.rand.nextInt(50) == 0){ double d0 = (double)(chunkX * 16 + this.rand.nextInt(16)); double d1 = (double)(this.rand.nextInt(this.rand.nextInt(40) + 8) + 20); double d2 = (double)(chunkZ * 16 + this.rand.nextInt(16)); int i = 1; - for (int j = 0; j < 1; ++j) - { + for (int j = 0; j < 1; ++j){ float f = this.rand.nextFloat() * ((float)Math.PI * 2F); float f1 = (this.rand.nextFloat() - 0.5F) * 2.0F / 8.0F; float f2 = (this.rand.nextFloat() * 2.0F + this.rand.nextFloat()) * 2.0F; - this.addTunnel(this.rand.nextLong(), originalX, originalZ, chunkPrimerIn, d0, d1, d2, f2, f, f1, 0, 0, 3.0D); + addTunnel(this.rand.nextLong(), originalX, originalZ, chunkPrimerIn, d0, d1, d2, f2, f, f1, 0, 0, 3.0D); } } } - protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) - { - return false; - } - - //Exception biomes to make sure we generate like vanilla - private boolean isExceptionBiome(net.minecraft.world.biome.Biome biome) - { - if (biome == net.minecraft.init.Biomes.BEACH) return true; - if (biome == net.minecraft.init.Biomes.DESERT) return true; - if (biome == net.minecraft.init.Biomes.MUSHROOM_ISLAND) return true; - if (biome == net.minecraft.init.Biomes.MUSHROOM_ISLAND_SHORE) return true; - return false; - } - - //Determine if the block at the specified location is the top block for the biome, we take into account - //Vanilla bugs to make sure that we generate the map the same way vanilla does. - private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) - { - net.minecraft.world.biome.Biome biome = world.getBiome(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); - IBlockState state = data.getBlockState(x, y, z); - return (isExceptionBiome(biome) ? state.getBlock() == Blocks.GRASS : state.getBlock() == biome.topBlock); + + private boolean isTopBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ){ + return (data.getBlockState(x, y, z).getBlock() == Blocks.GRASS); } - protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop) - { + protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop){ Biome biome = world.getBiome(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); IBlockState state = data.getBlockState(x, y, z); - IBlockState top = isExceptionBiome(biome) ? Blocks.GRASS.getDefaultState() : biome.topBlock; - IBlockState filler = isExceptionBiome(biome) ? Blocks.DIRT.getDefaultState() : biome.fillerBlock; + IBlockState top = Blocks.GRASS.getDefaultState(); + IBlockState filler = Blocks.DIRT.getDefaultState(); - if (state.getBlock() == Blocks.STONE || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) - { + if (state.getBlock() == Blocks.STONE || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()){ + //water generates below level 31 if (y<=31) { - data.setBlockState(x, y, z, WATER); - return; + data.setBlockState(x, y, z, WATER); + return; } + //if this is an ocean biome, fill it with water instead - if (biome==Biomes.OCEAN||biome==Biomes.DEEP_OCEAN&&(y-1)>=10) { - data.setBlockState(x, y, z, WATER); - return; - } - if (y - 1 < 10) - { - if (data.getBlockState(x, y+1, z)==WATER||data.getBlockState(x, y+1, z)==FLOWING_WATER) - data.setBlockState(x, y, z, GLOWING_OBSIDIAN); - else - data.setBlockState(x, y, z, LIQUID_REDSTONE); - } - else - { - data.setBlockState(x, y, z, AIR); - - if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) - { - data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState()); - } - } + if (biome==Biomes.OCEAN||biome==Biomes.DEEP_OCEAN&&y-1>=10) { + data.setBlockState(x, y, z, WATER); + return; + } + + //else, fill it with air + data.setBlockState(x, y, z, AIR); + if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) + data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState()); } } } \ No newline at end of file diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/misc/ChristmasTree.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/misc/ChristmasTree.java index 329617a..0c1517a 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/misc/ChristmasTree.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/misc/ChristmasTree.java @@ -36,13 +36,9 @@ public boolean generate(World worldIn, Random rand, BlockPos position) { int j1; if (i1 - position.getY() < j) - { j1 = 0; - } else - { j1 = l; - } BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); for (int k1 = position.getX() - j1; k1 <= position.getX() + j1 && flag; ++k1) { @@ -52,21 +48,15 @@ public boolean generate(World worldIn, Random rand, BlockPos position) { IBlockState state = worldIn.getBlockState(blockpos$mutableblockpos.setPos(k1, i1, l1)); if (!state.getBlock().isAir(state, worldIn, blockpos$mutableblockpos.setPos(k1, i1, l1)) && !state.getBlock().isLeaves(state, worldIn, blockpos$mutableblockpos.setPos(k1, i1, l1))) - { flag = false; - } } else - { flag = false; - } } } } if (!flag) - { return false; - } else { BlockPos down = position.down(); @@ -118,21 +108,15 @@ public boolean generate(World worldIn, Random rand, BlockPos position) BlockPos upN = position.up(k4); state = worldIn.getBlockState(upN); if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN)) - { setBlockAndNotifyAdequately(worldIn, position.up(k4), TRUNK); - } } return true; } else - { return false; - } } } else - { return false; - } } } \ No newline at end of file diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/ores/DirtGen.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/ores/DirtGen.java index 1165bce..0d95ebc 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/ores/DirtGen.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/ores/DirtGen.java @@ -15,9 +15,8 @@ public class DirtGen implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { - if (world.provider.getDimension() == 0) { + if (world.provider.getDimension() == 0) generateOverworld(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider); - } } private void generateOverworld(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider){ int dirtOrSand=random.nextInt(3); diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/ores/OreGenNether.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/ores/OreGenNether.java index 8dbfa29..e312231 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/ores/OreGenNether.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/ores/OreGenNether.java @@ -30,9 +30,8 @@ private void generateNether(Random random, int chunkX, int chunkZ, World world, IBlockState oreSelectionNether=Ores.SilverOreNether.getDefaultState(); //gold ore (nether variant) - if (selectOreNether==1) { + if (selectOreNether==1) oreSelectionNether=Ores.GoldOreNether.getDefaultState(); - } else oreSelectionNether=Ores.SilverOreNether.getDefaultState(); diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/ores/OreGenOverworld.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/ores/OreGenOverworld.java index bdfeb6f..eff7766 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/ores/OreGenOverworld.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/ores/OreGenOverworld.java @@ -29,15 +29,11 @@ private void generateOverworld(Random random, int chunkX, int chunkZ, World worl //ruby ore if (selectOreOverworld==0) - { oreSelectionOverworld=Ores.RubyOre.getDefaultState(); - } //silver ore else if (selectOreOverworld==1) - { - oreSelectionOverworld=Ores.SilverOre.getDefaultState(); - } + oreSelectionOverworld=Ores.SilverOre.getDefaultState(); else oreSelectionOverworld=Ores.SaltOre.getDefaultState(); generateOre(oreSelectionOverworld, world, random, chunkX * 16, chunkZ * 16, 16, 64, 4 + random.nextInt(4), 6); @@ -45,9 +41,8 @@ else if (selectOreOverworld==1) private void generateOre(IBlockState ore, World world, Random random, int x, int z, int minY, int maxY, int size, int chances) { int deltaY = maxY - minY; int rarity = 16; - if (ore==Ores.RubyOre.getDefaultState()) { + if (ore==Ores.RubyOre.getDefaultState()) rarity=8; - } for (int i = 0; i < chances; i++) { BlockPos pos = new BlockPos(x + random.nextInt(rarity), minY + random.nextInt(deltaY), z + random.nextInt(8)); WorldGenMinable generator = new WorldGenMinable(ore, size,BlockMatcher.forBlock(Blocks.STONE)); diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/AttieCat/JeffTank.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/AttieCat/JeffTank.java index e5fe071..bdd97fa 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/AttieCat/JeffTank.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/AttieCat/JeffTank.java @@ -17,9 +17,8 @@ public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkGen IChunkProvider chunkProvider) { int blockX = chunkX * 16; int blockZ = chunkZ * 16; - if (world.provider.getDimension()==-1) { + if (world.provider.getDimension()==-1) generateNether(world, rand, blockX + 8, blockZ + 8); - } } private void generateNether(World world, Random rand, int blockX, int blockZ) { diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/AttieCat/JeffTankGen.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/AttieCat/JeffTankGen.java index fc0cf2b..b3e15ce 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/AttieCat/JeffTankGen.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/AttieCat/JeffTankGen.java @@ -29,9 +29,7 @@ public boolean generate(World world, Random rand, BlockPos position) { TemplateManager templatemanager = worldserver.getStructureTemplateManager(); Template template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":attiecat/jeff_tank")); if(template == null||ModConfig.worldgen.structures.attiecat.JeffTank) - { return false; - } if(JeffTankGen.canSpawnHere(template, worldserver, position)) { if(rand.nextInt(ModConfig.worldgen.structures.attiecat.JeffTankChance) == 0){ IBlockState iblockstate = world.getBlockState(position); diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/AttieCat/Shrine.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/AttieCat/Shrine.java index d7bb28c..fa81305 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/AttieCat/Shrine.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/AttieCat/Shrine.java @@ -18,9 +18,7 @@ public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkGen int blockX = chunkX * 16; int blockZ = chunkZ * 16; if (world.provider.getDimension() == 1) - { generateEnd(world, rand, blockX + 8, blockZ + 8); - } } private void generateEnd(World world, Random rand, int blockX, int blockZ) { diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/AttieCat/ShrineGen.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/AttieCat/ShrineGen.java index 7d57e54..92df924 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/AttieCat/ShrineGen.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/AttieCat/ShrineGen.java @@ -30,16 +30,12 @@ public boolean generate(World world, Random rand, BlockPos position) { int selectShrine=rand.nextInt(2); Template template = null; if (selectShrine==1) - { template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":attiecat/bill_shrine")); - } else template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":attiecat/john_shrine")); if(template == null||ModConfig.worldgen.structures.attiecat.Shrines) - { - return false; - } + return false; if(ShrineGen.canSpawnHere(template, worldserver, position)) { if(rand.nextInt(ModConfig.worldgen.structures.attiecat.ShrinesChance) == 0){ @@ -63,8 +59,7 @@ public static boolean canSpawnHere(Template template, World world, BlockPos posA boolean corner2 = isCornerValid(world, posAboveGround.add(xwidth, 0, zwidth)); return posAboveGround.getY() > 31 && corner1 && corner2; } - public static boolean isCornerValid(World world, BlockPos pos) - { + public static boolean isCornerValid(World world, BlockPos pos){ int variation = 3; int highestBlock = getGroundFromAbove(world, pos.getX(), pos.getZ()); @@ -81,6 +76,6 @@ public static int getGroundFromAbove(World world, int x, int z) Block blockAt = world.getBlockState(new BlockPos(x,y,z)).getBlock(); foundGround = blockAt == Blocks.END_STONE; } - return y; + return y; } } \ No newline at end of file diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/DUTrees.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/DUTrees.java index 3a4ed5c..f2c158a 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/DUTrees.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/DUTrees.java @@ -32,12 +32,12 @@ private void generateDU(World world, Random rand, int blockX, int blockZ) } public static int getGroundFromAbove(World world, int x, int z) { - int y = 75; + int y = 85; boolean foundGround = false; while(!foundGround && y-- >= 31) { Block blockAt = world.getBlockState(new BlockPos(x,y,z)).getBlock(); - foundGround = blockAt == Blocks.GRASS; + foundGround = blockAt == Blocks.GRASS||blockAt==Blocks.SAND||blockAt==Blocks.SANDSTONE; } return y; } diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/DUTreesGen.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/DUTreesGen.java index 5b521a2..4f0248e 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/DUTreesGen.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/DUTreesGen.java @@ -32,47 +32,35 @@ public boolean generate(World world, Random rand, BlockPos position) { TemplateManager templatemanager = worldserver.getStructureTemplateManager(); Template oak= templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":trees/oak_sapling")); - Template birch=templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":trees/birch_sapling")); - Template darkOak=templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":trees/dark_oak_sapling")); Template acacia=templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":trees/acacia_sapling")); Template jungle=templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":trees/jungle_sapling")); - Template spruce=templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":trees/spruce_sapling")); - + Template [] cacti= {templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":cacti/cactus_1")),templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":cacti/cactus_2")),templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":cacti/cactus_3")),templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":cacti/shrub"))}; Template template = oak; - - int treeSelect=rand.nextInt(3); //oak sapling if(biome == Biomes.FOREST || biome == Biomes.FOREST_HILLS||biome==Biomes.SWAMPLAND||biome==Biomes.MUTATED_SWAMPLAND) { template = oak; } - //acacia sapling - if(biome == Biomes.SAVANNA||biome == Biomes.SAVANNA_PLATEAU||biome == Biomes.MUTATED_SAVANNA||biome == Biomes.MUTATED_SAVANNA_ROCK) { + if(biome == Biomes.SAVANNA||biome == Biomes.SAVANNA_PLATEAU||biome == Biomes.MUTATED_SAVANNA||biome == Biomes.MUTATED_SAVANNA_ROCK) template = acacia; - } - //birch sapling - if(biome == Biomes.BIRCH_FOREST_HILLS|| biome == Biomes.BIRCH_FOREST_HILLS) { + if(biome == Biomes.BIRCH_FOREST_HILLS|| biome == Biomes.BIRCH_FOREST_HILLS) template = birch; - } - //dark oak sapling - if(biome == Biomes.ROOFED_FOREST) { + if(biome == Biomes.ROOFED_FOREST) template = darkOak; - } - //jungle sapling - if(biome == Biomes.JUNGLE||biome == Biomes.JUNGLE_EDGE||biome == Biomes.JUNGLE_HILLS||biome == Biomes.MUTATED_JUNGLE||biome == Biomes.MUTATED_JUNGLE_EDGE) { + if(biome == Biomes.JUNGLE||biome == Biomes.JUNGLE_EDGE||biome == Biomes.JUNGLE_HILLS||biome == Biomes.MUTATED_JUNGLE||biome == Biomes.MUTATED_JUNGLE_EDGE) template = jungle; - } - //spruce sapling - if(biome == Biomes.TAIGA||biome == Biomes.TAIGA_HILLS||biome == Biomes.COLD_TAIGA||biome == Biomes.COLD_TAIGA_HILLS||biome == Biomes.MUTATED_REDWOOD_TAIGA||biome == Biomes.MUTATED_REDWOOD_TAIGA_HILLS||biome == Biomes.MUTATED_TAIGA||biome == Biomes.MUTATED_TAIGA_COLD||biome == Biomes.REDWOOD_TAIGA||biome == Biomes.REDWOOD_TAIGA_HILLS||biome==Biomes.EXTREME_HILLS_WITH_TREES||biome==Biomes.MUTATED_EXTREME_HILLS_WITH_TREES) { + if(biome == Biomes.TAIGA||biome == Biomes.TAIGA_HILLS||biome == Biomes.COLD_TAIGA||biome == Biomes.COLD_TAIGA_HILLS||biome == Biomes.MUTATED_REDWOOD_TAIGA||biome == Biomes.MUTATED_REDWOOD_TAIGA_HILLS||biome == Biomes.MUTATED_TAIGA||biome == Biomes.MUTATED_TAIGA_COLD||biome == Biomes.REDWOOD_TAIGA||biome == Biomes.REDWOOD_TAIGA_HILLS||biome==Biomes.EXTREME_HILLS_WITH_TREES||biome==Biomes.MUTATED_EXTREME_HILLS_WITH_TREES) template = spruce; - } + if(biome==Biomes.DESERT||biome==Biomes.DESERT_HILLS||biome==Biomes.MUTATED_DESERT) + template= cacti[rand.nextInt(4)]; + IBlockState iblockstate = world.getBlockState(position); world.notifyBlockUpdate(position, iblockstate, iblockstate, 3); PlacementSettings placementsettings = (new PlacementSettings()).setMirror(Mirror.NONE) @@ -99,13 +87,12 @@ public static boolean isCornerValid(World world, BlockPos pos) public static int getGroundFromAbove(World world, int x, int z) { - int y = 75; + int y = 85; boolean foundGround = false; while(!foundGround && y-- >= 31) { Block blockAt = world.getBlockState(new BlockPos(x,y,z)).getBlock(); - //Block blockAbove = world.getBlockState(new BlockPos(x,y+1,z)).getBlock(); - foundGround = (blockAt == Blocks.GRASS);// && blockAbove==Blocks.AIR); + foundGround = (blockAt == Blocks.GRASS||blockAt==Blocks.SAND||blockAt==Blocks.SANDSTONE); } return y; } diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/BrickPyramid.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/BrickPyramid.java index 1af06cd..3d55634 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/BrickPyramid.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/BrickPyramid.java @@ -17,9 +17,8 @@ public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkGen IChunkProvider chunkProvider) { int blockX = chunkX * 16; int blockZ = chunkZ * 16; - if (world.provider.getDimension() == 0) { + if (world.provider.getDimension() == 0) generateOverworld(world, rand, blockX + 8, blockZ + 8); - } } private void generateOverworld(World world, Random rand, int blockX, int blockZ) { diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/Minerbase.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/Minerbase.java index 792bf10..3631947 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/Minerbase.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/Minerbase.java @@ -19,9 +19,8 @@ public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkGen IChunkProvider chunkProvider) { int blockX = chunkX * 16; int blockZ = chunkZ * 16; - if (world.provider.getDimension() != 1&&world.provider.getDimension() != DimensionRegistry.DeepVoid&&world.provider.getDimension() != -1) { + if (world.provider.getDimension() != 1&&world.provider.getDimension() != DimensionRegistry.DeepVoid&&world.provider.getDimension() != -1) generateOverworld(world, rand, blockX + 8, blockZ + 8); - } } private void generateOverworld(World world, Random rand, int blockX, int blockZ) { @@ -34,7 +33,7 @@ private void generateOverworld(World world, Random rand, int blockX, int blockZ) } public static int getGroundFromAbove(World world, int x, int z) { - int y = 126; + int y = 75; boolean foundGround = false; while(!foundGround && y-- >= 31) { diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/MiniStronghold.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/MiniStronghold.java index e6a3804..4d7fa0c 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/MiniStronghold.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/MiniStronghold.java @@ -16,9 +16,8 @@ public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkGen IChunkProvider chunkProvider) { int blockX = chunkX * 16; int blockZ = chunkZ * 16; - if (world.provider.getDimension() != 1 && world.provider.getDimension() != -3 && world.provider.getDimension() != -1) { + if (world.provider.getDimension() != 1 && world.provider.getDimension() != -3 && world.provider.getDimension() != -1) generateOverworld(world, rand, blockX + 8, blockZ + 8); - } } private void generateOverworld(World world, Random rand, int blockX, int blockZ) diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/MiniStrongholdGen.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/MiniStrongholdGen.java index d225880..8cdad46 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/MiniStrongholdGen.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/MiniStrongholdGen.java @@ -31,9 +31,7 @@ public boolean generate(World world, Random rand, BlockPos position) { if(ModConfig.worldgen.structures.MiniStronghold==false) return false; if(template == null) - { return false; - } Biome biome = world.getBiomeForCoordsBody(position); if(rand.nextInt(ModConfig.worldgen.structures.MiniStrongholdChance) == 0){ IBlockState iblockstate = world.getBlockState(position); diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/VoidDungeonLargeGen.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/VoidDungeonLargeGen.java index bd3f822..faedd2d 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/VoidDungeonLargeGen.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Dungeons/VoidDungeonLargeGen.java @@ -36,9 +36,7 @@ public boolean generate(World world, Random rand, BlockPos position) { if (ModConfig.worldgen.structures.VoidDungeonLarge==false) return false; if(part1 == null) - { return false; - } Biome biome = world.getBiomeForCoordsBody(position); if(VoidDungeonLargeGen.canSpawnHere(part1, worldserver, position)) { if(rand.nextInt(ModConfig.worldgen.structures.VoidDungeonLargeChance) == 0){ diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Home.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Home.java index 1583e2f..75ec454 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Home.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Home.java @@ -28,7 +28,7 @@ private void generateOverworld(World world, Random rand, int blockX, int blockZ) } public static int getGroundFromAbove(World world, int x, int z) { - int y = 255; + int y = 75; boolean foundGround = false; while(!foundGround && y-- >= 31) { diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/HomeGen.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/HomeGen.java index 150f5a4..77986f8 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/HomeGen.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/HomeGen.java @@ -34,39 +34,26 @@ public boolean generate(World world, Random rand, BlockPos position) { Template template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":homes/starter_house")); //oak forest home - if(biome == Biomes.FOREST || biome == Biomes.FOREST_HILLS||biome==Biomes.SWAMPLAND||biome==Biomes.MUTATED_SWAMPLAND||biome==Biomes.PLAINS||biome==Biomes.MUTATED_PLAINS||biome==Biomes.ICE_PLAINS) { + if(biome == Biomes.FOREST || biome == Biomes.FOREST_HILLS||biome==Biomes.SWAMPLAND||biome==Biomes.MUTATED_SWAMPLAND||biome==Biomes.PLAINS||biome==Biomes.MUTATED_PLAINS||biome==Biomes.ICE_PLAINS) template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":homes/starter_house")); - } - //savanna home - if(biome == Biomes.SAVANNA||biome == Biomes.SAVANNA_PLATEAU||biome == Biomes.MUTATED_SAVANNA||biome == Biomes.MUTATED_SAVANNA_ROCK) { + if(biome == Biomes.SAVANNA||biome == Biomes.SAVANNA_PLATEAU||biome == Biomes.MUTATED_SAVANNA||biome == Biomes.MUTATED_SAVANNA_ROCK) template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":homes/starter_house_acacia")); - } - //birch forest home - if(biome == Biomes.BIRCH_FOREST_HILLS|| biome == Biomes.BIRCH_FOREST_HILLS) { - template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":homes/starter_house_birch")); - } - + if(biome == Biomes.BIRCH_FOREST_HILLS|| biome == Biomes.BIRCH_FOREST_HILLS) + template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":homes/starter_house_birch")); //roofed forest home - if(biome == Biomes.ROOFED_FOREST) { + if(biome == Biomes.ROOFED_FOREST) template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":homes/starter_house_dark_oak")); - } - //desert home - if(biome == Biomes.DESERT||biome == Biomes.DESERT_HILLS||biome == Biomes.MUTATED_DESERT) { - template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":homes/starter_house_desert")); - } - + if(biome == Biomes.DESERT||biome == Biomes.DESERT_HILLS||biome == Biomes.MUTATED_DESERT) + template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":homes/starter_house_desert")); //jungle home - if(biome == Biomes.JUNGLE||biome == Biomes.JUNGLE_EDGE||biome == Biomes.JUNGLE_HILLS||biome == Biomes.MUTATED_JUNGLE||biome == Biomes.MUTATED_JUNGLE_EDGE) { + if(biome == Biomes.JUNGLE||biome == Biomes.JUNGLE_EDGE||biome == Biomes.JUNGLE_HILLS||biome == Biomes.MUTATED_JUNGLE||biome == Biomes.MUTATED_JUNGLE_EDGE) template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":homes/starter_house_jungle")); - } - //spruce home - if(biome == Biomes.TAIGA||biome == Biomes.TAIGA_HILLS||biome == Biomes.COLD_TAIGA||biome == Biomes.COLD_TAIGA_HILLS||biome == Biomes.MUTATED_REDWOOD_TAIGA||biome == Biomes.MUTATED_REDWOOD_TAIGA_HILLS||biome == Biomes.MUTATED_TAIGA||biome == Biomes.MUTATED_TAIGA_COLD||biome == Biomes.REDWOOD_TAIGA||biome == Biomes.REDWOOD_TAIGA_HILLS||biome==Biomes.EXTREME_HILLS_WITH_TREES||biome==Biomes.MUTATED_EXTREME_HILLS_WITH_TREES) { + if(biome == Biomes.TAIGA||biome == Biomes.TAIGA_HILLS||biome == Biomes.COLD_TAIGA||biome == Biomes.COLD_TAIGA_HILLS||biome == Biomes.MUTATED_REDWOOD_TAIGA||biome == Biomes.MUTATED_REDWOOD_TAIGA_HILLS||biome == Biomes.MUTATED_TAIGA||biome == Biomes.MUTATED_TAIGA_COLD||biome == Biomes.REDWOOD_TAIGA||biome == Biomes.REDWOOD_TAIGA_HILLS||biome==Biomes.EXTREME_HILLS_WITH_TREES||biome==Biomes.MUTATED_EXTREME_HILLS_WITH_TREES) template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":homes/starter_house_spruce")); - } if(ModConfig.worldgen.structures.Homes==false) return false; @@ -103,7 +90,7 @@ public static boolean isCornerValid(World world, BlockPos pos) public static int getGroundFromAbove(World world, int x, int z) { - int y = 120; + int y = 75; boolean foundGround = false; while(!foundGround && y-- >= 31) { diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Ocean.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Ocean.java index 7a25300..d008df6 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Ocean.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Ocean.java @@ -17,9 +17,8 @@ public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkGen IChunkProvider chunkProvider) { int blockX = chunkX * 16; int blockZ = chunkZ * 16; - if (world.provider.getDimension() == 0) { + if (world.provider.getDimension() == 0) generateOverworld(world, rand, blockX + 8, blockZ + 8); - } } private void generateOverworld(World world, Random rand, int blockX, int blockZ) { diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/RoguePortal.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/RoguePortal.java index 8b40a54..235da0a 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/RoguePortal.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/RoguePortal.java @@ -17,9 +17,8 @@ public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkGen IChunkProvider chunkProvider) { int blockX = chunkX * 16; int blockZ = chunkZ * 16; - if (world.provider.getDimension() == 0) { + if (world.provider.getDimension() == 0) generateOverworld(world, rand, blockX + 8, blockZ + 8); - } } private void generateOverworld(World world, Random rand, int blockX, int blockZ) { diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/RoguePortalGen.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/RoguePortalGen.java index c743d6f..a16bca4 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/RoguePortalGen.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/RoguePortalGen.java @@ -16,7 +16,6 @@ import net.minecraft.util.math.ChunkPos; import net.minecraft.world.World; import net.minecraft.world.WorldServer; -import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraft.world.gen.structure.template.PlacementSettings; import net.minecraft.world.gen.structure.template.Template; @@ -29,13 +28,9 @@ public boolean generate(World world, Random rand, BlockPos position) { MinecraftServer minecraftserver = world.getMinecraftServer(); TemplateManager templatemanager = worldserver.getStructureTemplateManager(); Template template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":rogue_portal")); - if(template == null) - { - return false; - } - if (ModConfig.worldgen.structures.RoguePortal==false) + if(template == null||ModConfig.worldgen.structures.RoguePortal==false) return false; - Biome biome = world.getBiomeForCoordsBody(position); + if(RoguePortalGen.canSpawnHere(template, worldserver, position)) { if(rand.nextInt(ModConfig.worldgen.structures.RoguePortalChance) == 0){ IBlockState iblockstate = world.getBlockState(position); diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Runway.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Runway.java index 77d7961..e75c6e9 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Runway.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Runway.java @@ -17,9 +17,8 @@ public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkGen IChunkProvider chunkProvider) { int blockX = chunkX * 16; int blockZ = chunkZ * 16; - if (world.provider.getDimension() == 0) { + if (world.provider.getDimension() == 0) generateOverworld(world, rand, blockX + 8, blockZ + 8); - } } private void generateOverworld(World world, Random rand, int blockX, int blockZ) { diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/RunwayGen.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/RunwayGen.java index c179af7..2735812 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/RunwayGen.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/RunwayGen.java @@ -29,13 +29,8 @@ public boolean generate(World world, Random rand, BlockPos position) { MinecraftServer minecraftserver = world.getMinecraftServer(); TemplateManager templatemanager = worldserver.getStructureTemplateManager(); Template template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":runway")); - if(template == null) - { - System.out.println("Nether Noah's Paradise mod: Please don't screw with me!"); + if(template == null||ModConfig.worldgen.structures.Runway==false) return false; - } - if (ModConfig.worldgen.structures.Runway==false) - return false; Biome biome = world.getBiomeForCoordsBody(position); if(RunwayGen.canSpawnHere(template, worldserver, position)) { if(rand.nextInt(ModConfig.worldgen.structures.RunwayChance) == 0){ diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/SkyWheel.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/SkyWheel.java index a73c5ba..b67bc08 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/SkyWheel.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/SkyWheel.java @@ -16,9 +16,8 @@ public void generate(Random rand, int chunkX, int chunkZ, World world, IChunkGen IChunkProvider chunkProvider) { int blockX = chunkX * 16; int blockZ = chunkZ * 16; - if (world.provider.getDimension() == 0) { + if (world.provider.getDimension() == 0) generateOverworld(world, rand, blockX + 8, blockZ + 8); - } } private void generateOverworld(World world, Random rand, int blockX, int blockZ) diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/SkyWheelGen.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/SkyWheelGen.java index cdb0849..3b5fa19 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/SkyWheelGen.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/SkyWheelGen.java @@ -28,11 +28,7 @@ public boolean generate(World world, Random rand, BlockPos position) { MinecraftServer minecraftserver = world.getMinecraftServer(); TemplateManager templatemanager = worldserver.getStructureTemplateManager(); Template template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":sky_wheel")); - if(template == null) - { - return false; - } - if (ModConfig.worldgen.structures.SkyWheel==false) + if(template == null||ModConfig.worldgen.structures.SkyWheel==false) return false; Biome biome = world.getBiomeForCoordsBody(position); if(rand.nextInt(ModConfig.worldgen.structures.SkyWheelChance) == 0){ diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/TreasureChestGen.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/TreasureChestGen.java index 61f37cc..f3ebd80 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/TreasureChestGen.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/TreasureChestGen.java @@ -28,11 +28,7 @@ public boolean generate(World world, Random rand, BlockPos position) { MinecraftServer minecraftserver = world.getMinecraftServer(); TemplateManager templatemanager = worldserver.getStructureTemplateManager(); Template template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":treasure_chest")); - if(template == null) - { - return false; - } - if (ModConfig.worldgen.structures.TreasureChest==false) + if(template == null||ModConfig.worldgen.structures.TreasureChest==false) return false; Biome biome = world.getBiomeForCoordsBody(position); if(TreasureChestGen.canSpawnHere(template, worldserver, position)) { diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/WickerManGen.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/WickerManGen.java index 437336c..d821685 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/WickerManGen.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/WickerManGen.java @@ -30,13 +30,8 @@ public boolean generate(World world, Random rand, BlockPos position) { MinecraftServer minecraftserver = world.getMinecraftServer(); TemplateManager templatemanager = worldserver.getStructureTemplateManager(); Template template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":wicker_man")); - if (ModConfig.worldgen.structures.WickerMan==false) - return false; - if(template == null) - { - System.out.println("Nether Noah's Paradise mod: Please don't screw with me!"); - return false; - } + if (ModConfig.worldgen.structures.WickerMan==false||template == null) + return false; Biome biome = world.getBiomeForCoordsBody(position); if(biome == Biomes.FOREST || biome == Biomes.FOREST_HILLS|| biome == Biomes.BIRCH_FOREST_HILLS|| biome == Biomes.FOREST_HILLS) { if(WickerManGen.canSpawnHere(template, worldserver, position)) { diff --git a/src/main/resources/assets/nnparadisemod/structures/cacti/cactus_1.nbt b/src/main/resources/assets/nnparadisemod/structures/cacti/cactus_1.nbt new file mode 100644 index 0000000..a6b7a97 Binary files /dev/null and b/src/main/resources/assets/nnparadisemod/structures/cacti/cactus_1.nbt differ diff --git a/src/main/resources/assets/nnparadisemod/structures/cacti/cactus_2.nbt b/src/main/resources/assets/nnparadisemod/structures/cacti/cactus_2.nbt new file mode 100644 index 0000000..891a174 Binary files /dev/null and b/src/main/resources/assets/nnparadisemod/structures/cacti/cactus_2.nbt differ diff --git a/src/main/resources/assets/nnparadisemod/structures/cacti/cactus_3.nbt b/src/main/resources/assets/nnparadisemod/structures/cacti/cactus_3.nbt new file mode 100644 index 0000000..6f27007 Binary files /dev/null and b/src/main/resources/assets/nnparadisemod/structures/cacti/cactus_3.nbt differ diff --git a/src/main/resources/assets/nnparadisemod/structures/cacti/shrub.nbt b/src/main/resources/assets/nnparadisemod/structures/cacti/shrub.nbt new file mode 100644 index 0000000..3fb82e8 Binary files /dev/null and b/src/main/resources/assets/nnparadisemod/structures/cacti/shrub.nbt differ