From c929569cd48b450177737fa6c92b16aea6a97612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Mon, 11 Jul 2016 16:49:24 +0200 Subject: [PATCH] Some tweaks and clean-up on trees --- src/java/mmm/materials/MSapling.java | 4 +-- src/java/mmm/materials/MTree.java | 54 +++++++++++----------------- src/java/mmm/materials/MTrees.java | 4 ++- 3 files changed, 26 insertions(+), 36 deletions(-) diff --git a/src/java/mmm/materials/MSapling.java b/src/java/mmm/materials/MSapling.java index 97c3614..d7a101a 100644 --- a/src/java/mmm/materials/MSapling.java +++ b/src/java/mmm/materials/MSapling.java @@ -112,7 +112,7 @@ public class MSapling return; } - if ( this.wood.getMegaGenerator( ) != null ) { + if ( this.wood.canGenerateMega( ) ) { for ( int x = -1 ; x < 1 ; x++ ) { for ( int z = -1 ; z < 1 ; z++ ) { final BlockPos basePos = pos.add( x , 0 , z ); @@ -233,7 +233,7 @@ public class MSapling @SideOnly( Side.CLIENT ) public Block.EnumOffsetType getOffsetType( ) { - return Block.EnumOffsetType.XZ; + return this.wood.mustOffsetSapling( ) ? Block.EnumOffsetType.XZ : Block.EnumOffsetType.NONE; } diff --git a/src/java/mmm/materials/MTree.java b/src/java/mmm/materials/MTree.java index af17b90..98b2a19 100644 --- a/src/java/mmm/materials/MTree.java +++ b/src/java/mmm/materials/MTree.java @@ -52,6 +52,7 @@ public class MTree private int fruitDropChance = 0; private Item fruit = null; + private boolean mustOffsetSapling = false; private int saplingGrowthStages = 2; private float bonemealChance = .45f; private float growthChance = .142f; @@ -132,7 +133,14 @@ public class MTree } - public MTree setSaplingGrowthStages( final int stages ) + public MTree offsetSapling( ) + { + this.mustOffsetSapling = true; + return this; + } + + + public MTree setGrowthStages( final int stages ) { this.saplingGrowthStages = stages; return this; @@ -286,6 +294,12 @@ public class MTree } + public boolean mustOffsetSapling( ) + { + return this.mustOffsetSapling; + } + + public int getSaplingGrowthStages( ) { return this.saplingGrowthStages; @@ -325,6 +339,12 @@ public class MTree } + public boolean canGenerateMega( ) + { + return this.genMega != null; + } + + public boolean generateNormalOrBig( final World worldIn , final BlockPos pos , final Random rand ) { if ( this.genBig != null @@ -333,12 +353,7 @@ public class MTree return true; } } - return this.generateNormal( worldIn , pos , rand ); - } - - public boolean generateNormal( final World worldIn , final BlockPos pos , final Random rand ) - { if ( this.genNormal == null ) { return false; } @@ -346,15 +361,6 @@ public class MTree } - public boolean generateBig( final World worldIn , final BlockPos pos , final Random rand ) - { - if ( this.genBig == null ) { - return false; - } - return this.genBig.generate( worldIn , rand , pos ); - } - - public boolean generateMega( final World worldIn , final BlockPos pos , final Random rand ) { if ( this.genMega == null ) { @@ -364,24 +370,6 @@ public class MTree } - public WorldGenAbstractTree getNormalGenerator( ) - { - return this.genNormal; - } - - - public WorldGenAbstractTree getBigGenerator( ) - { - return this.genBig; - } - - - public WorldGenAbstractTree getMegaGenerator( ) - { - return this.genMega; - } - - @Override public void registerRecipes( ) { diff --git a/src/java/mmm/materials/MTrees.java b/src/java/mmm/materials/MTrees.java index 6fc7101..b049287 100644 --- a/src/java/mmm/materials/MTrees.java +++ b/src/java/mmm/materials/MTrees.java @@ -30,7 +30,9 @@ public class MTrees this.BAMBOO = new MTree( "bamboo" ) // .setBarkColor( MapColor.FOLIAGE ) // .setLogBoundingBox( UMaths.makeBlockAABB( 4 , 0 , 4 , 12 , 16 , 12 ) ) // - .setGrowthChance( .3f ) // + .setGrowthStages( 8 ) // + .setGrowthChance( .8f ) // + .offsetSapling( ) // .setTreeGenerator( WTBamboo.createSaplingGen( false ) ) // .setBigTreeGenerator( WTBamboo.createSaplingGen( true ) , .15f ) // .register( );