aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>2023-07-31 12:54:27 +0800
committerKevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>2023-08-30 22:49:53 -0400
commit3d1bf459e1dc3a140511f9052abb2eaca4a7858e (patch)
tree4589bce145b6588790d201ea3af17a97a348fab3
parent7257ed162b44bcbe49241d4177e25981bdb32092 (diff)
downloadSkyblocker-3d1bf459e1dc3a140511f9052abb2eaca4a7858e.tar.gz
Skyblocker-3d1bf459e1dc3a140511f9052abb2eaca4a7858e.tar.bz2
Skyblocker-3d1bf459e1dc3a140511f9052abb2eaca4a7858e.zip
Add needs scanning check and refactor SecretWaypoint
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/Room.java55
-rw-r--r--src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java26
2 files changed, 45 insertions, 36 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/Room.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/Room.java
index 0eae2793..85a20f0a 100644
--- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/Room.java
+++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/Room.java
@@ -116,7 +116,7 @@ public class Room {
protected void update() {
// Logical AND has higher precedence than logical OR
- if (name != null || !DungeonSecrets.isRoomsLoaded() || findRoom != null && !findRoom.isDone()) {
+ if (!type.needsScanning() || name != null || !DungeonSecrets.isRoomsLoaded() || findRoom != null && !findRoom.isDone()) {
return;
}
MinecraftClient client = MinecraftClient.getInstance();
@@ -201,18 +201,18 @@ public class Room {
}
}
- private Category getCategory(JsonObject categoryJson) {
+ private SecretWaypoint.Category getCategory(JsonObject categoryJson) {
return switch (categoryJson.get("category").getAsString()) {
- case "entrance" -> Category.ENTRANCE;
- case "superboom" -> Category.SUPERBOOM;
- case "chest" -> Category.CHEST;
- case "item" -> Category.ITEM;
- case "bat" -> Category.BAT;
- case "wither" -> Category.WITHER;
- case "lever" -> Category.LEVER;
- case "fairysoul" -> Category.FAIRYSOUL;
- case "stonk" -> Category.STONK;
- default -> Category.DEFAULT;
+ case "entrance" -> SecretWaypoint.Category.ENTRANCE;
+ case "superboom" -> SecretWaypoint.Category.SUPERBOOM;
+ case "chest" -> SecretWaypoint.Category.CHEST;
+ case "item" -> SecretWaypoint.Category.ITEM;
+ case "bat" -> SecretWaypoint.Category.BAT;
+ case "wither" -> SecretWaypoint.Category.WITHER;
+ case "lever" -> SecretWaypoint.Category.LEVER;
+ case "fairysoul" -> SecretWaypoint.Category.FAIRYSOUL;
+ case "stonk" -> SecretWaypoint.Category.STONK;
+ default -> SecretWaypoint.Category.DEFAULT;
};
}
@@ -248,6 +248,13 @@ public class Room {
Type(byte color) {
this.color = color;
}
+
+ private boolean needsScanning() {
+ return switch (this) {
+ case ROOM, PUZZLE, TRAP -> true;
+ default -> false;
+ };
+ }
}
private enum Shape {
@@ -272,28 +279,4 @@ public class Room {
public enum Direction {
NW, NE, SW, SE
}
-
- private record SecretWaypoint(int secretIndex, Category category, BlockPos pos, boolean missing) {
- }
-
- private enum Category {
- ENTRANCE(0, 255, 0),
- SUPERBOOM(255, 0, 0),
- CHEST(2, 213, 250),
- ITEM(2, 64, 250),
- BAT(142, 66, 0),
- WITHER(30, 30, 30),
- LEVER(250, 217, 2),
- FAIRYSOUL(255, 85, 255),
- STONK(146, 52, 235),
- DEFAULT(190, 255, 252);
- private final float[] colorComponents;
-
- Category(int... intColorComponents) {
- colorComponents = new float[intColorComponents.length];
- for (int i = 0; i < intColorComponents.length; i++) {
- colorComponents[i] = intColorComponents[i] / 255F;
- }
- }
- }
}
diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java
new file mode 100644
index 00000000..475229e0
--- /dev/null
+++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java
@@ -0,0 +1,26 @@
+package me.xmrvizzy.skyblocker.skyblock.dungeon.secrets;
+
+import net.minecraft.util.math.BlockPos;
+
+public record SecretWaypoint(int secretIndex, Category category, BlockPos pos, boolean missing) {
+ enum Category {
+ ENTRANCE(0, 255, 0),
+ SUPERBOOM(255, 0, 0),
+ CHEST(2, 213, 250),
+ ITEM(2, 64, 250),
+ BAT(142, 66, 0),
+ WITHER(30, 30, 30),
+ LEVER(250, 217, 2),
+ FAIRYSOUL(255, 85, 255),
+ STONK(146, 52, 235),
+ DEFAULT(190, 255, 252);
+ final float[] colorComponents;
+
+ Category(int... intColorComponents) {
+ colorComponents = new float[intColorComponents.length];
+ for (int i = 0; i < intColorComponents.length; i++) {
+ colorComponents[i] = intColorComponents[i] / 255F;
+ }
+ }
+ }
+}