diff --git a/src/java/mmm/world/World.java b/src/java/mmm/world/World.java index d914af3..aa60a40 100644 --- a/src/java/mmm/world/World.java +++ b/src/java/mmm/world/World.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import mmm.utils.I_UOreGenerationRegistrar; import mmm.utils.URegistry; +import mmm.world.biome.WBBambooForest; import mmm.world.biome.WBLimestoneMountains; import mmm.world.biome.WBLimestonePlateau; import mmm.world.biome.WBTropicalSwamp; @@ -76,6 +77,18 @@ public class World .setWaterColor( 0xe0ffae ) // Same as vanilla swamps .setType( BiomeType.WARM , 3 ) // .register( ); + + helper = new WBiomeHelper( WBBambooForest::new ); + helper.setNames( "Bamboo Forest" , "forest/bamboo" ) // + .setElevation( .1f , .1f ) // + .setWeather( .95f , .9f ) // + .setType( BiomeType.WARM , 3 ) // + .register( ); + helper.startMutation( ); + helper.setNames( "Dense Bamboo Forest" , "forest/bamboo/dense" ) // + .setType( BiomeType.WARM , 1 ) // + .setExtraProperty( "Dense" ) + .register( ); } diff --git a/src/java/mmm/world/biome/WBBambooForest.java b/src/java/mmm/world/biome/WBBambooForest.java new file mode 100644 index 0000000..b0636e7 --- /dev/null +++ b/src/java/mmm/world/biome/WBBambooForest.java @@ -0,0 +1,142 @@ +package mmm.world.biome; + + +import java.util.Random; + +import mmm.materials.Materials; +import mmm.world.WBiomeHelper; +import mmm.world.gen.WGBambooPatch; +import mmm.world.trees.A_WTTreeGenerator; +import mmm.world.trees.WTBambooGenerator; +import net.minecraft.block.BlockFlower; +import net.minecraft.block.BlockLeaves; +import net.minecraft.block.BlockTallGrass; +import net.minecraft.entity.passive.EntityRabbit; +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.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenShrub; +import net.minecraft.world.gen.feature.WorldGenTallGrass; +import net.minecraft.world.gen.feature.WorldGenVines; +import net.minecraft.world.gen.feature.WorldGenerator; + + + +public class WBBambooForest + extends Biome +{ + private static final A_WTTreeGenerator TG_BAMBOO_BIG = new WTBambooGenerator( true , false ); + private static final A_WTTreeGenerator TG_BAMBOO = new WTBambooGenerator( false , false ); + private static final WorldGenShrub TG_SHRUB = new WorldGenShrub( // + Materials.TREE.BAMBOO.LOG.getDefaultState( ) , // + Materials.TREE.BAMBOO.LEAVES.getDefaultState( ).withProperty( BlockLeaves.CHECK_DECAY , false ) ); + + private final int bigThreshold; + + + public WBBambooForest( final WBiomeHelper helper ) + { + super( helper.getProperties( ) ); + + this.theBiomeDecorator.treesPerChunk = 10; + this.theBiomeDecorator.grassPerChunk = 2; + this.theBiomeDecorator.flowersPerChunk = 5; + this.spawnableCreatureList.add( new Biome.SpawnListEntry( EntityRabbit.class , 4 , 2 , 3 ) ); + + if ( helper.hasExtraProperty( "Dense" ) ) { + this.theBiomeDecorator.treesPerChunk *= 2; + this.bigThreshold = 10; + } else { + this.bigThreshold = 2; + } + } + + + @Override + public WorldGenAbstractTree genBigTreeChance( final Random rand ) + { + final int r = rand.nextInt( 50 ); + if ( r < this.bigThreshold ) { + return WBBambooForest.TG_BAMBOO_BIG; + } else if ( r < this.bigThreshold + 5 ) { + return WBBambooForest.TG_SHRUB; + } else { + return WBBambooForest.TG_BAMBOO; + } + } + + + @Override + public WorldGenerator getRandomWorldGenForGrass( final Random rand ) + { + return rand.nextInt( 4 ) == 0 + ? new WorldGenTallGrass( BlockTallGrass.EnumType.FERN ) + : new WorldGenTallGrass( BlockTallGrass.EnumType.GRASS ); + } + + + @Override + public void decorate( final World worldIn , final Random rand , final BlockPos pos ) + { + System.err.println( pos.toString( ) ); + for ( int cx = pos.getX( ) ; cx < pos.getX( ) + 16 ; cx++ ) { + for ( int cz = pos.getZ( ) ; cz < pos.getZ( ) + 16 ; cz++ ) { + final double noise = Biome.GRASS_COLOR_NOISE.getValue( cz * 0.25D , cx * 0.25D ); + if ( noise > .75 ) { + for ( int y = 255 ; y >= 0 ; y-- ) { + final BlockPos bp = new BlockPos( cx , y , cz ); + if ( this.checkGround( worldIn , bp ) ) { + if ( this.checkGround( worldIn , bp.north( ) ) // + && this.checkGround( worldIn , bp.south( ) ) // + && this.checkGround( worldIn , bp.east( ) ) // + && this.checkGround( worldIn , bp.west( ) ) + && this.checkGround( worldIn , bp.down( ) ) ) { + worldIn.setBlockState( bp , Biome.WATER ); + } + break; + } + } + } + } + } + + super.decorate( worldIn , rand , pos ); + + if ( rand.nextInt( 20 ) == 0 ) { + new WGBambooPatch( ).generate( worldIn , rand , pos ); + } + + final WorldGenVines worldgenvines = new WorldGenVines( ); + for ( int i = 0 ; i < 50 ; i++ ) { + final int x = rand.nextInt( 16 ) + 8; + final int z = rand.nextInt( 16 ) + 8; + worldgenvines.generate( worldIn , rand , pos.add( x , 128 , z ) ); + } + } + + + @Override + public void addDefaultFlowers( ) + { + this.addFlower( Blocks.RED_FLOWER.getDefaultState( ) , 10 ); + this.addFlower( + Blocks.RED_FLOWER.getDefaultState( ) // + .withProperty( Blocks.RED_FLOWER.getTypeProperty( ) , BlockFlower.EnumFlowerType.ALLIUM ) , + 10 ); + this.addFlower( + Blocks.RED_FLOWER.getDefaultState( ) // + .withProperty( Blocks.RED_FLOWER.getTypeProperty( ) , BlockFlower.EnumFlowerType.BLUE_ORCHID ) , + 1 ); + this.addFlower( Blocks.YELLOW_FLOWER.getDefaultState( ) , 5 ); + } + + + private boolean checkGround( final World world , final BlockPos pos ) + { + return world.getBlockState( pos ).getBlock( ) == Blocks.GRASS + || world.getBlockState( pos ).getBlock( ) == Blocks.DIRT + || world.getBlockState( pos ).getBlock( ) == Blocks.WATER; + } +} diff --git a/src/java/mmm/world/biome/WBTropicalSwamp.java b/src/java/mmm/world/biome/WBTropicalSwamp.java index 7b05ae0..b7e1322 100644 --- a/src/java/mmm/world/biome/WBTropicalSwamp.java +++ b/src/java/mmm/world/biome/WBTropicalSwamp.java @@ -43,7 +43,7 @@ public class WBTropicalSwamp .withProperty( BlockOldLog.VARIANT , BlockPlanks.EnumType.OAK ); private static final IBlockState OAK_LEAF = Blocks.LEAVES.getDefaultState( ) // .withProperty( BlockOldLeaf.VARIANT , BlockPlanks.EnumType.OAK ) // - .withProperty( BlockLeaves.CHECK_DECAY , Boolean.valueOf( false ) ); + .withProperty( BlockLeaves.CHECK_DECAY , false ); private static final IBlockState WATER_LILY = Blocks.WATERLILY.getDefaultState( ); diff --git a/src/java/mmm/world/gen/WGTrapBlocks.java b/src/java/mmm/world/gen/WGTrapBlocks.java index 979c785..17cd698 100644 --- a/src/java/mmm/world/gen/WGTrapBlocks.java +++ b/src/java/mmm/world/gen/WGTrapBlocks.java @@ -96,7 +96,6 @@ public class WGTrapBlocks } String trapType = types.get( rand.nextInt( types.size( ) ) ); - System.err.println( "Trap at " + bp + " -> " + trapType ); for ( int x = -radius ; x <= radius ; x++ ) { for ( int y = -radius ; y <= radius ; y++ ) { for ( int z = -radius ; z <= radius ; z++ ) {