This commit is contained in:
modmuss50 2016-02-22 11:09:29 +00:00
parent e98bc2dbeb
commit 240b0029c8
3 changed files with 11 additions and 6 deletions

View file

@ -130,8 +130,8 @@ public class BlockRubberLog extends Block implements ITexturedBlock {
super.updateTick(worldIn, pos, state, rand);
if(!state.getValue(HAS_SAP)){
if(rand.nextInt(50) == 0){
EnumFacing facing = EnumFacing.getHorizontal(rand.nextInt(3));
if(worldIn.getBlockState(pos.down()).getBlock() == this && worldIn.getBlockState(pos.up()).getBlock() == this && worldIn.isAirBlock(pos.offset(facing))){
EnumFacing facing = EnumFacing.getHorizontal(rand.nextInt(4));
if(worldIn.getBlockState(pos.down()).getBlock() == this && worldIn.getBlockState(pos.up()).getBlock() == this){
worldIn.setBlockState(pos, state.withProperty(HAS_SAP, true).withProperty(SAP_SIDE, facing));
}
}

View file

@ -32,7 +32,9 @@ public class BlockRubberSapling extends BlockSapling {
return;
}
worldIn.setBlockToAir(pos);
new RubberTreeGenerator(false).generate(worldIn, rand, pos);
if(!new RubberTreeGenerator(false).generate(worldIn, rand, pos)){
worldIn.setBlockState(pos, state); //Re-add the sapling if the tree failed to grow
}
}
@Override