From f41c64c732a23c2ad8f3ef4629280716e0db691b Mon Sep 17 00:00:00 2001 From: Sollace Date: Thu, 19 Aug 2021 19:52:56 +0200 Subject: [PATCH] Fixed butterflies not taking off when you break the block they're sitting on --- .../unicopia/entity/ButterflyEntity.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/entity/ButterflyEntity.java b/src/main/java/com/minelittlepony/unicopia/entity/ButterflyEntity.java index ae9a077c..1531c75e 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/ButterflyEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/ButterflyEntity.java @@ -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 {