Unset the target when dead (fixes skeletons shooting at the ground)

This commit is contained in:
Sollace 2023-05-05 21:12:39 +01:00
parent ccb636a674
commit 62c11ec66b

View file

@ -48,6 +48,10 @@ public class DynamicTargetGoal extends Goal {
if (interval-- <= 0) {
interval = 20;
if (mob.getTarget() != null && mob.getTarget().isDead()) {
mob.setTarget(null);
}
target = VecHelper.findInRange(mob, mob.world, mob.getPos(), 26, test)
.stream()
.sorted(Comparator.comparing(e -> mob.distanceTo(e)))