From 4dae675f378f4c742bdfdda9a29323c5ca2b4c86 Mon Sep 17 00:00:00 2001 From: GotoLink Date: Tue, 8 Apr 2014 16:51:27 +0200 Subject: [PATCH] Added config for imbued stones generation --- common/MysticWorld/Lib/Booleans.java | 1 + common/MysticWorld/Util/Config.java | 1 + common/MysticWorld/WorldGen/StonesGen.java | 13 ++++--------- .../mysticworld/WorldGen/WorldGenerators.java | 18 +++++++++--------- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/common/MysticWorld/Lib/Booleans.java b/common/MysticWorld/Lib/Booleans.java index 8284535..3822330 100644 --- a/common/MysticWorld/Lib/Booleans.java +++ b/common/MysticWorld/Lib/Booleans.java @@ -2,6 +2,7 @@ package mysticworld.lib; public class Booleans { + public static boolean ENABLE_IMBUED_STONE_GEN; public static boolean ENABLE_BUSH_GEN; public static boolean ENABLE_GLACIER_GEN; public static boolean ENABLE_JUNGLE_REWRITE; diff --git a/common/MysticWorld/Util/Config.java b/common/MysticWorld/Util/Config.java index 8756ab0..be6501e 100644 --- a/common/MysticWorld/Util/Config.java +++ b/common/MysticWorld/Util/Config.java @@ -13,6 +13,7 @@ public class Config { config = new Configuration(file); MysticWorld.instance.ENABLE = config.get("General", "Enable", true).getBoolean(true); //Boolean Configurations + Booleans.ENABLE_IMBUED_STONE_GEN = config.get("World Generation", "Enable Imbued Stones Generation", true).getBoolean(true); Booleans.ENABLE_BUSH_GEN = config.get("World Generation", "Enable Bush Generation", true).getBoolean(true); Booleans.ENABLE_GLACIER_GEN = config.get("World Generation", "Enable Glacier Biome", true).getBoolean(true); Booleans.ENABLE_JUNGLE_REWRITE = config.get("World Generation", "Enable Vanilla Jungle Biome Modification", true).getBoolean(true); diff --git a/common/MysticWorld/WorldGen/StonesGen.java b/common/MysticWorld/WorldGen/StonesGen.java index 43fd9cc..0df055a 100644 --- a/common/MysticWorld/WorldGen/StonesGen.java +++ b/common/MysticWorld/WorldGen/StonesGen.java @@ -9,15 +9,10 @@ import net.minecraft.world.gen.feature.WorldGenerator; public class StonesGen extends WorldGenerator { @Override - public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) { - for (int l = 0; l < 1; ++l) { - int i1 = par3 + par2Random.nextInt(8) - par2Random.nextInt(8); - int j1 = par4 + par2Random.nextInt(4) - par2Random.nextInt(4); - int k1 = par5 + par2Random.nextInt(8) - par2Random.nextInt(8); - if (par1World.isAirBlock(i1, j1, k1) && par1World.getBlock(i1, j1 - 1, k1) == Blocks.grass && BlockHandler.oreImbuedStone.canPlaceBlockAt(par1World, i1, j1, k1)) { - par1World.setBlock(i1, j1, k1, BlockHandler.oreImbuedStone, par2Random.nextInt(5), 2); - } - } + public boolean generate(World par1World, Random par2Random, int i1, int j1, int k1) { + if (par1World.isAirBlock(i1, j1, k1) && par1World.getBlock(i1, j1 - 1, k1) == Blocks.grass && BlockHandler.oreImbuedStone.canPlaceBlockAt(par1World, i1, j1, k1)) { + par1World.setBlock(i1, j1, k1, BlockHandler.oreImbuedStone, par2Random.nextInt(5), 2); + } return true; } } diff --git a/common/mysticworld/WorldGen/WorldGenerators.java b/common/mysticworld/WorldGen/WorldGenerators.java index f0f4796..4d5379e 100644 --- a/common/mysticworld/WorldGen/WorldGenerators.java +++ b/common/mysticworld/WorldGen/WorldGenerators.java @@ -15,22 +15,22 @@ public class WorldGenerators implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { - switch (world.provider.dimensionId) { - case 0: + if(world.provider.dimensionId==0) { generateSurface(world, random, chunkX * 16, chunkZ * 16); } } private void generateSurface(World world, Random random, int blockX, int blockZ) { - int Xcoord1 = blockX + random.nextInt(16) + 8; - int Ycoord1 = random.nextInt(11) + 60; - int Zcoord1 = blockZ + random.nextInt(16) + 8; - stones.generate(world, random, Xcoord1, Ycoord1, Zcoord1); + int Ycoord1; + if(Booleans.ENABLE_IMBUED_STONE_GEN){ + int Xcoord1 = blockX + random.nextInt(16); + Ycoord1 = random.nextInt(15) + 56; + int Zcoord1 = blockZ + random.nextInt(16); + stones.generate(world, random, Xcoord1, Ycoord1, Zcoord1); + } if (Booleans.ENABLE_BUSH_GEN){ - Xcoord1 = blockX + random.nextInt(16) + 8; Ycoord1 = random.nextInt(11) + 60; - Zcoord1 = blockZ + random.nextInt(16) + 8; - bushes.generate(world, random, Xcoord1, Ycoord1, Zcoord1); + bushes.generate(world, random, blockX + 8, Ycoord1, blockZ + 8); } } } \ No newline at end of file