Make jump behaviour more consistent on slabs for new pathfinder

This commit is contained in:
fullwall 2016-03-06 16:42:10 +08:00
parent b25030e072
commit 5610955741
2 changed files with 4 additions and 4 deletions

View File

@ -2,6 +2,7 @@ package net.citizensnpcs.npc.ai;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.bukkit.util.Vector;
import net.citizensnpcs.Settings.Setting;
@ -22,10 +23,9 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
private final NPC npc;
private final NavigatorParameters params;
private Path plan;
private Vector vector;
AStarNavigationStrategy(NPC npc, Location dest, NavigatorParameters params) {
public AStarNavigationStrategy(NPC npc, Location dest, NavigatorParameters params) {
super(TargetType.LOCATION);
this.params = params;
this.destination = dest;
@ -80,7 +80,7 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
npc.getEntity().getWorld().playEffect(vector.toLocation(npc.getEntity().getWorld()), Effect.ENDER_SIGNAL,
0);
}
if (distance > 0 && dY > 0 && dY < 1 && xzDistance <= 2.75) {
if (distance > 0 && dY > NMS.getStepHeight((LivingEntity) npc.getEntity()) && xzDistance <= 2.75) {
NMS.setShouldJump(npc.getEntity());
}
double destX = vector.getX() + 0.5, destZ = vector.getZ() + 0.5;

View File

@ -471,7 +471,7 @@ public class NMS {
// handle.getAttributeInstance(GenericAttributes.d).getValue();
}
public static float getStepHeight(LivingEntity entity) {
public static float getStepHeight(org.bukkit.entity.Entity entity) {
return NMS.getHandle(entity).P;
}