aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data
diff options
context:
space:
mode:
authorsyeyoung <42869671+cyoung06@users.noreply.github.com>2020-11-25 16:08:17 +0900
committersyeyoung <42869671+cyoung06@users.noreply.github.com>2020-11-25 16:08:17 +0900
commitbfe86d4c79582bb708525ab7b7c433009948d0b8 (patch)
treef47072598d7a72976044c3341938c50008c9c053 /src/main/java/kr/syeyoung/dungeonsguide/dungeon/data
parent81a315f025f361d1155305e55dfee29308a74ed3 (diff)
downloadSkyblock-Dungeons-Guide-bfe86d4c79582bb708525ab7b7c433009948d0b8.tar.gz
Skyblock-Dungeons-Guide-bfe86d4c79582bb708525ab7b7c433009948d0b8.tar.bz2
Skyblock-Dungeons-Guide-bfe86d4c79582bb708525ab7b7c433009948d0b8.zip
asdakjsdk
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/dungeon/data')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/DungeonRoomInfo.java4
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java57
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPointSet.java11
3 files changed, 72 insertions, 0 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/DungeonRoomInfo.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/DungeonRoomInfo.java
index b998fb27..abe3e263 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/DungeonRoomInfo.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/DungeonRoomInfo.java
@@ -4,6 +4,8 @@ import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
import java.util.UUID;
@Getter
@@ -28,4 +30,6 @@ public class DungeonRoomInfo implements Serializable {
private String name;
private String processorId = "default";
+
+ private Map<String, Object> properties = new HashMap<String, Object>();
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java
new file mode 100644
index 00000000..49775537
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPoint.java
@@ -0,0 +1,57 @@
+package kr.syeyoung.dungeonsguide.dungeon.data;
+
+import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom;
+import kr.syeyoung.dungeonsguide.utils.VectorUtils;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import net.minecraft.block.Block;
+import net.minecraft.util.BlockPos;
+
+import javax.vecmath.Vector2d;
+
+@Data
+@AllArgsConstructor
+public class OffsetPoint {
+ private int x;
+ private int y;
+ private int z;
+
+ public OffsetPoint(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);
+
+ if (vector2d.x < 0) vector2d.x += dungeonRoom.getDungeonRoomInfo().getBlocks()[0].length - 1;
+ if (vector2d.y < 0) vector2d.y += dungeonRoom.getDungeonRoomInfo().getBlocks().length - 1;
+
+ this.x = (int) vector2d.x;
+ this.z = (int) vector2d.y;
+ this.y = dungeonRoom.getMin().getY() + pos.getY();
+ }
+
+ public BlockPos toRotatedRelBlockPos(DungeonRoom dungeonRoom) {
+ int rot = dungeonRoom.getRoomMatcher().getRotation();
+ Vector2d rot2 = new Vector2d(x,z);
+ for (int i = 0; i < dungeonRoom.getRoomMatcher().getRotation(); i++) {
+ rot2 = VectorUtils.rotateCounterClockwise(rot2);
+ }
+ 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;
+
+ return new BlockPos(rot2.x, y, rot2.y);
+ }
+
+ public Block getBlock(DungeonRoom dungeonRoom) {
+ BlockPos relBp = toRotatedRelBlockPos(dungeonRoom);
+
+ Block b = dungeonRoom.getRelativeBlockAt(relBp.getX(), relBp.getY(), relBp.getZ());
+ return b;
+ }
+
+ public int getData(DungeonRoom dungeonRoom) {
+ BlockPos relBp = toRotatedRelBlockPos(dungeonRoom);
+
+ int b = dungeonRoom.getRelativeBlockDataAt(relBp.getX(), relBp.getY(), relBp.getZ());
+ return b;
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPointSet.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPointSet.java
new file mode 100644
index 00000000..a381ac49
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/data/OffsetPointSet.java
@@ -0,0 +1,11 @@
+package kr.syeyoung.dungeonsguide.dungeon.data;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+public class OffsetPointSet {
+ private List<OffsetPoint> offsetPointList = new ArrayList<OffsetPoint>();
+}