diff options
author | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-11-27 22:24:48 +0900 |
---|---|---|
committer | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-11-27 22:24:48 +0900 |
commit | 314be153363dbf4d457363b70e7af77fd13d19c9 (patch) | |
tree | 8e7bd94e7623ce3193e13d6a7c6b1502448749cb /src/main/java/kr/syeyoung/dungeonsguide/dungeon | |
parent | b446655945ba1d9b92155f7fc43b37f0f2821c2a (diff) | |
download | Skyblock-Dungeons-Guide-314be153363dbf4d457363b70e7af77fd13d19c9.tar.gz Skyblock-Dungeons-Guide-314be153363dbf4d457363b70e7af77fd13d19c9.tar.bz2 Skyblock-Dungeons-Guide-314be153363dbf4d457363b70e7af77fd13d19c9.zip |
WATER PUZZLE SOLVER DONE. PERIOD.
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java | 20 |
1 files changed, 14 insertions, 6 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 b6497872..5a333143 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java @@ -23,11 +23,14 @@ public class OffsetPoint implements Cloneable, Serializable { public void setPosInWorld(DungeonRoom dungeonRoom, BlockPos pos) { Vector2d vector2d = new Vector2d(pos.getX() - dungeonRoom.getMin().getX(), pos.getZ() - dungeonRoom.getMin().getZ()); - for (int i = 0; i < dungeonRoom.getRoomMatcher().getRotation(); i++) + for (int i = 0; i < dungeonRoom.getRoomMatcher().getRotation(); i++) { vector2d = VectorUtils.rotateClockwise(vector2d); - - if (vector2d.x < 0) vector2d.x += dungeonRoom.getDungeonRoomInfo().getBlocks()[0].length - 1; - if (vector2d.y < 0) vector2d.y += dungeonRoom.getDungeonRoomInfo().getBlocks().length - 1; + if (i % 2 == 0) { + vector2d.x += dungeonRoom.getDungeonRoomInfo().getBlocks().length - 1; + } else { + vector2d.x += dungeonRoom.getDungeonRoomInfo().getBlocks()[0].length - 1; + } + } this.x = (int) vector2d.x; this.z = (int) vector2d.y; @@ -37,11 +40,16 @@ 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) { + rot2.y += dungeonRoom.getMax().getX() - dungeonRoom.getMin().getX() + 1; + } else { + rot2.y += dungeonRoom.getMax().getZ() - dungeonRoom.getMin().getZ() + 1; + } } - if (rot2.x < 0) rot2.x += dungeonRoom.getMax().getX() - dungeonRoom.getMin().getX() + 2; - if (rot2.y < 0) rot2.y += dungeonRoom.getMax().getZ() - dungeonRoom.getMin().getZ() + 2; +// System.out.println("After rot "+rot+" / "+rot2); return new BlockPos(rot2.x, y, rot2.y); } |