Skip to content

Commit

Permalink
Update SwimmingExaminer
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Jul 22, 2018
1 parent 91e5805 commit afc0c69
Showing 1 changed file with 9 additions and 0 deletions.
@@ -1,6 +1,7 @@
package net.citizensnpcs.api.astar.pathfinder;

import org.bukkit.Material;
import org.bukkit.entity.WaterMob;
import org.bukkit.util.Vector;

import net.citizensnpcs.api.npc.NPC;
Expand All @@ -20,6 +21,11 @@ public boolean canSwimInLava() {

@Override
public float getCost(BlockSource source, PathPoint point) {
if (SpigotUtil.isUsing1_13API() && npc.getEntity() instanceof WaterMob) {
Material in = source.getMaterialAt(point.getVector());
if (!MinecraftBlockExaminer.isLiquid(in))
return 0.5F;
}
return 0;
}

Expand All @@ -29,6 +35,9 @@ public PassableState isPassable(BlockSource source, PathPoint point) {
if (!MinecraftBlockExaminer.isLiquid(in)) {
return PassableState.IGNORE;
}
if (SpigotUtil.isUsing1_13API() && npc.getEntity() instanceof WaterMob) {
return PassableState.PASSABLE;
}
Material above = source.getMaterialAt(point.getVector().add(new Vector(0, 1, 0)));
PassableState canSwim = isSwimmableLiquid(above) || MinecraftBlockExaminer.canStandIn(above)
? PassableState.PASSABLE
Expand Down

0 comments on commit afc0c69

Please sign in to comment.