From 9d6e6dc41caa01bfce9ed730df0f8b7d9488ba93 Mon Sep 17 00:00:00 2001 From: Eleksploded Date: Sun, 7 Jun 2020 15:18:59 -0700 Subject: [PATCH] 5.6.15 --- 1.12.2/build.gradle | 2 +- .../eleksploded/lavadynamics/LavaConfig.java | 9 ++++ .../com/eleksploded/lavadynamics/Volcano.java | 2 +- .../generators/ConeVolcanoGen.java | 46 +++++++++++++------ .../generators/MountianVolcanoGen.java | 23 ++++++++-- Updates.json | 7 +-- 6 files changed, 65 insertions(+), 24 deletions(-) diff --git a/1.12.2/build.gradle b/1.12.2/build.gradle index 279ad87..87c8778 100644 --- a/1.12.2/build.gradle +++ b/1.12.2/build.gradle @@ -11,7 +11,7 @@ apply plugin: 'net.minecraftforge.gradle.forge' //Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. -version = "1.12.2-5.6.14" +version = "1.12.2-5.6.15" group = "com.eleksploded.lavadynamics" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "lavadynamics" diff --git a/1.12.2/src/main/java/com/eleksploded/lavadynamics/LavaConfig.java b/1.12.2/src/main/java/com/eleksploded/lavadynamics/LavaConfig.java index ccb97df..0f89cd1 100644 --- a/1.12.2/src/main/java/com/eleksploded/lavadynamics/LavaConfig.java +++ b/1.12.2/src/main/java/com/eleksploded/lavadynamics/LavaConfig.java @@ -66,6 +66,9 @@ public static class VolcanoSettings { @Config.RangeInt(min=1,max=128) public int craterSize = 15; + @Config.Comment("Should the inital explosion cause fire?") + public boolean initialFire = true; + @Config.Comment("Generate volcanoes at worldgen instead of after") public boolean worldGen = false; @@ -119,6 +122,12 @@ public static class VolcanoSettings { @Config.Comment("Distance from other volcanoes needed to spawn a new volcano") @Config.RangeInt(min=0,max=100000) public int distance = 500; + + @Config.Comment("Use Biome Blocks for volcano generation") + public boolean useBiome = true; + + @Config.Comment("How far in should biome filler blocks go? Set to 0 to disable use of filler blocks") + public int fillerSize = 2; } public static class WorldSmeltingOptions { diff --git a/1.12.2/src/main/java/com/eleksploded/lavadynamics/Volcano.java b/1.12.2/src/main/java/com/eleksploded/lavadynamics/Volcano.java index 3396c52..0e83581 100644 --- a/1.12.2/src/main/java/com/eleksploded/lavadynamics/Volcano.java +++ b/1.12.2/src/main/java/com/eleksploded/lavadynamics/Volcano.java @@ -235,7 +235,7 @@ public static void genVolcano(Chunk chunk, World world) { //Make our "eruption" - world.newExplosion(null, fill.getX(), fill.getY()+3, fill.getZ(), LavaConfig.volcano.craterSize, true, true); + world.newExplosion(null, fill.getX(), fill.getY()+3, fill.getZ(), LavaConfig.volcano.craterSize, LavaConfig.volcano.initialFire, true); if(debug) { LavaDynamics.Logger.info("Done with crater"); diff --git a/1.12.2/src/main/java/com/eleksploded/lavadynamics/generators/ConeVolcanoGen.java b/1.12.2/src/main/java/com/eleksploded/lavadynamics/generators/ConeVolcanoGen.java index 957f1ad..3331ee3 100644 --- a/1.12.2/src/main/java/com/eleksploded/lavadynamics/generators/ConeVolcanoGen.java +++ b/1.12.2/src/main/java/com/eleksploded/lavadynamics/generators/ConeVolcanoGen.java @@ -14,23 +14,24 @@ import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.feature.WorldGenerator; public class ConeVolcanoGen extends WorldGenerator { List ores = new ArrayList(); - + //Credit to CplPibald#7182 on discord for pointing out possible performance issue @SuppressWarnings("deprecation") public ConeVolcanoGen() { super(!LavaConfig.volcano.worldGen); List names = Arrays.stream(LavaConfig.volcano.ores).collect(Collectors.toList()); - + if(names.size() != LavaConfig.volcano.chance.length) { LavaDynamics.Logger.error("Detected Invalid Config: Ores do not match OreChance in config. Disabling ore generation in volcanoes"); names.clear(); } - + for(String name : names) { String[] split = name.split("\\|"); if(split.length != 2){ @@ -53,7 +54,7 @@ public ConeVolcanoGen() { public boolean generate(World world, Random random, BlockPos position) { - + Random rand = new Random(); while (world.isAirBlock(position) && position.getY() > 15) { @@ -63,7 +64,7 @@ public boolean generate(World world, Random random, BlockPos position) break; } } - + int height = rand.nextInt(LavaConfig.volcano.volcanoHeightMax-LavaConfig.volcano.volcanoHeightMin+1) + LavaConfig.volcano.volcanoHeightMin; if(height <= 0) { return false; @@ -76,21 +77,21 @@ public boolean generate(World world, Random random, BlockPos position) int i = caldera; int j = pos.getY(); while(true) { - + if(j >= 255 || j <= 3) { break; } - + BlockPos pos1 = new BlockPos(pos.getX(),j,pos.getZ()); if(isCornerAir(world,pos1,i) || pos1.getY() >= 255 || pos.getY() <= 3) { circle(i,world,pos1,j); - setBlockWithOre(world, pos1); + setBlockWithOre(world, pos1, false); i = i+1; j = j-1; } else { break; } - + } BlockPos fill1 = position.up(height); @@ -108,7 +109,7 @@ public boolean generate(World world, Random random, BlockPos position) int x1 = fill1.getX(); int y1 = fill1.getY()-1; int z1 = fill1.getZ(); - + for(float i1 = 0; i1 < radius; i1 += 0.5) { for(float j1 = 0; j1 < 2 * Math.PI * i1; j1 += 0.5) world.setBlockState(new BlockPos((int)Math.floor(x1 + Math.sin(j1) * i1), y1 + radius, (int)Math.floor(z1 + Math.cos(j1) * i1)), Blocks.LAVA.getDefaultState()); @@ -137,14 +138,19 @@ public void circle(int radius, World world, BlockPos fill1, int j) { int x1 = fill1.getX(); int y1 = fill1.getY(); int z1 = fill1.getZ(); - + for(float i1 = 0; i1 < radius; i1 += 0.5) { - for(float j1 = 0; j1 < 2 * Math.PI * i1; j1 += 0.5) - setBlockWithOre(world,new BlockPos((int)Math.floor(x1 + Math.sin(j1) * i1), y1, (int)Math.floor(z1 + Math.cos(j1) * i1))); + for(float j1 = 0; j1 < 2 * Math.PI * i1; j1 += 0.5) { + if(LavaConfig.volcano.useBiome && i1 == radius-.5) { + setBlockWithBiomeTop(world,new BlockPos((int)Math.floor(x1 + Math.sin(j1) * i1), y1, (int)Math.floor(z1 + Math.cos(j1) * i1))); + } else { + setBlockWithOre(world,new BlockPos((int)Math.floor(x1 + Math.sin(j1) * i1), y1, (int)Math.floor(z1 + Math.cos(j1) * i1)), LavaConfig.volcano.useBiome && i1 >= (radius-((LavaConfig.volcano.fillerSize) + .5F))); + } + } } } - private void setBlockWithOre(World worldIn, BlockPos blockpos) { + private void setBlockWithOre(World worldIn, BlockPos blockpos, boolean useFiller) { Random rand = new Random(); IBlockState block; @@ -152,11 +158,21 @@ private void setBlockWithOre(World worldIn, BlockPos blockpos) { int chance = 1000-LavaConfig.volcano.oreChance; if(ore <= chance) { - block=Blocks.STONE.getDefaultState(); + if(useFiller) { + block = worldIn.getBiome(blockpos).fillerBlock; + } else { + block=Blocks.STONE.getDefaultState(); + } } else { block= ores.get(rand.nextInt(ores.size())); } this.setBlockAndNotifyAdequately(worldIn, blockpos, block); } + + private void setBlockWithBiomeTop(World world, BlockPos blockpos) { + Biome biome = world.getBiome(blockpos); + + this.setBlockAndNotifyAdequately(world, blockpos, biome.topBlock); + } } diff --git a/1.12.2/src/main/java/com/eleksploded/lavadynamics/generators/MountianVolcanoGen.java b/1.12.2/src/main/java/com/eleksploded/lavadynamics/generators/MountianVolcanoGen.java index 205314a..450f435 100644 --- a/1.12.2/src/main/java/com/eleksploded/lavadynamics/generators/MountianVolcanoGen.java +++ b/1.12.2/src/main/java/com/eleksploded/lavadynamics/generators/MountianVolcanoGen.java @@ -16,6 +16,7 @@ import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.feature.WorldGenerator; public class MountianVolcanoGen extends WorldGenerator { @@ -80,7 +81,7 @@ public boolean generate(World world, Random random, BlockPos position) { for(float i1 = 0; i1 < radius; i1 += 0.5) { for(float j1 = 0; j1 < 2 * Math.PI * i1; j1 += 0.5) - setBlockWithOre(world, new BlockPos((int)Math.floor(x1 + Math.sin(j1) * i1), y1 + radius, (int)Math.floor(z1 + Math.cos(j1) * i1))); + setBlockWithOre(world, new BlockPos((int)Math.floor(x1 + Math.sin(j1) * i1), y1 + radius, (int)Math.floor(z1 + Math.cos(j1) * i1)), false); } pos = pos.down(); } @@ -92,7 +93,11 @@ public boolean generate(World world, Random random, BlockPos position) { for(float i1 = 0; i1 < radius; i1 += 0.5) { for(float j1 = 0; j1 < 2 * Math.PI * i1; j1 += 0.5) - world.setBlockState(new BlockPos((int)Math.floor(x1 + Math.sin(j1) * i1), y1 + radius, (int)Math.floor(z1 + Math.cos(j1) * i1)), Blocks.LAVA.getDefaultState()); + if(LavaConfig.volcano.useBiome && i1 == radius-.5) { + setBlockWithBiomeTop(world,new BlockPos((int)Math.floor(x1 + Math.sin(j1) * i1), y1, (int)Math.floor(z1 + Math.cos(j1) * i1))); + } else { + setBlockWithOre(world,new BlockPos((int)Math.floor(x1 + Math.sin(j1) * i1), y1, (int)Math.floor(z1 + Math.cos(j1) * i1)), LavaConfig.volcano.useBiome && i1 >= (radius-((LavaConfig.volcano.fillerSize) + .5F))); + } } position = position.down(); } @@ -100,7 +105,7 @@ public boolean generate(World world, Random random, BlockPos position) { return true; } - private void setBlockWithOre(World worldIn, BlockPos blockpos) { + private void setBlockWithOre(World worldIn, BlockPos blockpos, boolean useFiller) { Random rand = new Random(); IBlockState block; @@ -108,12 +113,22 @@ private void setBlockWithOre(World worldIn, BlockPos blockpos) { int chance = 1000-LavaConfig.volcano.oreChance; if(ore <= chance) { - block=Blocks.STONE.getDefaultState(); + if(useFiller) { + block = worldIn.getBiome(blockpos).fillerBlock; + } else { + block=Blocks.STONE.getDefaultState(); + } } else { block= ores.get(rand.nextInt(ores.size())); } this.setBlockAndNotifyAdequately(worldIn, blockpos, block); } + + private void setBlockWithBiomeTop(World world, BlockPos blockpos) { + Biome biome = world.getBiome(blockpos); + + this.setBlockAndNotifyAdequately(world, blockpos, biome.topBlock); + } } diff --git a/Updates.json b/Updates.json index 55314ec..c1f5de7 100644 --- a/Updates.json +++ b/Updates.json @@ -11,10 +11,11 @@ "5.6.3": "Minor Effect Changes", "5.6.2": "Fix Crash", "5.6.1": "See Curse Page", - "5.5.15": "See Curse Page" + "5.5.15": "See Curse Page", + "5.5.16": "Biomes, See Curse Page" }, "promos": { - "1.12.2-latest": "5.6.12", - "1.12.2-recommended": "5.6.12" + "1.12.2-latest": "5.6.16", + "1.12.2-recommended": "5.6.16" } }