Skip to content

Commit

Permalink
Make jump behaviour more consistent on slabs for new pathfinder
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Mar 6, 2016
1 parent f53ccc3 commit 4904b3e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Expand Up @@ -2,6 +2,7 @@

import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.entity.LivingEntity;
import org.bukkit.util.Vector;

import net.citizensnpcs.Settings.Setting;
Expand All @@ -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;
Expand Down Expand Up @@ -80,7 +80,7 @@ public boolean update() {
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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/citizensnpcs/util/NMS.java
Expand Up @@ -471,7 +471,7 @@ public static float getSpeedFor(NPC npc) {
// 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;
}

Expand Down

0 comments on commit 4904b3e

Please sign in to comment.