From 61770505484c61b9eea11f7e53db59745a531b14 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Wed, 17 Jan 2024 21:15:38 +0100 Subject: [PATCH] Emergency Movement fixes Signed-off-by: Lixfel --- .../fightsystem/ai/lixfel/LixfelAI.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/ai/lixfel/LixfelAI.java b/FightSystem_Core/src/de/steamwar/fightsystem/ai/lixfel/LixfelAI.java index f50fb74..b404ede 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/ai/lixfel/LixfelAI.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/ai/lixfel/LixfelAI.java @@ -134,30 +134,20 @@ public class LixfelAI extends AI { return PlanResult.EMPTY; Vector position = getPosition(); - if(position.getY() == plannedPosition.getY()) + if(position.getY() >= plannedPosition.getY()) return PlanResult.EMPTY; - boolean falling = getEntity().getVelocity().getY() < 0; - if(position.getY() > plannedPosition.getY()) { - if(!falling) { //Update grid accordingly - pathplanner.removePosition(plannedPosition); - position.setX(position.getBlockX() + 0.5); - position.setZ(position.getBlockZ() + 0.5); - pathplanner.addPosition(position); - } - return PlanResult.EMPTY; - } - - if(pathplanner.isLadder(plannedPosition) && getEntity().getVelocity().getY() >= -0.23) //alternative measure: falling speed + if(pathplanner.isLadder(plannedPosition) && getEntity().getVelocity().getY() >= -0.23) return PlanResult.EMPTY; pathplanner.removePosition(plannedPosition); //obviously not walkable anymore - if(falling) { + if(!getEntity().isOnGround()) { return new PlanResult(1000.0, () -> setTNT(position.subtract(new Vector(0, 1.0, 0)))); } else { position.setX(position.getBlockX() + 0.5); position.setZ(position.getBlockZ() + 0.5); pathplanner.addPosition(position); + setPlannedPosition(position); return PlanResult.EMPTY; } }