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.java4
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPointSet.java11
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java6
3 files changed, 15 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 05bc7138..ecb3b268 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java
@@ -21,7 +21,7 @@ public class OffsetPoint implements Cloneable {
}
public void setPosInWorld(DungeonRoom dungeonRoom, BlockPos pos) {
- Vector2d vector2d = new Vector2d(pos.getX(), pos.getZ());
+ Vector2d vector2d = new Vector2d(pos.getX() - dungeonRoom.getMin().getX(), pos.getZ() - dungeonRoom.getMin().getZ());
for (int i = 0; i < dungeonRoom.getRoomMatcher().getRotation(); i++)
vector2d = VectorUtils.rotateClockwise(vector2d);
@@ -30,7 +30,7 @@ public class OffsetPoint implements Cloneable {
this.x = (int) vector2d.x;
this.z = (int) vector2d.y;
- this.y = dungeonRoom.getMin().getY() + pos.getY();
+ this.y = pos.getY()-dungeonRoom.getMin().getY();
}
public BlockPos toRotatedRelBlockPos(DungeonRoom dungeonRoom) {
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPointSet.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPointSet.java
index a381ac49..c33f7af8 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPointSet.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPointSet.java
@@ -6,6 +6,15 @@ import java.util.ArrayList;
import java.util.List;
@Data
-public class OffsetPointSet {
+public class OffsetPointSet implements Cloneable{
private List<OffsetPoint> offsetPointList = new ArrayList<OffsetPoint>();
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ OffsetPointSet ops = new OffsetPointSet();
+ for (OffsetPoint offsetPoint : offsetPointList) {
+ ops.offsetPointList.add((OffsetPoint) offsetPoint.clone());
+ }
+ return ops;
+ }
}
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 2b56b139..c6afb59f 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java
@@ -108,21 +108,21 @@ public class DungeonRoom {
public Block getRelativeBlockAt(int x, int y, int z) {
// validate x y z's
if (canAccessRelative(x,z)) {
- BlockPos pos = new BlockPos(x,y,z).add(min.getX(),min.getZ(),min.getZ());
+ BlockPos pos = new BlockPos(x,y,z).add(min.getX(),min.getY(),min.getZ());
return this.context.getWorld().getChunkFromBlockCoords(pos).getBlock(pos);
}
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());
+ BlockPos pos = new BlockPos(x,y,z).add(min.getX(),min.getY(),min.getZ());
return pos;
}
public int getRelativeBlockDataAt(int x, int y, int z) {
// validate x y z's
if (canAccessRelative(x,z)) {
- BlockPos pos = new BlockPos(x,y,z).add(min.getX(),0,min.getZ());
+ BlockPos pos = new BlockPos(x,y,z).add(min.getX(),min.getY(),min.getZ());
return this.context.getWorld().getChunkFromBlockCoords(pos).getBlockMetadata(pos);
}
return -1;