Don't use door code

This commit is contained in:
fullwall 2019-05-23 17:32:38 +08:00
parent 9fa1646ad6
commit d9afd7ebdf

View File

@ -4,9 +4,6 @@ import java.util.List;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.material.Door;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -18,7 +15,6 @@ import net.citizensnpcs.api.ai.TargetType;
import net.citizensnpcs.api.ai.event.CancelReason; import net.citizensnpcs.api.ai.event.CancelReason;
import net.citizensnpcs.api.astar.AStarMachine; import net.citizensnpcs.api.astar.AStarMachine;
import net.citizensnpcs.api.astar.pathfinder.ChunkBlockSource; import net.citizensnpcs.api.astar.pathfinder.ChunkBlockSource;
import net.citizensnpcs.api.astar.pathfinder.MinecraftBlockExaminer;
import net.citizensnpcs.api.astar.pathfinder.Path; import net.citizensnpcs.api.astar.pathfinder.Path;
import net.citizensnpcs.api.astar.pathfinder.VectorGoal; import net.citizensnpcs.api.astar.pathfinder.VectorGoal;
import net.citizensnpcs.api.astar.pathfinder.VectorNode; import net.citizensnpcs.api.astar.pathfinder.VectorNode;
@ -94,15 +90,15 @@ public class AStarNavigationStrategy extends AbstractPathStrategy {
} }
Location currLoc = npc.getEntity().getLocation(NPC_LOCATION); Location currLoc = npc.getEntity().getLocation(NPC_LOCATION);
Vector destVector = new Vector(vector.getX() + 0.5, vector.getY(), vector.getZ() + 0.5); Vector destVector = new Vector(vector.getX() + 0.5, vector.getY(), vector.getZ() + 0.5);
Block block = currLoc.getWorld().getBlockAt(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); /*Block block = currLoc.getWorld().getBlockAt(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ());
if (MinecraftBlockExaminer.isDoor(block.getType())) { if (MinecraftBlockExaminer.isDoor(block.getType())) {
Door door = (Door) block.getState().getData(); Door door = (Door) block.getState().getData();
if (door.isOpen()) { if (door.isOpen()) {
BlockFace targetFace = door.getFacing().getOppositeFace(); BlockFace targetFace = door.getFacing().getOppositeFace();
destVector.setX(vector.getX() + targetFace.getModX()); destVector.setX(vector.getX() + targetFace.getModX());
destVector.setZ(vector.getZ() + targetFace.getModZ()); destVector.setZ(vector.getZ() + targetFace.getModZ());
} }
} }*/
if (currLoc.toVector().distanceSquared(destVector) <= params.distanceMargin()) { if (currLoc.toVector().distanceSquared(destVector) <= params.distanceMargin()) {
plan.update(npc); plan.update(npc);
if (plan.isComplete()) { if (plan.isComplete()) {