优化防御塔目标选择

This commit is contained in:
Atsuihsio 2025-02-14 17:14:27 +08:00
parent eef5bc9a0c
commit 369169ec75

View file

@ -280,6 +280,10 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity,
Entity target = EntityFindUtil.findEntity(level(), entityData.get(TARGET_UUID));
if (target != null) {
if (target instanceof LivingEntity living && living.getHealth() <= 0) {
entityData.set(TARGET_UUID, "none");
return;
}
Vec3 barrelRootPos = new Vec3(this.getX(), this.getY() + 1.390625f, this.getZ());
Vec3 targetVec = barrelRootPos.vectorTo(target.getEyePosition()).normalize();