Fixed butterflies not taking off when you break the block they're sitting on

This commit is contained in:
Sollace 2021-08-19 19:52:56 +02:00
parent 9c5768b737
commit f41c64c732

View file

@ -91,6 +91,9 @@ public class ButterflyEntity extends AmbientEntity {
public void setResting(boolean resting) {
getDataTracker().set(RESTING, resting);
if (!resting) {
hoveringPosition = null;
}
}
public Variant getVariant() {
@ -129,15 +132,15 @@ public class ButterflyEntity extends AmbientEntity {
super.tickMovement();
BlockPos pos = getBlockPos();
BlockPos below = pos.down();
BlockPos below = new BlockPos(getPos().add(0, -0.5, 0));
if (isResting()) {
if (world.getBlockState(below).isOpaque()) {
if (world.getBlockState(below).isAir()) {
setResting(false);
} else {
if (!world.getOtherEntities(this, getBoundingBox().expand(7), this::isAggressor).isEmpty()) {
setResting(false);
}
} else {
setResting(false);
}
} else {