diff options
author | syeyoung <cyoung06@naver.com> | 2023-02-11 20:07:42 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2023-02-11 20:07:42 +0900 |
commit | a7a805c7b54aad99739d03b796cb06b8087c3900 (patch) | |
tree | 97d59ff3235dbb082f665880ba0e8e341df929bc /mod/src/main/java/kr/syeyoung | |
parent | c25ae28babd2f68c588715cc1157a4e1ee2eb862 (diff) | |
download | Skyblock-Dungeons-Guide-a7a805c7b54aad99739d03b796cb06b8087c3900.tar.gz Skyblock-Dungeons-Guide-a7a805c7b54aad99739d03b796cb06b8087c3900.tar.bz2 Skyblock-Dungeons-Guide-a7a805c7b54aad99739d03b796cb06b8087c3900.zip |
- Fix typos
- Show lines even if player is in blocked loc
- Force refresh now should work as intended
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'mod/src/main/java/kr/syeyoung')
7 files changed, 33 insertions, 15 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMove.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMove.java index 8f1fc2d1..9ccbee8c 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMove.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMove.java @@ -107,7 +107,8 @@ public class ActionMove extends AbstractAction { public void forceRefresh(DungeonRoom dungeonRoom) { - if (executor != null) executor.setTarget(Minecraft.getMinecraft().thePlayer.getPositionVector()); + if (executor == null) executor = dungeonRoom.createEntityPathTo(target.getBlockPos(dungeonRoom)); + executor.setTarget(Minecraft.getMinecraft().thePlayer.getPositionVector()); } @Override public String toString() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMoveNearestAir.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMoveNearestAir.java index dce9494a..e832a59a 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMoveNearestAir.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMoveNearestAir.java @@ -79,7 +79,8 @@ public class ActionMoveNearestAir extends AbstractAction { } public void forceRefresh(DungeonRoom dungeonRoom) { - if (executor != null) executor.setTarget(Minecraft.getMinecraft().thePlayer.getPositionVector()); + if (executor == null) executor = dungeonRoom.createEntityPathTo(target.getBlockPos(dungeonRoom)); + executor.setTarget(Minecraft.getMinecraft().thePlayer.getPositionVector()); } @Override public String toString() { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/AStarCornerCut.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/AStarCornerCut.java index 2d060fbc..08e88392 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/AStarCornerCut.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/AStarCornerCut.java @@ -113,10 +113,15 @@ public class AStarCornerCut implements IPathfinder { } @Override + public Vec3 getTarget() { + return new Vec3(lastSx / 2.0, lastSy / 2.0, lastSz / 2.0); + } + + @Override public void setTarget(Vec3 from) { int tobeX = (int) Math.round(from.xCoord * 2); - int tobeY = (int) Math.round(from.zCoord * 2); - int tobeZ = (int) Math.round(from.yCoord * 2); + int tobeY = (int) Math.round(from.yCoord * 2); + int tobeZ = (int) Math.round(from.zCoord * 2); if (lastSx != tobeX || lastSy != tobeY || lastSz != tobeZ) { } else { return; @@ -124,8 +129,8 @@ public class AStarCornerCut implements IPathfinder { if (dungeonRoom.isBlocked(tobeX, tobeY, tobeZ)) return; this.lastSx = tobeX; - this.lastSz = tobeY; - this.lastSy = tobeZ; + this.lastSy = tobeY; + this.lastSz = tobeZ; open.clear(); pfindIdx++; found = false; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/AStarFineGrid.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/AStarFineGrid.java index 9980a7c7..3811076b 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/AStarFineGrid.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/AStarFineGrid.java @@ -112,8 +112,8 @@ public class AStarFineGrid implements IPathfinder { @Override public void setTarget(Vec3 from) { int tobeX = (int) Math.round(from.xCoord * 2); - int tobeY = (int) Math.round(from.zCoord * 2); - int tobeZ = (int) Math.round(from.yCoord * 2); + int tobeY = (int) Math.round(from.yCoord * 2); + int tobeZ = (int) Math.round(from.zCoord * 2); if (lastSx != tobeX || lastSy != tobeY || lastSz != tobeZ) { } else { return; @@ -121,8 +121,8 @@ public class AStarFineGrid implements IPathfinder { if (dungeonRoom.isBlocked(tobeX, tobeY, tobeZ)) return; this.lastSx = tobeX; - this.lastSz = tobeY; - this.lastSy = tobeZ; + this.lastSy = tobeY; + this.lastSz = tobeZ; open.clear(); pfindIdx++; found = false; @@ -142,6 +142,11 @@ public class AStarFineGrid implements IPathfinder { } @Override + public Vec3 getTarget() { + return new Vec3(lastSx / 2.0, lastSy / 2.0, lastSz / 2.0); + } + + @Override public List<Vec3> getRoute(Vec3 from) { int lastSx = (int) Math.round(from.xCoord * 2); int lastSy = (int) Math.round(from.yCoord * 2); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/IPathfinder.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/IPathfinder.java index 3ea5cfa1..a88a772f 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/IPathfinder.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/IPathfinder.java @@ -28,5 +28,6 @@ public interface IPathfinder { boolean doOneStep(); void setTarget(Vec3 from); + Vec3 getTarget(); List<Vec3> getRoute(Vec3 from); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/PathfinderExecutor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/PathfinderExecutor.java index 8dcd499c..3c433237 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/PathfinderExecutor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/PathfinderExecutor.java @@ -59,7 +59,7 @@ public class PathfinderExecutor { public List<Vec3> getRoute(Vec3 target) { if (!isComplete) return lastRoute; List<Vec3> route = pathfinder.getRoute(target); - if (route == null) return lastRoute = pathfinder.getRoute(getTarget()); + if (route == null) return lastRoute = pathfinder.getRoute(pathfinder.getTarget()); else return lastRoute = route; } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/ThetaStar.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/ThetaStar.java index 9365485a..0916af59 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/ThetaStar.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/pathfinding/algorithms/ThetaStar.java @@ -123,10 +123,15 @@ public class ThetaStar implements IPathfinder { } @Override + public Vec3 getTarget() { + return new Vec3(lastSx / 2.0, lastSy / 2.0, lastSz / 2.0); + } + + @Override public void setTarget(Vec3 from) { int tobeX = (int) Math.round(from.xCoord * 2); - int tobeY = (int) Math.round(from.zCoord * 2); - int tobeZ = (int) Math.round(from.yCoord * 2); + int tobeY = (int) Math.round(from.yCoord * 2); + int tobeZ = (int) Math.round(from.zCoord * 2); if (lastSx != tobeX || lastSy != tobeY || lastSz != tobeZ) { } else { return; @@ -134,8 +139,8 @@ public class ThetaStar implements IPathfinder { if (dungeonRoom.isBlocked(tobeX, tobeY, tobeZ)) return; this.lastSx = tobeX; - this.lastSz = tobeY; - this.lastSy = tobeZ; + this.lastSy = tobeY; + this.lastSz = tobeZ; open.clear(); pfindIdx++; found = false; |