diff options
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java')
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java | 23 |
1 files changed, 22 insertions, 1 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 49775537..05bc7138 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java @@ -11,12 +11,16 @@ import javax.vecmath.Vector2d; @Data @AllArgsConstructor -public class OffsetPoint { +public class OffsetPoint implements Cloneable { private int x; private int y; private int z; public OffsetPoint(DungeonRoom dungeonRoom, BlockPos pos) { + setPosInWorld(dungeonRoom, pos); + } + + public void setPosInWorld(DungeonRoom dungeonRoom, BlockPos pos) { Vector2d vector2d = new Vector2d(pos.getX(), pos.getZ()); for (int i = 0; i < dungeonRoom.getRoomMatcher().getRotation(); i++) vector2d = VectorUtils.rotateClockwise(vector2d); @@ -47,6 +51,10 @@ public class OffsetPoint { Block b = dungeonRoom.getRelativeBlockAt(relBp.getX(), relBp.getY(), relBp.getZ()); return b; } + public BlockPos getBlockPos(DungeonRoom dungeonRoom) { + BlockPos relBp = toRotatedRelBlockPos(dungeonRoom); + return dungeonRoom.getRelativeBlockPosAt(relBp.getX(), relBp.getY(), relBp.getZ()); + } public int getData(DungeonRoom dungeonRoom) { BlockPos relBp = toRotatedRelBlockPos(dungeonRoom); @@ -54,4 +62,17 @@ public class OffsetPoint { int b = dungeonRoom.getRelativeBlockDataAt(relBp.getX(), relBp.getY(), relBp.getZ()); return b; } + + @Override + public Object clone() throws CloneNotSupportedException { + return new OffsetPoint(x,y,z); + } + + @Override + public String toString() { + return "OffsetPoint{x=" + x + + ", y=" + y + + ", z=" + z + + '}'; + } } |