From 2a13974954867ab519e5e2af8cffc629bbb5de24 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Tue, 11 Jul 2023 10:39:38 +0800 Subject: Add Dungeon Secret Waypoint options --- src/main/resources/assets/skyblocker/lang/en_us.json | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/main/resources/assets/skyblocker/lang/en_us.json') diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 016d6d28..16684a41 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -198,6 +198,9 @@ "text.autoconfig.skyblocker.option.locations.barn.solveHungryHiker": "Solve Hungry Hiker", "text.autoconfig.skyblocker.option.locations.barn.solveTreasureHunter": "Solve Treasure Hunter", "text.autoconfig.skyblocker.option.locations.dungeons": "Dungeons", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints": "Dungeon Secret Waypoints", + "text.autoconfig.skyblocker.option.locations.dungeons.noLoadSecretWaypoints": "Not Load Secret Waypoints", + "text.autoconfig.skyblocker.option.locations.dungeons.noLoadSecretWaypoints.@Tooltip": "This option can save around 40 MB of ram if enabled, but Secret Waypoint will require a restart after turning off this option to work.", "text.autoconfig.skyblocker.option.locations.dungeons.croesusHelper": "Croesus Helper", "text.autoconfig.skyblocker.option.locations.dungeons.croesusHelper.@Tooltip": "Gray out chests that have already been opened.", "text.autoconfig.skyblocker.option.locations.dungeons.enableMap": "Enable Map", -- cgit From dde565cd0fd822386fd4a6fe0663a65c3c6c629b Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sun, 16 Jul 2023 11:51:19 +0800 Subject: Update ram usage data --- src/main/resources/assets/skyblocker/lang/en_us.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/resources/assets/skyblocker/lang/en_us.json') diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 16684a41..86054ba4 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -200,7 +200,7 @@ "text.autoconfig.skyblocker.option.locations.dungeons": "Dungeons", "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints": "Dungeon Secret Waypoints", "text.autoconfig.skyblocker.option.locations.dungeons.noLoadSecretWaypoints": "Not Load Secret Waypoints", - "text.autoconfig.skyblocker.option.locations.dungeons.noLoadSecretWaypoints.@Tooltip": "This option can save around 40 MB of ram if enabled, but Secret Waypoint will require a restart after turning off this option to work.", + "text.autoconfig.skyblocker.option.locations.dungeons.noLoadSecretWaypoints.@Tooltip": "This option can save around 20 MB of ram if enabled, but Secret Waypoint will require a restart after turning off this option to work.", "text.autoconfig.skyblocker.option.locations.dungeons.croesusHelper": "Croesus Helper", "text.autoconfig.skyblocker.option.locations.dungeons.croesusHelper.@Tooltip": "Gray out chests that have already been opened.", "text.autoconfig.skyblocker.option.locations.dungeons.enableMap": "Enable Map", -- cgit From 58616218d5d0c5359bdc1d84f226a0a1b08a71b2 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sun, 16 Jul 2023 16:13:22 +0800 Subject: Add room position utils and physical room position parsing --- .../skyblock/dungeon/secrets/DungeonMapUtils.java | 129 +++++++++++++++++---- .../skyblock/dungeon/secrets/DungeonSecrets.java | 18 ++- .../skyblocker/skyblock/dungeon/secrets/Room.java | 27 +++++ .../resources/assets/skyblocker/lang/en_us.json | 2 + 4 files changed, 149 insertions(+), 27 deletions(-) create mode 100644 src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/Room.java (limited to 'src/main/resources/assets/skyblocker/lang/en_us.json') diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonMapUtils.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonMapUtils.java index 9d1c7ccb..4ce9be06 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonMapUtils.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonMapUtils.java @@ -3,50 +3,135 @@ package me.xmrvizzy.skyblocker.skyblock.dungeon.secrets; import net.minecraft.block.MapColor; import net.minecraft.item.map.MapIcon; import net.minecraft.item.map.MapState; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.joml.RoundingMode; import org.joml.Vector2i; +import org.joml.Vector2ic; public class DungeonMapUtils { - public static final byte ENTRANCE_COLOR = MapColor.DARK_GREEN.getRenderColorByte(MapColor.Brightness.HIGH); - public static final byte ROOM_COLOR = MapColor.ORANGE.getRenderColorByte(MapColor.Brightness.LOWEST); - public static final byte PUZZLE_COLOR = MapColor.MAGENTA.getRenderColorByte(MapColor.Brightness.HIGH); - public static final byte MINIBOSS_COLOR = MapColor.YELLOW.getRenderColorByte(MapColor.Brightness.HIGH); - public static final byte FAIRY_COLOR = MapColor.PINK.getRenderColorByte(MapColor.Brightness.HIGH); - public static final byte BLOOD_COLOR = MapColor.BRIGHT_RED.getRenderColorByte(MapColor.Brightness.HIGH); - public static final byte UNKNOWN_COLOR = MapColor.GRAY.getRenderColorByte(MapColor.Brightness.NORMAL); public static final byte BLACK_COLOR = MapColor.BLACK.getRenderColorByte(MapColor.Brightness.LOWEST); public static final byte WHITE_COLOR = MapColor.WHITE.getRenderColorByte(MapColor.Brightness.HIGH); - public static Vector2i getEntrancePos(MapState map) { + @Nullable + private static Vector2i getMapPlayerPos(MapState map) { for (MapIcon icon : map.getIcons()) { if (icon.getType() == MapIcon.Type.FRAME) { - int x = (icon.getX() >> 1) + 64; - int z = (icon.getZ() >> 1) + 64; - if (getColor(map, x, z) == ENTRANCE_COLOR) { - while (getColor(map, x - 1, z) == ENTRANCE_COLOR) { - x--; - } - while (getColor(map, x, z - 1) == ENTRANCE_COLOR) { - z--; - } - return new Vector2i(x, z); - } + return new Vector2i((icon.getX() >> 1) + 64, (icon.getZ() >> 1) + 64); } } return null; } - public static int getRoomWidth(MapState map, Vector2i entrancePos) { + @Nullable + public static Vector2ic getMapEntrancePos(MapState map) { + Vector2i mapPos = getMapPlayerPos(map); + if (!isEntranceColor(getColor(map, mapPos))) { + return null; + } + // noinspection StatementWithEmptyBody, DataFlowIssue + while (isEntranceColor(getColor(map, mapPos.sub(1, 0)))) { + } + //noinspection StatementWithEmptyBody + while (isEntranceColor(getColor(map, mapPos.sub(0, 1)))) { + } + return mapPos; + } + + public static int getMapRoomWidth(MapState map, Vector2ic entrancePos) { int i = 0; - while (getColor(map, entrancePos.x + i, entrancePos.y) == ENTRANCE_COLOR) { - i++; + //noinspection StatementWithEmptyBody + while (isEntranceColor(getColor(map, entrancePos.x() + i++, entrancePos.y()))) { } return i; } + /** + * Gets the map position of the top left corner of the room the player is in. + * + * @param map the map + * @param entrancePos the map position of the top left corner of the entrance + * @param mapRoomWidth the width of a room on the map + * @return the map position of the top left corner of the room the player is in + * @implNote {@code mapPos} is shifted by 2 so room borders are evenly split. + * {@code mapPos} is then shifted by {@code offset} to align the top left most room at (0, 0) + * so subtracting the modulo will give the top left corner of the room shifted by {@code offset}. + * Finally, {@code mapPos} is shifted back by {@code offset} to its intended position. + */ + @Nullable + public static Vector2ic getMapRoomPos(MapState map, Vector2ic entrancePos, int mapRoomWidth) { + int mapRoomWidthWithGap = mapRoomWidth + 4; + Vector2i mapPos = getMapPlayerPos(map); + if (mapPos == null) { + return null; + } + Vector2ic offset = new Vector2i(entrancePos.x() % mapRoomWidthWithGap, entrancePos.y() % mapRoomWidthWithGap); + return mapPos.add(2, 2).sub(offset).sub(mapPos.x() % mapRoomWidthWithGap, mapPos.y() % mapRoomWidthWithGap).add(offset); + } + + /** + * Gets the map position of the top left corner of the room corresponding to the physical position of the northwest corner of a room. + * + * @param physicalEntrancePos the physical position of the northwest corner of the entrance room + * @param mapEntrancePos the map position of the top left corner of the entrance room + * @param mapRoomWidth the width of a room on the map + * @param physicalPos the physical position of the northwest corner of the room + * @return the map position of the top left corner of the room corresponding to the physical position of the northwest corner of a room + */ + public static Vector2ic getMapPosFromPhysical(Vector2ic physicalEntrancePos, Vector2ic mapEntrancePos, int mapRoomWidth, Vector2ic physicalPos) { + return new Vector2i(physicalPos).sub(physicalEntrancePos).div(32).mul(mapRoomWidth + 4).add(mapEntrancePos); + } + + @Nullable + public static Vector2ic getPhysicalEntrancePos(MapState map, @NotNull Vec3d playerPos) { + if (isEntranceColor(getColor(map, getMapPlayerPos(map)))) { + return getPhysicalRoomPos(playerPos); + } + return null; + } + + /** + * Gets the physical position of the northwest corner of the room the player is in. Hypixel Skyblock Dungeons are aligned to a 32 by 32 blocks grid, allowing corners to be calculated through math. + * + * @param playerPos the position of the player + * @return the physical position of the northwest corner of the room the player is in + * @implNote {@code physicalPos} is shifted by 0.5 so room borders are evenly split. + * {@code physicalPos} is further shifted by 8 because Hypixel offset dungeons by 8 blocks in Skyblock 0.12.3. + * Subtracting the modulo gives the northwest corner of the room shifted by 8. Finally, {@code physicalPos} is shifted back by 8 to its intended position. + */ + @NotNull + public static Vector2ic getPhysicalRoomPos(@NotNull Vec3d playerPos) { + Vector2i physicalPos = new Vector2i(playerPos.getX() + 8.5, playerPos.getZ() + 8.5, RoundingMode.TRUNCATE); + return physicalPos.sub(MathHelper.floorMod(physicalPos.x(), 32), MathHelper.floorMod(physicalPos.y(), 32)).sub(8, 8); + } + + /** + * Gets the physical position of the northwest corner of the room corresponding to the map position of the top left corner of a room. + * + * @param mapEntrancePos the map position of the top left corner of the entrance room + * @param mapRoomWidth the width of a room on the map + * @param physicalEntrancePos the physical position of the northwest corner of the entrance room + * @param mapPos the map position of the top left corner of the room + * @return the physical position of the northwest corner of the room corresponding to the map position of the top left corner of a room + */ + public static Vector2ic getPhysicalPosFromMap(Vector2ic mapEntrancePos, int mapRoomWidth, Vector2ic physicalEntrancePos, Vector2ic mapPos) { + return new Vector2i(mapPos).sub(mapEntrancePos).div(mapRoomWidth + 4).mul(32).add(physicalEntrancePos); + } + + private static byte getColor(MapState map, @Nullable Vector2ic pos) { + return pos == null ? -1 : getColor(map, pos.x(), pos.y()); + } + private static byte getColor(MapState map, int x, int z) { if (x < 0 || z < 0 || x >= 128 || z >= 128) { return -1; } return map.colors[x + (z << 7)]; } + + private static boolean isEntranceColor(byte color) { + return color == Room.RoomType.ENTRANCE.color; + } } diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java index 17446db7..01274ae4 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java @@ -9,9 +9,10 @@ import net.minecraft.item.FilledMapItem; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.item.map.MapState; +import net.minecraft.text.Text; import net.minecraft.util.Identifier; import org.jetbrains.annotations.Nullable; -import org.joml.Vector2i; +import org.joml.Vector2ic; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -43,8 +44,10 @@ public class DungeonSecrets { private static JsonObject waypointsJson; @Nullable private static CompletableFuture roomsLoaded; - private static Vector2i mapEntrancePos; + private static Vector2ic mapEntrancePos; private static int mapRoomWidth; + private static Vector2ic physicalEntrancePos; + private static Room currentRoom; public static boolean isRoomsLoaded() { return roomsLoaded != null && roomsLoaded.isDone(); @@ -106,7 +109,7 @@ public class DungeonSecrets { LOGGER.error("Failed to load dungeon secrets json", e); } }, MinecraftClient.getInstance())); - roomsLoaded = CompletableFuture.allOf(dungeonFutures.toArray(CompletableFuture[]::new)).thenRun(() -> LOGGER.info("Loaded dungeon secrets for {} dungeon(s), {} room shapes, and {} rooms total", ROOMS.size(), ROOMS.values().stream().mapToInt(HashMap::size).sum(), ROOMS.values().stream().map(HashMap::values).flatMap(Collection::stream).mapToInt(HashMap::size).sum())); + roomsLoaded = CompletableFuture.allOf(dungeonFutures.toArray(CompletableFuture[]::new)).thenRun(() -> LOGGER.info("[Skyblocker] Loaded dungeon secrets for {} dungeon(s), {} room shapes, and {} rooms total", ROOMS.size(), ROOMS.values().stream().mapToInt(HashMap::size).sum(), ROOMS.values().stream().map(HashMap::values).flatMap(Collection::stream).mapToInt(HashMap::size).sum())); } private static HashMap readRooms(Path roomShape, int resourcePathIndex) { @@ -146,11 +149,16 @@ public class DungeonSecrets { if (map == null) { return; } - if (mapEntrancePos == null && (mapEntrancePos = DungeonMapUtils.getEntrancePos(map)) == null) { + if (mapEntrancePos == null && (mapEntrancePos = DungeonMapUtils.getMapEntrancePos(map)) == null) { return; } - if (mapRoomWidth == 0 && (mapRoomWidth = DungeonMapUtils.getRoomWidth(map, mapEntrancePos)) == 0) { + if (mapRoomWidth == 0 && (mapRoomWidth = DungeonMapUtils.getMapRoomWidth(map, mapEntrancePos)) == 0) { return; } + if (physicalEntrancePos == null && (physicalEntrancePos = DungeonMapUtils.getPhysicalEntrancePos(map, client.player.getPos())) == null) { + client.player.sendMessage(Text.translatable("skyblocker.dungeons.secrets.physicalEntranceNotFound")); + return; + } + LOGGER.info("[Skyblocker] Detected dungeon with map room width {} and entrance at map pos {} and physical pos {}", mapRoomWidth, mapEntrancePos, physicalEntrancePos); } } 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 new file mode 100644 index 00000000..0ee7d7f4 --- /dev/null +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/Room.java @@ -0,0 +1,27 @@ +package me.xmrvizzy.skyblocker.skyblock.dungeon.secrets; + +import net.minecraft.block.MapColor; + +public class Room { + private final RoomType type; + private String name; + + public Room(RoomType type) { + this.type = type; + } + + public enum RoomType { + ENTRANCE(MapColor.DARK_GREEN.getRenderColorByte(MapColor.Brightness.HIGH)), + ROOM(MapColor.ORANGE.getRenderColorByte(MapColor.Brightness.LOWEST)), + PUZZLE(MapColor.MAGENTA.getRenderColorByte(MapColor.Brightness.HIGH)), + MINIBOSS(MapColor.YELLOW.getRenderColorByte(MapColor.Brightness.HIGH)), + FAIRY(MapColor.PINK.getRenderColorByte(MapColor.Brightness.HIGH)), + BLOOD(MapColor.BRIGHT_RED.getRenderColorByte(MapColor.Brightness.HIGH)), + UNKNOWN(MapColor.GRAY.getRenderColorByte(MapColor.Brightness.NORMAL)); + final byte color; + + RoomType(byte color) { + this.color = color; + } + } +} diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 86054ba4..90dfa3b9 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -283,6 +283,8 @@ "skyblocker.updaterepository.failed": "§b[§6Skyblocker§b] §cUpdating local repository failed. Remove files manually and restart game.", + "skyblocker.dungeons.secrets.physicalEntranceNotFound": "§b[§6Skyblocker§b] §cDungeon Entrance Room coordinates not found. Please go back to the green Entrance Room.", + "skyblocker.fishing.reelNow": "Reel in now!", "skyblocker.rift.healNow": "Heal now!", "skyblocker.rift.iceNow": "Ice now!", -- cgit From 7257ed162b44bcbe49241d4177e25981bdb32092 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Mon, 31 Jul 2023 12:17:20 +0800 Subject: Add secrets resetting --- .../skyblocker/config/SkyblockerConfig.java | 2 +- .../skyblock/dungeon/secrets/DungeonSecrets.java | 39 +++++++++++++++++----- .../skyblocker/skyblock/dungeon/secrets/Room.java | 2 +- .../resources/assets/skyblocker/lang/en_us.json | 4 +-- 4 files changed, 35 insertions(+), 12 deletions(-) (limited to 'src/main/resources/assets/skyblocker/lang/en_us.json') diff --git a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java index c7b84b25..8da4bb41 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java @@ -408,7 +408,7 @@ public class SkyblockerConfig implements ConfigData { public static class Dungeons { public boolean secretWaypoints = true; - public boolean noLoadSecretWaypoints = false; + public boolean noInitSecretWaypoints = false; @ConfigEntry.Gui.Tooltip() public boolean croesusHelper = true; public boolean enableMap = true; diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java index 94529726..7c0a0afb 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java @@ -16,6 +16,7 @@ import net.minecraft.item.Items; import net.minecraft.item.map.MapState; import net.minecraft.text.Text; import net.minecraft.util.Identifier; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.joml.Vector2ic; import org.slf4j.Logger; @@ -79,6 +80,7 @@ public class DungeonSecrets { /** * The map position of the top left corner of the entrance room. */ + @Nullable private static Vector2ic mapEntrancePos; /** * The size of a room on the map. @@ -87,7 +89,9 @@ public class DungeonSecrets { /** * The physical position of the northwest corner of the entrance room. */ + @Nullable private static Vector2ic physicalEntrancePos; + @NotNull private static final Map rooms = new HashMap<>(); private static Room currentRoom; @@ -108,7 +112,7 @@ public class DungeonSecrets { * Use {@link #isRoomsLoaded()} to check for completion of loading. */ public static void init() { - if (SkyblockerConfig.get().locations.dungeons.noLoadSecretWaypoints) { + if (SkyblockerConfig.get().locations.dungeons.noInitSecretWaypoints) { return; } CompletableFuture.runAsync(DungeonSecrets::load); @@ -186,7 +190,13 @@ public class DungeonSecrets { private static void update() { long startTime = System.currentTimeMillis(); - if (!SkyblockerConfig.get().locations.dungeons.secretWaypoints || !Utils.isInDungeons()) { + if (!SkyblockerConfig.get().locations.dungeons.secretWaypoints) { + return; + } + if (!Utils.isInDungeons()) { + if (mapEntrancePos != null) { + reset(); + } return; } MinecraftClient client = MinecraftClient.getInstance(); @@ -229,8 +239,7 @@ public class DungeonSecrets { if (room == null) { switch (type) { case ENTRANCE, PUZZLE, TRAP, MINIBOSS, FAIRY, BLOOD -> room = newRoom(type, physicalPos); - case ROOM -> - room = newRoom(type, DungeonMapUtils.getPhysicalPosFromMap(mapEntrancePos, mapRoomSize, physicalEntrancePos, DungeonMapUtils.getRoomSegments(map, mapPos, mapRoomSize, type.color))); + case ROOM -> room = newRoom(type, DungeonMapUtils.getPhysicalPosFromMap(mapEntrancePos, mapRoomSize, physicalEntrancePos, DungeonMapUtils.getRoomSegments(map, mapPos, mapRoomSize, type.color))); } } if (room != null && currentRoom != room) { @@ -248,12 +257,18 @@ public class DungeonSecrets { * @param type the type of room to create * @param physicalPositions the physical positions of the room */ + @Nullable private static Room newRoom(Room.Type type, Vector2ic... physicalPositions) { - Room newRoom = new Room(type, physicalPositions); - for (Vector2ic physicalPos : physicalPositions) { - rooms.put(physicalPos, newRoom); + try { + Room newRoom = new Room(type, physicalPositions); + for (Vector2ic physicalPos : physicalPositions) { + rooms.put(physicalPos, newRoom); + } + return newRoom; + } catch (IllegalArgumentException e) { + LOGGER.error("[Skyblocker] Failed to create room", e); } - return newRoom; + return null; } private static void render(WorldRenderContext context) { @@ -261,4 +276,12 @@ public class DungeonSecrets { currentRoom.render(context); } } + + private static void reset() { + mapEntrancePos = null; + mapRoomSize = 0; + physicalEntrancePos = null; + rooms.clear(); + currentRoom = null; + } } 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 84510997..0eae2793 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 @@ -97,7 +97,7 @@ public class Room { } else if (segmentsX.size() == 1 && segmentsY.size() > 1) { yield new Direction[]{Direction.NE, Direction.SW}; } - throw new IllegalStateException("Shape " + shape.shape + " does not match segments: " + Arrays.toString(segments.toArray())); + throw new IllegalArgumentException("Shape " + shape.shape + " does not match segments: " + Arrays.toString(segments.toArray())); } case L_SHAPE -> { if (!segments.contains(new Vector2i(segmentsX.firstInt(), segmentsY.firstInt()))) { diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 90dfa3b9..842c4591 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -199,8 +199,8 @@ "text.autoconfig.skyblocker.option.locations.barn.solveTreasureHunter": "Solve Treasure Hunter", "text.autoconfig.skyblocker.option.locations.dungeons": "Dungeons", "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints": "Dungeon Secret Waypoints", - "text.autoconfig.skyblocker.option.locations.dungeons.noLoadSecretWaypoints": "Not Load Secret Waypoints", - "text.autoconfig.skyblocker.option.locations.dungeons.noLoadSecretWaypoints.@Tooltip": "This option can save around 20 MB of ram if enabled, but Secret Waypoint will require a restart after turning off this option to work.", + "text.autoconfig.skyblocker.option.locations.dungeons.noInitSecretWaypoints": "Do Not Initialize Secret Waypoints", + "text.autoconfig.skyblocker.option.locations.dungeons.noInitSecretWaypoints.@Tooltip": "This option can save around 20 MB of ram if enabled, but Secret Waypoint will require a restart after turning off this option to work.", "text.autoconfig.skyblocker.option.locations.dungeons.croesusHelper": "Croesus Helper", "text.autoconfig.skyblocker.option.locations.dungeons.croesusHelper.@Tooltip": "Gray out chests that have already been opened.", "text.autoconfig.skyblocker.option.locations.dungeons.enableMap": "Enable Map", -- cgit From f51e8de1532b7fe052fe518638f46e9e5c5fd602 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sun, 20 Aug 2023 14:08:57 +0800 Subject: Make waypoint categories toggleable --- .../skyblocker/config/SkyblockerConfig.java | 22 ++++++++++++-- .../skyblock/dungeon/secrets/DungeonSecrets.java | 6 ++-- .../skyblocker/skyblock/dungeon/secrets/Room.java | 2 +- .../skyblock/dungeon/secrets/SecretWaypoint.java | 34 +++++++++++++--------- .../resources/assets/skyblocker/lang/en_us.json | 16 ++++++++-- 5 files changed, 59 insertions(+), 21 deletions(-) (limited to 'src/main/resources/assets/skyblocker/lang/en_us.json') diff --git a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java index 8da4bb41..6ddbdf65 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java @@ -407,8 +407,8 @@ public class SkyblockerConfig implements ConfigData { } public static class Dungeons { - public boolean secretWaypoints = true; - public boolean noInitSecretWaypoints = false; + @ConfigEntry.Gui.CollapsibleObject + public SecretWaypoints secretWaypoints = new SecretWaypoints(); @ConfigEntry.Gui.Tooltip() public boolean croesusHelper = true; public boolean enableMap = true; @@ -429,6 +429,24 @@ public class SkyblockerConfig implements ConfigData { public Terminals terminals = new Terminals(); } + public static class SecretWaypoints { + + public boolean enableSecretWaypoints = true; + @ConfigEntry.Gui.Tooltip() + public boolean noInitSecretWaypoints = false; + public boolean enableEntranceWaypoints = true; + public boolean enableSuperboomWaypoints = true; + public boolean enableChestWaypoints = true; + public boolean enableItemWaypoints = true; + public boolean enableBatWaypoints = true; + public boolean enableWitherWaypoints = true; + public boolean enableLeverWaypoints = true; + public boolean enableFairySoulWaypoints = true; + public boolean enableStonkWaypoints = true; + @ConfigEntry.Gui.Tooltip() + public boolean enableDefaultWaypoints = true; + } + public static class LividColor { @ConfigEntry.Gui.Tooltip() public boolean enableLividColor = true; diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java index 889c2829..11139971 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java @@ -120,7 +120,7 @@ public class DungeonSecrets { * Use {@link #isRoomsLoaded()} to check for completion of loading. */ public static void init() { - if (SkyblockerConfig.get().locations.dungeons.noInitSecretWaypoints) { + if (SkyblockerConfig.get().locations.dungeons.secretWaypoints.noInitSecretWaypoints) { return; } // Execute with MinecraftClient as executor since we need to wait for MinecraftClient#resourceManager to be set @@ -210,7 +210,7 @@ public class DungeonSecrets { */ @SuppressWarnings("JavadocReference") private static void update() { - if (!SkyblockerConfig.get().locations.dungeons.secretWaypoints) { + if (!SkyblockerConfig.get().locations.dungeons.secretWaypoints.enableSecretWaypoints) { return; } if (!Utils.isInDungeons()) { @@ -378,7 +378,7 @@ public class DungeonSecrets { * @return whether dungeon secrets should be processed */ private static boolean shouldProcess() { - return SkyblockerConfig.get().locations.dungeons.secretWaypoints && Utils.isInDungeons(); + return SkyblockerConfig.get().locations.dungeons.secretWaypoints.enableSecretWaypoints && Utils.isInDungeons(); } /** 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 0904a7f1..383e246d 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 @@ -324,7 +324,7 @@ public class Room { */ protected void render(WorldRenderContext context) { for (SecretWaypoint secretWaypoint : secretWaypoints.values()) { - if (secretWaypoint.isMissing()) { + if (secretWaypoint.shouldRender()) { secretWaypoint.render(context); } } 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 index 96fd7374..73a03fbc 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java @@ -1,6 +1,7 @@ package me.xmrvizzy.skyblocker.skyblock.dungeon.secrets; import com.google.gson.JsonObject; +import me.xmrvizzy.skyblocker.config.SkyblockerConfig; import me.xmrvizzy.skyblocker.utils.RenderHelper; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; import net.minecraft.client.MinecraftClient; @@ -10,6 +11,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import java.util.List; +import java.util.function.Predicate; public class SecretWaypoint { static final List SECRET_ITEMS = List.of("Decoy", "Defuse Kit", "Dungeon Chest Key", "Healing VIII", "Inflatable Jerry", "Spirit Leap", "Training Weights", "Trap", "Treasure Talisman"); @@ -29,8 +31,8 @@ public class SecretWaypoint { this.missing = true; } - public boolean isMissing() { - return missing; + public boolean shouldRender() { + return category.isEnabled() && missing; } public void setFound() { @@ -49,19 +51,21 @@ public class SecretWaypoint { } 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); + ENTRANCE(secretWaypoints -> secretWaypoints.enableEntranceWaypoints, 0, 255, 0), + SUPERBOOM(secretWaypoints -> secretWaypoints.enableSuperboomWaypoints, 255, 0, 0), + CHEST(secretWaypoints -> secretWaypoints.enableChestWaypoints, 2, 213, 250), + ITEM(secretWaypoints -> secretWaypoints.enableItemWaypoints, 2, 64, 250), + BAT(secretWaypoints -> secretWaypoints.enableBatWaypoints, 142, 66, 0), + WITHER(secretWaypoints -> secretWaypoints.enableWitherWaypoints, 30, 30, 30), + LEVER(secretWaypoints -> secretWaypoints.enableLeverWaypoints, 250, 217, 2), + FAIRYSOUL(secretWaypoints -> secretWaypoints.enableFairySoulWaypoints, 255, 85, 255), + STONK(secretWaypoints -> secretWaypoints.enableStonkWaypoints, 146, 52, 235), + DEFAULT(secretWaypoints -> secretWaypoints.enableDefaultWaypoints, 190, 255, 252); + private final Predicate enabledPredicate; private final float[] colorComponents; - Category(int... intColorComponents) { + Category(Predicate enabledPredicate, int... intColorComponents) { + this.enabledPredicate = enabledPredicate; colorComponents = new float[intColorComponents.length]; for (int i = 0; i < intColorComponents.length; i++) { colorComponents[i] = intColorComponents[i] / 255F; @@ -90,5 +94,9 @@ public class SecretWaypoint { boolean needsItemPickup() { return this == ITEM || this == BAT; } + + boolean isEnabled() { + return enabledPredicate.test(SkyblockerConfig.get().locations.dungeons.secretWaypoints); + } } } diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 842c4591..59cfdcf5 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -199,8 +199,20 @@ "text.autoconfig.skyblocker.option.locations.barn.solveTreasureHunter": "Solve Treasure Hunter", "text.autoconfig.skyblocker.option.locations.dungeons": "Dungeons", "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints": "Dungeon Secret Waypoints", - "text.autoconfig.skyblocker.option.locations.dungeons.noInitSecretWaypoints": "Do Not Initialize Secret Waypoints", - "text.autoconfig.skyblocker.option.locations.dungeons.noInitSecretWaypoints.@Tooltip": "This option can save around 20 MB of ram if enabled, but Secret Waypoint will require a restart after turning off this option to work.", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enableSecretWaypoints": "Enable Dungeon Secret Waypoints", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.noInitSecretWaypoints": "Do Not Initialize Secret Waypoints", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.noInitSecretWaypoints.@Tooltip": "This option can save around 20 MB of ram if enabled, but Secret Waypoint will require a restart after turning off this option to work.", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enableEntranceWaypoints" : "Enable Entrance Waypoints", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enableSuperboomWaypoints" : "Enable Superboom Waypoints", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enableChestWaypoints" : "Enable Chest Waypoints", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enableItemWaypoints" : "Enable Item Waypoints", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enableBatWaypoints" : "Enable Bat Waypoints", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enableWitherWaypoints" : "Enable Wither Essence Waypoints", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enableLeverWaypoints" : "Enable Lever Waypoints", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enableFairySoulWaypoints" : "Enable Fairy Soul Waypoints", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enableStonkWaypoints" : "Enable Stonk Waypoints", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enableDefaultWaypoints" : "Enable Default Waypoints", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enableDefaultWaypoints.@Tooltip" : "This includes all waypoints that do not belong to a category.", "text.autoconfig.skyblocker.option.locations.dungeons.croesusHelper": "Croesus Helper", "text.autoconfig.skyblocker.option.locations.dungeons.croesusHelper.@Tooltip": "Gray out chests that have already been opened.", "text.autoconfig.skyblocker.option.locations.dungeons.enableMap": "Enable Map", -- cgit From a015c67b635431d5bb9aa3208dfb1828a6fedc8c Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sun, 20 Aug 2023 15:38:11 +0800 Subject: Add ability to mark secrets as found or missing --- .../skyblock/dungeon/secrets/DungeonSecrets.java | 32 ++++++++++++++++++++++ .../skyblocker/skyblock/dungeon/secrets/Room.java | 4 +++ .../skyblock/dungeon/secrets/SecretWaypoint.java | 13 ++++++--- .../resources/assets/skyblocker/lang/en_us.json | 4 +++ 4 files changed, 49 insertions(+), 4 deletions(-) (limited to 'src/main/resources/assets/skyblocker/lang/en_us.json') diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java index 11139971..1a600309 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java @@ -3,12 +3,18 @@ package me.xmrvizzy.skyblocker.skyblock.dungeon.secrets; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.mojang.brigadier.Command; +import com.mojang.brigadier.arguments.IntegerArgumentType; +import com.mojang.brigadier.builder.ArgumentBuilder; +import com.mojang.brigadier.builder.RequiredArgumentBuilder; import it.unimi.dsi.fastutil.objects.Object2ByteMap; import it.unimi.dsi.fastutil.objects.Object2ByteOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectIntPair; import me.xmrvizzy.skyblocker.SkyblockerMod; import me.xmrvizzy.skyblocker.config.SkyblockerConfig; import me.xmrvizzy.skyblocker.utils.Utils; +import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; @@ -42,6 +48,9 @@ import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.zip.InflaterInputStream; +import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.argument; +import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal; + public class DungeonSecrets { protected static final Logger LOGGER = LoggerFactory.getLogger(DungeonSecrets.class); private static final String DUNGEONS_PATH = "dungeons"; @@ -133,6 +142,9 @@ public class DungeonSecrets { ClientReceiveMessageEvents.GAME.register(DungeonSecrets::onChatMessage); ClientReceiveMessageEvents.GAME_CANCELED.register(DungeonSecrets::onChatMessage); UseBlockCallback.EVENT.register((player, world, hand, hitResult) -> onUseBlock(world, hitResult)); + ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> dispatcher.register(literal(SkyblockerMod.NAMESPACE).then(literal("dungeons").then(literal("secrets") + .then(literal("markAsFound").then(markSecretsCommand(true))) + .then(literal("markAsMissing").then(markSecretsCommand(false))))))); } private static void load() { @@ -184,6 +196,18 @@ public class DungeonSecrets { } } + private static ArgumentBuilder> markSecretsCommand(boolean found) { + return argument("secret", IntegerArgumentType.integer()).executes(context -> { + int secretIndex = IntegerArgumentType.getInteger(context, "secret"); + if (markSecrets(secretIndex, found)) { + context.getSource().sendFeedback(Text.translatable(found ? "skyblocker.dungeons.secrets.markSecretFound" : "skyblocker.dungeons.secrets.markSecretMissing", secretIndex)); + } else { + context.getSource().sendError(Text.translatable(found ? "skyblocker.dungeons.secrets.markSecretFoundUnable" : "skyblocker.dungeons.secrets.markSecretMissingUnable", secretIndex)); + } + return Command.SINGLE_SUCCESS; + }); + } + /** * Updates the dungeon. The general idea is similar to the Dungeon Rooms Mod. *

@@ -339,6 +363,14 @@ public class DungeonSecrets { } } + public static boolean markSecrets(int secretIndex, boolean found) { + if (isCurrentRoomMatched()) { + currentRoom.markSecrets(secretIndex, found); + return true; + } + return false; + } + /** * Gets the room at the given physical position. * 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 c8bb27aa..3f69fca8 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 @@ -397,6 +397,10 @@ public class Room { DungeonSecrets.LOGGER.info(msg, args); } + protected void markSecrets(int secretIndex, boolean found) { + secretWaypoints.row(secretIndex).values().forEach(SecretWaypoint.getStatusSetter(found)); + } + public enum Type { ENTRANCE(MapColor.DARK_GREEN.getRenderColorByte(MapColor.Brightness.HIGH)), ROOM(MapColor.ORANGE.getRenderColorByte(MapColor.Brightness.LOWEST)), 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 index 3da9f487..e44f2ebe 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java @@ -12,6 +12,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import java.util.List; +import java.util.function.Consumer; import java.util.function.Predicate; import java.util.function.ToDoubleFunction; @@ -20,8 +21,8 @@ public class SecretWaypoint { final int secretIndex; final Category category; private final Text name; - final BlockPos pos; - final Vec3d centerPos; + private final BlockPos pos; + private final Vec3d centerPos; private boolean missing; SecretWaypoint(int secretIndex, JsonObject waypoint, String name, BlockPos pos) { @@ -41,7 +42,11 @@ public class SecretWaypoint { return secretWaypoint -> entity.squaredDistanceTo(secretWaypoint.centerPos) <= 36D; } - public boolean shouldRender() { + static Consumer getStatusSetter(boolean found) { + return secretWaypoint -> secretWaypoint.missing = !found; + } + + boolean shouldRender() { return category.isEnabled() && missing; } @@ -53,7 +58,7 @@ public class SecretWaypoint { return category.needsItemPickup(); } - public void setFound() { + void setFound() { this.missing = false; } diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 59cfdcf5..3af39c39 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -296,6 +296,10 @@ "skyblocker.updaterepository.failed": "§b[§6Skyblocker§b] §cUpdating local repository failed. Remove files manually and restart game.", "skyblocker.dungeons.secrets.physicalEntranceNotFound": "§b[§6Skyblocker§b] §cDungeon Entrance Room coordinates not found. Please go back to the green Entrance Room.", + "skyblocker.dungeons.secrets.markSecretFound": "§b[§6Skyblocker§b] §aMarked secret #%d as found.", + "skyblocker.dungeons.secrets.markSecretMissing": "§b[§6Skyblocker§b] §aMarked secret #%d as missing.", + "skyblocker.dungeons.secrets.markSecretFoundUnable": "§b[§6Skyblocker§b] §cUnable to mark secret #%d as found.", + "skyblocker.dungeons.secrets.markSecretMissingUnable": "§b[§6Skyblocker§b] §cUnable to mark secret #%d as missing.", "skyblocker.fishing.reelNow": "Reel in now!", "skyblocker.rift.healNow": "Heal now!", -- cgit From 761952420f1cf9896bd69a534a338d64658bab59 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sun, 27 Aug 2023 13:59:46 +0800 Subject: Update markSecrets --- .../skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java | 3 +-- .../me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/Room.java | 10 ++++++++-- src/main/resources/assets/skyblocker/lang/en_us.json | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src/main/resources/assets/skyblocker/lang/en_us.json') diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java index 9e339b3c..c916a5e4 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java @@ -367,8 +367,7 @@ public class DungeonSecrets { public static boolean markSecrets(int secretIndex, boolean found) { if (isCurrentRoomMatched()) { - currentRoom.markSecrets(secretIndex, found); - return true; + return currentRoom.markSecrets(secretIndex, found); } return false; } 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 3a03e9ee..fc62150c 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 @@ -400,8 +400,14 @@ public class Room { DungeonSecrets.LOGGER.info(msg, args); } - protected void markSecrets(int secretIndex, boolean found) { - secretWaypoints.row(secretIndex).values().forEach(found ? SecretWaypoint::setFound : SecretWaypoint::setMissing); + protected boolean markSecrets(int secretIndex, boolean found) { + Map secret = secretWaypoints.row(secretIndex); + if (secret.isEmpty()) { + return false; + } else { + secret.values().forEach(found ? SecretWaypoint::setFound : SecretWaypoint::setMissing); + return true; + } } public enum Type { diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 3af39c39..1a9e01fe 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -296,8 +296,8 @@ "skyblocker.updaterepository.failed": "§b[§6Skyblocker§b] §cUpdating local repository failed. Remove files manually and restart game.", "skyblocker.dungeons.secrets.physicalEntranceNotFound": "§b[§6Skyblocker§b] §cDungeon Entrance Room coordinates not found. Please go back to the green Entrance Room.", - "skyblocker.dungeons.secrets.markSecretFound": "§b[§6Skyblocker§b] §aMarked secret #%d as found.", - "skyblocker.dungeons.secrets.markSecretMissing": "§b[§6Skyblocker§b] §aMarked secret #%d as missing.", + "skyblocker.dungeons.secrets.markSecretFound": "§b[§6Skyblocker§b] §rMarked secret #%d as found.", + "skyblocker.dungeons.secrets.markSecretMissing": "§b[§6Skyblocker§b] §rMarked secret #%d as missing.", "skyblocker.dungeons.secrets.markSecretFoundUnable": "§b[§6Skyblocker§b] §cUnable to mark secret #%d as found.", "skyblocker.dungeons.secrets.markSecretMissingUnable": "§b[§6Skyblocker§b] §cUnable to mark secret #%d as missing.", -- cgit