added config for crystal clusters

Closes #700
This commit is contained in:
Ellpeck 2017-03-29 12:05:37 +02:00
parent 66cc7f59b3
commit ab5a4d29b1
2 changed files with 13 additions and 10 deletions

View file

@ -32,6 +32,7 @@ public enum ConfigBoolValues{
DO_COFFEE_GEN("Coffee Gen", ConfigCategories.WORLD_GEN, true, "Should Coffee Plants generate in the World?"),
DO_LOTUS_GEN("Black Lotus Gen", ConfigCategories.WORLD_GEN, true, "Should Black Lotus generate in the World?"),
DO_TREASURE_CHEST_GEN("Treasure Chest Gen", ConfigCategories.WORLD_GEN, true, "Should Treasure Chests generate in the World?"),
DO_CRYSTAL_CLUSTERS("Crystal Clusters in Lush Caves", ConfigCategories.WORLD_GEN, true, "If Crystal Clusters should generate in Lush Caves"),
DO_SPIDER_DROPS("Spider Cobweb Drop", ConfigCategories.MOB_DROPS, true, "Should Cobwebs drop from spiders?"),
DO_BAT_DROPS("Bat Wing Drop", ConfigCategories.MOB_DROPS, true, "Should Bat wings drop from Bats?"),

View file

@ -79,18 +79,20 @@ public class WorldGenLushCaves{
possiblePoses.add(pos);
}
}
else if(rand.nextInt(20) == 0){
EnumFacing[] values = EnumFacing.values();
EnumFacing side = values[rand.nextInt(values.length)];
BlockPos posSide = pos.offset(side);
else{
if(ConfigBoolValues.DO_CRYSTAL_CLUSTERS.isEnabled() && rand.nextInt(20) == 0){
EnumFacing[] values = EnumFacing.values();
EnumFacing side = values[rand.nextInt(values.length)];
BlockPos posSide = pos.offset(side);
if(!this.checkIndestructable(world, posSide)){
IBlockState state = world.getBlockState(pos);
IBlockState stateSide = world.getBlockState(posSide);
if(!this.checkIndestructable(world, posSide)){
IBlockState state = world.getBlockState(pos);
IBlockState stateSide = world.getBlockState(posSide);
if(state.getBlock().isAir(state, world, pos) && stateSide.getBlock().isSideSolid(stateSide, world, posSide, side.getOpposite())){
Block block = CRYSTAL_CLUSTERS[rand.nextInt(CRYSTAL_CLUSTERS.length)];
world.setBlockState(pos, block.getDefaultState().withProperty(BlockDirectional.FACING, side.getOpposite()), 2);
if(state.getBlock().isAir(state, world, pos) && stateSide.getBlock().isSideSolid(stateSide, world, posSide, side.getOpposite())){
Block block = CRYSTAL_CLUSTERS[rand.nextInt(CRYSTAL_CLUSTERS.length)];
world.setBlockState(pos, block.getDefaultState().withProperty(BlockDirectional.FACING, side.getOpposite()), 2);
}
}
}
}