diff options
Diffstat (limited to 'src/main/java/de/hysky/skyblocker')
5 files changed, 48 insertions, 12 deletions
diff --git a/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java index a15424a7..62b0ebf9 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java @@ -83,7 +83,7 @@ public class DwarvenMinesCategory { .controller(ConfigUtils::createBooleanController) .build()) .build()) - //crystal HUD //todo add descriptions to features + //crystal HUD .group(OptionGroup.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.crystalsHud")) .collapsed(false) @@ -101,13 +101,15 @@ public class DwarvenMinesCategory { .build()) .option(Option.<Boolean>createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.crystalsHud.showLocations")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.crystalsHud.showLocations.@Tooltip"))) .binding(defaults.locations.dwarvenMines.crystalsHud.showLocations, () -> config.locations.dwarvenMines.crystalsHud.showLocations, newValue -> config.locations.dwarvenMines.crystalsHud.showLocations = newValue) .controller(ConfigUtils::createBooleanController) .build()) .option(Option.<Integer>createBuilder() - .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.crystalsHud.locationSize")) + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.crystalsHud.showLocations.locationSize")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.crystalsHud.showLocations.locationSize.@Tooltip"))) .binding(defaults.locations.dwarvenMines.crystalsHud.locationSize, () -> config.locations.dwarvenMines.crystalsHud.locationSize, newValue -> config.locations.dwarvenMines.crystalsHud.locationSize = newValue) @@ -120,6 +122,7 @@ public class DwarvenMinesCategory { .collapsed(false) .option(Option.<Boolean>createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.crystalsWaypoints.enabled")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.crystalsWaypoints.enabled.@Tooltip"))) .binding(defaults.locations.dwarvenMines.crystalsWaypoints.enabled, () -> config.locations.dwarvenMines.crystalsWaypoints.enabled, newValue -> config.locations.dwarvenMines.crystalsWaypoints.enabled = newValue) @@ -127,6 +130,7 @@ public class DwarvenMinesCategory { .build()) .option(Option.<Boolean>createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.crystalsWaypoints.findInChat")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.crystalsWaypoints.findInChat.@Tooltip"))) .binding(defaults.locations.dwarvenMines.crystalsWaypoints.findInChat, () -> config.locations.dwarvenMines.crystalsWaypoints.findInChat, newValue -> config.locations.dwarvenMines.crystalsWaypoints.findInChat = newValue) diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java index e9dfd6ac..9212d74f 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsHud.java @@ -2,6 +2,8 @@ package de.hysky.skyblocker.skyblock.dwarven; import de.hysky.skyblocker.SkyblockerMod; import de.hysky.skyblocker.config.SkyblockerConfigManager; +import de.hysky.skyblocker.skyblock.dungeon.secrets.DungeonManager; +import de.hysky.skyblocker.skyblock.dungeon.secrets.Room; import de.hysky.skyblocker.utils.Utils; import de.hysky.skyblocker.utils.scheduler.Scheduler; import it.unimi.dsi.fastutil.Pair; @@ -29,10 +31,6 @@ public class CrystalsHud { public static boolean visible = false; - - - - public static void init() { ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> dispatcher.register(ClientCommandManager.literal("skyblocker") .then(ClientCommandManager.literal("hud") @@ -55,6 +53,14 @@ public class CrystalsHud { return IntIntPair.of(62, 62); } + + /** + * Renders the map to the players UI. renders the background image ({@link CrystalsHud#MAP_TEXTURE}) of the map then if enabled special locations on the map. then finally the player to the map. + * + * @param context DrawContext to draw map to + * @param hudX Top left X coordinate of the map + * @param hudY Top left Y coordinate of the map + */ public static void render( DrawContext context, int hudX, int hudY) { //draw map texture context. @@ -89,6 +95,13 @@ public class CrystalsHud { //todo add direction and scale (can not work out how to rotate) } + /** + * Converts an X and Z coordinate in the crystal hollow to a X and Y coordinate on the map. + * + * @param x the world X coordinate + * @param z the world Z coordinate + * @return the pair of values for x and y + */ private static Pair<Integer, Integer> transformLocation(double x, double z){ //converts an x and z to a location on the map int transformedX = (int)((x-202)/621 * 62); @@ -98,7 +111,10 @@ public class CrystalsHud { return Pair.of(transformedX,transformedY); } - + /** + * Works out if the crystals map should be rendered and sets {@link CrystalsHud#visible} accordingly. + * + */ public static void update() { if (client.player == null || client.getNetworkHandler() == null || !SkyblockerConfigManager.get().locations.dwarvenMines.crystalsHud.enabled) { visible = false; diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java index 181a8750..d7deed25 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java @@ -43,7 +43,9 @@ import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.lit public class CrystalsLocationsManager { public static final MinecraftClient client = MinecraftClient.getInstance(); - + /** + * A look-up table to convert between location names and waypoint in the {@link CrystalsWaypoint.Category} values. + */ public static final Map<String, CrystalsWaypoint.Category> WAYPOINTLOCATIONS = Map.of( "Jungle Temple", CrystalsWaypoint.Category.JUNGLETEMPLE, "Mines Of Divan", CrystalsWaypoint.Category.MINESOFDIVAN, @@ -94,8 +96,6 @@ public class CrystalsLocationsManager { } client.player.sendMessage(getLocationInputText(location), false); } - - } private static Boolean checkInCrystals(BlockPos pos){ //checks if a location is inside crystal hollows bounds diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsWaypoint.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsWaypoint.java index 39509c41..3ae56c47 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsWaypoint.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsWaypoint.java @@ -80,7 +80,9 @@ public class CrystalsWaypoint extends Waypoint { } - + /** + * enum for the different waypoints used int the crystals hud each with a {@link Category#name} and associated {@link Category#color} + */ enum Category implements StringIdentifiable { JUNGLETEMPLE("Jungle Temple",Color.GREEN), MINESOFDIVAN("Mines Of Divan",Color.CYAN), diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java index e7ffe362..fb055b87 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/DwarvenHud.java @@ -67,7 +67,12 @@ public class DwarvenHud { }); } - public static Pair<IntIntPair,IntIntPair> getDimForConfig(List<Commission> commissions) { //todo add powder + /** + * Gets the dimensions (width, height) for the commissions hud and the powder hud + * @param commissions what commissions to get the dimensions for + * @return a {@link Pair} of {@link IntIntPair} with the first pair being for the commissions hud and the second pair being for the powder hud + */ + public static Pair<IntIntPair,IntIntPair> getDimForConfig(List<Commission> commissions) { return switch (SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.style) { case SIMPLE -> { HudCommsWidget.INSTANCE_CFG.updateData(commissions, false); @@ -111,6 +116,15 @@ public class DwarvenHud { } } + /** + * Renders hud to window without using the widget rendering + * @param context DrawContext to draw the hud to + * @param comHudX X coordinate of the commissions hud + * @param comHudY Y coordinate of the commissions hud + * @param powderHudX X coordinate of the powder hud + * @param powderHudY Y coordinate of the powder hud + * @param commissions the commissions to render to the commissions hud + */ public static void renderClassic(DrawContext context, int comHudX, int comHudY, int powderHudX, int powderHudY, List<Commission> commissions) { if (SkyblockerConfigManager.get().locations.dwarvenMines.dwarvenHud.enableBackground) { context.fill(comHudX, comHudY, comHudX + 200, comHudY + (20 * commissions.size()), 0x64000000); |