Added config for imbued stones generation

This commit is contained in:
GotoLink 2014-04-08 16:51:27 +02:00
commit 4dae675f37
4 changed files with 15 additions and 18 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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;
}
}

View file

@ -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);
}
}
}