aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/dungeon
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDoorFinder.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoomInfoRegistry.java31
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java3
4 files changed, 26 insertions, 12 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java
index 5a333143..2fdfec96 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java
@@ -40,7 +40,6 @@ public class OffsetPoint implements Cloneable, Serializable {
public BlockPos toRotatedRelBlockPos(DungeonRoom dungeonRoom) {
int rot = dungeonRoom.getRoomMatcher().getRotation();
Vector2d rot2 = new Vector2d(x,z);
-// System.out.println("Before rot " +rot2);
for (int i = 0; i < dungeonRoom.getRoomMatcher().getRotation(); i++) {
rot2 = VectorUtils.rotateCounterClockwise(rot2);
if (i % 2 == 0) {
@@ -49,7 +48,6 @@ public class OffsetPoint implements Cloneable, Serializable {
rot2.y += dungeonRoom.getMax().getZ() - dungeonRoom.getMin().getZ() + 1;
}
}
-// System.out.println("After rot "+rot+" / "+rot2);
return new BlockPos(rot2.x, y, rot2.y);
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDoorFinder.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDoorFinder.java
index bb0a52a0..b73fa2aa 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDoorFinder.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/CatacombDoorFinder.java
@@ -22,7 +22,6 @@ public class CatacombDoorFinder implements StartDoorFinder {
Collection<EntityArmorStand> armorStand = w.getEntities(EntityArmorStand.class, new Predicate<EntityArmorStand>() {
@Override
public boolean apply(EntityArmorStand input) {
- System.out.println(input.getName());
return input.getName().equals("§bMort");
}
});
@@ -48,7 +47,6 @@ public class CatacombDoorFinder implements StartDoorFinder {
Collection<EntityArmorStand> armorStand = w.getEntities(EntityArmorStand.class, new Predicate<EntityArmorStand>() {
@Override
public boolean apply(EntityArmorStand input) {
- System.out.println(input.getName());
return input.getName().equals("§bMort");
}
});
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;
}
}