Fixed alfalfa causing a crash when attempting to grown into another block above it

This commit is contained in:
Sollace 2019-02-05 11:01:26 +02:00
parent 7cb52ecdf5
commit 33e121b3db

View file

@ -106,10 +106,12 @@ public class BlockAlfalfa extends BlockCrops {
boolean hasTrunk = world.getBlockState(pos.down(2)).getBlock() == this; boolean hasTrunk = world.getBlockState(pos.down(2)).getBlock() == this;
boolean hasRoot = world.getBlockState(pos.down(3)).getBlock() == this; boolean hasRoot = world.getBlockState(pos.down(3)).getBlock() == this;
if (state.getBlock() != this) {
if (state.getBlock().isAir(state, world, pos)) { if (state.getBlock().isAir(state, world, pos)) {
if (!(hasDown && hasTrunk && hasRoot)) { if (!(hasDown && hasTrunk && hasRoot)) {
world.setBlockState(pos, withAge(increase).withProperty(HALF, Half.TOP)); world.setBlockState(pos, withAge(increase).withProperty(HALF, Half.TOP));
} }
}
return; return;
} }