aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/dungeon
diff options
context:
space:
mode:
authorsyeyoung <42869671+cyoung06@users.noreply.github.com>2020-11-26 13:02:20 +0900
committersyeyoung <42869671+cyoung06@users.noreply.github.com>2020-11-26 13:02:20 +0900
commit4d5276d8523e5c4771bdde386c9a538ec544d4c5 (patch)
tree9c504ad9c1e441caa4f50cb1e78b00b91fa023ca /src/main/java/kr/syeyoung/dungeonsguide/dungeon
parent4ada6858039f3ca2f5de3c81df8c78f481d897d4 (diff)
downloadSkyblock-Dungeons-Guide-4d5276d8523e5c4771bdde386c9a538ec544d4c5.tar.gz
Skyblock-Dungeons-Guide-4d5276d8523e5c4771bdde386c9a538ec544d4c5.tar.bz2
Skyblock-Dungeons-Guide-4d5276d8523e5c4771bdde386c9a538ec544d4c5.zip
value edit stuff
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java23
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java5
2 files changed, 27 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 +
+ '}';
+ }
}
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 41e2fb6f..2b56b139 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java
@@ -114,6 +114,11 @@ public class DungeonRoom {
return null;
}
+ public BlockPos getRelativeBlockPosAt(int x, int y, int z) {
+ BlockPos pos = new BlockPos(x,y,z).add(min.getX(),min.getZ(),min.getZ());
+ return pos;
+ }
+
public int getRelativeBlockDataAt(int x, int y, int z) {
// validate x y z's
if (canAccessRelative(x,z)) {