From 219d95dc3972d169ef08228dc38d2e079662e416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Mon, 11 Jul 2016 17:34:01 +0200 Subject: [PATCH] Tropical forests --- src/java/mmm/world/World.java | 22 ++++- src/java/mmm/world/biome/WBBambooForest.java | 8 +- .../mmm/world/biome/WBTropicalForest.java | 89 +++++++++++++++++++ 3 files changed, 112 insertions(+), 7 deletions(-) create mode 100644 src/java/mmm/world/biome/WBTropicalForest.java diff --git a/src/java/mmm/world/World.java b/src/java/mmm/world/World.java index e205656..9f80888 100644 --- a/src/java/mmm/world/World.java +++ b/src/java/mmm/world/World.java @@ -8,6 +8,7 @@ import mmm.utils.URegistry; import mmm.world.biome.WBBambooForest; import mmm.world.biome.WBLimestoneMountains; import mmm.world.biome.WBLimestonePlateau; +import mmm.world.biome.WBTropicalForest; import mmm.world.biome.WBTropicalSwamp; import mmm.world.gen.WGOre; import mmm.world.gen.WGOreCondition; @@ -74,19 +75,34 @@ public class World .setElevation( -.2f , .1f ) // .setWeather( .95f , .95f ) // .setWaterColor( 0xe0ffae ) // Same as vanilla swamps - .setType( BiomeType.WARM , 3 ) // + .setType( BiomeType.WARM , 2 ) // .register( ); helper = new WBiomeHelper( WBBambooForest::new ); helper.setNames( "Bamboo Forest" , "forest/bamboo" ) // .setElevation( .1f , .1f ) // - .setWeather( .95f , .9f ) // + .setWeather( .9f , .95f ) // .setType( BiomeType.WARM , 3 ) // .register( ); - helper.startMutation( ); helper.setNames( "Dense Bamboo Forest" , "forest/bamboo/dense" ) // .setType( BiomeType.WARM , 1 ) // .setExtraProperty( "Dense" ).register( ); + helper.setNames( "Bamboo Forest Hills" , "forest/bamboo/hills" ) // + .setElevation( .45f , .3f ) // + .removeExtraProperty( "Dense" ) // + .setType( BiomeType.WARM , 2 ) // + .register( ); + + helper = new WBiomeHelper( WBTropicalForest::new ); + helper.setNames( "Tropical Forest" , "forest/tropical" ) // + .setElevation( .1f , .1f ) // + .setWeather( .9f , .95f ) // + .setType( BiomeType.WARM , 2 ) // + .register( ); + helper.setNames( "Tropical Forest Hills" , "forest/tropical/hills" ) // + .setElevation( .45f , .3f ) // + .setType( BiomeType.WARM , 2 ) // + .register( ); } diff --git a/src/java/mmm/world/biome/WBBambooForest.java b/src/java/mmm/world/biome/WBBambooForest.java index a9fc93a..628df4a 100644 --- a/src/java/mmm/world/biome/WBBambooForest.java +++ b/src/java/mmm/world/biome/WBBambooForest.java @@ -27,9 +27,9 @@ import net.minecraft.world.gen.feature.WorldGenerator; public class WBBambooForest extends Biome { - private static final A_WTTreeGenerator TG_BAMBOO_BIG = new WTBamboo( true , false ); - private static final A_WTTreeGenerator TG_BAMBOO = new WTBamboo( false , false ); - private static final WorldGenShrub TG_SHRUB = new WorldGenShrub( // + protected static final A_WTTreeGenerator TG_BAMBOO_BIG = new WTBamboo( true , false ); + protected static final A_WTTreeGenerator TG_BAMBOO = new WTBamboo( false , false ); + protected static final WorldGenShrub TG_BAMBOO_SHRUB = new WorldGenShrub( // Materials.TREE.BAMBOO.LOG.getDefaultState( ) , // Materials.TREE.BAMBOO.LEAVES.getDefaultState( ).withProperty( BlockLeaves.CHECK_DECAY , false ) ); @@ -61,7 +61,7 @@ public class WBBambooForest if ( r < this.bigThreshold ) { return WBBambooForest.TG_BAMBOO_BIG; } else if ( r < this.bigThreshold + 5 ) { - return WBBambooForest.TG_SHRUB; + return WBBambooForest.TG_BAMBOO_SHRUB; } else { return WBBambooForest.TG_BAMBOO; } diff --git a/src/java/mmm/world/biome/WBTropicalForest.java b/src/java/mmm/world/biome/WBTropicalForest.java new file mode 100644 index 0000000..f219c38 --- /dev/null +++ b/src/java/mmm/world/biome/WBTropicalForest.java @@ -0,0 +1,89 @@ +package mmm.world.biome; + + +import java.util.Random; + +import mmm.materials.Materials; +import mmm.world.WBiomeHelper; +import mmm.world.trees.A_WTTreeGenerator; +import mmm.world.trees.WTHevea; +import mmm.world.trees.WTHeveaBig; +import mmm.world.trees.WTHeveaMega; +import net.minecraft.block.BlockLeaves; +import net.minecraft.block.BlockOldLeaf; +import net.minecraft.block.BlockOldLog; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.passive.EntityOcelot; +import net.minecraft.init.Blocks; +import net.minecraft.world.biome.Biome; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenMegaJungle; +import net.minecraft.world.gen.feature.WorldGenShrub; +import net.minecraft.world.gen.feature.WorldGenTrees; + + + +public class WBTropicalForest + extends WBBambooForest +{ + + private static final IBlockState JUNGLE_LOG = Blocks.LOG.getDefaultState( ) // + .withProperty( BlockOldLog.VARIANT , BlockPlanks.EnumType.JUNGLE ); + private static final IBlockState JUNGLE_LEAF = Blocks.LEAVES.getDefaultState( ) + .withProperty( BlockOldLeaf.VARIANT , BlockPlanks.EnumType.JUNGLE ) + .withProperty( BlockLeaves.CHECK_DECAY , false ); + + private static final IBlockState HEVEA_LOG = Materials.TREE.HEVEA.LOG.getDefaultState( ); + private static final IBlockState HEVEA_LEAF = Materials.TREE.HEVEA.LEAVES.getDefaultState( ) // + .withProperty( BlockLeaves.CHECK_DECAY , false ); + + private static final A_WTTreeGenerator TG_HEVEA_GIANT = new WTHeveaMega( false ); + private static final A_WTTreeGenerator TG_HEVEA_BIG = new WTHeveaBig( false ); + private static final A_WTTreeGenerator TG_HEVEA = new WTHevea( false ); + protected static final WorldGenShrub TG_HEVEA_SHRUB = new WorldGenShrub( // + WBTropicalForest.HEVEA_LOG , WBTropicalForest.HEVEA_LEAF ); + + private static final WorldGenMegaJungle TG_JUNGLE = new WorldGenMegaJungle( false , 10 , 20 , + WBTropicalForest.JUNGLE_LOG , WBTropicalForest.JUNGLE_LEAF ); + protected static final WorldGenShrub TG_JUNGLE_SHRUB = new WorldGenShrub( // + WBTropicalForest.JUNGLE_LOG , WBTropicalForest.JUNGLE_LEAF ); + + + public WBTropicalForest( final WBiomeHelper helper ) + { + super( helper ); + this.theBiomeDecorator.treesPerChunk = 100; + this.spawnableMonsterList.add( new Biome.SpawnListEntry( EntityOcelot.class , 2 , 1 , 1 ) ); + } + + + @Override + public WorldGenAbstractTree genBigTreeChance( final Random rand ) + { + final int r = rand.nextInt( 60 ); + if ( r < 1 ) { + return WBTropicalForest.TG_HEVEA_GIANT; + } else if ( r < 5 ) { + return WBTropicalForest.TG_JUNGLE; + } else if ( r < 10 ) { + return WBBambooForest.TG_BAMBOO_BIG; + } else if ( r < 15 ) { + return WBTropicalForest.TG_HEVEA_BIG; + } else if ( r < 25 ) { + return new WorldGenTrees( false , 4 + rand.nextInt( 7 ) , WBTropicalForest.JUNGLE_LOG , + WBTropicalForest.JUNGLE_LEAF , true ); + } else if ( r < 35 ) { + return WBTropicalForest.TG_HEVEA; + } else if ( r < 45 ) { + return WBBambooForest.TG_BAMBOO; + } else if ( r < 50 ) { + return WBBambooForest.TG_BAMBOO_SHRUB; + } else if ( r < 55 ) { + return WBTropicalForest.TG_JUNGLE_SHRUB; + } else { + return WBTropicalForest.TG_HEVEA_SHRUB; + } + } + +}