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,9 +106,11 @@ 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().isAir(state, world, pos)) { if (state.getBlock() != this) {
if (!(hasDown && hasTrunk && hasRoot)) { if (state.getBlock().isAir(state, world, pos)) {
world.setBlockState(pos, withAge(increase).withProperty(HALF, Half.TOP)); if (!(hasDown && hasTrunk && hasRoot)) {
world.setBlockState(pos, withAge(increase).withProperty(HALF, Half.TOP));
}
} }
return; return;
} }