aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/dungeon
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-02-13 01:23:05 +0900
committersyeyoung <cyong06@naver.com>2021-02-13 01:23:05 +0900
commitacbdeb579e4c64d96b9274996e2a21659385fcfe (patch)
tree73c28738e63b2420d97d1fd621e8891b8014b56a /src/main/java/kr/syeyoung/dungeonsguide/dungeon
parent77af3008dba9efab778555093191ecf8817e0ed3 (diff)
downloadSkyblock-Dungeons-Guide-acbdeb579e4c64d96b9274996e2a21659385fcfe.tar.gz
Skyblock-Dungeons-Guide-acbdeb579e4c64d96b9274996e2a21659385fcfe.tar.bz2
Skyblock-Dungeons-Guide-acbdeb579e4c64d96b9274996e2a21659385fcfe.zip
ok idk
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon')
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java2
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java16
2 files changed, 12 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 3c262856..8c5376d7 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java
@@ -167,6 +167,6 @@ public class DungeonRoom {
return (shape >>(roomPt.y *4 +roomPt.x) & 0x1) > 0;
}
public boolean canAccessRelative(int x, int z) {
- return (shape >>((z/32) *4 +(x/32)) & 0x1) > 0;
+ return x>= 0 && z >= 0 && (shape >>((z/32) *4 +(x/32)) & 0x1) > 0;
}
}
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 41967e6c..c4bc596c 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/RoomMatcher.java
@@ -61,6 +61,8 @@ public class RoomMatcher {
private boolean tryMatching(DungeonRoomInfo dungeonRoomInfo, int rotation) {
if (dungeonRoomInfo.getColor() != dungeonRoom.getColor()) return false;
+ System.out.println("Matching "+dungeonRoomInfo.getName()+" At "+rotation);
+
int[][] res = dungeonRoomInfo.getBlocks();
for (int i = 0; i < rotation; i++)
res = ArrayUtils.rotateCounterClockwise(res);
@@ -72,6 +74,7 @@ public class RoomMatcher {
Block b = dungeonRoom.getRelativeBlockAt(x,0,z);
if (b == null || Block.getIdFromBlock(b) != data) {
+ System.out.println("Failed At "+x+"."+z + " "+data+" found " + Block.getIdFromBlock(b) +" found");
return false;
}
}
@@ -93,11 +96,14 @@ public class RoomMatcher {
for (int z = 0; z < data.length; z++) {
for (int x = 0; x < data[0].length; x++) {
- if (!(offset <= x && widthX - offset > x && offset <= z && heightZ - offset > z)) {
- data[z][x] = -1;
- continue;
- }
- if (!(dungeonRoom.canAccessRelative(x + offset - 1, z + offset - 1) && dungeonRoom.canAccessRelative(x - offset, z - offset))) {
+// if (!(offset < x && widthX - offset > x && offset < z && heightZ - offset > z)) {
+// data[z][x] = -1;
+// continue;
+// }
+ if (!(dungeonRoom.canAccessRelative(x + offset, z + offset)
+ && dungeonRoom.canAccessRelative(x - offset -1 , z - offset-1)
+ && dungeonRoom.canAccessRelative(x + offset , z - offset-1)
+ && dungeonRoom.canAccessRelative(x - offset -1 , z + offset))) {
data[z][x] = -1;
continue;
}