Set destination even for non NPCs
This commit is contained in:
parent
1ca256753b
commit
bf532728d1
|
@ -71,7 +71,8 @@ public abstract class AbstractBlockBreaker extends BlockBreaker {
|
|||
return BehaviorStatus.SUCCESS;
|
||||
}
|
||||
currentTick = (int) (System.currentTimeMillis() / 50);
|
||||
if (configuration.radius() > 0 && distance() >= configuration.radius()) {
|
||||
if (configuration.radius() > 0) {
|
||||
if (distance() >= configuration.radius()) {
|
||||
startDigTick = currentTick;
|
||||
if (entity instanceof NPCHolder) {
|
||||
NPC npc = ((NPCHolder) entity).getNPC();
|
||||
|
@ -79,12 +80,16 @@ public abstract class AbstractBlockBreaker extends BlockBreaker {
|
|||
npc.getNavigator().setTarget(location);
|
||||
npc.getNavigator().getLocalParameters().pathDistanceMargin(
|
||||
Math.max(1, npc.getNavigator().getLocalParameters().pathDistanceMargin()));
|
||||
npc.getNavigator().getLocalParameters().distanceMargin(Math.max(configuration.radius() - 1, 0.75));
|
||||
npc.getNavigator().getLocalParameters()
|
||||
.distanceMargin(Math.max(configuration.radius() - 1, 0.75));
|
||||
setTarget = true;
|
||||
}
|
||||
} else if (NMS.getDestination(entity) == null) {
|
||||
NMS.setDestination(entity, x, y, z, 1);
|
||||
}
|
||||
return BehaviorStatus.RUNNING;
|
||||
}
|
||||
}
|
||||
Util.faceLocation(entity, location);
|
||||
if (entity instanceof Player && currentTick % 5 == 0) {
|
||||
PlayerAnimation.ARM_SWING.play((Player) entity);
|
||||
|
|
|
@ -380,6 +380,9 @@ public class NMSImpl implements NMSBridge {
|
|||
Entity handle = getHandle(entity);
|
||||
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
||||
if (controller == null || !controller.a()) {
|
||||
return null;
|
||||
}
|
||||
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
||||
}
|
||||
|
||||
|
|
|
@ -399,6 +399,9 @@ public class NMSImpl implements NMSBridge {
|
|||
Entity handle = getHandle(entity);
|
||||
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
||||
if (controller == null || !controller.a()) {
|
||||
return null;
|
||||
}
|
||||
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
||||
}
|
||||
|
||||
|
|
|
@ -403,6 +403,9 @@ public class NMSImpl implements NMSBridge {
|
|||
Entity handle = getHandle(entity);
|
||||
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
||||
if (controller == null || !controller.b()) {
|
||||
return null;
|
||||
}
|
||||
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
||||
}
|
||||
|
||||
|
|
|
@ -425,6 +425,9 @@ public class NMSImpl implements NMSBridge {
|
|||
Entity handle = getHandle(entity);
|
||||
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
||||
if (controller == null || !controller.b()) {
|
||||
return null;
|
||||
}
|
||||
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
||||
}
|
||||
|
||||
|
|
|
@ -468,6 +468,9 @@ public class NMSImpl implements NMSBridge {
|
|||
Entity handle = getHandle(entity);
|
||||
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
||||
if (controller == null || !controller.b()) {
|
||||
return null;
|
||||
}
|
||||
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
||||
}
|
||||
|
||||
|
|
|
@ -477,6 +477,9 @@ public class NMSImpl implements NMSBridge {
|
|||
Entity handle = getHandle(entity);
|
||||
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
||||
if (controller == null || !controller.b()) {
|
||||
return null;
|
||||
}
|
||||
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
||||
}
|
||||
|
||||
|
|
|
@ -483,6 +483,9 @@ public class NMSImpl implements NMSBridge {
|
|||
Entity handle = getHandle(entity);
|
||||
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
||||
if (controller == null || !controller.b()) {
|
||||
return null;
|
||||
}
|
||||
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
||||
}
|
||||
|
||||
|
|
|
@ -498,6 +498,9 @@ public class NMSImpl implements NMSBridge {
|
|||
Entity handle = getHandle(entity);
|
||||
MoveControl controller = handle instanceof Mob ? ((Mob) handle).getMoveControl()
|
||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getMoveControl() : null;
|
||||
if (controller == null || !controller.hasWanted()) {
|
||||
return null;
|
||||
}
|
||||
return new Location(entity.getWorld(), controller.getWantedX(), controller.getWantedY(),
|
||||
controller.getWantedZ());
|
||||
}
|
||||
|
|
|
@ -503,6 +503,9 @@ public class NMSImpl implements NMSBridge {
|
|||
Entity handle = getHandle(entity);
|
||||
MoveControl controller = handle instanceof Mob ? ((Mob) handle).getMoveControl()
|
||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getMoveControl() : null;
|
||||
if (controller == null || !controller.hasWanted()) {
|
||||
return null;
|
||||
}
|
||||
return new Location(entity.getWorld(), controller.getWantedX(), controller.getWantedY(),
|
||||
controller.getWantedZ());
|
||||
}
|
||||
|
|
|
@ -511,6 +511,9 @@ public class NMSImpl implements NMSBridge {
|
|||
Entity handle = getHandle(entity);
|
||||
MoveControl controller = handle instanceof Mob ? ((Mob) handle).getMoveControl()
|
||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getMoveControl() : null;
|
||||
if (controller == null || !controller.hasWanted()) {
|
||||
return null;
|
||||
}
|
||||
return new Location(entity.getWorld(), controller.getWantedX(), controller.getWantedY(),
|
||||
controller.getWantedZ());
|
||||
}
|
||||
|
|
|
@ -84,7 +84,6 @@ public class PlayerMoveControl extends MoveControl {
|
|||
|
||||
@Override
|
||||
public void setWantedPosition(double d0, double d1, double d2, double d3) {
|
||||
System.out.println("set pos: " + d0 + " " + d2);
|
||||
this.tx = d0;
|
||||
this.ty = d1;
|
||||
this.tz = d2;
|
||||
|
|
|
@ -344,6 +344,9 @@ public class NMSImpl implements NMSBridge {
|
|||
Entity handle = getHandle(entity);
|
||||
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
||||
if (controller == null || !controller.a()) {
|
||||
return null;
|
||||
}
|
||||
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue