aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/kr/syeyoung')
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java2
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java18
3 files changed, 13 insertions, 9 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java
index 5079f4c9..2fc86b8e 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java
@@ -64,7 +64,7 @@ public class ActionMove extends AbstractAction {
tick = (tick+1) % 10;
if (tick == 0) {
latest = dungeonRoom.getPathFinder().createEntityPathTo(dungeonRoom.getContext().getWorld(),
- Minecraft.getMinecraft().thePlayer, target.getBlockPos(dungeonRoom), 100);
+ Minecraft.getMinecraft().thePlayer, target.getBlockPos(dungeonRoom), Integer.MAX_VALUE);
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java
index 994c7a7d..3f8e4061 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java
@@ -57,7 +57,7 @@ public class ActionMoveNearestAir extends AbstractAction {
tick = (tick+1) % 10;
if (tick == 0) {
latest = dungeonRoom.getPathFinder().createEntityPathTo(dungeonRoom.getContext().getWorld(),
- Minecraft.getMinecraft().thePlayer, target.getBlockPos(dungeonRoom), 100);
+ Minecraft.getMinecraft().thePlayer, target.getBlockPos(dungeonRoom), Integer.MAX_VALUE);
}
}
@Override
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java b/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java
index 9e138ed9..680fd1a2 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/pathfinding/NodeProcessorDungeonRoom.java
@@ -52,13 +52,8 @@ public class NodeProcessorDungeonRoom extends NodeProcessor {
int newZ = currentPoint.zCoord + dir.getZ();
if (newX < 0 || newZ < 0) continue;
if (newX > sub.getX()|| newZ > sub.getZ()) continue;
- IBlockState state = entityIn.getEntityWorld().getBlockState(dungeonRoom.getMin().add(newX, newY, newZ));
- if (state.getBlock() == Blocks.air || state.getBlock() == Blocks.water || state.getBlock() == Blocks.lava
- || state.getBlock() == Blocks.flowing_water || state.getBlock() == Blocks.flowing_lava
- || state.getBlock() == Blocks.vine || state.getBlock() == Blocks.ladder
- || state.getBlock() == Blocks.standing_sign || state.getBlock() == Blocks.wall_sign
- || state.getBlock() == Blocks.trapdoor || state.getBlock() == Blocks.iron_trapdoor
- || (state == Blocks.stone.getStateFromMeta(2))) {
+ if (isValidBlock(entityIn.getEntityWorld().getBlockState(dungeonRoom.getMin().add(newX, newY, newZ)))
+ && isValidBlock( entityIn.getEntityWorld().getBlockState(dungeonRoom.getMin().add(newX, newY + 1, newZ)))) {
PathPoint pt = openPoint(newX, newY, newZ);
if (pt.visited) continue;
pathOptions[i++] = pt;
@@ -66,4 +61,13 @@ public class NodeProcessorDungeonRoom extends NodeProcessor {
}
return i;
}
+
+ private boolean isValidBlock(IBlockState state) {
+ return state.getBlock() == Blocks.air || state.getBlock() == Blocks.water || state.getBlock() == Blocks.lava
+ || state.getBlock() == Blocks.flowing_water || state.getBlock() == Blocks.flowing_lava
+ || state.getBlock() == Blocks.vine || state.getBlock() == Blocks.ladder
+ || state.getBlock() == Blocks.standing_sign || state.getBlock() == Blocks.wall_sign
+ || state.getBlock() == Blocks.trapdoor || state.getBlock() == Blocks.iron_trapdoor
+ || (state == Blocks.stone.getStateFromMeta(2));
+ }
}