diff options
author | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-09 00:07:22 +0900 |
---|---|---|
committer | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-12-09 00:07:22 +0900 |
commit | 1f4774812f3f26dad9ac8d0fbeef7ff9a911c67d (patch) | |
tree | 0e31d23cf0837f6db2239a5d4ec54c1d79be17a3 /src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder | |
parent | 956e6ed51382aaac19ae5a7a8b4c664ae630e587 (diff) | |
download | Skyblock-Dungeons-Guide-1f4774812f3f26dad9ac8d0fbeef7ff9a911c67d.tar.gz Skyblock-Dungeons-Guide-1f4774812f3f26dad9ac8d0fbeef7ff9a911c67d.tar.bz2 Skyblock-Dungeons-Guide-1f4774812f3f26dad9ac8d0fbeef7ff9a911c67d.zip |
remove system printlns
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java | 31 | ||||
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java | 3 |
2 files changed, 26 insertions, 8 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java index b96e4366..6f5ac4ce 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java @@ -69,11 +69,32 @@ public class DungeonRoomInfoRegistry { uuidMap.clear(); Authenticator authenticator = DungeonsGuideMain.getDungeonsGuideMain().getAuthenticator(); InputStream inputStream = authenticator.getInputStream("roomdata/datas.txt"); - inputStream.read(new byte[4]); - BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); - String name; - while ((name = br.readLine()) != null) { - System.out.println("Trying to load "+name); + byte[] bytes = new byte[4]; + inputStream.read(bytes); + + int length = ((bytes[0] & 0xFF) << 24) | + ((bytes[1] & 0xFF) << 16) | + ((bytes[2] & 0xFF) << 8 ) | + ((bytes[3] & 0xFF)); + ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); + int totalLen = 0; + try { + byte[] buffer = new byte[128]; + int read = 0; + while ( (read = inputStream.read(buffer)) != -1 ) { + totalLen += read; + byteStream.write(buffer, 0, read); + if (totalLen >= length) break;; + } + } catch (Exception ignored) {} + byte[] byte1 = byteStream.toByteArray(); + byte[] byte2 = new byte[(int) length]; + System.arraycopy(byte1, 0, byte2, 0, byte2.length); + inputStream.close(); + + String names = new String(byte2); + + for (String name : names.split("\n")) { if (name.endsWith(".roomdata")) continue; try { InputStream fis = authenticator.getInputStream(name); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java index 46337480..ac713082 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java @@ -49,15 +49,12 @@ public class RoomMatcher { for (int i = 0; i < rotation; i++) res = ArrayUtils.rotateCounterClockwise(res); - System.out.println("Trying to match "+dungeonRoomInfo.getUuid().toString()+" / "+dungeonRoomInfo.getName()+"... at rotation "+rotation); - for (int z = 0; z < res.length; z ++) { for (int x = 0; x < res[0].length; x++) { int data = res[z][x]; if (data == -1) continue; Block b = dungeonRoom.getRelativeBlockAt(x,0,z); if (b == null || Block.getIdFromBlock(b) != data) { - System.out.println("Match failed at offset X"+x+" / Z"+z+". expected "+data+" but found "+b +" ("+Block.getIdFromBlock(b)+")"); return false; } } |