Fix #1959 Forestry leaves causing server crash

This commit is contained in:
Nedelosk committed 2018-02-16 18:56:25 +01:00
1 parent eea193aa83
commit 34be92d462
1 file changed
+6 -1
@@ -2,13 +2,14 @@ package forestry.arboriculture;
import java.util.Random;
import forestry.arboriculture.blocks.BlockAbstractLeaves;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import forestry.arboriculture.blocks.BlockAbstractLeaves;
/**
* Based on vanilla leaf decay in {@link BlockLeaves#updateTick(World, BlockPos, IBlockState, Random)}
* but accepts leaves that are connected further from a trunk
@@ -30,6 +31,10 @@ public class LeafDecayHelper {
}
IBlockState state = world.getBlockState(pos);
if(!state.getProperties().containsKey(BlockLeaves.DECAYABLE)){
return;
}
// Fix a bug where Forestry leaves were not decayable.
// The non-decayable Forestry leaves are all BlockDecorativeLeaves.
if (!state.getValue(BlockLeaves.DECAYABLE)) {