diff --git a/src/java/mmm/world/World.java b/src/java/mmm/world/World.java index 31417d1..94e512e 100644 --- a/src/java/mmm/world/World.java +++ b/src/java/mmm/world/World.java @@ -7,6 +7,7 @@ import mmm.utils.I_UOreGenerationRegistrar; import mmm.utils.URegistry; import mmm.world.biome.WBLimestoneMountains; import mmm.world.biome.WBLimestonePlateau; +import mmm.world.biome.WBTropicalSwamp; import mmm.world.gen.WGBasalt; import mmm.world.gen.WGOre; import mmm.world.gen.WGOreCondition; @@ -64,6 +65,14 @@ public class World .setWeather( .7f , .5f ) // .removeExtraProperty( "ChaosChance" )// .register( ); + + helper = new WBiomeHelper( WBTropicalSwamp::new ); + helper.setNames( "Tropical Swamp" , "swamp/tropical" ) // + .setElevation( -.2f , .1f ) // + .setWeather( .95f , .95f ) // + .setWaterColor( 0xe0ffae ) // Same as vanilla swamps + .setType( BiomeType.WARM , 3 ) // + .register( ); } diff --git a/src/java/mmm/world/biome/WBTropicalSwamp.java b/src/java/mmm/world/biome/WBTropicalSwamp.java new file mode 100644 index 0000000..1016f8b --- /dev/null +++ b/src/java/mmm/world/biome/WBTropicalSwamp.java @@ -0,0 +1,173 @@ +package mmm.world.biome; + + +import java.util.Random; + +import mmm.materials.Materials; +import mmm.world.I_WBiomeWithOres; +import mmm.world.WBiomeHelper; +import mmm.world.gen.WGOreParameters; +import mmm.world.trees.A_WTTreeGenerator; +import mmm.world.trees.WTBambooGenerator; +import mmm.world.trees.WTHeveaGenerator; +import net.minecraft.block.BlockFlower; +import net.minecraft.block.BlockLeaves; +import net.minecraft.block.BlockOldLeaf; +import net.minecraft.block.BlockOldLog; +import net.minecraft.block.BlockPlanks; +import net.minecraft.block.BlockTallGrass; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.monster.EntitySlime; +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.chunk.ChunkPrimer; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.WorldGenFossils; +import net.minecraft.world.gen.feature.WorldGenShrub; +import net.minecraft.world.gen.feature.WorldGenTallGrass; +import net.minecraft.world.gen.feature.WorldGenTrees; +import net.minecraft.world.gen.feature.WorldGenVines; +import net.minecraft.world.gen.feature.WorldGenerator; + + + +public class WBTropicalSwamp + extends Biome + implements I_WBiomeWithOres +{ + private static final IBlockState OAK_LOG = Blocks.LOG.getDefaultState( ) // + .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 ) ); + + private static final IBlockState WATER_LILY = Blocks.WATERLILY.getDefaultState( ); + + private static final A_WTTreeGenerator TG_BAMBOO_BIG = new WTBambooGenerator( true , false ) // + .setWood( Materials.TREE.BAMBOO ); + private static final A_WTTreeGenerator TG_BAMBOO = new WTBambooGenerator( false , false ) // + .setWood( Materials.TREE.BAMBOO ); + private static final A_WTTreeGenerator TG_HEVEA = new WTHeveaGenerator( false ) // + .setWood( Materials.TREE.HEVEA ); + private static final WorldGenShrub TG_SHRUB = new WorldGenShrub( WBTropicalSwamp.OAK_LOG , + WBTropicalSwamp.OAK_LEAF ); + + + public WBTropicalSwamp( final WBiomeHelper helper ) + { + super( helper.getProperties( ) ); + + this.theBiomeDecorator.treesPerChunk = 15; + this.theBiomeDecorator.flowersPerChunk = 3; + this.theBiomeDecorator.deadBushPerChunk = 1; + this.theBiomeDecorator.mushroomsPerChunk = 2; + this.theBiomeDecorator.reedsPerChunk = 10; + this.theBiomeDecorator.clayPerChunk = 2; + this.theBiomeDecorator.waterlilyPerChunk = 4; + this.theBiomeDecorator.sandPerChunk2 = 0; + this.theBiomeDecorator.sandPerChunk = 0; + this.theBiomeDecorator.grassPerChunk = 5; + + this.spawnableMonsterList.add( new Biome.SpawnListEntry( EntitySlime.class , 1 , 1 , 1 ) ); + } + + + @Override + public WorldGenAbstractTree genBigTreeChance( final Random rand ) + { + final int treeTypes = rand.nextInt( 30 ); + if ( treeTypes < 3 ) { + return WBTropicalSwamp.TG_SHRUB; + } else if ( treeTypes < 7 ) { + return new WorldGenTrees( false , 2 + rand.nextInt( 5 ) , WBTropicalSwamp.OAK_LOG , + WBTropicalSwamp.OAK_LEAF , true ); + } else if ( treeTypes < 16 ) { + return WBTropicalSwamp.TG_HEVEA; + } else if ( treeTypes < 29 ) { + return WBTropicalSwamp.TG_BAMBOO; + } else { + return WBTropicalSwamp.TG_BAMBOO_BIG; + } + } + + + @Override + public void genTerrainBlocks( final World worldIn , final Random rand , final ChunkPrimer chunkPrimerIn , + final int x , final int z , final double noiseVal ) + { + final double d0 = Biome.GRASS_COLOR_NOISE.getValue( x * 0.25D , z * 0.25D ); + if ( d0 > 0.0D ) { + final int i = x & 15; + final int j = z & 15; + + for ( int k = 255 ; k >= 0 ; --k ) { + if ( chunkPrimerIn.getBlockState( j , k , i ).getMaterial( ) != Material.AIR ) { + if ( k == 62 && chunkPrimerIn.getBlockState( j , k , i ).getBlock( ) != Blocks.WATER ) { + chunkPrimerIn.setBlockState( j , k , i , Biome.WATER ); + if ( d0 < 0.12D ) { + chunkPrimerIn.setBlockState( j , k + 1 , i , WBTropicalSwamp.WATER_LILY ); + } + } + break; + } + } + } + + this.generateBiomeTerrain( worldIn , rand , chunkPrimerIn , x , z , noiseVal ); + } + + + @Override + public WGOreParameters[] getBiomeOres( final World world ) + { + return new WGOreParameters[] { + new WGOreParameters( Materials.ROCK.SLATE , 20 , 60 ) + }; + } + + + @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 ) + { + super.decorate( 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 ) ); + } + + if ( rand.nextInt( 64 ) == 0 ) { + new WorldGenFossils( ).generate( worldIn , rand , pos ); + } + } + + + @Override + public void addDefaultFlowers( ) + { + this.addFlower( Blocks.RED_FLOWER.getDefaultState( ).withProperty( Blocks.RED_FLOWER.getTypeProperty( ) , + BlockFlower.EnumFlowerType.BLUE_ORCHID ) , 10 ); + } + + + @Override + public BlockFlower.EnumFlowerType pickRandomFlower( final Random rand , final BlockPos pos ) + { + return BlockFlower.EnumFlowerType.BLUE_ORCHID; + } + +} diff --git a/src/java/mmm/world/trees/A_WTTreeGenerator.java b/src/java/mmm/world/trees/A_WTTreeGenerator.java index 51b6c3b..8dd41e0 100644 --- a/src/java/mmm/world/trees/A_WTTreeGenerator.java +++ b/src/java/mmm/world/trees/A_WTTreeGenerator.java @@ -175,9 +175,10 @@ public abstract class A_WTTreeGenerator } - public void setWood( final MTree wood ) + public A_WTTreeGenerator setWood( final MTree wood ) { this.wood = wood; + return this; }