diff --git a/changelog.txt b/changelog.txt index 66bc1c4..5e1f878 100644 --- a/changelog.txt +++ b/changelog.txt @@ -198,7 +198,9 @@ Improved world generation in the Deep Underground 1.1.1: Fixed a bug with diamond crystal generating in the deep void and deep underground + 1.2: Added biomes to Deep Underground 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 diff --git a/src/main/java/com/NetherNoah/ParadiseMod/blocks/misc/glowingIce.java b/src/main/java/com/NetherNoah/ParadiseMod/blocks/misc/glowingIce.java new file mode 100644 index 0000000..deee7fc --- /dev/null +++ b/src/main/java/com/NetherNoah/ParadiseMod/blocks/misc/glowingIce.java @@ -0,0 +1,21 @@ +package com.NetherNoah.ParadiseMod.blocks.misc; + +import net.minecraft.block.Block; +import net.minecraft.block.SoundType; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; + +public class glowingIce extends Block { + public glowingIce() { + super(Material.ICE); + setUnlocalizedName("glowingIce"); + setRegistryName("glowing_ice"); + setHardness(.2F); + setResistance(2F); + setCreativeTab(CreativeTabs.BUILDING_BLOCKS); + setHarvestLevel("pickaxe",0); + setLightLevel(.46666667F); + setSoundType(SoundType.GLASS); + setDefaultSlipperiness(1F); + } +} \ No newline at end of file diff --git a/src/main/java/com/NetherNoah/ParadiseMod/init/ModBlocks/Misc.java b/src/main/java/com/NetherNoah/ParadiseMod/init/ModBlocks/Misc.java index 0374719..b2602c2 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/init/ModBlocks/Misc.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/init/ModBlocks/Misc.java @@ -23,6 +23,7 @@ import com.NetherNoah.ParadiseMod.blocks.misc.VoidFurnaceLit; import com.NetherNoah.ParadiseMod.blocks.misc.VoidStone; import com.NetherNoah.ParadiseMod.blocks.misc.emeraldRail; +import com.NetherNoah.ParadiseMod.blocks.misc.glowingIce; import com.NetherNoah.ParadiseMod.blocks.misc.glowingObsidian; import com.NetherNoah.ParadiseMod.blocks.misc.soulGlass; import com.NetherNoah.ParadiseMod.blocks.misc.soulGlassPane; @@ -80,6 +81,7 @@ public class Misc { public static MossyFurnaceCode MossyFurnaceLit; public static VoidFurnaceCode VoidFurnace; public static VoidFurnaceCode VoidFurnaceLit; + public static Block glowingIce; public static void initAndRegister() { Utils.regBlock(RegenerationStone=new RegenerationStone()); @@ -111,11 +113,13 @@ public static void initAndRegister() { Utils.regBlock(GoldHopper = new GoldHopper()); Utils.regBlock(MossyFurnace = new MossyFurnace()); Utils.regBlock(VoidFurnace=new VoidFurnace()); + Utils.regBlock(glowingIce=new glowingIce()); ForgeRegistries.BLOCKS.register(MossyFurnaceLit = new MossyFurnaceLit()); ForgeRegistries.BLOCKS.register(VoidFurnaceLit=new VoidFurnaceLit()); } public static void regRenders() { + Utils.regRender(glowingIce); Utils.regRender(RegenerationStone); Utils.regRender(VoidBricks); Utils.regRender(PolishedVoidStone); 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 6565164..64154ca 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/dimension/DUChunkGenerator.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/dimension/DUChunkGenerator.java @@ -3,8 +3,11 @@ import java.util.List; import java.util.Random; +import com.NetherNoah.ParadiseMod.init.LiquidRedstone; import com.NetherNoah.ParadiseMod.init.ModBlocks.Crystals; -import com.NetherNoah.ParadiseMod.world.MapGenDuCaves; +import com.NetherNoah.ParadiseMod.init.ModBlocks.Misc; +import com.NetherNoah.ParadiseMod.world.mapgen.MapGenDUCaves; +import com.NetherNoah.ParadiseMod.world.mapgen.MapGenDURavines; import net.minecraft.block.Block; import net.minecraft.block.BlockStone; @@ -23,7 +26,6 @@ import net.minecraft.world.chunk.ChunkPrimer; import net.minecraft.world.gen.IChunkGenerator; import net.minecraft.world.gen.MapGenBase; -import net.minecraft.world.gen.MapGenRavine; import net.minecraft.world.gen.NoiseGeneratorOctaves; import net.minecraft.world.gen.feature.WorldGenBush; import net.minecraft.world.gen.feature.WorldGenMinable; @@ -51,6 +53,9 @@ public class DUChunkGenerator implements IChunkGenerator { protected static final IBlockState SANDSTONE = Blocks.SANDSTONE.getDefaultState(); protected static final IBlockState PRISMARINE=Blocks.PRISMARINE.getDefaultState(); protected static final IBlockState COBBLESTONE = Blocks.COBBLESTONE.getDefaultState(); + protected static final IBlockState MYCELIUM=Blocks.MYCELIUM.getDefaultState(); + protected static final IBlockState LIQUID_REDSTONE=LiquidRedstone.BlockLiquidRedstone.instance.getDefaultState(); + protected static final IBlockState GLOWING_ICE=Misc.glowingIce.getDefaultState(); private final World world; @@ -78,6 +83,9 @@ public class DUChunkGenerator implements IChunkGenerator { //volcanic private final WorldGenMinable Magma= new WorldGenMinable(Blocks.MAGMA.getDefaultState(), 33,BlockMatcher.forBlock(Blocks.COBBLESTONE)); + //icy + private final WorldGenMinable glowingIce= new WorldGenMinable(GLOWING_ICE, 33,BlockMatcher.forBlock(Blocks.PACKED_ICE)); + //crystals private final WorldGenBush quartzGen = new WorldGenBush(Crystals.quartzCrystal); private final WorldGenBush diamondGen = new WorldGenBush(Crystals.diamondCrystal); @@ -100,8 +108,8 @@ public class DUChunkGenerator implements IChunkGenerator { private final WorldGenBush redMushroomFeature = new WorldGenBush(Blocks.RED_MUSHROOM); //natural structures - private MapGenBase genDUCaves = new MapGenDuCaves(); - private MapGenBase genDURavines = new MapGenRavine(); + private MapGenBase genDUCaves = new MapGenDUCaves(); + private MapGenBase genDURavines = new MapGenDURavines(); private MapGenBase genDUMineshafts=new MapGenMineshaft(); double[] pnr; @@ -266,6 +274,7 @@ public Chunk generateChunk(int x, int z) { boolean desert=blockBiome==Biomes.DESERT||blockBiome==Biomes.DESERT_HILLS||blockBiome==Biomes.MUTATED_DESERT; boolean volcanic=blockBiome==Biomes.EXTREME_HILLS||blockBiome==Biomes.EXTREME_HILLS_EDGE||blockBiome==Biomes.EXTREME_HILLS_WITH_TREES||blockBiome==Biomes.MUTATED_EXTREME_HILLS||blockBiome==Biomes.MUTATED_EXTREME_HILLS_WITH_TREES; boolean oceanic=blockBiome==Biomes.OCEAN||blockBiome==Biomes.DEEP_OCEAN; + boolean mushroom=blockBiome==Biomes.MUSHROOM_ISLAND||blockBiome==Biomes.MUSHROOM_ISLAND_SHORE; //block to replace Block blockToReplace=chunk.getBlockState(cx, cy, cz).getBlock(); @@ -277,8 +286,15 @@ public Chunk generateChunk(int x, int z) { if (blockToReplace==Blocks.GRAVEL) chunk.setBlockState(new BlockPos(cx,cy,cz), STONE); + 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()); + //replace grass and dirt if (blockToReplace==Blocks.GRASS||blockToReplace==Blocks.DIRT) { + if (mushroom) + chunk.setBlockState(new BlockPos(cx,cy,cz), MYCELIUM); if (icy) chunk.setBlockState(new BlockPos(cx, cy, cz),COMPICE); @@ -300,7 +316,7 @@ public Chunk generateChunk(int x, int z) { //replace exposed stone if (blockToReplace==Blocks.STONE) { - if (chunk.getBlockState(cx+1,cy, cz).getBlock()==Blocks.AIR||chunk.getBlockState(cx,cy+1, cz).getBlock()==Blocks.AIR||chunk.getBlockState(cx,cy, cz+1).getBlock()==Blocks.AIR||chunk.getBlockState(cx-1,cy, cz).getBlock()==Blocks.AIR||chunk.getBlockState(cx,cy-1, cz).getBlock()==Blocks.AIR|| chunk.getBlockState(cx,cy, cz-1).getBlock()==Blocks.AIR) { + if (chunk.getBlockState(cx+1,cy, cz).getBlock()==Blocks.AIR||chunk.getBlockState(cx,cy+1, cz).getBlock()==Blocks.AIR||chunk.getBlockState(cx,cy, cz+1).getBlock()==Blocks.AIR||chunk.getBlockState(cx-1,cy, cz).getBlock()==Blocks.AIR||chunk.getBlockState(cx,cy-1, cz).getBlock()==Blocks.AIR|| chunk.getBlockState(cx,cy, cz-1).getBlock()==Blocks.AIR||chunk.getBlockState(cx+1,cy, cz).getBlock()==Blocks.WATER||chunk.getBlockState(cx,cy+1, cz).getBlock()==Blocks.WATER||chunk.getBlockState(cx,cy, cz+1).getBlock()==Blocks.WATER||chunk.getBlockState(cx-1,cy, cz).getBlock()==Blocks.WATER||chunk.getBlockState(cx,cy-1, cz).getBlock()==Blocks.WATER|| chunk.getBlockState(cx,cy, cz-1).getBlock()==Blocks.WATER) { if (icy) chunk.setBlockState(new BlockPos(cx, cy, cz), COMPICE); @@ -452,6 +468,9 @@ public void populate(int x, int z) { //oceanic Lantern.generate(world, rand, blockpos.add(rand.nextInt(16), rand.nextInt(216) + 20, rand.nextInt(16))); + + //icy + glowingIce.generate(world, rand, blockpos.add(rand.nextInt(16), rand.nextInt(216) + 20, rand.nextInt(16))); } biome.decorate(world, rand, new BlockPos(i, 0, j)); MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(world, rand, blockpos)); diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/MapGenDuCaves.java b/src/main/java/com/NetherNoah/ParadiseMod/world/mapgen/MapGenDUCaves.java similarity index 70% rename from src/main/java/com/NetherNoah/ParadiseMod/world/MapGenDuCaves.java rename to src/main/java/com/NetherNoah/ParadiseMod/world/mapgen/MapGenDUCaves.java index f64d708..562b01c 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/MapGenDuCaves.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/mapgen/MapGenDUCaves.java @@ -1,30 +1,37 @@ -package com.NetherNoah.ParadiseMod.world; +package com.NetherNoah.ParadiseMod.world.mapgen; 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; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; +import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.ChunkPrimer; import net.minecraft.world.gen.MapGenBase; -public class MapGenDuCaves extends MapGenBase +public class MapGenDUCaves extends MapGenBase { - protected static final IBlockState BLK_LAVA = LiquidRedstone.BlockLiquidRedstone.instance.getDefaultState(); - protected static final IBlockState BLK_AIR = Blocks.AIR.getDefaultState(); + 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(); - protected void addRoom(long p_180703_1_, int p_180703_3_, int p_180703_4_, ChunkPrimer p_180703_5_, 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_, p_180703_5_, p_180703_6_, p_180703_8_, p_180703_10_, 1.0F + this.rand.nextFloat() * 6.0F, 0.0F, 0.0F, -1, -1, 0.5D); + 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 p_180702_5_, 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); @@ -76,8 +83,8 @@ protected void addTunnel(long p_180702_1_, int p_180702_3_, int p_180702_4_, Chu 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_, p_180702_5_, 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_, p_180702_5_, 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); + 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; } @@ -142,7 +149,7 @@ protected void addTunnel(long p_180702_1_, int p_180702_3_, int p_180702_4_, Chu { if (l1 >= 0 && l1 < 256) { - if (isOceanBlock(p_180702_5_, j1, l1, k1, p_180702_3_, p_180702_4_)) + if (isOceanBlock(primer, j1, l1, k1, p_180702_3_, p_180702_4_)) { flag3 = true; } @@ -177,15 +184,15 @@ protected void addTunnel(long p_180702_1_, int p_180702_3_, int p_180702_4_, Chu if (d9 > -0.7D && d10 * d10 + d9 * d9 + d8 * d8 < 1.0D) { - IBlockState iblockstate1 = p_180702_5_.getBlockState(j3, j2, i2); - IBlockState iblockstate2 = (IBlockState)MoreObjects.firstNonNull(p_180702_5_.getBlockState(j3, j2 + 1, i2), BLK_AIR); + IBlockState iblockstate1 = primer.getBlockState(j3, j2, i2); + IBlockState iblockstate2 = (IBlockState)MoreObjects.firstNonNull(primer.getBlockState(j3, j2 + 1, i2), AIR); - if (isTopBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_)) + if (isTopBlock(primer, j3, j2, i2, p_180702_3_, p_180702_4_)) { flag1 = true; } - digBlock(p_180702_5_, j3, j2, i2, p_180702_3_, p_180702_4_, flag1, iblockstate1, iblockstate2); + digBlock(primer, j3, j2, i2, p_180702_3_, p_180702_4_, flag1, iblockstate1, iblockstate2); } } } @@ -202,47 +209,49 @@ protected void addTunnel(long p_180702_1_, int p_180702_3_, int p_180702_4_, Chu } } - protected boolean canReplaceBlock(IBlockState p_175793_1_, IBlockState p_175793_2_) + protected boolean canReplaceBlock(IBlockState block1, IBlockState block2) { - if (p_175793_1_.getBlock() == Blocks.STONE) + if (block1.getBlock() == Blocks.STONE) { return true; } - else if (p_175793_1_.getBlock() == Blocks.DIRT) + else if (block1.getBlock() == Blocks.DIRT) { return true; } - else if (p_175793_1_.getBlock() == Blocks.GRASS) + else if (block1.getBlock() == Blocks.GRASS) { return true; } - else if (p_175793_1_.getBlock() == Blocks.HARDENED_CLAY) + else if (block1.getBlock() == Blocks.HARDENED_CLAY) { return true; } - else if (p_175793_1_.getBlock() == Blocks.STAINED_HARDENED_CLAY) + else if (block1.getBlock() == Blocks.STAINED_HARDENED_CLAY) { return true; } - else if (p_175793_1_.getBlock() == Blocks.SANDSTONE) + else if (block1.getBlock() == Blocks.SANDSTONE) { return true; } - else if (p_175793_1_.getBlock() == Blocks.RED_SANDSTONE) + else if (block1.getBlock() == Blocks.RED_SANDSTONE) { return true; } - else if (p_175793_1_.getBlock() == Blocks.MYCELIUM) + else if (block1.getBlock() == Blocks.MYCELIUM) { return true; } - else if (p_175793_1_.getBlock() == Blocks.SNOW_LAYER) + else if (block1.getBlock() == Blocks.SNOW_LAYER) { return true; } + else if (block1.getBlock()==Blocks.FLOWING_WATER||block1.getBlock()==Blocks.WATER) + return true; else { - return (p_175793_1_.getBlock() == Blocks.SAND || p_175793_1_.getBlock() == Blocks.GRAVEL) && p_175793_2_.getMaterial() != Material.WATER; + return (block1.getBlock() == Blocks.SAND || block1.getBlock() == Blocks.GRAVEL) && block2.getMaterial() != Material.WATER; } } @@ -289,15 +298,15 @@ protected void recursiveGenerate(World worldIn, int chunkX, int chunkZ, int orig protected boolean isOceanBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ) { - net.minecraft.block.Block block = data.getBlockState(x, y, z).getBlock(); - return block== Blocks.FLOWING_WATER || block == Blocks.WATER; + Block block = data.getBlockState(x, y, z).getBlock(); + return false; } //Exception biomes to make sure we generate like vanilla - private boolean isExceptionBiome(net.minecraft.world.biome.Biome biome) + private boolean isExceptionBiome(Biome biome) { - if (biome == net.minecraft.init.Biomes.BEACH) return true; - if (biome == net.minecraft.init.Biomes.DESERT) return true; + if (biome == Biomes.BEACH) return true; + if (biome == Biomes.DESERT) return true; return false; } @@ -305,46 +314,31 @@ private boolean isExceptionBiome(net.minecraft.world.biome.Biome biome) //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)); + 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); } - /** - * Digs out the current block, default implementation removes stone, filler, and top block - * Sets the block to lava if y is less then 10, and air other wise. - * If setting to air, it also checks to see if we've broken the surface and if so - * tries to make the floor the biome's top block - * - * @param data Block data array - * @param index Pre-calculated index into block data - * @param x local X position - * @param y local Y position - * @param z local Z position - * @param chunkX Chunk X position - * @param chunkZ Chunk Y position - * @param foundTop True if we've encountered the biome's top block. Ideally if we've broken the surface. - */ protected void digBlock(ChunkPrimer data, int x, int y, int z, int chunkX, int chunkZ, boolean foundTop, IBlockState state, IBlockState up) { - net.minecraft.world.biome.Biome biome = world.getBiome(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); + Biome biome = world.getBiome(new BlockPos(x + chunkX * 16, 0, z + chunkZ * 16)); IBlockState top = biome.topBlock; IBlockState filler = biome.fillerBlock; if (this.canReplaceBlock(state, up) || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) { - if (y - 1 < 10) - { - data.setBlockState(x, y, z, BLK_LAVA); - } - else - { - data.setBlockState(x, y, z, BLK_AIR); - - if (foundTop && data.getBlockState(x, y - 1, z).getBlock() == filler.getBlock()) - { - data.setBlockState(x, y - 1, z, top.getBlock().getDefaultState()); - } + if (y<=31) { + 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; + } + 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()); } } } diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/mapgen/MapGenDURavines.java b/src/main/java/com/NetherNoah/ParadiseMod/world/mapgen/MapGenDURavines.java new file mode 100644 index 0000000..3d9ab95 --- /dev/null +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/mapgen/MapGenDURavines.java @@ -0,0 +1,277 @@ +package com.NetherNoah.ParadiseMod.world.mapgen; + +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; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.biome.Biome; +import net.minecraft.world.chunk.ChunkPrimer; +import net.minecraft.world.gen.MapGenBase; + +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_) + { + 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) + { + int i = this.range * 16 - 16; + p_180707_16_ = i - random.nextInt(i / 4); + } + + boolean flag1 = false; + + 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) + { + 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_) + { + 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); + d2 = d2 * ((double)random.nextFloat() * 0.25D + 0.75D); + float f3 = MathHelper.cos(p_180707_14_); + float f4 = MathHelper.sin(p_180707_14_); + p_180707_6_ += (double)(MathHelper.cos(p_180707_13_) * f3); + p_180707_8_ += (double)f4; + p_180707_10_ += (double)(MathHelper.sin(p_180707_13_) * f3); + p_180707_14_ = p_180707_14_ * 0.7F; + p_180707_14_ = p_180707_14_ + f1 * 0.05F; + p_180707_13_ += f * 0.05F; + f1 = f1 * 0.8F; + f = f * 0.5F; + 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) + { + 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) + { + 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; + int l = MathHelper.floor(p_180707_8_ + d2) + 1; + int i3 = MathHelper.floor(p_180707_10_ - d9) - p_180707_4_ * 16 - 1; + 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; + } + + 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; + + 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; + } + + digBlock(primer, j3, j2, i2, p_180707_3_, p_180707_4_, flag); + } + } + } + } + } + + if (flag1) + { + break; + } + } + } + } + } + } + + /** + * 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) + { + 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) + { + 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); + } + } + } + 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); + } + + 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; + + if (state.getBlock() == Blocks.STONE || state.getBlock() == top.getBlock() || state.getBlock() == filler.getBlock()) + { + if (y<=31) { + 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()); + } + } + } + } +} \ No newline at end of file diff --git a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Buoy.java b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Buoy.java index c24d4c0..62b8e7e 100644 --- a/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Buoy.java +++ b/src/main/java/com/NetherNoah/ParadiseMod/world/worldgen/structures/Buoy.java @@ -33,7 +33,7 @@ public static int getGroundFromAbove(World world, int x, int z) while(!foundGround && y-- >= 31) { Block blockAt = world.getBlockState(new BlockPos(x,y,z)).getBlock(); - foundGround = blockAt == Blocks.WATER; + foundGround = blockAt == Blocks.WATER||blockAt==Blocks.ICE; } 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 2d10ce2..5b521a2 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 @@ -37,11 +37,11 @@ public boolean generate(World world, Random rand, BlockPos position) { 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_tree")); + 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_tree")); + Template spruce=templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":trees/spruce_sapling")); - Template template = templatemanager.getTemplate(minecraftserver, new ResourceLocation(Reference.MOD_ID+":trees/oak_sapling")); + Template template = oak; int treeSelect=rand.nextInt(3); //oak sapling diff --git a/src/main/resources/assets/nnparadisemod/blockstates/glowing_ice.json b/src/main/resources/assets/nnparadisemod/blockstates/glowing_ice.json new file mode 100644 index 0000000..9435eff --- /dev/null +++ b/src/main/resources/assets/nnparadisemod/blockstates/glowing_ice.json @@ -0,0 +1 @@ +{"variants":{"normal":{"model":"nnparadisemod:glowing_ice"}}} diff --git a/src/main/resources/assets/nnparadisemod/lang/en_US.lang b/src/main/resources/assets/nnparadisemod/lang/en_US.lang index 6ff1c37..0518409 100644 --- a/src/main/resources/assets/nnparadisemod/lang/en_US.lang +++ b/src/main/resources/assets/nnparadisemod/lang/en_US.lang @@ -97,6 +97,7 @@ item.CactusStick.name=Cactus Stick item.VoidPearl.name=Void Pearl #Blocks +tile.glowingIce.name=Glowing Ice tile.SilverFenceGate.name=Silver Fence Gate tile.endPearlBlock.name=Ender Pearl Block tile.EndRubyOre.name=Ender Ruby Ore diff --git a/src/main/resources/assets/nnparadisemod/models/block/glowing_ice.json b/src/main/resources/assets/nnparadisemod/models/block/glowing_ice.json new file mode 100644 index 0000000..86c29e6 --- /dev/null +++ b/src/main/resources/assets/nnparadisemod/models/block/glowing_ice.json @@ -0,0 +1 @@ +{"parent":"block/cube_all","textures":{"all":"nnparadisemod:blocks/glowing_ice"}} diff --git a/src/main/resources/assets/nnparadisemod/models/item/glowing_ice.json b/src/main/resources/assets/nnparadisemod/models/item/glowing_ice.json new file mode 100644 index 0000000..ed48f29 --- /dev/null +++ b/src/main/resources/assets/nnparadisemod/models/item/glowing_ice.json @@ -0,0 +1 @@ +{"parent":"nnparadisemod:block/glowing_ice"} diff --git a/src/main/resources/assets/nnparadisemod/textures/blocks/glowing_ice.png b/src/main/resources/assets/nnparadisemod/textures/blocks/glowing_ice.png new file mode 100644 index 0000000..36bc06e Binary files /dev/null and b/src/main/resources/assets/nnparadisemod/textures/blocks/glowing_ice.png differ