diff options
author | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-07 11:37:30 +0900 |
---|---|---|
committer | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-07 11:37:30 +0900 |
commit | f1c2c88c6fb0adbdd64df4c0bab13ba83a564264 (patch) | |
tree | a3809f3e4597a8090adec49f188a1334d1888469 /src/main/java/kr | |
parent | 8345651586a5c68cfb36f3f3eb1a2a97ceb3a4b7 (diff) | |
download | Skyblock-Dungeons-Guide-f1c2c88c6fb0adbdd64df4c0bab13ba83a564264.tar.gz Skyblock-Dungeons-Guide-f1c2c88c6fb0adbdd64df4c0bab13ba83a564264.tar.bz2 Skyblock-Dungeons-Guide-f1c2c88c6fb0adbdd64df4c0bab13ba83a564264.zip |
message
Diffstat (limited to 'src/main/java/kr')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java | 1 | ||||
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java | 2 | ||||
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTrivia.java | 6 | ||||
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java | 4 | ||||
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/icefill/RoomProcessorIcePath2.java (renamed from src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorIcePath2.java) | 64 |
5 files changed, 44 insertions, 33 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java index 44bc9fb6..118d92b7 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java @@ -1,6 +1,7 @@ package kr.syeyoung.dungeonsguide.roomprocessor; import kr.syeyoung.dungeonsguide.roomprocessor.boxpuzzle.RoomProcessorBoxSolver; +import kr.syeyoung.dungeonsguide.roomprocessor.icefill.RoomProcessorIcePath2; import kr.syeyoung.dungeonsguide.roomprocessor.waterpuzzle.RoomProcessorWaterPuzzle; import java.util.HashMap; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java index 800b34f7..35b32094 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRiddle.java @@ -52,7 +52,7 @@ public class RoomProcessorRiddle extends GeneralRoomProcessor { } } if (foundMatch) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide :::: "+ch2.split(":")[0].trim()+" §fhas the reward!")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §eRiddle §7:: "+ch2.split(":")[0].trim()+" §fhas the reward!")); final String name = TextUtils.stripColor(ch2.split(":")[0]).replace("[NPC] ","").toLowerCase(); final BlockPos low = getDungeonRoom().getMin(); final BlockPos high = getDungeonRoom().getMax(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTrivia.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTrivia.java index 05d236e1..d5b60845 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTrivia.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorTrivia.java @@ -97,11 +97,11 @@ public class RoomProcessorTrivia extends GeneralRoomProcessor { String theRealAnswer = match(question, answerA, answerB, answerC); if (theRealAnswer == null) - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide :::: §cCouldn't determine the answer! (no question found)")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §eTrivia §7:: §cCouldn't determine the answer! (no question found)")); else if (theRealAnswer.length() >1) - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide :::: §cCouldn't determine the answer! ("+theRealAnswer+")")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §eTrivia §7:: §cCouldn't determine the answer! ("+theRealAnswer+")")); else - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide :::: §6"+theRealAnswer+"§f is the correct answer!")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §eTrivia §7:: "+theRealAnswer+"§f is the correct answer!")); correctAnswer = theRealAnswer; } String correctAnswer; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java index e907671a..9b45b4a9 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/boxpuzzle/RoomProcessorBoxSolver.java @@ -121,7 +121,7 @@ public class RoomProcessorBoxSolver extends GeneralRoomProcessor { if (calcDone2) { BoxPuzzleSolvingThread.Route semi_solution = puzzleSolvingThread.solution; if (semi_solution == null) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide :::: §cCouldn't find solution involving less than 20 box moves within 3m concurrent possibility")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §eBox Solver §7:: §cCouldn't find solution involving less than 20 box moves within 3m concurrent possibility")); step = 0; calcDone2 = false; pathFindReq = true; @@ -131,7 +131,7 @@ public class RoomProcessorBoxSolver extends GeneralRoomProcessor { return; } else{ solution = semi_solution.boxMoves; - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide :::: Solution Found!")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §eBox Solver §7:: Solution Found!")); } step = 0; lastState = currboard; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorIcePath2.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/icefill/RoomProcessorIcePath2.java index 65485ea0..540092bc 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorIcePath2.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/icefill/RoomProcessorIcePath2.java @@ -1,27 +1,28 @@ -package kr.syeyoung.dungeonsguide.roomprocessor; +package kr.syeyoung.dungeonsguide.roomprocessor.icefill; -import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.roomprocessor.GeneralRoomProcessor; +import kr.syeyoung.dungeonsguide.roomprocessor.RoomProcessorGenerator; import kr.syeyoung.dungeonsguide.utils.RenderUtils; -import kr.syeyoung.dungeonsguide.utils.TextUtils; -import net.minecraft.client.Minecraft; import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; import java.awt.*; import java.util.ArrayList; +import java.util.Queue; import java.util.Arrays; import java.util.LinkedList; import java.util.List; -import java.util.regex.Pattern; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.CopyOnWriteArrayList; public class RoomProcessorIcePath2 extends GeneralRoomProcessor { private boolean bugged = false; - private List<List<BlockPos>> solution = new ArrayList<List<BlockPos>>(); + private List<List<BlockPos>> solution = new CopyOnWriteArrayList<List<BlockPos>>(); + + private Queue<String> messageQueue = new ConcurrentLinkedQueue<String>(); public RoomProcessorIcePath2(DungeonRoom dungeonRoom) { @@ -33,19 +34,19 @@ public class RoomProcessorIcePath2 extends GeneralRoomProcessor { return; } - for (String s : levels.split(",")) { + for (final String s : levels.split(",")) { try { OffsetPointSet level = (OffsetPointSet) dungeonRoom.getDungeonRoomInfo().getProperties().get(s + "-board"); String data = (String) dungeonRoom.getDungeonRoomInfo().getProperties().get(s + "-level"); - int width = Integer.parseInt(data.split(":")[0]); - int height = Integer.parseInt(data.split(":")[1]); - int startX = Integer.parseInt(data.split(":")[2]); - int startY = Integer.parseInt(data.split(":")[3]); - int endX = Integer.parseInt(data.split(":")[4]); - int endY = Integer.parseInt(data.split(":")[5]); - - int[][] map = new int[height][width]; - BlockPos[][] map2 = new BlockPos[height][width]; + final int width = Integer.parseInt(data.split(":")[0]); + final int height = Integer.parseInt(data.split(":")[1]); + final int startX = Integer.parseInt(data.split(":")[2]); + final int startY = Integer.parseInt(data.split(":")[3]); + final int endX = Integer.parseInt(data.split(":")[4]); + final int endY = Integer.parseInt(data.split(":")[5]); + + final int[][] map = new int[height][width]; + final BlockPos[][] map2 = new BlockPos[height][width]; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { map2[y][x] = level.getOffsetPointList().get(y * width + x).getBlockPos(dungeonRoom); @@ -53,15 +54,24 @@ public class RoomProcessorIcePath2 extends GeneralRoomProcessor { } } - List<Point> hamiltonianPath = findFirstHamiltonianPath(map, startX, startY, endX, endY); - if (hamiltonianPath == null) continue; - hamiltonianPath.add(0,new Point(startX, startY)); - List<BlockPos> poses = new LinkedList<BlockPos>(); - for (int i = 0; i < hamiltonianPath.size(); i++) { - Point p = hamiltonianPath.get(i); - poses.add(map2[p.y][p.x]); - } - solution.add(poses); + new Thread() { + public void run() { + messageQueue.add("§eDungeons Guide §7:: §eIcePath §7:: §fCalculating solution for floor "+s); + List<Point> hamiltonianPath = findFirstHamiltonianPath(map, startX, startY, endX, endY); + if (hamiltonianPath == null) { + messageQueue.add("§eDungeons Guide §7:: §eIcePath §7:: §cCouldn't find solution for floor "+s); + return; + } + messageQueue.add("§eDungeons Guide §7:: §eIcePath §7:: §fFound solution for floor "+s+"!"); + hamiltonianPath.add(0,new Point(startX, startY)); + List<BlockPos> poses = new LinkedList<BlockPos>(); + for (int i = 0; i < hamiltonianPath.size(); i++) { + Point p = hamiltonianPath.get(i); + poses.add(map2[p.y][p.x]); + } + solution.add(poses); + } + }.start(); } catch (Exception e) { e.printStackTrace(); } |