From 81148c7c0af8a57084ad4a339e5b801e7c01fd0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Sun, 10 Jul 2016 00:58:56 +0200 Subject: [PATCH] Some clean-up on the new tree stuff --- TODO.txt | 35 +++++++++---------- src/java/mmm/materials/MTree.java | 6 ++-- src/java/mmm/materials/MTrees.java | 13 ++++--- src/java/mmm/world/biome/WBTropicalSwamp.java | 14 ++++---- .../mmm/world/trees/A_WTTreeGenerator.java | 15 ++++---- .../mmm/world/trees/WTBambooGenerator.java | 20 ++++++++--- .../mmm/world/trees/WTHeveaGenerator.java | 21 +++++++++-- 7 files changed, 74 insertions(+), 50 deletions(-) diff --git a/TODO.txt b/TODO.txt index fab788b..a671a8c 100644 --- a/TODO.txt +++ b/TODO.txt @@ -5,15 +5,13 @@ deco No Copper pots deco No Copper plates deco No Lanterns deco No Light plates -deco No Limestone... - ...stairs - ...slabs -deco No Slate... - ...stairs - ...slabs -deco No Basalt... - ...stairs - ...slabs +deco No Stone - Smooth + stairs + slabs + Limestone + Slate + Basalt +deco No Wood - Stairs + slabs + doors + fences + chairs + tables + thrones + Hevea + Bamboo ------------------------------------------------------------------------------------------------------- plants No? Tomatoes plants No? Turnips @@ -43,20 +41,17 @@ materials No Alloys Alnico materials No Metal from slag -> in metal recycler -materials No Black sand -materials No Quicksand / quagmire +materials No Black sand URGENT +materials No Quicksand / quagmire URGENT materials No Metals Lead Aluminium Silver materials No Liquids Mercury -------------------------------------------------------------------------------------------------------- -materials.rock No Smooth limestone -materials.rock No Smooth slate -materials.rock No Smooth basalt -------------------------------------------------------------------------------------------------------- -materials.ore No Olivine +materials No Missing bamboo plank textures BF +materials No Make bamboo behave like bamboo BF +materials No Olivine ------------------------------------------------------------------------------------------------------- tech.base No Alloy furnace -> fix item pickup in creative mode BF @@ -67,15 +62,19 @@ tech.base No Metal recycler tech.tools No Pan (for e.g. panning gold) -> limit it per chunk -> depend on chunk minerals +tech.tools No Boats + Hevea + Bamboo ------------------------------------------------------------------------------------------------------- tech.blackboard ??? AUGUSTIN WANTS IT! ------------------------------------------------------------------------------------------------------- animals ??? Goats +animals ??? Alligators ------------------------------------------------------------------------------------------------------- world ??? Improved system to handle neighbouring biomes BF world.gen ??? Make basalt gen behave correctly at chunk boundaries BF world.gen ??? Improve saltpeter gen so it generates in caves only BF -world ??? Volcanos +world ??? Volcanos URGENT ------------------------------------------------------------------------------------------------------- ??? ??? Sub-blocks ??? Yes Improved pistons diff --git a/src/java/mmm/materials/MTree.java b/src/java/mmm/materials/MTree.java index 52332d5..dfadfd2 100644 --- a/src/java/mmm/materials/MTree.java +++ b/src/java/mmm/materials/MTree.java @@ -172,7 +172,7 @@ public class MTree { this.genNormal = generator; if ( generator != null ) { - generator.setWood( this ); + generator.setTreeMaterials( this ); } return this; } @@ -189,7 +189,7 @@ public class MTree this.genBig = generator; this.genBigChance = chance; if ( generator != null ) { - generator.setWood( this ); + generator.setTreeMaterials( this ); } return this; } @@ -199,7 +199,7 @@ public class MTree { this.genMega = generator; if ( generator != null ) { - generator.setWood( this ); + generator.setTreeMaterials( this ); } return this; } diff --git a/src/java/mmm/materials/MTrees.java b/src/java/mmm/materials/MTrees.java index 67cc12c..197fed3 100644 --- a/src/java/mmm/materials/MTrees.java +++ b/src/java/mmm/materials/MTrees.java @@ -2,8 +2,8 @@ package mmm.materials; import mmm.utils.UMaths; -import mmm.world.trees.WTHeveaGenerator; import mmm.world.trees.WTBambooGenerator; +import mmm.world.trees.WTHeveaGenerator; import net.minecraft.block.material.MapColor; @@ -17,19 +17,18 @@ public class MTrees MTrees( ) { - HEVEA = new MTree( "hevea" ) // + this.HEVEA = new MTree( "hevea" ) // .setBarkColor( MapColor.GRAY ) // .setBaseFireInfo( 5 , 8 ) // - .setTreeGenerator( new WTHeveaGenerator( true ) ) // + .setTreeGenerator( WTHeveaGenerator.createSaplingGen( ) ) // .register( ); - BAMBOO = new MTree( "bamboo" ) // + this.BAMBOO = new MTree( "bamboo" ) // .setBarkColor( MapColor.FOLIAGE ) // .setLogBoundingBox( UMaths.makeBlockAABB( 4 , 0 , 4 , 12 , 16 , 12 ) ) // .setGrowthChance( .3f ) // - .setSaplingGrowthStages( 1 ) // - .setTreeGenerator( new WTBambooGenerator( false , true ) ) // - .setBigTreeGenerator( new WTBambooGenerator( true , true ) , .15f ) // + .setTreeGenerator( WTBambooGenerator.createSaplingGen( false ) ) // + .setBigTreeGenerator( WTBambooGenerator.createSaplingGen( true ) , .15f ) // .register( ); } } diff --git a/src/java/mmm/world/biome/WBTropicalSwamp.java b/src/java/mmm/world/biome/WBTropicalSwamp.java index 1016f8b..50e052e 100644 --- a/src/java/mmm/world/biome/WBTropicalSwamp.java +++ b/src/java/mmm/world/biome/WBTropicalSwamp.java @@ -46,14 +46,12 @@ public class WBTropicalSwamp 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 ); + 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 A_WTTreeGenerator TG_HEVEA = new WTHeveaGenerator( false ); + + private static final WorldGenShrub TG_SHRUB = new WorldGenShrub( // + WBTropicalSwamp.OAK_LOG , WBTropicalSwamp.OAK_LEAF ); public WBTropicalSwamp( final WBiomeHelper helper ) diff --git a/src/java/mmm/world/trees/A_WTTreeGenerator.java b/src/java/mmm/world/trees/A_WTTreeGenerator.java index 8dd41e0..e90cc2b 100644 --- a/src/java/mmm/world/trees/A_WTTreeGenerator.java +++ b/src/java/mmm/world/trees/A_WTTreeGenerator.java @@ -160,24 +160,25 @@ public abstract class A_WTTreeGenerator } - private MTree wood; + private MTree materials; - public A_WTTreeGenerator( final boolean notify ) + public A_WTTreeGenerator( final boolean notify , MTree materials ) { super( notify ); + this.materials = materials; } - public MTree getWood( ) + public MTree getTreeMaterials( ) { - return this.wood; + return this.materials; } - public A_WTTreeGenerator setWood( final MTree wood ) + public A_WTTreeGenerator setTreeMaterials( final MTree materials ) { - this.wood = wood; + this.materials = materials; return this; } @@ -185,7 +186,7 @@ public abstract class A_WTTreeGenerator @Override public boolean generate( final World worldIn , final Random rand , final BlockPos position ) { - if ( position.getY( ) < 1 || !this.wood.canSaplingStay( worldIn , position ) ) { + if ( position.getY( ) < 1 || !this.materials.canSaplingStay( worldIn , position ) ) { return false; } diff --git a/src/java/mmm/world/trees/WTBambooGenerator.java b/src/java/mmm/world/trees/WTBambooGenerator.java index 215e041..300f712 100644 --- a/src/java/mmm/world/trees/WTBambooGenerator.java +++ b/src/java/mmm/world/trees/WTBambooGenerator.java @@ -3,6 +3,8 @@ package mmm.world.trees; import java.util.Random; +import mmm.materials.MTree; +import mmm.materials.Materials; import net.minecraft.block.BlockLeaves; import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; @@ -12,6 +14,10 @@ import net.minecraft.util.math.BlockPos; public class WTBambooGenerator extends A_WTTreeGenerator { + public static WTBambooGenerator createSaplingGen( final boolean big ) + { + return new WTBambooGenerator( big , true , null ); + } private final int minHeight; private final int randomHeight; @@ -20,7 +26,13 @@ public class WTBambooGenerator public WTBambooGenerator( final boolean big , final boolean notify ) { - super( notify ); + this( big , notify , Materials.TREE.BAMBOO ); + } + + + private WTBambooGenerator( final boolean big , final boolean notify , MTree materials ) + { + super( notify , materials ); this.minHeight = big ? 13 : 5; this.randomHeight = big ? 15 : 8; this.maxRingRadius = big ? 2 : 1; @@ -39,7 +51,7 @@ public class WTBambooGenerator { // Trunk for ( int y = 0 ; y < rtd.height ; y++ ) { - rtd.setBlock( 2 , y , 2 , this.getWood( ).LOG , E_BlockRequirement.VANILLA ); + rtd.setBlock( 2 , y , 2 , this.getTreeMaterials( ).LOG , E_BlockRequirement.VANILLA ); rtd.setRequirement( 2 , y , 2 , E_BlockRequirement.VANILLA ); } @@ -51,8 +63,8 @@ public class WTBambooGenerator } // Leaves - final IBlockState leaves = this.getWood( ).LEAVES.getDefaultState( ).withProperty( BlockLeaves.CHECK_DECAY , - false ); + final IBlockState leaves = this.getTreeMaterials( ).LEAVES.getDefaultState( ) // + .withProperty( BlockLeaves.CHECK_DECAY , false ); int ringY = 1 + rand.nextInt( 3 ); while ( ringY < rtd.height ) { final int radius = 1 + rand.nextInt( this.maxRingRadius ); diff --git a/src/java/mmm/world/trees/WTHeveaGenerator.java b/src/java/mmm/world/trees/WTHeveaGenerator.java index fa983a8..5cb9364 100644 --- a/src/java/mmm/world/trees/WTHeveaGenerator.java +++ b/src/java/mmm/world/trees/WTHeveaGenerator.java @@ -4,6 +4,7 @@ package mmm.world.trees; import java.util.Random; import mmm.materials.MLeaves; +import mmm.materials.Materials; import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; @@ -13,9 +14,22 @@ public class WTHeveaGenerator extends A_WTTreeGenerator { + public static WTHeveaGenerator createSaplingGen( ) + { + return new WTHeveaGenerator( ); + } + + public WTHeveaGenerator( final boolean notify ) { - super( notify ); + super( notify , Materials.TREE.HEVEA ); + } + + + // Used for sapling gen + private WTHeveaGenerator( ) + { + super( true , null ); } @@ -39,7 +53,8 @@ public class WTHeveaGenerator final int trunkHeight = Math.max( trunkBottom + 1 , rtd.height - ( 1 + rand.nextInt( leavesHeight ) ) ); // Lower part of the leaves - IBlockState leaves = this.getWood( ).LEAVES.getDefaultState( ).withProperty( MLeaves.CHECK_DECAY , false ); + IBlockState leaves = this.getTreeMaterials( ).LEAVES.getDefaultState( )// + .withProperty( MLeaves.CHECK_DECAY , false ); for ( int y = trunkBottom , i = 0 ; y < lowerPart ; y++ , i++ ) { final int radius = ( i >> 1 ) + 1; final int rSquare = radius * radius + ( i & 1 ); @@ -72,7 +87,7 @@ public class WTHeveaGenerator // Trunk for ( int y = 0 ; y < trunkHeight ; y++ ) { - rtd.setBlock( centre , y , centre , this.getWood( ).LOG , E_BlockRequirement.VANILLA ); + rtd.setBlock( centre , y , centre , this.getTreeMaterials( ).LOG , E_BlockRequirement.VANILLA ); rtd.setRequirement( centre , y , centre , E_BlockRequirement.VANILLA ); } }