diff options
author | syeyoung <cyoung06@naver.com> | 2021-09-18 12:29:50 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2021-09-18 12:29:50 +0900 |
commit | 3d42886e90d2d41603d5741a3d5d07907f7758fe (patch) | |
tree | 725c2c886d42fd9cb858a49bb9be326dbc6030d7 /src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java | |
parent | b5f5a1a613ab534e247c8eb04110344e2161d8d3 (diff) | |
download | Skyblock-Dungeons-Guide-3d42886e90d2d41603d5741a3d5d07907f7758fe.tar.gz Skyblock-Dungeons-Guide-3d42886e90d2d41603d5741a3d5d07907f7758fe.tar.bz2 Skyblock-Dungeons-Guide-3d42886e90d2d41603d5741a3d5d07907f7758fe.zip |
- Waypoints? and new JPS Pathfinding Algorithm
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java')
-rwxr-xr-x | src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java index 5c6a7023..85970fa3 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java @@ -91,11 +91,9 @@ public class DungeonRoom { this.currentState = currentState; } - @Getter - private final PathFinder pathFinder; - public ScheduledFuture<List<BlockPos>> createEntityPathTo(IBlockAccess blockaccess, Entity entityIn, BlockPos targetPos, float dist) { - return asyncPathFinder.schedule(() -> { + ScheduledFuture<List<BlockPos>> sf = asyncPathFinder.schedule(() -> { + PathFinder pathFinder = new PathFinder(nodeProcessorDungeonRoom); PathEntity latest = pathFinder.createEntityPathTo(blockaccess, entityIn, targetPos, dist); if (latest != null) { List<BlockPos> poses = new ArrayList<>(); @@ -107,9 +105,11 @@ public class DungeonRoom { } return new ArrayList<>(); }, 0, TimeUnit.MILLISECONDS); + asyncPathFinder.schedule(() -> sf.cancel(true), 10, TimeUnit.SECONDS); + return sf; } - private static final ScheduledExecutorService asyncPathFinder = Executors.newScheduledThreadPool(2); + private static final ScheduledExecutorService asyncPathFinder = Executors.newScheduledThreadPool(4); @Getter private final NodeProcessorDungeonRoom nodeProcessorDungeonRoom; @@ -144,7 +144,6 @@ public class DungeonRoom { buildDoors(); buildRoom(); nodeProcessorDungeonRoom = new NodeProcessorDungeonRoom(this); - pathFinder = new PathFinder(nodeProcessorDungeonRoom); updateRoomProcessor(); } |