Some tweaks and clean-up on trees

This commit is contained in:
Emmanuel BENOîT 2016-07-11 16:49:24 +02:00
parent f7b5e3df23
commit c929569cd4
3 changed files with 26 additions and 36 deletions

View file

@ -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;
}

View file

@ -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( )
{

View file

@ -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( );