mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-02-09 00:42:03 +01:00
New finder now sets the passenger movement for horses
This commit is contained in:
parent
03064a55f5
commit
cc14768607
@ -5,6 +5,7 @@ import java.util.List;
|
|||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
@ -25,6 +26,7 @@ import net.citizensnpcs.api.astar.pathfinder.VectorGoal;
|
|||||||
import net.citizensnpcs.api.astar.pathfinder.VectorNode;
|
import net.citizensnpcs.api.astar.pathfinder.VectorNode;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
import net.citizensnpcs.util.NMS;
|
import net.citizensnpcs.util.NMS;
|
||||||
|
import net.citizensnpcs.util.Util;
|
||||||
|
|
||||||
public class AStarNavigationStrategy extends AbstractPathStrategy {
|
public class AStarNavigationStrategy extends AbstractPathStrategy {
|
||||||
private final Location destination;
|
private final Location destination;
|
||||||
@ -164,7 +166,13 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
|
|||||||
if (distance > 0 && dY > NMS.getStepHeight(npc.getEntity()) && xzDistance <= 2.75) {
|
if (distance > 0 && dY > NMS.getStepHeight(npc.getEntity()) && xzDistance <= 2.75) {
|
||||||
NMS.setShouldJump(npc.getEntity());
|
NMS.setShouldJump(npc.getEntity());
|
||||||
}
|
}
|
||||||
NMS.setDestination(npc.getEntity(), destVector.getX(), destVector.getY(), destVector.getZ(), params.speed());
|
if (Util.isHorse(npc.getEntity().getType())) {
|
||||||
|
Entity passenger = npc.getEntity().getPassenger();
|
||||||
|
NMS.setDestination(passenger, destVector.getX(), destVector.getY(), destVector.getZ(), params.speed());
|
||||||
|
} else {
|
||||||
|
NMS.setDestination(npc.getEntity(), destVector.getX(), destVector.getY(), destVector.getZ(),
|
||||||
|
params.speed());
|
||||||
|
}
|
||||||
params.run();
|
params.run();
|
||||||
plan.run(npc);
|
plan.run(npc);
|
||||||
return false;
|
return false;
|
||||||
|
@ -125,7 +125,7 @@ public class CitizensNavigator implements Navigator, Runnable {
|
|||||||
defaultParams.updatePathRate(root.getInt("updatepathrate"));
|
defaultParams.updatePathRate(root.getInt("updatepathrate"));
|
||||||
}
|
}
|
||||||
defaultParams.speedModifier((float) root.getDouble("speedmodifier", 1F));
|
defaultParams.speedModifier((float) root.getDouble("speedmodifier", 1F));
|
||||||
defaultParams.avoidWater(root.getBoolean("avoidwater"));
|
defaultParams.avoidWater(root.getBoolean("avoidwater"));
|
||||||
if (!root.getBoolean("usedefaultstuckaction") && defaultParams.stuckAction() == TeleportStuckAction.INSTANCE) {
|
if (!root.getBoolean("usedefaultstuckaction") && defaultParams.stuckAction() == TeleportStuckAction.INSTANCE) {
|
||||||
defaultParams.stuckAction(null);
|
defaultParams.stuckAction(null);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user