diff options
author | syeyoung <cyoung06@naver.com> | 2022-05-07 00:47:38 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2022-05-07 00:47:38 +0900 |
commit | f9bdd265df98610ef9ba44f354e7d57f88f826cd (patch) | |
tree | 8083523c0c1770c22e585c8f65de6cafb867b90f /src/main/java/kr | |
parent | 183549fad0e35b543dc06b212c2836ddd5bad3d5 (diff) | |
download | Skyblock-Dungeons-Guide-f9bdd265df98610ef9ba44f354e7d57f88f826cd.tar.gz Skyblock-Dungeons-Guide-f9bdd265df98610ef9ba44f354e7d57f88f826cd.tar.bz2 Skyblock-Dungeons-Guide-f9bdd265df98610ef9ba44f354e7d57f88f826cd.zip |
- Enable force-refresh, but do not perform if there's pathfind undergoing.
Diffstat (limited to 'src/main/java/kr')
3 files changed, 14 insertions, 14 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 d486d220..ec790489 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMove.java @@ -103,7 +103,7 @@ public class ActionMove extends AbstractAction { public void forceRefresh(DungeonRoom dungeonRoom) { try { - if (latestFuture != null) latestFuture.cancel(true); + if (latestFuture != null) return; } catch (Exception ignored) {} latestFuture = dungeonRoom.createEntityPathTo(dungeonRoom.getContext().getWorld(), Minecraft.getMinecraft().thePlayer, target.getBlockPos(dungeonRoom), Integer.MAX_VALUE, 10000); } 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 85343568..14897147 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/actions/ActionMoveNearestAir.java @@ -102,7 +102,7 @@ public class ActionMoveNearestAir extends AbstractAction { public void forceRefresh(DungeonRoom dungeonRoom) { try { - if (latestFuture != null) latestFuture.cancel(true); + if (latestFuture != null) return; } catch (Exception ignored) {} latestFuture = dungeonRoom.createEntityPathTo(dungeonRoom.getContext().getWorld(), Minecraft.getMinecraft().thePlayer, target.getBlockPos(dungeonRoom), Integer.MAX_VALUE, 10000); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java index 22daf0f2..452c0003 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java @@ -339,18 +339,18 @@ public class GeneralRoomProcessor implements RoomProcessor { searchForNextTarget(); } else if (FeatureRegistry.SECRET_CREATE_REFRESH_LINE.getKeybind() == keyInputEvent.getKey() && FeatureRegistry.SECRET_CREATE_REFRESH_LINE.isEnabled()) { ActionRoute actionRoute = getBestFit(0); - // disable force refresh. It's bad idea. -// if (actionRoute.getCurrentAction() instanceof ActionMove) { -// ActionMove ac = (ActionMove) actionRoute.getCurrentAction(); -// ac.forceRefresh(getDungeonRoom()); -// } else if (actionRoute.getCurrentAction() instanceof ActionMoveNearestAir) { -// ActionMoveNearestAir ac = (ActionMoveNearestAir) actionRoute.getCurrentAction(); -// ac.forceRefresh(getDungeonRoom()); -// } else if (actionRoute.getCurrent() >= 1 && actionRoute.getActions().get(actionRoute.getCurrent()-1) instanceof ActionMove) { -// ((ActionMove)actionRoute.getActions().get(actionRoute.getCurrent()-1)).forceRefresh(dungeonRoom); -// } else if (actionRoute.getCurrent() >= 1 && actionRoute.getActions().get(actionRoute.getCurrent()-1) instanceof ActionMoveNearestAir) { -// ((ActionMoveNearestAir)actionRoute.getActions().get(actionRoute.getCurrent()-1)).forceRefresh(dungeonRoom); -// } + // actually do force refresh because of force freeze pathfind + if (actionRoute.getCurrentAction() instanceof ActionMove) { + ActionMove ac = (ActionMove) actionRoute.getCurrentAction(); + ac.forceRefresh(getDungeonRoom()); + } else if (actionRoute.getCurrentAction() instanceof ActionMoveNearestAir) { + ActionMoveNearestAir ac = (ActionMoveNearestAir) actionRoute.getCurrentAction(); + ac.forceRefresh(getDungeonRoom()); + } else if (actionRoute.getCurrent() >= 1 && actionRoute.getActions().get(actionRoute.getCurrent()-1) instanceof ActionMove) { + ((ActionMove)actionRoute.getActions().get(actionRoute.getCurrent()-1)).forceRefresh(dungeonRoom); + } else if (actionRoute.getCurrent() >= 1 && actionRoute.getActions().get(actionRoute.getCurrent()-1) instanceof ActionMoveNearestAir) { + ((ActionMoveNearestAir)actionRoute.getActions().get(actionRoute.getCurrent()-1)).forceRefresh(dungeonRoom); + } if (FeatureRegistry.SECRET_CREATE_REFRESH_LINE.isPathfind() && !actionRoute.getActionRouteProperties().isPathfind()) { actionRoute.getActionRouteProperties().setPathfind(true); |