mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-23 19:16:34 +01:00
Add debug-pathfinding setting
This commit is contained in:
parent
c538a18471
commit
a0c6039e8e
@ -68,6 +68,7 @@ public class Settings {
|
||||
DATABASE_URL("storage.database.url", ""),
|
||||
DATABASE_USERNAME("storage.database.username", ""),
|
||||
DEBUG_MODE("general.debug-mode", false),
|
||||
DEBUG_PATHFINDING("general.debug-mode.pathfinding", false),
|
||||
DEFAULT_LOOK_CLOSE("npc.default.look-close.enabled", false),
|
||||
DEFAULT_LOOK_CLOSE_RANGE("npc.default.look-close.range", 5),
|
||||
DEFAULT_NPC_LIMIT("npc.limits.default-limit", 10),
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.citizensnpcs.npc.ai;
|
||||
|
||||
import net.citizensnpcs.Settings.Setting;
|
||||
import net.citizensnpcs.api.ai.NavigatorParameters;
|
||||
import net.citizensnpcs.api.ai.TargetType;
|
||||
import net.citizensnpcs.api.ai.event.CancelReason;
|
||||
@ -12,6 +13,7 @@ import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
import net.minecraft.server.v1_6_R3.EntityLiving;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -66,6 +68,11 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
|
||||
double dY = vector.getY() - handle.locY;
|
||||
double xzDistance = dX * dX + dZ * dZ;
|
||||
double distance = xzDistance + dY * dY;
|
||||
if (Setting.DEBUG_PATHFINDING.asBoolean()) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
npc.getBukkitEntity().getWorld().playEffect(npc.getStoredLocation(), Effect.MOBSPAWNER_FLAMES, 0);
|
||||
}
|
||||
}
|
||||
if (distance > 0 && dY > 0 && xzDistance <= 2.75) {
|
||||
NMS.setShouldJump(npc.getBukkitEntity());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user