From 00340f5d7df495f7351159e9da86e74b1b5fd2a9 Mon Sep 17 00:00:00 2001 From: Kevin <92656833+kevinthegreat1@users.noreply.github.com> Date: Tue, 17 Oct 2023 19:53:55 -0400 Subject: Refactor NEU Repo (#364) Add RepoParser Fix Golden Dragon stats leveling Add wiki option Fix recipe output count --- .../hysky/skyblocker/config/SkyblockerConfig.java | 231 +++++++++++---------- 1 file changed, 121 insertions(+), 110 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java') diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index 189c6af7..107fe26e 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -16,7 +16,7 @@ import java.util.List; public class SkyblockerConfig { @SerialEntry public int version = 1; - + @SerialEntry public General general = new General(); @@ -117,7 +117,7 @@ public class SkyblockerConfig { @SerialEntry public String uiTitle; - + @SerialEntry public String clickEvent; } @@ -137,10 +137,10 @@ public class SkyblockerConfig { @SerialEntry public String itemName; - + @SerialEntry public int count; - + @SerialEntry public String nbt; } @@ -148,16 +148,16 @@ public class SkyblockerConfig { public static class General { @SerialEntry public boolean acceptReparty = true; - + @SerialEntry public boolean backpackPreviewWithoutShift = false; - + @SerialEntry public boolean compactorDeletorPreview = true; - + @SerialEntry public boolean hideEmptyTooltips = true; - + @SerialEntry public boolean hideStatusEffectOverlay = false; @@ -181,7 +181,7 @@ public class SkyblockerConfig { @SerialEntry public Shortcuts shortcuts = new Shortcuts(); - + @SerialEntry public QuiverWarning quiverWarning = new QuiverWarning(); @@ -193,7 +193,10 @@ public class SkyblockerConfig { @SerialEntry public ItemInfoDisplay itemInfoDisplay = new ItemInfoDisplay(); - + + @SerialEntry + public WikiLookup wikiLookup = new WikiLookup(); + @SerialEntry public SpecialEffects specialEffects = new SpecialEffects(); @@ -208,7 +211,7 @@ public class SkyblockerConfig { @SerialEntry public List lockedSlots = new ArrayList<>(); - + @SerialEntry public ObjectOpenHashSet protectedItems = new ObjectOpenHashSet<>(); @@ -228,10 +231,10 @@ public class SkyblockerConfig { @SerialEntry public int tabHudScale = 100; - + @SerialEntry public boolean plainPlayerNames = false; - + @SerialEntry public NameSorting nameSorting = NameSorting.DEFAULT; } @@ -259,13 +262,13 @@ public class SkyblockerConfig { public static class BarPositions { @SerialEntry public BarPosition healthBarPosition = BarPosition.LAYER1; - + @SerialEntry public BarPosition manaBarPosition = BarPosition.LAYER1; - + @SerialEntry public BarPosition defenceBarPosition = BarPosition.LAYER1; - + @SerialEntry public BarPosition experienceBarPosition = BarPosition.LAYER1; @@ -292,10 +295,10 @@ public class SkyblockerConfig { public static class Experiments { @SerialEntry public boolean enableChronomatronSolver = true; - + @SerialEntry public boolean enableSuperpairsSolver = true; - + @SerialEntry public boolean enableUltrasequencerSolver = true; } @@ -308,10 +311,10 @@ public class SkyblockerConfig { public static class FairySouls { @SerialEntry public boolean enableFairySoulsHelper = false; - + @SerialEntry public boolean highlightFoundSouls = true; - + @SerialEntry public boolean highlightOnlyNearbySouls = false; } @@ -324,14 +327,14 @@ public class SkyblockerConfig { public static class Shortcuts { @SerialEntry public boolean enableShortcuts = true; - + @SerialEntry public boolean enableCommandShortcuts = true; - + @SerialEntry public boolean enableCommandArgShortcuts = true; } - + public static class QuiverWarning { @SerialEntry public boolean enableQuiverWarning = true; @@ -346,7 +349,7 @@ public class SkyblockerConfig { public static class Hitbox { @SerialEntry public boolean oldFarmlandHitbox = true; - + @SerialEntry public boolean oldLeverHitbox = false; } @@ -354,16 +357,16 @@ public class SkyblockerConfig { public static class TitleContainer { @SerialEntry public float titleContainerScale = 100; - + @SerialEntry public int x = 540; - + @SerialEntry public int y = 10; - + @SerialEntry public Direction direction = Direction.HORIZONTAL; - + @SerialEntry public Alignment alignment = Alignment.MIDDLE; } @@ -371,19 +374,19 @@ public class SkyblockerConfig { public static class TeleportOverlay { @SerialEntry public boolean enableTeleportOverlays = true; - + @SerialEntry public boolean enableWeirdTransmission = true; - + @SerialEntry public boolean enableInstantTransmission = true; - + @SerialEntry public boolean enableEtherTransmission = true; - + @SerialEntry public boolean enableSinrecallTransmission = true; - + @SerialEntry public boolean enableWitherImpact = true; } @@ -419,10 +422,10 @@ public class SkyblockerConfig { @SerialEntry public Info info = Info.LOCATION; - + @SerialEntry public boolean cycleMode = false; - + @SerialEntry public String customMessage = "Playing Skyblock"; } @@ -444,22 +447,22 @@ public class SkyblockerConfig { public static class ItemTooltip { @SerialEntry public boolean enableNPCPrice = true; - + @SerialEntry public boolean enableMotesPrice = true; - + @SerialEntry public boolean enableAvgBIN = true; - + @SerialEntry public Average avg = Average.THREE_DAY; - + @SerialEntry public boolean enableLowestBIN = true; - + @SerialEntry public boolean enableBazaarPrice = true; - + @SerialEntry public boolean enableMuseumDate = true; } @@ -467,14 +470,22 @@ public class SkyblockerConfig { public static class ItemInfoDisplay { @SerialEntry public boolean attributeShardInfo = true; - + @SerialEntry public boolean itemRarityBackgrounds = false; @SerialEntry public float itemRarityBackgroundsOpacity = 1f; } - + + public static class WikiLookup { + @SerialEntry + public boolean enableWikiLookup = true; + + @SerialEntry + public boolean officialWiki = false; + } + public static class SpecialEffects { @SerialEntry public boolean rareDungeonDropEffects = true; @@ -492,7 +503,7 @@ public class SkyblockerConfig { @SerialEntry public Rift rift = new Rift(); - + @SerialEntry public SpidersDen spidersDen = new SpidersDen(); } @@ -500,46 +511,46 @@ public class SkyblockerConfig { public static class Dungeons { @SerialEntry public SecretWaypoints secretWaypoints = new SecretWaypoints(); - + @SerialEntry public DungeonChestProfit dungeonChestProfit = new DungeonChestProfit(); - + @SerialEntry public boolean croesusHelper = true; - + @SerialEntry public boolean enableMap = true; - + @SerialEntry public float mapScaling = 1f; - + @SerialEntry public int mapX = 2; - + @SerialEntry public int mapY = 2; - + @SerialEntry public boolean starredMobGlow = true; - + @SerialEntry public boolean solveThreeWeirdos = true; - + @SerialEntry public boolean blazeSolver = true; @SerialEntry public boolean creeperSolver = true; - + @SerialEntry public boolean solveTrivia = true; - + @SerialEntry public boolean solveTicTacToe = true; - + @SerialEntry public LividColor lividColor = new LividColor(); - + @SerialEntry public Terminals terminals = new Terminals(); } @@ -547,72 +558,72 @@ public class SkyblockerConfig { public static class SecretWaypoints { @SerialEntry public boolean enableSecretWaypoints = true; - + @SerialEntry public boolean noInitSecretWaypoints = false; - + @SerialEntry public boolean enableEntranceWaypoints = true; - + @SerialEntry public boolean enableSuperboomWaypoints = true; - + @SerialEntry public boolean enableChestWaypoints = true; - + @SerialEntry public boolean enableItemWaypoints = true; - + @SerialEntry public boolean enableBatWaypoints = true; - + @SerialEntry public boolean enableWitherWaypoints = true; - + @SerialEntry public boolean enableLeverWaypoints = true; - + @SerialEntry public boolean enableFairySoulWaypoints = true; - + @SerialEntry public boolean enableStonkWaypoints = true; - + @SerialEntry public boolean enableDefaultWaypoints = true; } - + public static class DungeonChestProfit { @SerialEntry public boolean enableProfitCalculator = true; - + @SerialEntry public boolean includeKismet = false; - + @SerialEntry public boolean includeEssence = true; - + @SerialEntry public int neutralThreshold = 1000; - + @SerialEntry public Formatting neutralColor = Formatting.DARK_GRAY; - + @SerialEntry public Formatting profitColor = Formatting.DARK_GREEN; - + @SerialEntry public Formatting lossColor = Formatting.RED; - + @SerialEntry public Formatting incompleteColor = Formatting.BLUE; - + } public static class LividColor { @SerialEntry public boolean enableLividColor = true; - + @SerialEntry public String lividColorText = "The livid color is [color]"; } @@ -620,10 +631,10 @@ public class SkyblockerConfig { public static class Terminals { @SerialEntry public boolean solveColor = true; - + @SerialEntry public boolean solveOrder = true; - + @SerialEntry public boolean solveStartsWith = true; } @@ -631,13 +642,13 @@ public class SkyblockerConfig { public static class DwarvenMines { @SerialEntry public boolean enableDrillFuel = true; - + @SerialEntry public boolean solveFetchur = true; - + @SerialEntry public boolean solvePuzzler = true; - + @SerialEntry public DwarvenHud dwarvenHud = new DwarvenHud(); } @@ -645,16 +656,16 @@ public class SkyblockerConfig { public static class DwarvenHud { @SerialEntry public boolean enabled = true; - + @SerialEntry public DwarvenHudStyle style = DwarvenHudStyle.SIMPLE; - + @SerialEntry public boolean enableBackground = true; - + @SerialEntry public int x = 10; - + @SerialEntry public int y = 10; } @@ -675,7 +686,7 @@ public class SkyblockerConfig { public static class Barn { @SerialEntry public boolean solveHungryHiker = true; - + @SerialEntry public boolean solveTreasureHunter = true; } @@ -683,20 +694,20 @@ public class SkyblockerConfig { public static class Rift { @SerialEntry public boolean mirrorverseWaypoints = true; - + @SerialEntry public int mcGrubberStacks = 0; } - + public static class SpidersDen { @SerialEntry public Relics relics = new Relics(); } - + public static class Relics { @SerialEntry public boolean enableRelicsHelper = false; - + @SerialEntry public boolean highlightFoundRelics = true; } @@ -709,34 +720,34 @@ public class SkyblockerConfig { public static class VampireSlayer { @SerialEntry public boolean enableEffigyWaypoints = true; - + @SerialEntry public boolean compactEffigyWaypoints; - + @SerialEntry public int effigyUpdateFrequency = 5; - + @SerialEntry public boolean enableHolyIceIndicator = true; - + @SerialEntry public int holyIceIndicatorTickDelay = 10; @SerialEntry public int holyIceUpdateFrequency = 5; - + @SerialEntry public boolean enableHealingMelonIndicator = true; - + @SerialEntry public float healingMelonHealthThreshold = 4f; - + @SerialEntry public boolean enableSteakStakeIndicator = true; @SerialEntry public int steakStakeUpdateFrequency = 5; - + @SerialEntry public boolean enableManiaIndicator = true; @@ -747,34 +758,34 @@ public class SkyblockerConfig { public static class Messages { @SerialEntry public ChatFilterResult hideAbility = ChatFilterResult.PASS; - + @SerialEntry public ChatFilterResult hideHeal = ChatFilterResult.PASS; - + @SerialEntry public ChatFilterResult hideAOTE = ChatFilterResult.PASS; - + @SerialEntry public ChatFilterResult hideImplosion = ChatFilterResult.PASS; - + @SerialEntry public ChatFilterResult hideMoltenWave = ChatFilterResult.PASS; - + @SerialEntry public ChatFilterResult hideAds = ChatFilterResult.PASS; - + @SerialEntry public ChatFilterResult hideTeleportPad = ChatFilterResult.PASS; - + @SerialEntry public ChatFilterResult hideCombo = ChatFilterResult.PASS; - + @SerialEntry public ChatFilterResult hideAutopet = ChatFilterResult.PASS; - + @SerialEntry public ChatFilterResult hideShowOff = ChatFilterResult.PASS; - + @SerialEntry public boolean hideMana = false; } -- cgit From 38f3ec2348c0d02d3b2ef682bfbb62aa0a327cec Mon Sep 17 00:00:00 2001 From: Yasin Date: Wed, 18 Oct 2023 02:04:12 +0200 Subject: Change flame height (#370) --- .../hysky/skyblocker/config/SkyblockerConfig.java | 11 +++++++++++ .../config/categories/GeneralCategory.java | 20 ++++++++++++++++++++ .../mixin/InGameOverlayRendererMixin.java | 22 ++++++++++++++++++++++ .../resources/assets/skyblocker/lang/en_us.json | 3 +++ src/main/resources/skyblocker.mixins.json | 1 + 5 files changed, 57 insertions(+) create mode 100644 src/main/java/de/hysky/skyblocker/mixin/InGameOverlayRendererMixin.java (limited to 'src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java') diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index 107fe26e..4efcc1df 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -209,6 +209,9 @@ public class SkyblockerConfig { @SerialEntry public TeleportOverlay teleportOverlay = new TeleportOverlay(); + @SerialEntry + public FlameOverlay flameOverlay = new FlameOverlay(); + @SerialEntry public List lockedSlots = new ArrayList<>(); @@ -391,6 +394,14 @@ public class SkyblockerConfig { public boolean enableWitherImpact = true; } + public static class FlameOverlay { + @SerialEntry + public float flameHeight = 0f; + + @SerialEntry + public float flameOpacity = 0f; + } + public enum Direction { HORIZONTAL, VERTICAL; diff --git a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java index 80792ab9..635d192f 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java @@ -525,6 +525,26 @@ public class GeneralCategory { .controller(ConfigUtils::createBooleanController) .build()) .build()) + + //Flame Overlay + .group(OptionGroup.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.flameOverlay")) + .collapsed(true) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.flameOverlay.flameHeight")) + .binding(defaults.general.flameOverlay.flameHeight, + () -> config.general.flameOverlay.flameHeight, + newValue -> config.general.flameOverlay.flameHeight = newValue) + .controller(opt -> FloatSliderControllerBuilder.create(opt).range(0.0f, 0.5f).step(0.01f)) + .build()) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.flameOverlay.flameOpacity")) + .binding(defaults.general.flameOverlay.flameOpacity, + () -> config.general.flameOverlay.flameOpacity, + newValue -> config.general.flameOverlay.flameOpacity = newValue) + .controller(opt -> FloatSliderControllerBuilder.create(opt).range(0.0f, 0.8f).step(0.1f)) + .build()) + .build()) .build(); } } diff --git a/src/main/java/de/hysky/skyblocker/mixin/InGameOverlayRendererMixin.java b/src/main/java/de/hysky/skyblocker/mixin/InGameOverlayRendererMixin.java new file mode 100644 index 00000000..b957603a --- /dev/null +++ b/src/main/java/de/hysky/skyblocker/mixin/InGameOverlayRendererMixin.java @@ -0,0 +1,22 @@ +package de.hysky.skyblocker.mixin; + +import de.hysky.skyblocker.config.SkyblockerConfigManager; +import net.minecraft.client.gui.hud.InGameOverlayRenderer; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyArg; + +@Mixin(InGameOverlayRenderer.class) +public class InGameOverlayRendererMixin { + + @ModifyArg(method = "renderFireOverlay", index = 2, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/BufferBuilder;vertex(Lorg/joml/Matrix4f;FFF)Lnet/minecraft/client/render/VertexConsumer;")) + private static float configureFlameHeight(float y) { + return y - SkyblockerConfigManager.get().general.flameOverlay.flameHeight; + } + + @ModifyArg(method = "renderFireOverlay", index = 3, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/VertexConsumer;color(FFFF)Lnet/minecraft/client/render/VertexConsumer;")) + private static float configureFlameOpacity(float opacity) { + return opacity - SkyblockerConfigManager.get().general.flameOverlay.flameOpacity; + } + +} diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 90805b31..df58136c 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -107,6 +107,9 @@ "text.autoconfig.skyblocker.option.general.teleportOverlay.enableEtherTransmission": "Enable Ether Transmission Overlay", "text.autoconfig.skyblocker.option.general.teleportOverlay.enableSinrecallTransmission": "Enable Sinrecall Transmission Overlay", "text.autoconfig.skyblocker.option.general.teleportOverlay.enableWitherImpact": "Enable Wither Impact Overlay", + "text.autoconfig.skyblocker.option.general.flameOverlay": "Flame Overlay", + "text.autoconfig.skyblocker.option.general.flameOverlay.flameHeight": "Flame Height", + "text.autoconfig.skyblocker.option.general.flameOverlay.flameOpacity": "Flame Opacity", "skyblocker.itemTooltip.nullMessage": "§b[§6Skyblocker§b] §cItem price information on tooltip will renew in max 60 seconds. If not, check latest.log", "skyblocker.itemTooltip.noData": "§cNo Data", diff --git a/src/main/resources/skyblocker.mixins.json b/src/main/resources/skyblocker.mixins.json index efca46f7..4e7bfe16 100644 --- a/src/main/resources/skyblocker.mixins.json +++ b/src/main/resources/skyblocker.mixins.json @@ -16,6 +16,7 @@ "GenericContainerScreenHandlerMixin", "HandledScreenMixin", "InGameHudMixin", + "InGameOverlayRendererMixin", "InventoryScreenMixin", "ItemMixin", "ItemStackMixin", -- cgit From 132c33af264df143bc3e02087c76be20d94aebf5 Mon Sep 17 00:00:00 2001 From: Aaron <51387595+AzureAaron@users.noreply.github.com> Date: Wed, 18 Oct 2023 00:45:58 -0400 Subject: Secret Waypoint Rendering Customization --- .../hysky/skyblocker/config/SkyblockerConfig.java | 18 ++++++++++++++++++ .../config/categories/DungeonsCategory.java | 9 +++++++++ .../skyblocker/skyblock/dungeon/CreeperBeams.java | 8 ++++---- .../skyblocker/skyblock/dungeon/DungeonBlaze.java | 4 ++-- .../skyblocker/skyblock/dungeon/TicTacToe.java | 2 +- .../skyblock/dungeon/secrets/SecretWaypoint.java | 21 ++++++++++++++++++++- .../hysky/skyblocker/utils/render/RenderHelper.java | 4 +++- .../resources/assets/skyblocker/lang/en_us.json | 2 ++ 8 files changed, 59 insertions(+), 9 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java') diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index 4efcc1df..6622fa83 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -572,6 +572,9 @@ public class SkyblockerConfig { @SerialEntry public boolean noInitSecretWaypoints = false; + + @SerialEntry + public WaypointType waypointType = WaypointType.WAYPOINT; @SerialEntry public boolean enableEntranceWaypoints = true; @@ -603,6 +606,21 @@ public class SkyblockerConfig { @SerialEntry public boolean enableDefaultWaypoints = true; } + + public enum WaypointType { + WAYPOINT, + OUTLINE, + OUTLINED_WAYPOINT; + + @Override + public String toString() { + return switch (this) { + case WAYPOINT -> "Waypoint"; + case OUTLINE -> "Outline"; + case OUTLINED_WAYPOINT -> "Outlined Waypoint"; + }; + } + } public static class DungeonChestProfit { @SerialEntry diff --git a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java index a9c0c26b..89ac6f8e 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java @@ -2,6 +2,7 @@ package de.hysky.skyblocker.config.categories; import de.hysky.skyblocker.config.ConfigUtils; import de.hysky.skyblocker.config.SkyblockerConfig; +import de.hysky.skyblocker.config.SkyblockerConfig.WaypointType; import dev.isxander.yacl3.api.ButtonOption; import dev.isxander.yacl3.api.ConfigCategory; import dev.isxander.yacl3.api.Option; @@ -43,6 +44,14 @@ public class DungeonsCategory { .controller(ConfigUtils::createBooleanController) .flag(OptionFlag.GAME_RESTART) .build()) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.waypointType")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.waypointType.@Tooltip"))) + .binding(defaults.locations.dungeons.secretWaypoints.waypointType, + () -> config.locations.dungeons.secretWaypoints.waypointType, + newValue -> config.locations.dungeons.secretWaypoints.waypointType = newValue) + .controller(ConfigUtils::createEnumCyclingListController) + .build()) .option(Option.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enableEntranceWaypoints")) .binding(defaults.locations.dungeons.secretWaypoints.enableEntranceWaypoints, diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CreeperBeams.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CreeperBeams.java index 5356658e..08c22b27 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CreeperBeams.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/CreeperBeams.java @@ -238,12 +238,12 @@ public class CreeperBeams { // render either in a color if not created or faintly green if created public void render(WorldRenderContext wrc, float[] color) { if (toDo) { - RenderHelper.renderOutline(wrc, outlineOne, color, 3); - RenderHelper.renderOutline(wrc, outlineTwo, color, 3); + RenderHelper.renderOutline(wrc, outlineOne, color, 3, false); + RenderHelper.renderOutline(wrc, outlineTwo, color, 3, false); RenderHelper.renderLinesFromPoints(wrc, line, color, 1, 2); } else { - RenderHelper.renderOutline(wrc, outlineOne, LIME_COLOR_COMPONENTS, 1); - RenderHelper.renderOutline(wrc, outlineTwo, LIME_COLOR_COMPONENTS, 1); + RenderHelper.renderOutline(wrc, outlineOne, LIME_COLOR_COMPONENTS, 1, false); + RenderHelper.renderOutline(wrc, outlineTwo, LIME_COLOR_COMPONENTS, 1, false); RenderHelper.renderLinesFromPoints(wrc, line, LIME_COLOR_COMPONENTS, 0.75f, 1); } } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonBlaze.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonBlaze.java index cfb16b4d..f49a2f2e 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonBlaze.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/DungeonBlaze.java @@ -128,11 +128,11 @@ public class DungeonBlaze { */ private static void renderBlazeOutline(ArmorStandEntity blaze, ArmorStandEntity nextBlaze, WorldRenderContext wrc) { Box blazeBox = blaze.getBoundingBox().expand(0.3, 0.9, 0.3).offset(0, -1.1, 0); - RenderHelper.renderOutline(wrc, blazeBox, GREEN_COLOR_COMPONENTS, 5f); + RenderHelper.renderOutline(wrc, blazeBox, GREEN_COLOR_COMPONENTS, 5f, false); if (nextBlaze != null && nextBlaze.isAlive() && nextBlaze != blaze) { Box nextBlazeBox = nextBlaze.getBoundingBox().expand(0.3, 0.9, 0.3).offset(0, -1.1, 0); - RenderHelper.renderOutline(wrc, nextBlazeBox, WHITE_COLOR_COMPONENTS, 5f); + RenderHelper.renderOutline(wrc, nextBlazeBox, WHITE_COLOR_COMPONENTS, 5f, false); Vec3d blazeCenter = blazeBox.getCenter(); Vec3d nextBlazeCenter = nextBlazeBox.getCenter(); diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/TicTacToe.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/TicTacToe.java index 2d56c8a0..7f249e7d 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/TicTacToe.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/TicTacToe.java @@ -127,7 +127,7 @@ public class TicTacToe { private static void solutionRenderer(WorldRenderContext context) { try { if (SkyblockerConfigManager.get().locations.dungeons.solveTicTacToe && nextBestMoveToMake != null) { - RenderHelper.renderOutline(context, nextBestMoveToMake, RED_COLOR_COMPONENTS, 5); + RenderHelper.renderOutline(context, nextBestMoveToMake, RED_COLOR_COMPONENTS, 5, false); } } catch (Exception e) { LOGGER.error("[Skyblocker Tic Tac Toe] Encountered an exception while rendering the tic tac toe solution!", e); diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java index d2a31ea3..eb3b7041 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java @@ -11,6 +11,7 @@ import net.minecraft.entity.Entity; import net.minecraft.text.Text; import net.minecraft.util.Formatting; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Box; import net.minecraft.util.math.Vec3d; import java.util.List; @@ -75,7 +76,25 @@ public class SecretWaypoint { * Renders the secret waypoint, including a filled cube, a beacon beam, the name, and the distance from the player. */ void render(WorldRenderContext context) { - RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, pos, category.colorComponents, 0.5F); + switch (SkyblockerConfigManager.get().locations.dungeons.secretWaypoints.waypointType) { + case WAYPOINT: { + RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, pos, category.colorComponents, 0.5F); + + break; + } + case OUTLINE: { + RenderHelper.renderOutline(context, new Box(pos), category.colorComponents, 5F, true); + + break; + } + case OUTLINED_WAYPOINT : { + RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, pos, category.colorComponents, 0.5F); + RenderHelper.renderOutline(context, new Box(pos), category.colorComponents, 5F, true); + + break; + } + } + Vec3d posUp = centerPos.add(0, 1, 0); RenderHelper.renderText(context, name, posUp, true); double distance = context.camera().getPos().distanceTo(centerPos); diff --git a/src/main/java/de/hysky/skyblocker/utils/render/RenderHelper.java b/src/main/java/de/hysky/skyblocker/utils/render/RenderHelper.java index 4630149c..5ab698a7 100644 --- a/src/main/java/de/hysky/skyblocker/utils/render/RenderHelper.java +++ b/src/main/java/de/hysky/skyblocker/utils/render/RenderHelper.java @@ -78,7 +78,7 @@ public class RenderHelper { * Renders the outline of a box with the specified color components and line width. * This does not use renderer since renderer draws outline using debug lines with a fixed width. */ - public static void renderOutline(WorldRenderContext context, Box box, float[] colorComponents, float lineWidth) { + public static void renderOutline(WorldRenderContext context, Box box, float[] colorComponents, float lineWidth, boolean throughWalls) { if (FrustumUtils.isVisible(box)) { MatrixStack matrices = context.matrixStack(); Vec3d camera = context.camera().getPos(); @@ -90,6 +90,7 @@ public class RenderHelper { RenderSystem.lineWidth(lineWidth); RenderSystem.disableCull(); RenderSystem.enableDepthTest(); + RenderSystem.depthFunc(throughWalls ? GL11.GL_ALWAYS : GL11.GL_LEQUAL); matrices.push(); matrices.translate(-camera.getX(), -camera.getY(), -camera.getZ()); @@ -102,6 +103,7 @@ public class RenderHelper { RenderSystem.lineWidth(1f); RenderSystem.enableCull(); RenderSystem.disableDepthTest(); + RenderSystem.depthFunc(GL11.GL_LEQUAL); } } diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index df58136c..f39aa669 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -238,6 +238,8 @@ "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.waypointType": "Waypoint Type", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.waypointType.@Tooltip": "Waypoint: The standard waypoint.\n\nOutline: Outlines the secret in a box.\n\nOutlined Waypoint: Displays both a waypoint and an outline.", "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", -- cgit From 7773e425d3e2da1e4d4c0368be3067052f35139e Mon Sep 17 00:00:00 2001 From: Aaron <51387595+AzureAaron@users.noreply.github.com> Date: Wed, 18 Oct 2023 22:11:32 -0400 Subject: More Waypoint Customization --- .../hysky/skyblocker/config/SkyblockerConfig.java | 13 +++++++--- .../config/categories/DungeonsCategory.java | 7 +++++ .../skyblock/dungeon/secrets/SecretWaypoint.java | 30 +++++++++++++++------- .../resources/assets/skyblocker/lang/en_us.json | 3 ++- 4 files changed, 40 insertions(+), 13 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java') diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index 6622fa83..d7279bc8 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -575,6 +575,9 @@ public class SkyblockerConfig { @SerialEntry public WaypointType waypointType = WaypointType.WAYPOINT; + + @SerialEntry + public boolean showSecretText = true; @SerialEntry public boolean enableEntranceWaypoints = true; @@ -609,15 +612,19 @@ public class SkyblockerConfig { public enum WaypointType { WAYPOINT, - OUTLINE, - OUTLINED_WAYPOINT; + OUTLINED_WAYPOINT, + HIGHLIGHT, + OUTLINED_HIGHLIGHT, + OUTLINE; @Override public String toString() { return switch (this) { case WAYPOINT -> "Waypoint"; - case OUTLINE -> "Outline"; case OUTLINED_WAYPOINT -> "Outlined Waypoint"; + case HIGHLIGHT -> "Highlight"; + case OUTLINED_HIGHLIGHT -> "Outlined Highlight"; + case OUTLINE -> "Outline"; }; } } diff --git a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java index 89ac6f8e..7b32cb78 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java @@ -52,6 +52,13 @@ public class DungeonsCategory { newValue -> config.locations.dungeons.secretWaypoints.waypointType = newValue) .controller(ConfigUtils::createEnumCyclingListController) .build()) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.showSecretText")) + .binding(defaults.locations.dungeons.secretWaypoints.showSecretText, + () -> config.locations.dungeons.secretWaypoints.showSecretText, + newValue -> config.locations.dungeons.secretWaypoints.showSecretText = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) .option(Option.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enableEntranceWaypoints")) .binding(defaults.locations.dungeons.secretWaypoints.enableEntranceWaypoints, diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java index 9fc2e778..0d9bdff1 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java @@ -18,6 +18,8 @@ import java.util.function.Predicate; import java.util.function.ToDoubleFunction; public class SecretWaypoint { + private static final float HIGHLIGHT_ALPHA = 0.5f; + private static final float LINE_WIDTH = 5f; static final List SECRET_ITEMS = List.of("Decoy", "Defuse Kit", "Dungeon Chest Key", "Healing VIII", "Inflatable Jerry", "Spirit Leap", "Training Weights", "Trap", "Treasure Talisman"); final int secretIndex; final Category category; @@ -75,19 +77,29 @@ public class SecretWaypoint { * Renders the secret waypoint, including a filled cube, a beacon beam, the name, and the distance from the player. */ void render(WorldRenderContext context) { - switch (SkyblockerConfigManager.get().locations.dungeons.secretWaypoints.waypointType) { - case WAYPOINT -> RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, pos, category.colorComponents, 0.5F); - case OUTLINE -> RenderHelper.renderOutline(context, new Box(pos), category.colorComponents, 5F, true); + SkyblockerConfig.SecretWaypoints config = SkyblockerConfigManager.get().locations.dungeons.secretWaypoints; + + switch (config.waypointType) { + case WAYPOINT -> RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, pos, category.colorComponents, HIGHLIGHT_ALPHA); case OUTLINED_WAYPOINT -> { - RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, pos, category.colorComponents, 0.5F); - RenderHelper.renderOutline(context, new Box(pos), category.colorComponents, 5F, true); + RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, pos, category.colorComponents, HIGHLIGHT_ALPHA); + RenderHelper.renderOutline(context, new Box(pos), category.colorComponents, LINE_WIDTH, true); + } + case HIGHLIGHT -> RenderHelper.renderFilledThroughWalls(context, pos, category.colorComponents, HIGHLIGHT_ALPHA); + case OUTLINED_HIGHLIGHT -> { + RenderHelper.renderFilledThroughWalls(context, pos, category.colorComponents, HIGHLIGHT_ALPHA); + RenderHelper.renderOutline(context, new Box(pos), category.colorComponents, LINE_WIDTH, true); } + //TODO In the future, shrink the box for wither essence and items so its more realistic + case OUTLINE -> RenderHelper.renderOutline(context, new Box(pos), category.colorComponents, LINE_WIDTH, true); } - Vec3d posUp = centerPos.add(0, 1, 0); - RenderHelper.renderText(context, name, posUp, true); - double distance = context.camera().getPos().distanceTo(centerPos); - RenderHelper.renderText(context, Text.literal(Math.round(distance) + "m").formatted(Formatting.YELLOW), posUp, 1, MinecraftClient.getInstance().textRenderer.fontHeight + 1, true); + if (config.showSecretText) { + Vec3d posUp = centerPos.add(0, 1, 0); + RenderHelper.renderText(context, name, posUp, true); + double distance = context.camera().getPos().distanceTo(centerPos); + RenderHelper.renderText(context, Text.literal(Math.round(distance) + "m").formatted(Formatting.YELLOW), posUp, 1, MinecraftClient.getInstance().textRenderer.fontHeight + 1, true); + } } enum Category { diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index f39aa669..552caf7c 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -239,7 +239,8 @@ "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.waypointType": "Waypoint Type", - "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.waypointType.@Tooltip": "Waypoint: The standard waypoint.\n\nOutline: Outlines the secret in a box.\n\nOutlined Waypoint: Displays both a waypoint and an outline.", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.waypointType.@Tooltip": "Waypoint: Displays a highlight and beam.\n\nOutlined Waypoint: Displays both a waypoint and an outline.\n\nHighlight: Only displays a highlight.\n\nOutlined Highlight: Displays both a highlight and an outline.\n\nOutline: Outlines the secret in a box.", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.showSecretText": "Show Secret Text", "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", -- cgit From 9cc09de788ce6f1003a92d1bdedabe8f0fd20c4e Mon Sep 17 00:00:00 2001 From: Aaron <51387595+AzureAaron@users.noreply.github.com> Date: Sun, 22 Oct 2023 04:01:26 -0400 Subject: Add AOTV & Pearl Secret Waypoints --- .../hysky/skyblocker/config/SkyblockerConfig.java | 6 ++ .../config/categories/DungeonsCategory.java | 15 +++++ .../skyblock/dungeon/secrets/DungeonSecrets.java | 2 +- .../skyblocker/skyblock/dungeon/secrets/Room.java | 13 ++++- .../skyblock/dungeon/secrets/SecretWaypoint.java | 4 ++ .../skyblocker/dungeons/secretlocations.json | 65 +++++++++++++++++++++- .../resources/assets/skyblocker/lang/en_us.json | 5 +- 7 files changed, 104 insertions(+), 6 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java') diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index d7279bc8..3f39c933 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -605,6 +605,12 @@ public class SkyblockerConfig { @SerialEntry public boolean enableStonkWaypoints = true; + + @SerialEntry + public boolean enableAotvWaypoints = true; + + @SerialEntry + public boolean enablePearlWaypoints = true; @SerialEntry public boolean enableDefaultWaypoints = true; diff --git a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java index 7b32cb78..0101eccf 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java @@ -122,6 +122,21 @@ public class DungeonsCategory { newValue -> config.locations.dungeons.secretWaypoints.enableStonkWaypoints = newValue) .controller(ConfigUtils::createBooleanController) .build()) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enableAotvWaypoints")) + .binding(defaults.locations.dungeons.secretWaypoints.enableAotvWaypoints, + () -> config.locations.dungeons.secretWaypoints.enableAotvWaypoints, + newValue -> config.locations.dungeons.secretWaypoints.enableAotvWaypoints = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enablePearlWaypoints")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enablePearlWaypoints.@Tooltip"))) + .binding(defaults.locations.dungeons.secretWaypoints.enablePearlWaypoints, + () -> config.locations.dungeons.secretWaypoints.enablePearlWaypoints, + newValue -> config.locations.dungeons.secretWaypoints.enablePearlWaypoints = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) .option(Option.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enableDefaultWaypoints")) .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enableDefaultWaypoints.@Tooltip"))) diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java index d143a3c2..d01305f9 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/DungeonSecrets.java @@ -249,7 +249,7 @@ public class DungeonSecrets { BlockPos relativePos = DungeonMapUtils.actualToRelative(currentRoom.getDirection(), physicalCornerPos, blockToCheck); - source.sendFeedback(Constants.PREFIX.get().append(Text.translatable("skyblocker.dungeons.secrets.posMessage", relativePos.getX(), relativePos.getY(), relativePos.getZ()))); + source.sendFeedback(Constants.PREFIX.get().append(Text.translatable("skyblocker.dungeons.secrets.posMessage", currentRoom.getName(), relativePos.getX(), relativePos.getY(), relativePos.getZ()))); } else { source.sendError(Constants.PREFIX.get().append(Text.translatable("skyblocker.dungeons.secrets.unableToFindPos"))); } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/Room.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/Room.java index 6e7ee953..79b13d3b 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/Room.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/Room.java @@ -74,6 +74,7 @@ public class Room { private TriState matched = TriState.DEFAULT; private Table secretWaypoints; private Direction direction = null; + private String name = null; public Room(@NotNull Type type, @NotNull Vector2ic... physicalPositions) { this.type = type; @@ -90,6 +91,11 @@ public class Room { return type; } + @NotNull + public Set getSegments() { + return segments; + } + public boolean isMatched() { return matched == TriState.TRUE; } @@ -99,9 +105,9 @@ public class Room { return direction; } - @NotNull - public Set getSegments() { - return segments; + @Nullable + public String getName() { + return name; } @Override @@ -310,6 +316,7 @@ public class Room { secretWaypoints = ImmutableTable.copyOf(secretWaypointsMutable); matched = TriState.TRUE; this.direction = direction; + this.name = name; DungeonSecrets.LOGGER.info("[Skyblocker] Room {} matched after checking {} block(s)", name, checkedBlocks.size()); } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java index 0d9bdff1..a520c73f 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java @@ -112,6 +112,8 @@ public class SecretWaypoint { LEVER(secretWaypoints -> secretWaypoints.enableLeverWaypoints, 250, 217, 2), FAIRYSOUL(secretWaypoints -> secretWaypoints.enableFairySoulWaypoints, 255, 85, 255), STONK(secretWaypoints -> secretWaypoints.enableStonkWaypoints, 146, 52, 235), + AOTV(secretWaypoints -> secretWaypoints.enableAotvWaypoints, 252, 98, 3), + PEARL(secretWaypoints -> secretWaypoints.enablePearlWaypoints, 57, 117, 125), DEFAULT(secretWaypoints -> secretWaypoints.enableDefaultWaypoints, 190, 255, 252); private final Predicate enabledPredicate; private final float[] colorComponents; @@ -135,6 +137,8 @@ public class SecretWaypoint { case "lever" -> Category.LEVER; case "fairysoul" -> Category.FAIRYSOUL; case "stonk" -> Category.STONK; + case "aotv" -> Category.AOTV; + case "pearl" -> Category.PEARL; default -> Category.DEFAULT; }; } diff --git a/src/main/resources/assets/skyblocker/dungeons/secretlocations.json b/src/main/resources/assets/skyblocker/dungeons/secretlocations.json index d5e38345..5972659f 100644 --- a/src/main/resources/assets/skyblocker/dungeons/secretlocations.json +++ b/src/main/resources/assets/skyblocker/dungeons/secretlocations.json @@ -834,6 +834,13 @@ "y":75, "z":21 }, + { + "secretName":"2 - AOTV", + "category":"aotv", + "x":25, + "y":76, + "z":22 + }, { "secretName":"2 - Stonk", "category":"stonk", @@ -2947,7 +2954,7 @@ "category":"stonk", "x":17, "y":70, - "z":15 + "z":14 }, { "secretName":"6 - Pressure Plate 2", @@ -3058,6 +3065,13 @@ "y":70, "z":5 }, + { + "secretName":"2 - AOTV", + "category":"aotv", + "x":77, + "y":82, + "z":16 + }, { "secretName":"2 - Wither Essence", "category":"wither", @@ -3109,6 +3123,13 @@ "y":50, "z":9 }, + { + "secretName":"3 - AOTV", + "category":"aotv", + "x":7, + "y":80, + "z":15 + }, { "secretName":"3 - Superboom", "category":"superboom", @@ -3225,6 +3246,13 @@ "y":89, "z":24 }, + { + "secretName":"1/2 - AOTV", + "category":"aotv", + "x":84, + "y":91, + "z":26 + }, { "secretName":"1 - Bat", "category":"bat", @@ -4071,6 +4099,13 @@ "y":109, "z":30 }, + { + "secretName":"5 - AOTV", + "category":"aotv", + "x":52, + "y":78, + "z":9 + }, { "secretName":"5 - Crypt", "category":"superboom", @@ -5080,6 +5115,13 @@ "y":86, "z":61 }, + { + "secretName": "7 - AOTV", + "category":"aotv", + "x":39, + "y":84, + "z":58 + }, { "secretName":"7 - Chest", "category":"chest", @@ -5331,6 +5373,13 @@ "y":85, "z":43 }, + { + "secretName":"3/4 - AOTV", + "category":"aotv", + "x":49, + "y":83, + "z":36 + }, { "secretName":"3 - Chest", "category":"chest", @@ -5552,6 +5601,13 @@ "y":45, "z":15 }, + { + "secretName":"5 - Pearl", + "category":"pearl", + "x":8, + "y":59, + "z":14 + }, { "secretName":"5 - Entrance", "category":"entrance", @@ -5835,6 +5891,13 @@ } ], "Double-Stair-3":[ + { + "secretName":"1 - Pearl", + "category":"pearl", + "x":24, + "y":72, + "z":11 + }, { "secretName":"1 - Wither Essence", "category":"wither", diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index b42ab1e3..a6bf6b49 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -164,6 +164,9 @@ "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.enableAotvWaypoints" : "Enable AOTV Waypoints", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enablePearlWaypoints": "Enable Pearl Waypoints", + "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enablePearlWaypoints.@Tooltip": "With these waypoints, you throw a pearl towards the block and at the same time AOTV up.", "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.dungeonChestProfit": "Dungeon Chest Profit Calculator", @@ -272,7 +275,7 @@ "skyblocker.dungeons.secrets.markSecretMissing": "§rMarked secret #%d as missing.", "skyblocker.dungeons.secrets.markSecretFoundUnable": "§cUnable to mark secret #%d as found.", "skyblocker.dungeons.secrets.markSecretMissingUnable": "§cUnable to mark secret #%d as missing.", - "skyblocker.dungeons.secrets.posMessage": "§rRoom Pos: X: %d, Y: %d, Z: %d", + "skyblocker.dungeons.secrets.posMessage": "§rRoom: %s, X: %d, Y: %d, Z: %d", "skyblocker.dungeons.secrets.unableToFindPos": "§cUnable to find room position! (Are you in a dungeon room, are you facing a block?)", "skyblocker.fishing.reelNow": "Reel in now!", -- cgit From 219648e46b1b1e46ae27bcf8ba80e0b5536c6dab Mon Sep 17 00:00:00 2001 From: Aaron <51387595+AzureAaron@users.noreply.github.com> Date: Sun, 22 Oct 2023 20:21:19 -0400 Subject: Enigma Soul Waypoints --- .../hysky/skyblocker/config/SkyblockerConfig.java | 6 + .../config/categories/LocationsCategory.java | 15 + .../skyblocker/skyblock/rift/EnigmaSouls.java | 184 ++++ .../skyblock/rift/MirrorverseWaypoints.java | 2 +- .../de/hysky/skyblocker/skyblock/rift/TheRift.java | 8 + .../resources/assets/skyblocker/lang/en_us.json | 5 + .../assets/skyblocker/mirrorverse_waypoints.json | 1019 -------------------- .../skyblocker/rift/enigma_soul_waypoints.json | 215 +++++ .../skyblocker/rift/mirrorverse_waypoints.json | 1019 ++++++++++++++++++++ 9 files changed, 1453 insertions(+), 1020 deletions(-) create mode 100644 src/main/java/de/hysky/skyblocker/skyblock/rift/EnigmaSouls.java delete mode 100644 src/main/resources/assets/skyblocker/mirrorverse_waypoints.json create mode 100644 src/main/resources/assets/skyblocker/rift/enigma_soul_waypoints.json create mode 100644 src/main/resources/assets/skyblocker/rift/mirrorverse_waypoints.json (limited to 'src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java') diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index d7279bc8..57d12c76 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -730,6 +730,12 @@ public class SkyblockerConfig { public static class Rift { @SerialEntry public boolean mirrorverseWaypoints = true; + + @SerialEntry + public boolean enigmaSoulWaypoints = false; + + @SerialEntry + public boolean highlightFoundEnigmaSouls = true; @SerialEntry public int mcGrubberStacks = 0; diff --git a/src/main/java/de/hysky/skyblocker/config/categories/LocationsCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/LocationsCategory.java index 399bb9f6..5e662fcc 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/LocationsCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/LocationsCategory.java @@ -46,6 +46,21 @@ public class LocationsCategory { newValue -> config.locations.rift.mirrorverseWaypoints = newValue) .controller(ConfigUtils::createBooleanController) .build()) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.rift.enigmaSoulWaypoints")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.rift.enigmaSoulWaypoints.@Tooltip"))) + .binding(defaults.locations.rift.enigmaSoulWaypoints, + () -> config.locations.rift.enigmaSoulWaypoints, + newValue -> config.locations.rift.enigmaSoulWaypoints = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.rift.highlightFoundEnigmaSouls")) + .binding(defaults.locations.rift.highlightFoundEnigmaSouls, + () -> config.locations.rift.highlightFoundEnigmaSouls, + newValue -> config.locations.rift.highlightFoundEnigmaSouls = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) .option(Option.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.locations.rift.mcGrubberStacks")) .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.rift.mcGrubberStacks.@Tooltip"))) diff --git a/src/main/java/de/hysky/skyblocker/skyblock/rift/EnigmaSouls.java b/src/main/java/de/hysky/skyblocker/skyblock/rift/EnigmaSouls.java new file mode 100644 index 00000000..3a0651ef --- /dev/null +++ b/src/main/java/de/hysky/skyblocker/skyblock/rift/EnigmaSouls.java @@ -0,0 +1,184 @@ +package de.hysky.skyblocker.skyblock.rift; + +import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.NoSuchFileException; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.mojang.brigadier.Command; +import com.mojang.brigadier.CommandDispatcher; + +import de.hysky.skyblocker.SkyblockerMod; +import de.hysky.skyblocker.config.SkyblockerConfig; +import de.hysky.skyblocker.config.SkyblockerConfigManager; +import de.hysky.skyblocker.utils.Constants; +import de.hysky.skyblocker.utils.PosUtils; +import de.hysky.skyblocker.utils.Utils; +import de.hysky.skyblocker.utils.render.RenderHelper; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.command.CommandRegistryAccess; +import net.minecraft.text.Text; +import net.minecraft.util.DyeColor; +import net.minecraft.util.Formatting; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; + +public class EnigmaSouls { + private static final Logger LOGGER = LoggerFactory.getLogger(EnigmaSouls.class); + private static final Identifier WAYPOINTS_JSON = new Identifier(SkyblockerMod.NAMESPACE, "rift/enigma_soul_waypoints.json"); + private static final BlockPos[] SOUL_WAYPOINTS = new BlockPos[42]; + private static final Path FOUND_SOULS_FILE = SkyblockerMod.CONFIG_DIR.resolve("found_enigma_souls.json"); + private static final Object2ObjectOpenHashMap> FOUND_SOULS = new Object2ObjectOpenHashMap<>(); + private static final float[] GREEN = DyeColor.GREEN.getColorComponents(); + private static final float[] RED = DyeColor.RED.getColorComponents(); + + private static CompletableFuture soulsLoaded; + + static void load(MinecraftClient client) { + //Load waypoints + soulsLoaded = CompletableFuture.runAsync(() -> { + try (BufferedReader reader = client.getResourceManager().openAsReader(WAYPOINTS_JSON)) { + JsonObject file = JsonParser.parseReader(reader).getAsJsonObject(); + JsonArray waypoints = file.get("waypoints").getAsJsonArray(); + + for (int i = 0; i < waypoints.size(); i++) { + JsonObject waypoint = waypoints.get(i).getAsJsonObject(); + SOUL_WAYPOINTS[i] = new BlockPos(waypoint.get("x").getAsInt(), waypoint.get("y").getAsInt(), waypoint.get("z").getAsInt()); + } + + } catch (IOException e) { + LOGGER.error("[Skyblocker] There was an error while loading enigma soul waypoints! Exception: {}", e); + } + + //Load found souls + try (BufferedReader reader = Files.newBufferedReader(FOUND_SOULS_FILE)) { + for (Map.Entry profile : JsonParser.parseReader(reader).getAsJsonObject().asMap().entrySet()) { + ObjectOpenHashSet foundSoulsOnProfile = new ObjectOpenHashSet<>(); + + for (JsonElement foundSoul : profile.getValue().getAsJsonArray().asList()) { + foundSoulsOnProfile.add(PosUtils.parsePosString(foundSoul.getAsString())); + } + + FOUND_SOULS.put(profile.getKey(), foundSoulsOnProfile); + } + } catch (NoSuchFileException ignored) { + } catch (IOException e) { + LOGGER.error("[Skyblocker] There was an error while loading found enigma souls! Exception: {}", e); + } + }); + } + + static void save(MinecraftClient client) { + JsonObject json = new JsonObject(); + + for (Map.Entry> foundSoulsForProfile : FOUND_SOULS.entrySet()) { + JsonArray foundSoulsJson = new JsonArray(); + + for (BlockPos foundSoul : foundSoulsForProfile.getValue()) { + foundSoulsJson.add(PosUtils.getPosString(foundSoul)); + } + + json.add(foundSoulsForProfile.getKey(), foundSoulsJson); + } + + try (BufferedWriter writer = Files.newBufferedWriter(FOUND_SOULS_FILE)) { + SkyblockerMod.GSON.toJson(json, writer); + } catch (IOException e) { + LOGGER.error("[Skyblocker] There was an error while saving found enigma souls! Exception: {}", e); + } + } + + static void render(WorldRenderContext wrc) { + SkyblockerConfig.Rift config = SkyblockerConfigManager.get().locations.rift; + + if (Utils.isInTheRift() && config.enigmaSoulWaypoints && soulsLoaded.isDone()) { + for (BlockPos pos : SOUL_WAYPOINTS) { + if (isSoulMissing(pos)) { + RenderHelper.renderFilledThroughWallsWithBeaconBeam(wrc, pos, GREEN, 0.5f); + } else if (config.highlightFoundEnigmaSouls) { + RenderHelper.renderFilledThroughWallsWithBeaconBeam(wrc, pos, RED, 0.5f); + } + } + } + } + + static void onMessage(Text text, boolean overlay) { + if (Utils.isInTheRift() && !overlay) { + String message = text.getString(); + + if (message.equals("You have already found that Enigma Soul!") || Formatting.strip(message).equals("SOUL! You unlocked an Enigma Soul!")) markClosestSoulAsFound(); + } + } + + static void registerCommands(CommandDispatcher dispatcher, CommandRegistryAccess registryAccess) { + dispatcher.register(literal(SkyblockerMod.NAMESPACE) + .then(literal("rift") + .then(literal("enigmaSouls") + .then(literal("markAllFound").executes(context -> { + markAllFound(); + context.getSource().sendFeedback(Constants.PREFIX.get().append(Text.translatable("skyblocker.rift.enigmaSouls.markAllFound"))); + + return Command.SINGLE_SUCCESS; + })) + .then(literal("markAllMissing").executes(context -> { + markAllMissing(); + context.getSource().sendFeedback(Constants.PREFIX.get().append(Text.translatable("skyblocker.rift.enigmaSouls.markAllMissing"))); + + return Command.SINGLE_SUCCESS; + }))))); + } + + @SuppressWarnings("resource") + private static void markClosestSoulAsFound() { + if (!soulsLoaded.isDone()) return; + + ClientPlayerEntity player = MinecraftClient.getInstance().player; + + Arrays.stream(SOUL_WAYPOINTS) + .filter(EnigmaSouls::isSoulMissing) + .min(Comparator.comparingDouble(soulPos -> soulPos.getSquaredDistance(player.getPos()))) + .filter(soulPos -> soulPos.getSquaredDistance(player.getPos()) <= 16) + .ifPresent(soulPos -> { + FOUND_SOULS.computeIfAbsent(Utils.getProfile(), profile -> new ObjectOpenHashSet<>()); + FOUND_SOULS.get(Utils.getProfile()).add(soulPos); + }); + } + + private static boolean isSoulMissing(BlockPos soulPos) { + ObjectOpenHashSet foundSoulsOnProfile = FOUND_SOULS.get(Utils.getProfile()); + + return foundSoulsOnProfile == null || !foundSoulsOnProfile.contains(soulPos); + } + + private static void markAllFound() { + FOUND_SOULS.computeIfAbsent(Utils.getProfile(), profile -> new ObjectOpenHashSet<>()); + FOUND_SOULS.get(Utils.getProfile()).addAll(List.of(SOUL_WAYPOINTS)); + } + + private static void markAllMissing() { + ObjectOpenHashSet foundSoulsOnProfile = FOUND_SOULS.get(Utils.getProfile()); + + if (foundSoulsOnProfile != null) foundSoulsOnProfile.clear(); + } +} diff --git a/src/main/java/de/hysky/skyblocker/skyblock/rift/MirrorverseWaypoints.java b/src/main/java/de/hysky/skyblocker/skyblock/rift/MirrorverseWaypoints.java index 06181349..d6e3f427 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/rift/MirrorverseWaypoints.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/rift/MirrorverseWaypoints.java @@ -21,7 +21,7 @@ import java.io.IOException; public class MirrorverseWaypoints { private static final Logger LOGGER = LoggerFactory.getLogger("skyblocker"); private static final MinecraftClient CLIENT = MinecraftClient.getInstance(); - private static final Identifier WAYPOINTS_JSON = new Identifier(SkyblockerMod.NAMESPACE, "mirrorverse_waypoints.json"); + private static final Identifier WAYPOINTS_JSON = new Identifier(SkyblockerMod.NAMESPACE, "rift/mirrorverse_waypoints.json"); private static final BlockPos[] LAVA_PATH_WAYPOINTS = new BlockPos[107]; private static final BlockPos[] UPSIDE_DOWN_WAYPOINTS = new BlockPos[66]; private static final BlockPos[] TURBULATOR_WAYPOINTS = new BlockPos[27]; diff --git a/src/main/java/de/hysky/skyblocker/skyblock/rift/TheRift.java b/src/main/java/de/hysky/skyblocker/skyblock/rift/TheRift.java index b39151d3..95a2ecf4 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/rift/TheRift.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/rift/TheRift.java @@ -2,6 +2,9 @@ package de.hysky.skyblocker.skyblock.rift; import de.hysky.skyblocker.config.SkyblockerConfigManager; import de.hysky.skyblocker.utils.scheduler.Scheduler; +import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents; +import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; public class TheRift { @@ -13,6 +16,11 @@ public class TheRift { public static void init() { WorldRenderEvents.AFTER_TRANSLUCENT.register(MirrorverseWaypoints::render); WorldRenderEvents.AFTER_TRANSLUCENT.register(EffigyWaypoints::render); + WorldRenderEvents.AFTER_TRANSLUCENT.register(EnigmaSouls::render); + ClientLifecycleEvents.CLIENT_STARTED.register(EnigmaSouls::load); + ClientLifecycleEvents.CLIENT_STOPPING.register(EnigmaSouls::save); + ClientReceiveMessageEvents.GAME.register(EnigmaSouls::onMessage); + ClientCommandRegistrationCallback.EVENT.register(EnigmaSouls::registerCommands); Scheduler.INSTANCE.scheduleCyclic(EffigyWaypoints::updateEffigies, SkyblockerConfigManager.get().slayer.vampireSlayer.effigyUpdateFrequency); Scheduler.INSTANCE.scheduleCyclic(TwinClawsIndicator::updateIce, SkyblockerConfigManager.get().slayer.vampireSlayer.holyIceUpdateFrequency); Scheduler.INSTANCE.scheduleCyclic(ManiaIndicator::updateMania, SkyblockerConfigManager.get().slayer.vampireSlayer.maniaUpdateFrequency); diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index f02eb319..ea6931e0 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -215,6 +215,9 @@ "text.autoconfig.skyblocker.option.locations.rift": "The Rift", "text.autoconfig.skyblocker.option.locations.rift.mirrorverseWaypoints": "Enable Mirrorverse Waypoints", + "text.autoconfig.skyblocker.option.locations.rift.enigmaSoulWaypoints": "Enable Enigma Soul Waypoints", + "text.autoconfig.skyblocker.option.locations.rift.enigmaSoulWaypoints.@Tooltip": "Note: Many enigma souls have a small task you must complete in order to get it, so its recommended to also watch a YouTube video when finding them.", + "text.autoconfig.skyblocker.option.locations.rift.highlightFoundEnigmaSouls": "Highlight Found Enigma Souls", "text.autoconfig.skyblocker.option.locations.rift.mcGrubberStacks": "McGrubber Stacks", "text.autoconfig.skyblocker.option.locations.rift.mcGrubberStacks.@Tooltip": "Used for calculating Motes sell prices.", @@ -270,6 +273,8 @@ "skyblocker.rift.iceNow": "Ice now!", "skyblocker.rift.mania": "Mania!", "skyblocker.rift.stakeNow": "Stake now!", + "skyblocker.rift.enigmaSouls.markAllFound": "§rMarked all enigma souls as found!", + "skyblocker.rift.enigmaSouls.markAllMissing": "§rMarked all enigma souls as missing!", "skyblocker.fairySouls.markAllFound": "§rMarked all fairy souls in the current island as found", "skyblocker.fairySouls.markAllMissing": "§rMarked all fairy souls in the current island as missing", "skyblocker.relics.markAllFound": "§rMarked all relics as found", diff --git a/src/main/resources/assets/skyblocker/mirrorverse_waypoints.json b/src/main/resources/assets/skyblocker/mirrorverse_waypoints.json deleted file mode 100644 index 2bc0296e..00000000 --- a/src/main/resources/assets/skyblocker/mirrorverse_waypoints.json +++ /dev/null @@ -1,1019 +0,0 @@ -{ - "sections": [ - { - "name": "Lava Path", - "waypoints": [ - { - "x": -101, - "y": 52, - "z": -116 - }, - { - "x": -99, - "y": 52, - "z": -110 - }, - { - "x": -95, - "y": 52, - "z": -108 - }, - { - "x": -88, - "y": 52, - "z": -107 - }, - { - "x": -95, - "y": 52, - "z": -114 - }, - { - "x": -95, - "y": 52, - "z": -109 - }, - { - "x": -84, - "y": 52, - "z": -112 - }, - { - "x": -91, - "y": 52, - "z": -108 - }, - { - "x": -94, - "y": 52, - "z": -116 - }, - { - "x": -88, - "y": 52, - "z": -112 - }, - { - "x": -101, - "y": 52, - "z": -108 - }, - { - "x": -94, - "y": 52, - "z": -114 - }, - { - "x": -85, - "y": 52, - "z": -112 - }, - { - "x": -88, - "y": 52, - "z": -114 - }, - { - "x": -90, - "y": 52, - "z": -110 - }, - { - "x": -84, - "y": 52, - "z": -113 - }, - { - "x": -90, - "y": 52, - "z": -116 - }, - { - "x": -105, - "y": 52, - "z": -113 - }, - { - "x": -82, - "y": 52, - "z": -112 - }, - { - "x": -90, - "y": 52, - "z": -112 - }, - { - "x": -88, - "y": 52, - "z": -111 - }, - { - "x": -82, - "y": 52, - "z": -111 - }, - { - "x": -104, - "y": 52, - "z": -112 - }, - { - "x": -87, - "y": 52, - "z": -107 - }, - { - "x": -100, - "y": 52, - "z": -108 - }, - { - "x": -86, - "y": 52, - "z": -109 - }, - { - "x": -91, - "y": 52, - "z": -110 - }, - { - "x": -96, - "y": 52, - "z": -108 - }, - { - "x": -102, - "y": 52, - "z": -111 - }, - { - "x": -96, - "y": 52, - "z": -115 - }, - { - "x": -97, - "y": 52, - "z": -116 - }, - { - "x": -83, - "y": 52, - "z": -111 - }, - { - "x": -84, - "y": 52, - "z": -107 - }, - { - "x": -90, - "y": 52, - "z": -115 - }, - { - "x": -86, - "y": 52, - "z": -107 - }, - { - "x": -97, - "y": 52, - "z": -112 - }, - { - "x": -86, - "y": 52, - "z": -113 - }, - { - "x": -92, - "y": 52, - "z": -110 - }, - { - "x": -95, - "y": 52, - "z": -111 - }, - { - "x": -90, - "y": 52, - "z": -114 - }, - { - "x": -93, - "y": 52, - "z": -108 - }, - { - "x": -98, - "y": 52, - "z": -116 - }, - { - "x": -98, - "y": 52, - "z": -115 - }, - { - "x": -90, - "y": 52, - "z": -107 - }, - { - "x": -98, - "y": 52, - "z": -112 - }, - { - "x": -98, - "y": 52, - "z": -109 - }, - { - "x": -98, - "y": 52, - "z": -113 - }, - { - "x": -100, - "y": 52, - "z": -116 - }, - { - "x": -96, - "y": 52, - "z": -114 - }, - { - "x": -86, - "y": 52, - "z": -110 - }, - { - "x": -93, - "y": 52, - "z": -109 - }, - { - "x": -88, - "y": 52, - "z": -110 - }, - { - "x": -94, - "y": 52, - "z": -115 - }, - { - "x": -84, - "y": 52, - "z": -111 - }, - { - "x": -84, - "y": 52, - "z": -108 - }, - { - "x": -86, - "y": 52, - "z": -115 - }, - { - "x": -98, - "y": 52, - "z": -110 - }, - { - "x": -102, - "y": 52, - "z": -108 - }, - { - "x": -92, - "y": 52, - "z": -114 - }, - { - "x": -102, - "y": 52, - "z": -114 - }, - { - "x": -85, - "y": 52, - "z": -109 - }, - { - "x": -86, - "y": 52, - "z": -112 - }, - { - "x": -104, - "y": 52, - "z": -113 - }, - { - "x": -105, - "y": 52, - "z": -112 - }, - { - "x": -91, - "y": 52, - "z": -114 - }, - { - "x": -100, - "y": 52, - "z": -112 - }, - { - "x": -93, - "y": 52, - "z": -110 - }, - { - "x": -91, - "y": 52, - "z": -112 - }, - { - "x": -101, - "y": 52, - "z": -112 - }, - { - "x": -92, - "y": 52, - "z": -108 - }, - { - "x": -82, - "y": 52, - "z": -113 - }, - { - "x": -87, - "y": 52, - "z": -115 - }, - { - "x": -84, - "y": 52, - "z": -109 - }, - { - "x": -88, - "y": 52, - "z": -113 - }, - { - "x": -92, - "y": 52, - "z": -116 - }, - { - "x": -96, - "y": 52, - "z": -111 - }, - { - "x": -96, - "y": 52, - "z": -116 - }, - { - "x": -98, - "y": 52, - "z": -108 - }, - { - "x": -98, - "y": 52, - "z": -114 - }, - { - "x": -96, - "y": 52, - "z": -112 - }, - { - "x": -85, - "y": 52, - "z": -107 - }, - { - "x": -102, - "y": 52, - "z": -115 - }, - { - "x": -87, - "y": 52, - "z": -110 - }, - { - "x": -100, - "y": 52, - "z": -113 - }, - { - "x": -103, - "y": 52, - "z": -114 - }, - { - "x": -102, - "y": 52, - "z": -116 - }, - { - "x": -95, - "y": 52, - "z": -110 - }, - { - "x": -89, - "y": 52, - "z": -107 - }, - { - "x": -92, - "y": 52, - "z": -113 - }, - { - "x": -100, - "y": 52, - "z": -110 - }, - { - "x": -100, - "y": 52, - "z": -115 - }, - { - "x": -86, - "y": 52, - "z": -114 - }, - { - "x": -88, - "y": 52, - "z": -115 - }, - { - "x": -92, - "y": 52, - "z": -112 - }, - { - "x": -100, - "y": 52, - "z": -114 - }, - { - "x": -91, - "y": 52, - "z": -116 - }, - { - "x": -102, - "y": 52, - "z": -110 - }, - { - "x": -102, - "y": 52, - "z": -112 - }, - { - "x": -93, - "y": 52, - "z": -116 - }, - { - "x": -90, - "y": 52, - "z": -111 - }, - { - "x": -104, - "y": 52, - "z": -114 - }, - { - "x": -83, - "y": 52, - "z": -112 - }, - { - "x": -83, - "y": 52, - "z": -113 - }, - { - "x": -100, - "y": 52, - "z": -109 - }, - { - "x": -102, - "y": 52, - "z": -109 - }, - { - "x": -90, - "y": 52, - "z": -108 - }, - { - "x": -97, - "y": 52, - "z": -108 - } - ] - }, - { - "name": "Upside Down Parkour", - "waypoints": [ - { - "x": -137, - "y": 39, - "z": -104 - }, - { - "x": -169, - "y": 42, - "z": -116 - }, - { - "x": -173, - "y": 43, - "z": -112 - }, - { - "x": -197, - "y": 39, - "z": -92 - }, - { - "x": -161, - "y": 39, - "z": -92 - }, - { - "x": -137, - "y": 40, - "z": -116 - }, - { - "x": -213, - "y": 41, - "z": -116 - }, - { - "x": -173, - "y": 41, - "z": -96 - }, - { - "x": -205, - "y": 41, - "z": -100 - }, - { - "x": -205, - "y": 43, - "z": -108 - }, - { - "x": -137, - "y": 41, - "z": -96 - }, - { - "x": -145, - "y": 40, - "z": -104 - }, - { - "x": -149, - "y": 43, - "z": -112 - }, - { - "x": -189, - "y": 42, - "z": -120 - }, - { - "x": -157, - "y": 41, - "z": -104 - }, - { - "x": -189, - "y": 43, - "z": -116 - }, - { - "x": -193, - "y": 42, - "z": -104 - }, - { - "x": -161, - "y": 40, - "z": -120 - }, - { - "x": -221, - "y": 43, - "z": -104 - }, - { - "x": -185, - "y": 41, - "z": -108 - }, - { - "x": -141, - "y": 41, - "z": -120 - }, - { - "x": -157, - "y": 39, - "z": -116 - }, - { - "x": -153, - "y": 40, - "z": -100 - }, - { - "x": -209, - "y": 43, - "z": -120 - }, - { - "x": -129, - "y": 39, - "z": -108 - }, - { - "x": -189, - "y": 43, - "z": -100 - }, - { - "x": -141, - "y": 42, - "z": -100 - }, - { - "x": -133, - "y": 40, - "z": -108 - }, - { - "x": -209, - "y": 42, - "z": -104 - }, - { - "x": -173, - "y": 41, - "z": -100 - }, - { - "x": -189, - "y": 43, - "z": -112 - }, - { - "x": -145, - "y": 40, - "z": -108 - }, - { - "x": -217, - "y": 42, - "z": -108 - }, - { - "x": -169, - "y": 41, - "z": -120 - }, - { - "x": -165, - "y": 43, - "z": -109 - }, - { - "x": -145, - "y": 42, - "z": -116 - }, - { - "x": -165, - "y": 42, - "z": -104 - }, - { - "x": -181, - "y": 40, - "z": -112 - }, - { - "x": -193, - "y": 41, - "z": -108 - }, - { - "x": -201, - "y": 40, - "z": -96 - }, - { - "x": -137, - "y": 41, - "z": -124 - }, - { - "x": -173, - "y": 43, - "z": -108 - }, - { - "x": -133, - "y": 40, - "z": -100 - }, - { - "x": -201, - "y": 40, - "z": -116 - }, - { - "x": -185, - "y": 41, - "z": -108 - }, - { - "x": -125, - "y": 39, - "z": -108 - }, - { - "x": -161, - "y": 42, - "z": -112 - }, - { - "x": -165, - "y": 40, - "z": -96 - }, - { - "x": -141, - "y": 39, - "z": -112 - }, - { - "x": -177, - "y": 39, - "z": -92 - }, - { - "x": -213, - "y": 41, - "z": -112 - }, - { - "x": -153, - "y": 42, - "z": -108 - }, - { - "x": -205, - "y": 42, - "z": -120 - }, - { - "x": -197, - "y": 43, - "z": -112 - }, - { - "x": -181, - "y": 42, - "z": -104 - }, - { - "x": -165, - "y": 41, - "z": -100 - }, - { - "x": -193, - "y": 42, - "z": -96 - }, - { - "x": -133, - "y": 40, - "z": -120 - }, - { - "x": -185, - "y": 41, - "z": -100 - }, - { - "x": -165, - "y": 41, - "z": -124 - }, - { - "x": -177, - "y": 40, - "z": -104 - }, - { - "x": -157, - "y": 40, - "z": -96 - }, - { - "x": -205, - "y": 41, - "z": -116 - }, - { - "x": -181, - "y": 40, - "z": -96 - }, - { - "x": -201, - "y": 43, - "z": -108 - }, - { - "x": -185, - "y": 41, - "z": -116 - } - ] - }, - { - "name": "Turbulator Parkour", - "waypoints": [ - { - "x": -302, - "y": 34, - "z": -107 - }, - { - "x": -304, - "y": 52, - "z": -109 - }, - { - "x": -306, - "y": 16, - "z": -107 - }, - { - "x": -304, - "y": 12, - "z": -107 - }, - { - "x": -308, - "y": 6, - "z": -105 - }, - { - "x": -302, - "y": 44, - "z": -107 - }, - { - "x": -306, - "y": 24, - "z": -109 - }, - { - "x": -302, - "y": 18, - "z": -111 - }, - { - "x": -300, - "y": 36, - "z": -109 - }, - { - "x": -304, - "y": 30, - "z": -103 - }, - { - "x": -302, - "y": 26, - "z": -111 - }, - { - "x": -308, - "y": 14, - "z": -103 - }, - { - "x": -300, - "y": 46, - "z": -103 - }, - { - "x": -300, - "y": 10, - "z": -111 - }, - { - "x": -300, - "y": 20, - "z": -107 - }, - { - "x": -306, - "y": 54, - "z": -111 - }, - { - "x": -306, - "y": 4, - "z": -103 - }, - { - "x": -300, - "y": 28, - "z": -107 - }, - { - "x": -306, - "y": 42, - "z": -111 - }, - { - "x": -308, - "y": 50, - "z": -105 - }, - { - "x": -304, - "y": 48, - "z": -107 - }, - { - "x": -302, - "y": 38, - "z": -105 - }, - { - "x": -304, - "y": 22, - "z": -111 - }, - { - "x": -304, - "y": 2, - "z": -107 - }, - { - "x": -304, - "y": 40, - "z": -107 - }, - { - "x": -306, - "y": 32, - "z": -105 - }, - { - "x": -304, - "y": 8, - "z": -109 - } - ] - } - ] -} \ No newline at end of file diff --git a/src/main/resources/assets/skyblocker/rift/enigma_soul_waypoints.json b/src/main/resources/assets/skyblocker/rift/enigma_soul_waypoints.json new file mode 100644 index 00000000..5c428fed --- /dev/null +++ b/src/main/resources/assets/skyblocker/rift/enigma_soul_waypoints.json @@ -0,0 +1,215 @@ +{ + "credit": "Official Hypixel Wiki - https://wiki.hypixel.net", + "waypoints": [ + { + "x": -15, + "y": 91, + "z": 94 + }, + { + "x": -27, + "y": 71, + "z": 90 + }, + { + "x": -6, + "y": 60, + "z": 226 + }, + { + "x": -142, + "y": 68, + "z": 174 + }, + { + "x": -137, + "y": 51, + "z": 120 + }, + { + "x": -129, + "y": 72, + "z": 77 + }, + { + "x": -27, + "y": 89, + "z": 136 + }, + { + "x": -137, + "y": 133, + "z": 156 + }, + { + "x": -108, + "y": 117, + "z": 123 + }, + { + "x": -115, + "y": 69, + "z": 61 + }, + { + "x": 43, + "y": 91, + "z": 56 + }, + { + "x": -168, + "y": 81, + "z": 12 + }, + { + "x": -204, + "y": 75, + "z": 49 + }, + { + "x": -93, + "y": 73, + "z": 36 + }, + { + "x": -102, + "y": 72, + "z": -103 + }, + { + "x": -34, + "y": 71, + "z": -88 + }, + { + "x": -106, + "y": 78, + "z": -101 + }, + { + "x": -95, + "y": 76, + "z": -82 + }, + { + "x": -94, + "y": 70, + "z": -84 + }, + { + "x": -38, + "y": 44, + "z": 130 + }, + { + "x": -88, + "y": 79, + "z": -102 + }, + { + "x": -76, + "y": 90, + "z": -149 + }, + { + "x": -106, + "y": 249, + "z": -149 + }, + { + "x": -74, + "y": 65, + "z": -119 + }, + { + "x": -77, + "y": 72, + "z": -176 + }, + { + "x": -21, + "y": 72, + "z": -18 + }, + { + "x": -88, + "y": 20, + "z": 0 + }, + { + "x": 27, + "y": 71, + "z": -77 + }, + { + "x": 42, + "y": 88, + "z": -91 + }, + { + "x": 47, + "y": 68, + "z": -59 + }, + { + "x": -34, + "y": 66, + "z": -25 + }, + { + "x": -23, + "y": 84, + "z": -92 + }, + { + "x": 40, + "y": 70, + "z": 27 + }, + { + "x": 38, + "y": 63, + "z": -198 + }, + { + "x": 3, + "y": 68, + "z": -204 + }, + { + "x": -161, + "y": 98, + "z": -72 + }, + { + "x": 255, + "y": 74, + "z": 160 + }, + { + "x": 262, + "y": 118, + "z": 94 + }, + { + "x": 182, + "y": 92, + "z": 124 + }, + { + "x": 266, + "y": 60, + "z": 145 + }, + { + "x": 232, + "y": 94, + "z": 168 + }, + { + "x": 256, + "y": 130, + "z": 75 + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/skyblocker/rift/mirrorverse_waypoints.json b/src/main/resources/assets/skyblocker/rift/mirrorverse_waypoints.json new file mode 100644 index 00000000..2bc0296e --- /dev/null +++ b/src/main/resources/assets/skyblocker/rift/mirrorverse_waypoints.json @@ -0,0 +1,1019 @@ +{ + "sections": [ + { + "name": "Lava Path", + "waypoints": [ + { + "x": -101, + "y": 52, + "z": -116 + }, + { + "x": -99, + "y": 52, + "z": -110 + }, + { + "x": -95, + "y": 52, + "z": -108 + }, + { + "x": -88, + "y": 52, + "z": -107 + }, + { + "x": -95, + "y": 52, + "z": -114 + }, + { + "x": -95, + "y": 52, + "z": -109 + }, + { + "x": -84, + "y": 52, + "z": -112 + }, + { + "x": -91, + "y": 52, + "z": -108 + }, + { + "x": -94, + "y": 52, + "z": -116 + }, + { + "x": -88, + "y": 52, + "z": -112 + }, + { + "x": -101, + "y": 52, + "z": -108 + }, + { + "x": -94, + "y": 52, + "z": -114 + }, + { + "x": -85, + "y": 52, + "z": -112 + }, + { + "x": -88, + "y": 52, + "z": -114 + }, + { + "x": -90, + "y": 52, + "z": -110 + }, + { + "x": -84, + "y": 52, + "z": -113 + }, + { + "x": -90, + "y": 52, + "z": -116 + }, + { + "x": -105, + "y": 52, + "z": -113 + }, + { + "x": -82, + "y": 52, + "z": -112 + }, + { + "x": -90, + "y": 52, + "z": -112 + }, + { + "x": -88, + "y": 52, + "z": -111 + }, + { + "x": -82, + "y": 52, + "z": -111 + }, + { + "x": -104, + "y": 52, + "z": -112 + }, + { + "x": -87, + "y": 52, + "z": -107 + }, + { + "x": -100, + "y": 52, + "z": -108 + }, + { + "x": -86, + "y": 52, + "z": -109 + }, + { + "x": -91, + "y": 52, + "z": -110 + }, + { + "x": -96, + "y": 52, + "z": -108 + }, + { + "x": -102, + "y": 52, + "z": -111 + }, + { + "x": -96, + "y": 52, + "z": -115 + }, + { + "x": -97, + "y": 52, + "z": -116 + }, + { + "x": -83, + "y": 52, + "z": -111 + }, + { + "x": -84, + "y": 52, + "z": -107 + }, + { + "x": -90, + "y": 52, + "z": -115 + }, + { + "x": -86, + "y": 52, + "z": -107 + }, + { + "x": -97, + "y": 52, + "z": -112 + }, + { + "x": -86, + "y": 52, + "z": -113 + }, + { + "x": -92, + "y": 52, + "z": -110 + }, + { + "x": -95, + "y": 52, + "z": -111 + }, + { + "x": -90, + "y": 52, + "z": -114 + }, + { + "x": -93, + "y": 52, + "z": -108 + }, + { + "x": -98, + "y": 52, + "z": -116 + }, + { + "x": -98, + "y": 52, + "z": -115 + }, + { + "x": -90, + "y": 52, + "z": -107 + }, + { + "x": -98, + "y": 52, + "z": -112 + }, + { + "x": -98, + "y": 52, + "z": -109 + }, + { + "x": -98, + "y": 52, + "z": -113 + }, + { + "x": -100, + "y": 52, + "z": -116 + }, + { + "x": -96, + "y": 52, + "z": -114 + }, + { + "x": -86, + "y": 52, + "z": -110 + }, + { + "x": -93, + "y": 52, + "z": -109 + }, + { + "x": -88, + "y": 52, + "z": -110 + }, + { + "x": -94, + "y": 52, + "z": -115 + }, + { + "x": -84, + "y": 52, + "z": -111 + }, + { + "x": -84, + "y": 52, + "z": -108 + }, + { + "x": -86, + "y": 52, + "z": -115 + }, + { + "x": -98, + "y": 52, + "z": -110 + }, + { + "x": -102, + "y": 52, + "z": -108 + }, + { + "x": -92, + "y": 52, + "z": -114 + }, + { + "x": -102, + "y": 52, + "z": -114 + }, + { + "x": -85, + "y": 52, + "z": -109 + }, + { + "x": -86, + "y": 52, + "z": -112 + }, + { + "x": -104, + "y": 52, + "z": -113 + }, + { + "x": -105, + "y": 52, + "z": -112 + }, + { + "x": -91, + "y": 52, + "z": -114 + }, + { + "x": -100, + "y": 52, + "z": -112 + }, + { + "x": -93, + "y": 52, + "z": -110 + }, + { + "x": -91, + "y": 52, + "z": -112 + }, + { + "x": -101, + "y": 52, + "z": -112 + }, + { + "x": -92, + "y": 52, + "z": -108 + }, + { + "x": -82, + "y": 52, + "z": -113 + }, + { + "x": -87, + "y": 52, + "z": -115 + }, + { + "x": -84, + "y": 52, + "z": -109 + }, + { + "x": -88, + "y": 52, + "z": -113 + }, + { + "x": -92, + "y": 52, + "z": -116 + }, + { + "x": -96, + "y": 52, + "z": -111 + }, + { + "x": -96, + "y": 52, + "z": -116 + }, + { + "x": -98, + "y": 52, + "z": -108 + }, + { + "x": -98, + "y": 52, + "z": -114 + }, + { + "x": -96, + "y": 52, + "z": -112 + }, + { + "x": -85, + "y": 52, + "z": -107 + }, + { + "x": -102, + "y": 52, + "z": -115 + }, + { + "x": -87, + "y": 52, + "z": -110 + }, + { + "x": -100, + "y": 52, + "z": -113 + }, + { + "x": -103, + "y": 52, + "z": -114 + }, + { + "x": -102, + "y": 52, + "z": -116 + }, + { + "x": -95, + "y": 52, + "z": -110 + }, + { + "x": -89, + "y": 52, + "z": -107 + }, + { + "x": -92, + "y": 52, + "z": -113 + }, + { + "x": -100, + "y": 52, + "z": -110 + }, + { + "x": -100, + "y": 52, + "z": -115 + }, + { + "x": -86, + "y": 52, + "z": -114 + }, + { + "x": -88, + "y": 52, + "z": -115 + }, + { + "x": -92, + "y": 52, + "z": -112 + }, + { + "x": -100, + "y": 52, + "z": -114 + }, + { + "x": -91, + "y": 52, + "z": -116 + }, + { + "x": -102, + "y": 52, + "z": -110 + }, + { + "x": -102, + "y": 52, + "z": -112 + }, + { + "x": -93, + "y": 52, + "z": -116 + }, + { + "x": -90, + "y": 52, + "z": -111 + }, + { + "x": -104, + "y": 52, + "z": -114 + }, + { + "x": -83, + "y": 52, + "z": -112 + }, + { + "x": -83, + "y": 52, + "z": -113 + }, + { + "x": -100, + "y": 52, + "z": -109 + }, + { + "x": -102, + "y": 52, + "z": -109 + }, + { + "x": -90, + "y": 52, + "z": -108 + }, + { + "x": -97, + "y": 52, + "z": -108 + } + ] + }, + { + "name": "Upside Down Parkour", + "waypoints": [ + { + "x": -137, + "y": 39, + "z": -104 + }, + { + "x": -169, + "y": 42, + "z": -116 + }, + { + "x": -173, + "y": 43, + "z": -112 + }, + { + "x": -197, + "y": 39, + "z": -92 + }, + { + "x": -161, + "y": 39, + "z": -92 + }, + { + "x": -137, + "y": 40, + "z": -116 + }, + { + "x": -213, + "y": 41, + "z": -116 + }, + { + "x": -173, + "y": 41, + "z": -96 + }, + { + "x": -205, + "y": 41, + "z": -100 + }, + { + "x": -205, + "y": 43, + "z": -108 + }, + { + "x": -137, + "y": 41, + "z": -96 + }, + { + "x": -145, + "y": 40, + "z": -104 + }, + { + "x": -149, + "y": 43, + "z": -112 + }, + { + "x": -189, + "y": 42, + "z": -120 + }, + { + "x": -157, + "y": 41, + "z": -104 + }, + { + "x": -189, + "y": 43, + "z": -116 + }, + { + "x": -193, + "y": 42, + "z": -104 + }, + { + "x": -161, + "y": 40, + "z": -120 + }, + { + "x": -221, + "y": 43, + "z": -104 + }, + { + "x": -185, + "y": 41, + "z": -108 + }, + { + "x": -141, + "y": 41, + "z": -120 + }, + { + "x": -157, + "y": 39, + "z": -116 + }, + { + "x": -153, + "y": 40, + "z": -100 + }, + { + "x": -209, + "y": 43, + "z": -120 + }, + { + "x": -129, + "y": 39, + "z": -108 + }, + { + "x": -189, + "y": 43, + "z": -100 + }, + { + "x": -141, + "y": 42, + "z": -100 + }, + { + "x": -133, + "y": 40, + "z": -108 + }, + { + "x": -209, + "y": 42, + "z": -104 + }, + { + "x": -173, + "y": 41, + "z": -100 + }, + { + "x": -189, + "y": 43, + "z": -112 + }, + { + "x": -145, + "y": 40, + "z": -108 + }, + { + "x": -217, + "y": 42, + "z": -108 + }, + { + "x": -169, + "y": 41, + "z": -120 + }, + { + "x": -165, + "y": 43, + "z": -109 + }, + { + "x": -145, + "y": 42, + "z": -116 + }, + { + "x": -165, + "y": 42, + "z": -104 + }, + { + "x": -181, + "y": 40, + "z": -112 + }, + { + "x": -193, + "y": 41, + "z": -108 + }, + { + "x": -201, + "y": 40, + "z": -96 + }, + { + "x": -137, + "y": 41, + "z": -124 + }, + { + "x": -173, + "y": 43, + "z": -108 + }, + { + "x": -133, + "y": 40, + "z": -100 + }, + { + "x": -201, + "y": 40, + "z": -116 + }, + { + "x": -185, + "y": 41, + "z": -108 + }, + { + "x": -125, + "y": 39, + "z": -108 + }, + { + "x": -161, + "y": 42, + "z": -112 + }, + { + "x": -165, + "y": 40, + "z": -96 + }, + { + "x": -141, + "y": 39, + "z": -112 + }, + { + "x": -177, + "y": 39, + "z": -92 + }, + { + "x": -213, + "y": 41, + "z": -112 + }, + { + "x": -153, + "y": 42, + "z": -108 + }, + { + "x": -205, + "y": 42, + "z": -120 + }, + { + "x": -197, + "y": 43, + "z": -112 + }, + { + "x": -181, + "y": 42, + "z": -104 + }, + { + "x": -165, + "y": 41, + "z": -100 + }, + { + "x": -193, + "y": 42, + "z": -96 + }, + { + "x": -133, + "y": 40, + "z": -120 + }, + { + "x": -185, + "y": 41, + "z": -100 + }, + { + "x": -165, + "y": 41, + "z": -124 + }, + { + "x": -177, + "y": 40, + "z": -104 + }, + { + "x": -157, + "y": 40, + "z": -96 + }, + { + "x": -205, + "y": 41, + "z": -116 + }, + { + "x": -181, + "y": 40, + "z": -96 + }, + { + "x": -201, + "y": 43, + "z": -108 + }, + { + "x": -185, + "y": 41, + "z": -116 + } + ] + }, + { + "name": "Turbulator Parkour", + "waypoints": [ + { + "x": -302, + "y": 34, + "z": -107 + }, + { + "x": -304, + "y": 52, + "z": -109 + }, + { + "x": -306, + "y": 16, + "z": -107 + }, + { + "x": -304, + "y": 12, + "z": -107 + }, + { + "x": -308, + "y": 6, + "z": -105 + }, + { + "x": -302, + "y": 44, + "z": -107 + }, + { + "x": -306, + "y": 24, + "z": -109 + }, + { + "x": -302, + "y": 18, + "z": -111 + }, + { + "x": -300, + "y": 36, + "z": -109 + }, + { + "x": -304, + "y": 30, + "z": -103 + }, + { + "x": -302, + "y": 26, + "z": -111 + }, + { + "x": -308, + "y": 14, + "z": -103 + }, + { + "x": -300, + "y": 46, + "z": -103 + }, + { + "x": -300, + "y": 10, + "z": -111 + }, + { + "x": -300, + "y": 20, + "z": -107 + }, + { + "x": -306, + "y": 54, + "z": -111 + }, + { + "x": -306, + "y": 4, + "z": -103 + }, + { + "x": -300, + "y": 28, + "z": -107 + }, + { + "x": -306, + "y": 42, + "z": -111 + }, + { + "x": -308, + "y": 50, + "z": -105 + }, + { + "x": -304, + "y": 48, + "z": -107 + }, + { + "x": -302, + "y": 38, + "z": -105 + }, + { + "x": -304, + "y": 22, + "z": -111 + }, + { + "x": -304, + "y": 2, + "z": -107 + }, + { + "x": -304, + "y": 40, + "z": -107 + }, + { + "x": -306, + "y": 32, + "z": -105 + }, + { + "x": -304, + "y": 8, + "z": -109 + } + ] + } + ] +} \ No newline at end of file -- cgit From 594f1d34b51cc49cea90003262f77e0974e5b62d Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sun, 1 Oct 2023 00:17:04 -0400 Subject: Add config option --- .../java/de/hysky/skyblocker/config/SkyblockerConfig.java | 9 ++++++++- .../hysky/skyblocker/config/categories/GeneralCategory.java | 13 +++++++++++++ .../skyblocker/skyblock/diana/MythologicalRitual.java | 4 ++-- src/main/resources/assets/skyblocker/lang/en_us.json | 2 ++ 4 files changed, 25 insertions(+), 3 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java') diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index d7279bc8..5f8f47d0 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -176,6 +176,9 @@ public class SkyblockerConfig { @SerialEntry public FairySouls fairySouls = new FairySouls(); + @SerialEntry + public MythologicalRitual mythologicalRitual = new MythologicalRitual(); + @SerialEntry public ItemCooldown itemCooldown = new ItemCooldown(); @@ -322,6 +325,11 @@ public class SkyblockerConfig { public boolean highlightOnlyNearbySouls = false; } + public static class MythologicalRitual { + @SerialEntry + public boolean enableMythologicalRitualHelper = true; + } + public static class ItemCooldown { @SerialEntry public boolean enableItemCooldowns = true; @@ -653,7 +661,6 @@ public class SkyblockerConfig { @SerialEntry public Formatting incompleteColor = Formatting.BLUE; - } public static class LividColor { diff --git a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java index 30bdbd3f..60deedd2 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java @@ -200,6 +200,19 @@ public class GeneralCategory { .build()) .build()) + //Mythological Ritual + .group(OptionGroup.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.mythologicalRitual")) + .collapsed(true) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.mythologicalRitual.enableMythologicalRitualHelper")) + .binding(defaults.general.mythologicalRitual.enableMythologicalRitualHelper, + () -> config.general.mythologicalRitual.enableMythologicalRitualHelper, + newValue -> config.general.mythologicalRitual.enableMythologicalRitualHelper = newValue) + .controller(BooleanControllerBuilder::create) + .build()) + .build()) + //Item Cooldown .group(OptionGroup.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.general.itemCooldown")) diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/diana/MythologicalRitual.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/diana/MythologicalRitual.java index 62462f56..72607037 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/diana/MythologicalRitual.java +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/diana/MythologicalRitual.java @@ -2,7 +2,7 @@ package me.xmrvizzy.skyblocker.skyblock.diana; import com.mojang.brigadier.Command; import me.xmrvizzy.skyblocker.SkyblockerMod; -import me.xmrvizzy.skyblocker.config.SkyblockerConfig; +import me.xmrvizzy.skyblocker.config.SkyblockerConfigManager; import me.xmrvizzy.skyblocker.utils.Utils; import me.xmrvizzy.skyblocker.utils.render.RenderHelper; import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; @@ -168,7 +168,7 @@ public class MythologicalRitual { } private static boolean isActive() { - return SkyblockerConfig.get().general.fairySouls.enableFairySoulsHelper && Utils.getLocationRaw().equals("hub"); // TODO Change to actual config option + return SkyblockerConfigManager.get().general.mythologicalRitual.enableMythologicalRitualHelper && Utils.getLocationRaw().equals("hub"); } private static class GriffinBurrow { diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index f02eb319..aaa21814 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -38,6 +38,8 @@ "text.autoconfig.skyblocker.option.general.fairySouls.highlightFoundSouls": "Highlight found fairy souls", "text.autoconfig.skyblocker.option.general.fairySouls.highlightOnlyNearbySouls": "Only highlight nearby fairy souls", "text.autoconfig.skyblocker.option.general.fairySouls.highlightOnlyNearbySouls.@Tooltip": "When enabled only fairy souls in a radius of 50 blocks are highlighted", + "text.autoconfig.skyblocker.option.general.mythologicalRitual": "Mythological Ritual Helper", + "text.autoconfig.skyblocker.option.general.mythologicalRitual.enableMythologicalRitualHelper": "Enable Mythological Ritual Helper", "text.autoconfig.skyblocker.option.general.itemCooldown": "Item Cooldown", "text.autoconfig.skyblocker.option.general.itemCooldown.enableItemCooldowns": "Enable Item Cooldown", "text.autoconfig.skyblocker.option.general.shortcuts": "Shortcuts", -- cgit From 99a4bbc07ad8d916476ba87304aec9015cdcbbdb Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Tue, 10 Oct 2023 10:56:58 -0400 Subject: Refactor imports --- src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java | 4 ++-- .../java/de/hysky/skyblocker/config/categories/GeneralCategory.java | 4 ++-- .../java/de/hysky/skyblocker/mixin/ClientPlayNetworkHandlerMixin.java | 2 +- src/main/java/de/hysky/skyblocker/utils/render/RenderHelper.java | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java') diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index 5f8f47d0..9d5e95f5 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -1,11 +1,11 @@ package de.hysky.skyblocker.config; +import de.hysky.skyblocker.skyblock.item.CustomArmorTrims; +import de.hysky.skyblocker.utils.chat.ChatFilterResult; import dev.isxander.yacl3.config.v2.api.SerialEntry; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; -import de.hysky.skyblocker.skyblock.item.CustomArmorTrims; -import de.hysky.skyblocker.utils.chat.ChatFilterResult; import net.minecraft.client.resource.language.I18n; import net.minecraft.text.Text; import net.minecraft.util.Formatting; diff --git a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java index f1f64130..a20f962d 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java @@ -2,12 +2,12 @@ package de.hysky.skyblocker.config.categories; import de.hysky.skyblocker.config.ConfigUtils; import de.hysky.skyblocker.config.SkyblockerConfig; +import de.hysky.skyblocker.skyblock.shortcut.ShortcutsConfigScreen; +import de.hysky.skyblocker.utils.render.title.TitleContainerConfigScreen; import dev.isxander.yacl3.api.*; import dev.isxander.yacl3.api.controller.FloatFieldControllerBuilder; import dev.isxander.yacl3.api.controller.FloatSliderControllerBuilder; import dev.isxander.yacl3.api.controller.IntegerSliderControllerBuilder; -import de.hysky.skyblocker.skyblock.shortcut.ShortcutsConfigScreen; -import de.hysky.skyblocker.utils.render.title.TitleContainerConfigScreen; import net.minecraft.client.MinecraftClient; import net.minecraft.text.Text; diff --git a/src/main/java/de/hysky/skyblocker/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/de/hysky/skyblocker/mixin/ClientPlayNetworkHandlerMixin.java index 7615a8e1..f68a4e94 100644 --- a/src/main/java/de/hysky/skyblocker/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/de/hysky/skyblocker/mixin/ClientPlayNetworkHandlerMixin.java @@ -2,11 +2,11 @@ package de.hysky.skyblocker.mixin; import com.llamalad7.mixinextras.injector.WrapWithCondition; import com.llamalad7.mixinextras.sugar.Local; -import dev.cbyrne.betterinject.annotations.Inject; import de.hysky.skyblocker.skyblock.FishingHelper; import de.hysky.skyblocker.skyblock.diana.MythologicalRitual; import de.hysky.skyblocker.skyblock.dungeon.secrets.DungeonSecrets; import de.hysky.skyblocker.utils.Utils; +import dev.cbyrne.betterinject.annotations.Inject; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.entity.ItemEntity; diff --git a/src/main/java/de/hysky/skyblocker/utils/render/RenderHelper.java b/src/main/java/de/hysky/skyblocker/utils/render/RenderHelper.java index ec03b05f..4cfaef8f 100644 --- a/src/main/java/de/hysky/skyblocker/utils/render/RenderHelper.java +++ b/src/main/java/de/hysky/skyblocker/utils/render/RenderHelper.java @@ -2,10 +2,10 @@ package de.hysky.skyblocker.utils.render; import com.mojang.blaze3d.systems.RenderSystem; import de.hysky.skyblocker.mixin.accessor.BeaconBlockEntityRendererInvoker; -import me.x150.renderer.render.Renderer3d; import de.hysky.skyblocker.utils.render.culling.OcclusionCulling; import de.hysky.skyblocker.utils.render.title.Title; import de.hysky.skyblocker.utils.render.title.TitleContainer; +import me.x150.renderer.render.Renderer3d; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -- cgit From e00501cda9bec3da79896f098279c2f2a0f1a926 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Mon, 23 Oct 2023 14:51:57 -0400 Subject: Abstract Waypoint --- .../hysky/skyblocker/config/SkyblockerConfig.java | 22 +---- .../config/categories/DungeonsCategory.java | 4 +- .../skyblock/dungeon/secrets/SecretWaypoint.java | 48 +++-------- .../hysky/skyblocker/utils/waypoint/Waypoint.java | 95 ++++++++++++++++++++++ 4 files changed, 112 insertions(+), 57 deletions(-) create mode 100644 src/main/java/de/hysky/skyblocker/utils/waypoint/Waypoint.java (limited to 'src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java') diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index 51f3f098..8905644f 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -2,6 +2,7 @@ package de.hysky.skyblocker.config; import de.hysky.skyblocker.skyblock.item.CustomArmorTrims; import de.hysky.skyblocker.utils.chat.ChatFilterResult; +import de.hysky.skyblocker.utils.waypoint.Waypoint; import dev.isxander.yacl3.config.v2.api.SerialEntry; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; @@ -582,7 +583,7 @@ public class SkyblockerConfig { public boolean noInitSecretWaypoints = false; @SerialEntry - public WaypointType waypointType = WaypointType.WAYPOINT; + public Waypoint.Type waypointType = Waypoint.Type.WAYPOINT; @SerialEntry public boolean showSecretText = true; @@ -623,25 +624,6 @@ public class SkyblockerConfig { @SerialEntry public boolean enableDefaultWaypoints = true; } - - public enum WaypointType { - WAYPOINT, - OUTLINED_WAYPOINT, - HIGHLIGHT, - OUTLINED_HIGHLIGHT, - OUTLINE; - - @Override - public String toString() { - return switch (this) { - case WAYPOINT -> "Waypoint"; - case OUTLINED_WAYPOINT -> "Outlined Waypoint"; - case HIGHLIGHT -> "Highlight"; - case OUTLINED_HIGHLIGHT -> "Outlined Highlight"; - case OUTLINE -> "Outline"; - }; - } - } public static class DungeonChestProfit { @SerialEntry diff --git a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java index 2cdde89d..fdb13892 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java @@ -2,7 +2,7 @@ package de.hysky.skyblocker.config.categories; import de.hysky.skyblocker.config.ConfigUtils; import de.hysky.skyblocker.config.SkyblockerConfig; -import de.hysky.skyblocker.config.SkyblockerConfig.WaypointType; +import de.hysky.skyblocker.utils.waypoint.Waypoint.Type; import dev.isxander.yacl3.api.ButtonOption; import dev.isxander.yacl3.api.ConfigCategory; import dev.isxander.yacl3.api.Option; @@ -44,7 +44,7 @@ public class DungeonsCategory { .controller(ConfigUtils::createBooleanController) .flag(OptionFlag.GAME_RESTART) .build()) - .option(Option.createBuilder() + .option(Option.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.waypointType")) .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.waypointType.@Tooltip"))) .binding(defaults.locations.dungeons.secretWaypoints.waypointType, diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java index a520c73f..72cc5ad8 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretWaypoint.java @@ -4,37 +4,35 @@ import com.google.gson.JsonObject; import de.hysky.skyblocker.config.SkyblockerConfig; import de.hysky.skyblocker.config.SkyblockerConfigManager; import de.hysky.skyblocker.utils.render.RenderHelper; +import de.hysky.skyblocker.utils.waypoint.Waypoint; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; import net.minecraft.client.MinecraftClient; import net.minecraft.entity.Entity; import net.minecraft.text.Text; import net.minecraft.util.Formatting; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; import net.minecraft.util.math.Vec3d; import java.util.List; import java.util.function.Predicate; +import java.util.function.Supplier; import java.util.function.ToDoubleFunction; -public class SecretWaypoint { - private static final float HIGHLIGHT_ALPHA = 0.5f; - private static final float LINE_WIDTH = 5f; +public class SecretWaypoint extends Waypoint { static final List SECRET_ITEMS = List.of("Decoy", "Defuse Kit", "Dungeon Chest Key", "Healing VIII", "Inflatable Jerry", "Spirit Leap", "Training Weights", "Trap", "Treasure Talisman"); + private static final SkyblockerConfig.SecretWaypoints config = SkyblockerConfigManager.get().locations.dungeons.secretWaypoints; + private static final Supplier typeSupplier = () -> config.waypointType; final int secretIndex; final Category category; private final Text name; - private final BlockPos pos; private final Vec3d centerPos; - private boolean missing; SecretWaypoint(int secretIndex, JsonObject waypoint, String name, BlockPos pos) { + super(pos, typeSupplier, Category.get(waypoint).colorComponents); this.secretIndex = secretIndex; this.category = Category.get(waypoint); this.name = Text.of(name); - this.pos = pos; this.centerPos = pos.toCenterPos(); - this.missing = true; } static ToDoubleFunction getSquaredDistanceToFunction(Entity entity) { @@ -45,8 +43,9 @@ public class SecretWaypoint { return secretWaypoint -> entity.squaredDistanceTo(secretWaypoint.centerPos) <= 36D; } - boolean shouldRender() { - return category.isEnabled() && missing; + @Override + protected boolean shouldRender() { + return super.shouldRender() && category.isEnabled(); } boolean needsInteraction() { @@ -65,34 +64,13 @@ public class SecretWaypoint { return category.isBat(); } - void setFound() { - this.missing = false; - } - - void setMissing() { - this.missing = true; - } - /** * Renders the secret waypoint, including a filled cube, a beacon beam, the name, and the distance from the player. */ - void render(WorldRenderContext context) { - SkyblockerConfig.SecretWaypoints config = SkyblockerConfigManager.get().locations.dungeons.secretWaypoints; - - switch (config.waypointType) { - case WAYPOINT -> RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, pos, category.colorComponents, HIGHLIGHT_ALPHA); - case OUTLINED_WAYPOINT -> { - RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, pos, category.colorComponents, HIGHLIGHT_ALPHA); - RenderHelper.renderOutline(context, new Box(pos), category.colorComponents, LINE_WIDTH, true); - } - case HIGHLIGHT -> RenderHelper.renderFilledThroughWalls(context, pos, category.colorComponents, HIGHLIGHT_ALPHA); - case OUTLINED_HIGHLIGHT -> { - RenderHelper.renderFilledThroughWalls(context, pos, category.colorComponents, HIGHLIGHT_ALPHA); - RenderHelper.renderOutline(context, new Box(pos), category.colorComponents, LINE_WIDTH, true); - } - //TODO In the future, shrink the box for wither essence and items so its more realistic - case OUTLINE -> RenderHelper.renderOutline(context, new Box(pos), category.colorComponents, LINE_WIDTH, true); - } + @Override + protected void render(WorldRenderContext context) { + //TODO In the future, shrink the box for wither essence and items so its more realistic + super.render(context); if (config.showSecretText) { Vec3d posUp = centerPos.add(0, 1, 0); diff --git a/src/main/java/de/hysky/skyblocker/utils/waypoint/Waypoint.java b/src/main/java/de/hysky/skyblocker/utils/waypoint/Waypoint.java new file mode 100644 index 00000000..2cb37e6b --- /dev/null +++ b/src/main/java/de/hysky/skyblocker/utils/waypoint/Waypoint.java @@ -0,0 +1,95 @@ +package de.hysky.skyblocker.utils.waypoint; + +import de.hysky.skyblocker.utils.render.RenderHelper; +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Box; + +import java.util.function.Supplier; + +public class Waypoint { + protected static final float DEFAULT_HIGHLIGHT_ALPHA = 0.5f; + protected static final float DEFAULT_LINE_WIDTH = 5f; + protected final BlockPos pos; + protected final Box box; + protected final Supplier typeSupplier; + protected final float[] colorComponents; + protected final float alpha; + protected final float lineWidth; + protected final boolean throughWalls; + protected boolean shouldRender; + + protected Waypoint(BlockPos pos, Supplier typeSupplier, float[] colorComponents) { + this(pos, typeSupplier, colorComponents, DEFAULT_HIGHLIGHT_ALPHA); + } + + protected Waypoint(BlockPos pos, Supplier typeSupplier, float[] colorComponents, float alpha) { + this(pos, typeSupplier, colorComponents, alpha, DEFAULT_LINE_WIDTH); + } + + protected Waypoint(BlockPos pos, Supplier typeSupplier, float[] colorComponents, float alpha, float lineWidth) { + this(pos, typeSupplier, colorComponents, alpha, lineWidth, true); + } + + protected Waypoint(BlockPos pos, Supplier typeSupplier, float[] colorComponents, float alpha, float lineWidth, boolean throughWalls) { + this(pos, typeSupplier, colorComponents, alpha, lineWidth, throughWalls, true); + } + + protected Waypoint(BlockPos pos, Supplier typeSupplier, float[] colorComponents, float alpha, float lineWidth, boolean throughWalls, boolean shouldRender) { + this.pos = pos; + this.box = new Box(pos); + this.typeSupplier = typeSupplier; + this.colorComponents = colorComponents; + this.alpha = alpha; + this.lineWidth = lineWidth; + this.throughWalls = throughWalls; + this.shouldRender = shouldRender; + } + + protected boolean shouldRender() { + return shouldRender; + } + + public void setFound() { + this.shouldRender = false; + } + + public void setMissing() { + this.shouldRender = true; + } + + protected void render(WorldRenderContext context) { + switch (typeSupplier.get()) { + case WAYPOINT -> RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, pos, colorComponents, alpha); + case OUTLINED_WAYPOINT -> { + RenderHelper.renderFilledThroughWallsWithBeaconBeam(context, pos, colorComponents, alpha); + RenderHelper.renderOutline(context, box, colorComponents, lineWidth, throughWalls); + } + case HIGHLIGHT -> RenderHelper.renderFilledThroughWalls(context, pos, colorComponents, alpha); + case OUTLINED_HIGHLIGHT -> { + RenderHelper.renderFilledThroughWalls(context, pos, colorComponents, alpha); + RenderHelper.renderOutline(context, box, colorComponents, lineWidth, throughWalls); + } + case OUTLINE -> RenderHelper.renderOutline(context, box, colorComponents, lineWidth, throughWalls); + } + } + + public enum Type { + WAYPOINT, + OUTLINED_WAYPOINT, + HIGHLIGHT, + OUTLINED_HIGHLIGHT, + OUTLINE; + + @Override + public String toString() { + return switch (this) { + case WAYPOINT -> "Waypoint"; + case OUTLINED_WAYPOINT -> "Outlined Waypoint"; + case HIGHLIGHT -> "Highlight"; + case OUTLINED_HIGHLIGHT -> "Outlined Highlight"; + case OUTLINE -> "Outline"; + }; + } + } +} -- cgit From 3a68bf3d435e1288a050f3db18c9fc61b7e23172 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sat, 28 Oct 2023 13:14:37 -0400 Subject: Update files --- .../hysky/skyblocker/config/SkyblockerConfig.java | 5 +- .../config/categories/GeneralCategory.java | 7 + .../skyblocker/skyblock/item/ExoticCheck.java | 87 +++ .../skyblocker/skyblock/item/PriceInfoTooltip.java | 8 +- .../java/de/hysky/skyblocker/utils/Constants.java | 25 + .../skyblocker/config/SkyblockerConfig.java | 650 --------------------- .../skyblock/item/exotic/ExoticCheck.java | 88 --- .../me/xmrvizzy/skyblocker/utils/Constants.java | 33 -- .../resources/assets/skyblocker/lang/en_us.json | 2 +- 9 files changed, 127 insertions(+), 778 deletions(-) create mode 100644 src/main/java/de/hysky/skyblocker/skyblock/item/ExoticCheck.java delete mode 100644 src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java delete mode 100644 src/main/java/me/xmrvizzy/skyblocker/skyblock/item/exotic/ExoticCheck.java delete mode 100644 src/main/java/me/xmrvizzy/skyblocker/utils/Constants.java (limited to 'src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java') diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index 8905644f..4959ca3b 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -178,7 +178,7 @@ public class SkyblockerConfig { public FairySouls fairySouls = new FairySouls(); @SerialEntry - public MythologicalRitual mythologicalRitual = new MythologicalRitual(); + public MythologicalRitual mythologicalRitual = new MythologicalRitual(); @SerialEntry public ItemCooldown itemCooldown = new ItemCooldown(); @@ -485,6 +485,9 @@ public class SkyblockerConfig { @SerialEntry public boolean enableMuseumDate = true; + + @SerialEntry + public boolean enableExoticCheck = true; } public static class ItemInfoDisplay { diff --git a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java index 10b21891..8ce00172 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java @@ -356,6 +356,13 @@ public class GeneralCategory { newValue -> config.general.itemTooltip.enableMuseumDate = newValue) .controller(ConfigUtils::createBooleanController) .build()) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.itemTooltip.enableExoticCheck")) + .binding(defaults.general.itemTooltip.enableExoticCheck, + () -> config.general.itemTooltip.enableExoticCheck, + newValue -> config.general.itemTooltip.enableExoticCheck = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) .build()) //Item Info Display diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/ExoticCheck.java b/src/main/java/de/hysky/skyblocker/skyblock/item/ExoticCheck.java new file mode 100644 index 00000000..130ef049 --- /dev/null +++ b/src/main/java/de/hysky/skyblocker/skyblock/item/ExoticCheck.java @@ -0,0 +1,87 @@ +package de.hysky.skyblocker.skyblock.item; + +import de.hysky.skyblocker.utils.Constants; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.text.MutableText; +import net.minecraft.text.Text; +import net.minecraft.util.Formatting; + +public class ExoticCheck { + public static String getExpectedHex(String id) { + String color = PriceInfoTooltip.colorJson.get(id).getAsString(); + if (color != null) { + String[] RGBValues = color.split(","); + String hex = String.format("%02x%02x%02x", Integer.parseInt(RGBValues[0]), Integer.parseInt(RGBValues[1]), Integer.parseInt(RGBValues[2])); + return hex.toUpperCase(); + } else { + System.out.println("Color is null"); + return null; + } + } + + public static boolean isException(String id, String hex) { + if (id.startsWith("LEATHER") || id.equals("GHOST_BOOTS") || Constants.SEYMOUR_IDS.contains(id)) { + return true; + } + if (id.startsWith("RANCHER")) { + return Constants.RANCHERS.contains(hex); + } + if (id.contains("ADAPTIVE_CHESTPLATE")) { + return Constants.ADAPTIVE_CHEST.contains(hex); + } else if (id.contains("ADAPTIVE")) { + return Constants.ADAPTIVE.contains(hex); + } + if (id.startsWith("REAPER")) { + return Constants.REAPER.contains(hex); + } + if (id.startsWith("FAIRY")) { + return Constants.FAIRY_HEXES.contains(hex); + } + if (id.startsWith("CRYSTAL")) { + return Constants.CRYSTAL_HEXES.contains(hex); + } + if (id.contains("SPOOK")) { + return Constants.SPOOK.contains(hex); + } + return false; + } + + public static String checkDyeType(String hex) { + if (Constants.CRYSTAL_HEXES.contains(hex)) { + return "CRYSTAL"; + } + if (Constants.FAIRY_HEXES.contains(hex)) { + return "FAIRY"; + } + if (Constants.OG_FAIRY_HEXES.contains(hex)) { + return "OG_FAIRY"; + } + if (Constants.SPOOK.contains(hex)) { + return "SPOOK"; + } + if (Constants.GLITCHED.contains(hex)) { + return "GLITCHED"; + } + return "EXOTIC"; + } + + public static boolean intendedDyed(NbtCompound ItemData) { + return ItemData.getCompound("ExtraAttributes").contains("dye_item"); + } + + public static Formatting getFormattingColor(String s) { + return switch (s) { + case "CRYSTAL" -> Formatting.AQUA; + case "FAIRY" -> Formatting.LIGHT_PURPLE; + case "OG_FAIRY" -> Formatting.DARK_PURPLE; + case "SPOOK" -> Formatting.RED; + case "GLITCHED" -> Formatting.BLUE; + case "EXOTIC" -> Formatting.GOLD; + default -> Formatting.DARK_GRAY; + }; + } + + public static MutableText getTranslatedText(String s) { + return Text.translatable("skyblocker.exotic." + s.toLowerCase()); + } +} diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/PriceInfoTooltip.java b/src/main/java/de/hysky/skyblocker/skyblock/item/PriceInfoTooltip.java index e8d619cd..9e38f276 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/item/PriceInfoTooltip.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/item/PriceInfoTooltip.java @@ -4,7 +4,6 @@ import com.google.gson.JsonObject; import de.hysky.skyblocker.SkyblockerMod; import de.hysky.skyblocker.config.SkyblockerConfig; import de.hysky.skyblocker.config.SkyblockerConfigManager; -import de.hysky.skyblocker.skyblock.item.exotic.CheckExotic; import de.hysky.skyblocker.utils.Constants; import de.hysky.skyblocker.utils.Http; import de.hysky.skyblocker.utils.ItemUtils; @@ -39,7 +38,6 @@ public class PriceInfoTooltip { private static JsonObject motesPricesJson; public static JsonObject colorJson; private static volatile boolean nullMsgSend = false; - private final static Gson gson = new Gson(); private static final Map apiAddresses; private static long npcHash = 0; private static long museumHash = 0; @@ -62,7 +60,7 @@ public class PriceInfoTooltip { return; } - if (SkyblockerConfig.get().general.itemTooltip.enableExoticCheck) { + if (SkyblockerConfigManager.get().general.itemTooltip.enableExoticCheck) { if (colorJson == null) { nullWarning(); } else if (stack.getNbt() != null) { @@ -416,11 +414,11 @@ public class PriceInfoTooltip { if (SkyblockerConfigManager.get().general.itemTooltip.enableMotesPrice && motesPricesJson == null) futureList.add(CompletableFuture.runAsync(() -> motesPricesJson = downloadPrices("motes"))); - if (SkyblockerConfig.get().general.itemTooltip.enableExoticCheck && colorJson == null) + if (SkyblockerConfigManager.get().general.itemTooltip.enableExoticCheck && colorJson == null) futureList.add(CompletableFuture.runAsync(() -> colorJson = downloadPrices("color"))); minute++; - CompletableFuture.allOf(futureList.toArray(new CompletableFuture[0])) + CompletableFuture.allOf(futureList.toArray(CompletableFuture[]::new)) .whenComplete((unused, throwable) -> nullMsgSend = false); }, 1200, true); } diff --git a/src/main/java/de/hysky/skyblocker/utils/Constants.java b/src/main/java/de/hysky/skyblocker/utils/Constants.java index f144b519..94eacf49 100644 --- a/src/main/java/de/hysky/skyblocker/utils/Constants.java +++ b/src/main/java/de/hysky/skyblocker/utils/Constants.java @@ -1,5 +1,6 @@ package de.hysky.skyblocker.utils; +import java.util.List; import java.util.function.IntFunction; import java.util.function.Supplier; import java.util.function.UnaryOperator; @@ -28,4 +29,28 @@ public interface Constants { .append(Text.literal("e").styled(WITH_COLOR.apply(0x12d5eb))) .append(Text.literal("r").styled(WITH_COLOR.apply(0x14d0ff))) .append(Text.literal("] ").formatted(Formatting.GRAY)); + + + List SEYMOUR_IDS = List.of("VELVET_TOP_HAT", "CASHMERE_JACKET", "SATIN_TROUSERS", "OXFORD_SHOES"); + + // Exotic Hexes + List CRYSTAL_HEXES = List.of("1F0030", "46085E", "54146E", "5D1C78", "63237D", "6A2C82", "7E4196", "8E51A6", "9C64B3", "A875BD", + "B88BC9", "C6A3D4", "D9C1E3", "E5D1ED", "EFE1F5", "FCF3FF"); + List FAIRY_HEXES = List.of("330066", "4C0099", "660033", "660066", "6600CC", "7F00FF", "99004C", "990099", "9933FF", "B266FF", + "CC0066", "CC00CC", "CC99FF", "E5CCFF", "FF007F", "FF00FF", "FF3399", "FF33FF", "FF66B2", "FF66FF", "FF99CC", "FF99FF", "FFCCE5", + "FFCCFF"); + List OG_FAIRY_HEXES = List.of("FF99FF", "FFCCFF", "E5CCFF", "CC99FF", "CC00CC", "FF00FF", "FF33FF", "FF66FF", + "B266FF", "9933FF", "7F00FF", "660066", "6600CC", "4C0099", "330066", "990099", "660033", "99004C", "CC0066", + "660033", "99004C", "FFCCE5", "660033", "FFCCE5", "FF99CC", "FFCCE5", "FF99CC", "FF66B2"); + List GLITCHED = List.of("FFDC51", "F7DA33", "606060", "E7413C", "45413C", "4A14B7", "1793C4", "000000", "E75C3C", "65605A", + "5D2FB9", "17A8C4", "E76E3C", "88837E", "8969C8", "1CD4E4"); // Glitched through other means such as Shark Scale upgrade color + List SPOOK = List.of("000000", "070008", "0E000F", "150017", "1B001F", "220027", "29002E", "300036", "37003E", "3E0046", + "45004D", "4C0055", "52005D", "590065", "60006C", "670074", "6E007C", "750084", "7C008B", "830093", + "89009B", "9000A3", "9700AA", "993399", "9E00B2"); + + // List of exceptions + List RANCHERS = List.of("CC5500", "000000", "0"); + List REAPER = List.of("1B1B1B", "FF0000"); + List ADAPTIVE_CHEST = List.of("3ABE78", "82E3D8", "BFBCB2", "D579FF", "FF4242", "FFC234"); + List ADAPTIVE = List.of("169F57", "2AB5A5", "6E00A0", "BB0000", "BFBCB2", "FFF7E6"); } diff --git a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java deleted file mode 100644 index 7fc042e5..00000000 --- a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java +++ /dev/null @@ -1,650 +0,0 @@ -package me.xmrvizzy.skyblocker.config; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import me.shedaniel.autoconfig.AutoConfig; -import me.shedaniel.autoconfig.ConfigData; -import me.shedaniel.autoconfig.annotation.Config; -import me.shedaniel.autoconfig.annotation.ConfigEntry; -import me.shedaniel.autoconfig.serializer.ConfigSerializer; -import me.shedaniel.autoconfig.serializer.GsonConfigSerializer; -import me.xmrvizzy.skyblocker.SkyblockerMod; -import me.xmrvizzy.skyblocker.skyblock.item.CustomArmorTrims; -import me.xmrvizzy.skyblocker.utils.chat.ChatFilterResult; -import me.xmrvizzy.skyblocker.utils.scheduler.Scheduler; -import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import net.minecraft.client.resource.language.I18n; -import net.minecraft.text.Style; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; - -import java.util.ArrayList; -import java.util.List; - -import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal; - -@Config(name = "skyblocker") -public class SkyblockerConfig implements ConfigData { - - @ConfigEntry.Category("general") - @ConfigEntry.Gui.TransitiveObject - public General general = new General(); - - @ConfigEntry.Category("locations") - @ConfigEntry.Gui.TransitiveObject - public Locations locations = new Locations(); - - @ConfigEntry.Category("slayer") - @ConfigEntry.Gui.TransitiveObject - public Slayer slayer = new Slayer(); - - @ConfigEntry.Category("quickNav") - @ConfigEntry.Gui.TransitiveObject - public QuickNav quickNav = new QuickNav(); - - @ConfigEntry.Category("messages") - @ConfigEntry.Gui.TransitiveObject - public Messages messages = new Messages(); - - @ConfigEntry.Category("richPresence") - @ConfigEntry.Gui.TransitiveObject - public RichPresence richPresence = new RichPresence(); - - public static class QuickNav { - public boolean enableQuickNav = true; - - @ConfigEntry.Category("button1") - @ConfigEntry.Gui.CollapsibleObject() - public QuickNavItem button1 = new QuickNavItem(true, new ItemData("diamond_sword"), "Your Skills", "/skills"); - - @ConfigEntry.Category("button2") - @ConfigEntry.Gui.CollapsibleObject() - public QuickNavItem button2 = new QuickNavItem(true, new ItemData("painting"), "Collections", "/collection"); - - @ConfigEntry.Category("button3") - @ConfigEntry.Gui.CollapsibleObject() - public QuickNavItem button3 = new QuickNavItem(true, new ItemData("bone"), "\\Pets \\(\\d+/\\d+\\)", "/pets"); - - @ConfigEntry.Category("button4") - @ConfigEntry.Gui.CollapsibleObject() - public QuickNavItem button4 = new QuickNavItem(true, new ItemData("leather_chestplate", 1, "tag:{display:{color:8991416}}"), "Wardrobe \\([12]/2\\)", "/wardrobe"); - - @ConfigEntry.Category("button5") - @ConfigEntry.Gui.CollapsibleObject() - public QuickNavItem button5 = new QuickNavItem(true, new ItemData("player_head", 1, "tag:{SkullOwner:{Id:[I;-2081424676,-57521078,-2073572414,158072763],Properties:{textures:[{Value:\"ewogICJ0aW1lc3RhbXAiIDogMTU5MTMxMDU4NTYwOSwKICAicHJvZmlsZUlkIiA6ICI0MWQzYWJjMmQ3NDk0MDBjOTA5MGQ1NDM0ZDAzODMxYiIsCiAgInByb2ZpbGVOYW1lIiA6ICJNZWdha2xvb24iLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvODBhMDc3ZTI0OGQxNDI3NzJlYTgwMDg2NGY4YzU3OGI5ZDM2ODg1YjI5ZGFmODM2YjY0YTcwNjg4MmI2ZWMxMCIKICAgIH0KICB9Cn0=\"}]}}}"), "Sack of Sacks", "/sacks"); - - @ConfigEntry.Category("button6") - @ConfigEntry.Gui.CollapsibleObject() - public QuickNavItem button6 = new QuickNavItem(true, new ItemData("ender_chest"), "(?:Rift )?Storage(?: \\(1/2\\))?", "/storage"); - - @ConfigEntry.Category("button7") - @ConfigEntry.Gui.CollapsibleObject() - public QuickNavItem button7 = new QuickNavItem(true, new ItemData("player_head", 1, "tag:{SkullOwner:{Id:[I;-300151517,-631415889,-1193921967,-1821784279],Properties:{textures:[{Value:\"e3RleHR1cmVzOntTS0lOOnt1cmw6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDdjYzY2ODc0MjNkMDU3MGQ1NTZhYzUzZTA2NzZjYjU2M2JiZGQ5NzE3Y2Q4MjY5YmRlYmVkNmY2ZDRlN2JmOCJ9fX0=\"}]}}}"), "none", "/hub"); - - @ConfigEntry.Category("button8") - @ConfigEntry.Gui.CollapsibleObject() - public QuickNavItem button8 = new QuickNavItem(true, new ItemData("player_head", 1, "tag:{SkullOwner:{Id:[I;1605800870,415127827,-1236127084,15358548],Properties:{textures:[{Value:\"e3RleHR1cmVzOntTS0lOOnt1cmw6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzg5MWQ1YjI3M2ZmMGJjNTBjOTYwYjJjZDg2ZWVmMWM0MGExYjk0MDMyYWU3MWU3NTQ3NWE1NjhhODI1NzQyMSJ9fX0=\"}]}}}"), "none", "/warp dungeon_hub"); - - @ConfigEntry.Category("button9") - @ConfigEntry.Gui.CollapsibleObject() - public QuickNavItem button9 = new QuickNavItem(true, new ItemData("player_head", 1, "tag:{SkullOwner:{Id:[I;-562285948,532499670,-1705302742,775653035],Properties:{textures:[{Value:\"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjVkZjU1NTkyNjQzMGQ1ZDc1YWRlZDIxZGQ5NjE5Yjc2YzViN2NhMmM3ZjU0MDE0NDA1MjNkNTNhOGJjZmFhYiJ9fX0=\"}]}}}"), "Visit prtl", "/visit prtl"); - - @ConfigEntry.Category("button10") - @ConfigEntry.Gui.CollapsibleObject() - public QuickNavItem button10 = new QuickNavItem(true, new ItemData("enchanting_table"), "Enchant Item", "/etable"); - - @ConfigEntry.Category("button11") - @ConfigEntry.Gui.CollapsibleObject() - public QuickNavItem button11 = new QuickNavItem(true, new ItemData("anvil"), "Anvil", "/anvil"); - - @ConfigEntry.Category("button12") - @ConfigEntry.Gui.CollapsibleObject() - public QuickNavItem button12 = new QuickNavItem(true, new ItemData("crafting_table"), "Craft Item", "/craft"); - } - - public static class QuickNavItem { - public QuickNavItem(Boolean render, ItemData itemData, String uiTitle, String clickEvent) { - this.render = render; - this.item = itemData; - this.clickEvent = clickEvent; - this.uiTitle = uiTitle; - } - - public Boolean render; - - @ConfigEntry.Category("item") - @ConfigEntry.Gui.CollapsibleObject() - public ItemData item; - - public String uiTitle; - public String clickEvent; - } - - public static class ItemData { - public ItemData(String itemName, int count, String nbt) { - this.itemName = itemName; - this.count = count; - this.nbt = nbt; - } - - public ItemData(String itemName) { - this.itemName = itemName; - this.count = 1; - this.nbt = ""; - } - - public String itemName; - public int count; - public String nbt; - } - - public static class General { - public boolean acceptReparty = true; - public boolean backpackPreviewWithoutShift = false; - public boolean hideEmptyTooltips = true; - public boolean hideStatusEffectOverlay = false; - - @ConfigEntry.Category("tabHud") - @ConfigEntry.Gui.CollapsibleObject() - public TabHudConf tabHud = new TabHudConf(); - - @ConfigEntry.Gui.Excluded - public String apiKey; - - @ConfigEntry.Category("bars") - @ConfigEntry.Gui.CollapsibleObject() - public Bars bars = new Bars(); - - @ConfigEntry.Category("experiments") - @ConfigEntry.Gui.CollapsibleObject() - public Experiments experiments = new Experiments(); - - @ConfigEntry.Category("fishing") - @ConfigEntry.Gui.CollapsibleObject() - public Fishing fishing = new Fishing(); - - @ConfigEntry.Category("fairySouls") - @ConfigEntry.Gui.CollapsibleObject() - public FairySouls fairySouls = new FairySouls(); - - @ConfigEntry.Category("shortcuts") - @ConfigEntry.Gui.CollapsibleObject() - public Shortcuts shortcuts = new Shortcuts(); - - @ConfigEntry.Category("quiverWarning") - @ConfigEntry.Gui.CollapsibleObject() - public QuiverWarning quiverWarning = new QuiverWarning(); - - @ConfigEntry.Category("itemList") - @ConfigEntry.Gui.CollapsibleObject() - public ItemList itemList = new ItemList(); - - @ConfigEntry.Category("itemTooltip") - @ConfigEntry.Gui.CollapsibleObject() - public ItemTooltip itemTooltip = new ItemTooltip(); - - @ConfigEntry.Category("itemInfoDisplay") - @ConfigEntry.Gui.CollapsibleObject - public ItemInfoDisplay itemInfoDisplay = new ItemInfoDisplay(); - - @ConfigEntry.Category("specialEffects") - @ConfigEntry.Gui.CollapsibleObject - public SpecialEffects specialEffects = new SpecialEffects(); - - @ConfigEntry.Category("hitbox") - @ConfigEntry.Gui.CollapsibleObject() - public Hitbox hitbox = new Hitbox(); - - @ConfigEntry.Gui.Tooltip() - @ConfigEntry.Category("titleContainer") - @ConfigEntry.Gui.CollapsibleObject() - public TitleContainer titleContainer = new TitleContainer(); - - @ConfigEntry.Category("Teleport Overlay") - @ConfigEntry.Gui.CollapsibleObject() - public TeleportOverlay teleportOverlay = new TeleportOverlay(); - - @ConfigEntry.Gui.Excluded - public List lockedSlots = new ArrayList<>(); - - @ConfigEntry.Gui.Excluded - public Object2ObjectOpenHashMap customItemNames = new Object2ObjectOpenHashMap<>(); - - @ConfigEntry.Gui.Excluded - public Object2IntOpenHashMap customDyeColors = new Object2IntOpenHashMap<>(); - - @ConfigEntry.Gui.Excluded - public Object2ObjectOpenHashMap customArmorTrims = new Object2ObjectOpenHashMap<>(); - } - - public static class TabHudConf { - public boolean tabHudEnabled = true; - - @ConfigEntry.BoundedDiscrete(min = 10, max = 200) - @ConfigEntry.Gui.Tooltip() - public int tabHudScale = 100; - @ConfigEntry.Gui.Tooltip - public boolean plainPlayerNames = false; - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) - @ConfigEntry.Gui.Tooltip - public NameSorting nameSorting = NameSorting.DEFAULT; - } - - public enum NameSorting { - DEFAULT, - ALPHABETICAL; - - @Override - public String toString() { - return switch (this) { - case DEFAULT -> "Default"; - case ALPHABETICAL -> "Alphabetical"; - }; - } - } - - public static class Bars { - public boolean enableBars = true; - - @ConfigEntry.Category("barpositions") - @ConfigEntry.Gui.CollapsibleObject() - public BarPositions barpositions = new BarPositions(); - } - - public static class BarPositions { - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) - public BarPosition healthBarPosition = BarPosition.LAYER1; - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) - public BarPosition manaBarPosition = BarPosition.LAYER1; - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) - public BarPosition defenceBarPosition = BarPosition.LAYER1; - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) - public BarPosition experienceBarPosition = BarPosition.LAYER1; - - } - - public enum BarPosition { - LAYER1, - LAYER2, - RIGHT, - NONE; - - @Override - public String toString() { - return I18n.translate("text.autoconfig.skyblocker.option.general.bars.barpositions." + name()); - } - - public int toInt() { - return switch (this) { - case LAYER1 -> 0; - case LAYER2 -> 1; - case RIGHT -> 2; - case NONE -> -1; - }; - } - } - - public static class Experiments { - public boolean enableChronomatronSolver = true; - public boolean enableSuperpairsSolver = true; - public boolean enableUltrasequencerSolver = true; - } - - public static class Fishing { - public boolean enableFishingHelper = true; - } - - public static class FairySouls { - public boolean enableFairySoulsHelper = false; - } - - public static class Shortcuts { - @ConfigEntry.Gui.Tooltip() - public boolean enableShortcuts = true; - @ConfigEntry.Gui.Tooltip() - public boolean enableCommandShortcuts = true; - @ConfigEntry.Gui.Tooltip() - public boolean enableCommandArgShortcuts = true; - } - - public static class QuiverWarning { - public boolean enableQuiverWarning = true; - public boolean enableQuiverWarningInDungeons = true; - public boolean enableQuiverWarningAfterDungeon = true; - } - - public static class Hitbox { - public boolean oldFarmlandHitbox = true; - public boolean oldLeverHitbox = false; - } - - public static class TitleContainer { - @ConfigEntry.BoundedDiscrete(min = 30, max = 140) - public float titleContainerScale = 100; - public int x = 540; - public int y = 10; - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) - public Direction direction = Direction.HORIZONTAL; - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.DROPDOWN) - public Alignment alignment = Alignment.MIDDLE; - } - - public static class TeleportOverlay { - public boolean enableTeleportOverlays = true; - public boolean enableWeirdTransmission = true; - public boolean enableInstantTransmission = true; - public boolean enableEtherTransmission = true; - public boolean enableSinrecallTransmission = true; - public boolean enableWitherImpact = true; - } - - public enum Direction { - HORIZONTAL, - VERTICAL; - - @Override - public String toString() { - return switch (this) { - case HORIZONTAL -> "Horizontal"; - case VERTICAL -> "Vertical"; - }; - } - } - - public enum Alignment { - LEFT, - RIGHT, - MIDDLE; - - @Override - public String toString() { - return switch (this) { - case LEFT -> "Left"; - case RIGHT -> "Right"; - case MIDDLE -> "Middle"; - }; - } - } - - public static class RichPresence { - public boolean enableRichPresence = false; - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) - @ConfigEntry.Gui.Tooltip() - public Info info = Info.LOCATION; - public boolean cycleMode = false; - public String customMessage = "Playing Skyblock"; - } - - public static class ItemList { - public boolean enableItemList = true; - } - - public enum Average { - ONE_DAY, - THREE_DAY, - BOTH; - - @Override - public String toString() { - return I18n.translate("text.autoconfig.skyblocker.option.general.itemTooltip.avg." + name()); - } - } - - public static class ItemTooltip { - public boolean enableExoticCheck = true; - public boolean enableNPCPrice = true; - @ConfigEntry.Gui.Tooltip - public boolean enableMotesPrice = true; - public boolean enableAvgBIN = true; - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) - @ConfigEntry.Gui.Tooltip() - public Average avg = Average.THREE_DAY; - public boolean enableLowestBIN = true; - public boolean enableBazaarPrice = true; - public boolean enableMuseumDate = true; - } - - public static class ItemInfoDisplay { - @ConfigEntry.Gui.Tooltip - public boolean attributeShardInfo = true; - } - - public static class SpecialEffects { - @ConfigEntry.Gui.Tooltip - public boolean rareDungeonDropEffects = true; - } - - public static class Locations { - @ConfigEntry.Category("barn") - @ConfigEntry.Gui.CollapsibleObject() - public Barn barn = new Barn(); - - @ConfigEntry.Category("dungeons") - @ConfigEntry.Gui.CollapsibleObject() - public Dungeons dungeons = new Dungeons(); - - @ConfigEntry.Category("dwarvenmines") - @ConfigEntry.Gui.CollapsibleObject() - public DwarvenMines dwarvenMines = new DwarvenMines(); - - @ConfigEntry.Category("rift") - @ConfigEntry.Gui.CollapsibleObject() - public Rift rift = new Rift(); - } - - public static class Dungeons { - @ConfigEntry.Gui.CollapsibleObject - public SecretWaypoints secretWaypoints = new SecretWaypoints(); - @ConfigEntry.Gui.CollapsibleObject - public DungeonChestProfit dungeonChestProfit = new DungeonChestProfit(); - @ConfigEntry.Gui.Tooltip() - public boolean croesusHelper = true; - public boolean enableMap = true; - public float mapScaling = 1f; - public int mapX = 2; - public int mapY = 2; - @ConfigEntry.Gui.Tooltip - public boolean starredMobGlow = true; - public boolean solveThreeWeirdos = true; - @ConfigEntry.Gui.Tooltip - public boolean blazesolver = true; - public boolean solveTrivia = true; - @ConfigEntry.Gui.Tooltip - public boolean solveTicTacToe = true; - @ConfigEntry.Gui.CollapsibleObject - public LividColor lividColor = new LividColor(); - @ConfigEntry.Gui.CollapsibleObject() - 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 DungeonChestProfit { - @ConfigEntry.Gui.Tooltip - public boolean enableProfitCalculator = true; - @ConfigEntry.Gui.Tooltip - public boolean includeKismet = false; - @ConfigEntry.Gui.Tooltip - public boolean includeEssence = true; - } - - public static class LividColor { - @ConfigEntry.Gui.Tooltip() - public boolean enableLividColor = true; - @ConfigEntry.Gui.Tooltip() - public String lividColorText = "The livid color is [color]"; - } - - public static class Terminals { - public boolean solveColor = true; - public boolean solveOrder = true; - public boolean solveStartsWith = true; - } - - public static class DwarvenMines { - public boolean enableDrillFuel = true; - public boolean solveFetchur = true; - public boolean solvePuzzler = true; - @ConfigEntry.Gui.CollapsibleObject() - public DwarvenHud dwarvenHud = new DwarvenHud(); - } - - public static class DwarvenHud { - public boolean enabled = true; - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) - @ConfigEntry.Gui.Tooltip(count = 3) - public DwarvenHudStyle style = DwarvenHudStyle.SIMPLE; - public boolean enableBackground = true; - public int x = 10; - public int y = 10; - } - - public enum DwarvenHudStyle { - SIMPLE, - FANCY, - CLASSIC; - - @Override - public String toString() { - return switch (this) { - case SIMPLE -> "Simple"; - case FANCY -> "Fancy"; - case CLASSIC -> "Classic"; - }; - } - } - - public static class Barn { - public boolean solveHungryHiker = true; - public boolean solveTreasureHunter = true; - } - - public static class Rift { - public boolean mirrorverseWaypoints = true; - @ConfigEntry.BoundedDiscrete(min = 0, max = 5) - @ConfigEntry.Gui.Tooltip - public int mcGrubberStacks = 0; - } - - public static class Slayer { - @ConfigEntry.Category("vampire") - @ConfigEntry.Gui.CollapsibleObject() - public VampireSlayer vampireSlayer = new VampireSlayer(); - } - - public static class VampireSlayer { - public boolean enableEffigyWaypoints = true; - public boolean compactEffigyWaypoints; - @ConfigEntry.BoundedDiscrete(min = 1, max = 10) - @ConfigEntry.Gui.Tooltip() - public int effigyUpdateFrequency = 5; - public boolean enableHolyIceIndicator = true; - public int holyIceIndicatorTickDelay = 10; - @ConfigEntry.BoundedDiscrete(min = 1, max = 10) - @ConfigEntry.Gui.Tooltip() - public int holyIceUpdateFrequency = 5; - public boolean enableHealingMelonIndicator = true; - public float healingMelonHealthThreshold = 4F; - public boolean enableSteakStakeIndicator = true; - @ConfigEntry.BoundedDiscrete(min = 1, max = 10) - @ConfigEntry.Gui.Tooltip() - public int steakStakeUpdateFrequency = 5; - public boolean enableManiaIndicator = true; - @ConfigEntry.BoundedDiscrete(min = 1, max = 10) - @ConfigEntry.Gui.Tooltip() - public int maniaUpdateFrequency = 5; - } - - public static class Messages { - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) - public ChatFilterResult hideAbility = ChatFilterResult.PASS; - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) - public ChatFilterResult hideHeal = ChatFilterResult.PASS; - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) - public ChatFilterResult hideAOTE = ChatFilterResult.PASS; - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) - public ChatFilterResult hideImplosion = ChatFilterResult.PASS; - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) - public ChatFilterResult hideMoltenWave = ChatFilterResult.PASS; - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) - public ChatFilterResult hideAds = ChatFilterResult.PASS; - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) - public ChatFilterResult hideTeleportPad = ChatFilterResult.PASS; - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) - public ChatFilterResult hideCombo = ChatFilterResult.PASS; - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) - public ChatFilterResult hideAutopet = ChatFilterResult.PASS; - @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) - @ConfigEntry.Gui.Tooltip - public ChatFilterResult hideShowOff = ChatFilterResult.PASS; - @ConfigEntry.Gui.Tooltip() - public boolean hideMana = false; - } - - public enum Info { - PURSE, - BITS, - LOCATION; - - @Override - public String toString() { - return I18n.translate("text.autoconfig.skyblocker.option.richPresence.info." + name()); - } - } - - /** - * Registers the config to AutoConfig and registers commands to open the config screen. - */ - public static void init() { - Gson gson = new GsonBuilder() - .setPrettyPrinting() - .registerTypeHierarchyAdapter(Text.class, new Text.Serializer()) - .registerTypeHierarchyAdapter(Style.class, new Style.Serializer()) - .registerTypeHierarchyAdapter(Identifier.class, new Identifier.Serializer()) - .create(); - - ConfigSerializer.Factory serializer = (cfg, cfgClass) -> new GsonConfigSerializer<>(cfg, cfgClass, gson); - - AutoConfig.register(SkyblockerConfig.class, serializer); - ClientCommandRegistrationCallback.EVENT.register(((dispatcher, registryAccess) -> dispatcher.register(literal(SkyblockerMod.NAMESPACE).then(optionsLiteral("config")).then(optionsLiteral("options"))))); - } - - /** - * Registers an options command with the given name. Used for registering both options and config as valid commands. - * - * @param name the name of the command node - * @return the command builder - */ - private static LiteralArgumentBuilder optionsLiteral(String name) { - // Don't immediately open the next screen as it will be closed by ChatScreen right after this command is executed - return literal(name).executes(Scheduler.queueOpenScreenCommand(AutoConfig.getConfigScreen(SkyblockerConfig.class, null))); - } - - public static SkyblockerConfig get() { - return AutoConfig.getConfigHolder(SkyblockerConfig.class).getConfig(); - } - - public static void save() { - AutoConfig.getConfigHolder(SkyblockerConfig.class).save(); - } -} diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/exotic/ExoticCheck.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/exotic/ExoticCheck.java deleted file mode 100644 index 6a8e51a5..00000000 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/item/exotic/ExoticCheck.java +++ /dev/null @@ -1,88 +0,0 @@ -package me.xmrvizzy.skyblocker.skyblock.item.exotic; - -import me.xmrvizzy.skyblocker.skyblock.item.PriceInfoTooltip; -import me.xmrvizzy.skyblocker.utils.Constants; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.text.MutableText; -import net.minecraft.text.Text; -import net.minecraft.util.Formatting; - -public class ExoticCheck { - public static String getExpectedHex(String id) { - String color = PriceInfoTooltip.colorJson.get(id).getAsString(); - if (color != null) { - String[] RGBValues = color.split(","); - String hex = String.format("%02x%02x%02x", Integer.parseInt(RGBValues[0]), Integer.parseInt(RGBValues[1]), Integer.parseInt(RGBValues[2])); - return hex.toUpperCase(); - } else { - System.out.println("Color is null"); - return null; - } - } - - public static boolean isException(String id, String hex) { - if (id.startsWith("LEATHER") || id.equals("GHOST_BOOTS") || Constants.SEYMOUR_IDS.contains(id)) { - return true; - } - if (id.startsWith("RANCHER")) { - return Constants.RANCHERS.contains(hex); - } - if (id.contains("ADAPTIVE_CHESTPLATE")) { - return Constants.ADAPTIVE_CHEST.contains(hex); - } else if (id.contains("ADAPTIVE")) { - return Constants.ADAPTIVE.contains(hex); - } - if (id.startsWith("REAPER")) { - return Constants.REAPER.contains(hex); - } - if (id.startsWith("FAIRY")) { - return Constants.FAIRY_HEXES.contains(hex); - } - if (id.startsWith("CRYSTAL")) { - return Constants.CRYSTAL_HEXES.contains(hex); - } - if (id.contains("SPOOK")) { - return Constants.SPOOK.contains(hex); - } - return false; - } - - public static String checkDyeType(String hex) { - if (Constants.CRYSTAL_HEXES.contains(hex)) { - return "CRYSTAL"; - } - if (Constants.FAIRY_HEXES.contains(hex)) { - return "FAIRY"; - } - if (Constants.OG_FAIRY_HEXES.contains(hex)) { - return "OG_FAIRY"; - } - if (Constants.SPOOK.contains(hex)) { - return "SPOOK"; - } - if (Constants.GLITCHED.contains(hex)) { - return "GLITCHED"; - } - return "EXOTIC"; - } - - public static boolean intendedDyed(NbtCompound ItemData) { - return ItemData.getCompound("ExtraAttributes").contains("dye_item"); - } - - public static Formatting getFormattingColor(String s) { - return switch (s) { - case "CRYSTAL" -> Formatting.AQUA; - case "FAIRY" -> Formatting.LIGHT_PURPLE; - case "OG_FAIRY" -> Formatting.DARK_PURPLE; - case "SPOOK" -> Formatting.RED; - case "GLITCHED" -> Formatting.BLUE; - case "EXOTIC" -> Formatting.GOLD; - default -> Formatting.DARK_GRAY; - }; - } - - public static MutableText getTranslatedText(String s) { - return Text.translatable("skyblocker.exotic." + s.toLowerCase()); - } -} diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/Constants.java b/src/main/java/me/xmrvizzy/skyblocker/utils/Constants.java deleted file mode 100644 index a10e6025..00000000 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/Constants.java +++ /dev/null @@ -1,33 +0,0 @@ -package me.xmrvizzy.skyblocker.utils; - -import java.util.List; - -/** - * Holds generic static constants - */ -public interface Constants { - String LEVEL_EMBLEMS = "\u2E15\u273F\u2741\u2E19\u03B1\u270E\u2615\u2616\u2663\u213B\u2694\u27B6\u26A1\u2604\u269A\u2693\u2620\u269B\u2666\u2660\u2764\u2727\u238A\u1360\u262C\u269D\u29C9\uA214\u32D6\u2E0E\u26A0\uA541\u3020\u30C4\u2948\u2622\u2623\u273E\u269C\u0BD0\u0A6D\u2742\u16C3\u3023\u10F6\u0444\u266A\u266B\u04C3\u26C1\u26C3\u16DD\uA03E\u1C6A\u03A3\u09EB\u2603\u2654\u26C2\u12DE"; - - List SEYMOUR_IDS = List.of("VELVET_TOP_HAT", "CASHMERE_JACKET", "SATIN_TROUSERS", "OXFORD_SHOES"); - - // Exotic Hexes - List CRYSTAL_HEXES = List.of("1F0030", "46085E", "54146E", "5D1C78", "63237D", "6A2C82", "7E4196", "8E51A6", "9C64B3", "A875BD", - "B88BC9", "C6A3D4", "D9C1E3", "E5D1ED", "EFE1F5", "FCF3FF"); - List FAIRY_HEXES = List.of("330066", "4C0099", "660033", "660066", "6600CC", "7F00FF", "99004C", "990099", "9933FF", "B266FF", - "CC0066", "CC00CC", "CC99FF", "E5CCFF", "FF007F", "FF00FF", "FF3399", "FF33FF", "FF66B2", "FF66FF", "FF99CC", "FF99FF", "FFCCE5", - "FFCCFF"); - List OG_FAIRY_HEXES = List.of("FF99FF", "FFCCFF", "E5CCFF", "CC99FF", "CC00CC", "FF00FF", "FF33FF", "FF66FF", - "B266FF", "9933FF", "7F00FF", "660066", "6600CC", "4C0099", "330066", "990099", "660033", "99004C", "CC0066", - "660033", "99004C", "FFCCE5", "660033", "FFCCE5", "FF99CC", "FFCCE5", "FF99CC", "FF66B2"); - List GLITCHED = List.of("FFDC51", "F7DA33", "606060", "E7413C", "45413C", "4A14B7", "1793C4", "000000", "E75C3C", "65605A", - "5D2FB9", "17A8C4", "E76E3C", "88837E", "8969C8", "1CD4E4"); // Glitched through other means such as Shark Scale upgrade color¬ - List SPOOK = List.of("000000", "070008", "0E000F", "150017", "1B001F", "220027", "29002E", "300036", "37003E", "3E0046", - "45004D", "4C0055", "52005D", "590065", "60006C", "670074", "6E007C", "750084", "7C008B", "830093", - "89009B", "9000A3", "9700AA", "993399", "9E00B2"); - - // List of exceptions - List RANCHERS = List.of("CC5500", "000000", "0"); - List REAPER = List.of("1B1B1B", "FF0000"); - List ADAPTIVE_CHEST = List.of("3ABE78", "82E3D8", "BFBCB2", "D579FF", "FF4242", "FFC234"); - List ADAPTIVE = List.of("169F57", "2AB5A5", "6E00A0", "BB0000", "BFBCB2", "FFF7E6"); -} diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 990fc351..2373468b 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -65,7 +65,6 @@ "text.autoconfig.skyblocker.option.general.tabHud.nameSorting": "Player Name Sorting Method", "text.autoconfig.skyblocker.option.general.tabHud.nameSorting.@Tooltip": "Alphabetical sorting sorts names alphabetically while Default has no particular order.", "text.autoconfig.skyblocker.option.general.itemTooltip": "Item Tooltip", - "text.autoconfig.skyblocker.option.general.itemTooltip.enableExoticCheck": "Enable Exotic Check", "text.autoconfig.skyblocker.option.general.itemTooltip.enableNPCPrice": "Enable NPC Price", "text.autoconfig.skyblocker.option.general.itemTooltip.enableMotesPrice": "Enable Motes Price", "text.autoconfig.skyblocker.option.general.itemTooltip.enableMotesPrice.@Tooltip": "Displays the Motes sell price of an item while in The Rift.", @@ -78,6 +77,7 @@ "text.autoconfig.skyblocker.option.general.itemTooltip.enableLowestBIN": "Enable Lowest BIN Price", "text.autoconfig.skyblocker.option.general.itemTooltip.enableBazaarPrice": "Enable Bazaar buy/sell Price", "text.autoconfig.skyblocker.option.general.itemTooltip.enableMuseumDate": "Enable Museum & Date", + "text.autoconfig.skyblocker.option.general.itemTooltip.enableExoticCheck": "Enable Exotic Check", "text.autoconfig.skyblocker.option.general.itemInfoDisplay": "Item Info Display", "text.autoconfig.skyblocker.option.general.itemInfoDisplay.attributeShardInfo": "Attribute Shard Info", "text.autoconfig.skyblocker.option.general.itemInfoDisplay.attributeShardInfo.@Tooltip": "Displays the attribute's level as the stack count and the initials of the attribute's name.", -- cgit From 54b67d826aa84c40c506b46649483d5f08737134 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sun, 29 Oct 2023 02:16:44 -0400 Subject: Update exotic tooltip --- src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java | 2 +- .../de/hysky/skyblocker/config/categories/GeneralCategory.java | 8 ++++---- src/main/java/de/hysky/skyblocker/mixin/HandledScreenMixin.java | 4 +++- .../hysky/skyblocker/skyblock/item/tooltip/TooltipInfoType.java | 2 +- src/main/resources/assets/skyblocker/lang/en_us.json | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java') diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index 4959ca3b..15017995 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -487,7 +487,7 @@ public class SkyblockerConfig { public boolean enableMuseumDate = true; @SerialEntry - public boolean enableExoticCheck = true; + public boolean enableExoticTooltip = true; } public static class ItemInfoDisplay { diff --git a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java index 8ce00172..b6865edc 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java @@ -357,10 +357,10 @@ public class GeneralCategory { .controller(ConfigUtils::createBooleanController) .build()) .option(Option.createBuilder() - .name(Text.translatable("text.autoconfig.skyblocker.option.general.itemTooltip.enableExoticCheck")) - .binding(defaults.general.itemTooltip.enableExoticCheck, - () -> config.general.itemTooltip.enableExoticCheck, - newValue -> config.general.itemTooltip.enableExoticCheck = newValue) + .name(Text.translatable("text.autoconfig.skyblocker.option.general.itemTooltip.enableExoticTooltip")) + .binding(defaults.general.itemTooltip.enableExoticTooltip, + () -> config.general.itemTooltip.enableExoticTooltip, + newValue -> config.general.itemTooltip.enableExoticTooltip = newValue) .controller(ConfigUtils::createBooleanController) .build()) .build()) diff --git a/src/main/java/de/hysky/skyblocker/mixin/HandledScreenMixin.java b/src/main/java/de/hysky/skyblocker/mixin/HandledScreenMixin.java index d7e5e824..b25db7cf 100644 --- a/src/main/java/de/hysky/skyblocker/mixin/HandledScreenMixin.java +++ b/src/main/java/de/hysky/skyblocker/mixin/HandledScreenMixin.java @@ -6,7 +6,9 @@ import de.hysky.skyblocker.skyblock.experiment.ChronomatronSolver; import de.hysky.skyblocker.skyblock.experiment.ExperimentSolver; import de.hysky.skyblocker.skyblock.experiment.SuperpairsSolver; import de.hysky.skyblocker.skyblock.experiment.UltrasequencerSolver; -import de.hysky.skyblocker.skyblock.item.*; +import de.hysky.skyblocker.skyblock.item.ItemProtection; +import de.hysky.skyblocker.skyblock.item.ItemRarityBackgrounds; +import de.hysky.skyblocker.skyblock.item.WikiLookup; import de.hysky.skyblocker.skyblock.item.tooltip.BackpackPreview; import de.hysky.skyblocker.skyblock.item.tooltip.CompactorDeletorPreview; import de.hysky.skyblocker.utils.ItemUtils; diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/TooltipInfoType.java b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/TooltipInfoType.java index ddc8bd1c..b786f4c1 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/TooltipInfoType.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/TooltipInfoType.java @@ -21,7 +21,7 @@ public enum TooltipInfoType implements Runnable { THREE_DAY_AVERAGE("https://moulberry.codes/auction_averages_lbin/3day.json", itemTooltip -> itemTooltip.enableAvgBIN, false), MOTES("https://hysky.de/api/motesprice", itemTooltip -> itemTooltip.enableMotesPrice, itemTooltip -> itemTooltip.enableMotesPrice && Utils.isInTheRift(), true), MUSEUM("https://hysky.de/api/museum", itemTooltip -> itemTooltip.enableMuseumDate, true), - COLOR("https://hysky.de/api/color", itemTooltip -> itemTooltip.enableExoticCheck, true); + COLOR("https://hysky.de/api/color", itemTooltip -> itemTooltip.enableExoticTooltip, true); private final String address; private final Predicate dataEnabled; diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 2373468b..b1aa7e44 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -77,7 +77,7 @@ "text.autoconfig.skyblocker.option.general.itemTooltip.enableLowestBIN": "Enable Lowest BIN Price", "text.autoconfig.skyblocker.option.general.itemTooltip.enableBazaarPrice": "Enable Bazaar buy/sell Price", "text.autoconfig.skyblocker.option.general.itemTooltip.enableMuseumDate": "Enable Museum & Date", - "text.autoconfig.skyblocker.option.general.itemTooltip.enableExoticCheck": "Enable Exotic Check", + "text.autoconfig.skyblocker.option.general.itemTooltip.enableExoticTooltip": "Enable Exotic Tooltip", "text.autoconfig.skyblocker.option.general.itemInfoDisplay": "Item Info Display", "text.autoconfig.skyblocker.option.general.itemInfoDisplay.attributeShardInfo": "Attribute Shard Info", "text.autoconfig.skyblocker.option.general.itemInfoDisplay.attributeShardInfo.@Tooltip": "Displays the attribute's level as the stack count and the initials of the attribute's name.", -- cgit From 5bb91104d3275283d7479f0b35c1b18be470d632 Mon Sep 17 00:00:00 2001 From: Aaron <51387595+AzureAaron@users.noreply.github.com> Date: Tue, 31 Oct 2023 01:08:28 -0400 Subject: Player Secrets Tracker (#394) * Player Secrets Tracker * Refactor SecretsTracker --------- Co-authored-by: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> --- .../java/de/hysky/skyblocker/SkyblockerMod.java | 4 + .../hysky/skyblocker/config/SkyblockerConfig.java | 3 + .../config/categories/DungeonsCategory.java | 8 + .../skyblock/dungeon/secrets/SecretsTracker.java | 174 +++++++++++++++++++++ .../skyblocker/skyblock/item/MuseumItemCache.java | 4 +- .../tabhud/widget/DungeonPlayerWidget.java | 2 +- .../java/de/hysky/skyblocker/utils/ApiUtils.java | 53 +++++++ src/main/java/de/hysky/skyblocker/utils/Http.java | 22 ++- src/main/java/de/hysky/skyblocker/utils/Utils.java | 7 +- .../resources/assets/skyblocker/lang/en_us.json | 8 +- 10 files changed, 270 insertions(+), 15 deletions(-) create mode 100644 src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretsTracker.java create mode 100644 src/main/java/de/hysky/skyblocker/utils/ApiUtils.java (limited to 'src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java') diff --git a/src/main/java/de/hysky/skyblocker/SkyblockerMod.java b/src/main/java/de/hysky/skyblocker/SkyblockerMod.java index 5178a777..b398e9b6 100644 --- a/src/main/java/de/hysky/skyblocker/SkyblockerMod.java +++ b/src/main/java/de/hysky/skyblocker/SkyblockerMod.java @@ -7,6 +7,7 @@ import de.hysky.skyblocker.skyblock.*; import de.hysky.skyblocker.skyblock.diana.MythologicalRitual; import de.hysky.skyblocker.skyblock.dungeon.*; import de.hysky.skyblocker.skyblock.dungeon.secrets.DungeonSecrets; +import de.hysky.skyblocker.skyblock.dungeon.secrets.SecretsTracker; import de.hysky.skyblocker.skyblock.dwarven.DwarvenHud; import de.hysky.skyblocker.skyblock.item.*; import de.hysky.skyblocker.skyblock.item.tooltip.BackpackPreview; @@ -20,6 +21,7 @@ import de.hysky.skyblocker.skyblock.spidersden.Relics; import de.hysky.skyblocker.skyblock.tabhud.TabHud; import de.hysky.skyblocker.skyblock.tabhud.screenbuilder.ScreenMaster; import de.hysky.skyblocker.skyblock.tabhud.util.PlayerListMgr; +import de.hysky.skyblocker.utils.ApiUtils; import de.hysky.skyblocker.utils.NEURepoManager; import de.hysky.skyblocker.utils.Utils; import de.hysky.skyblocker.utils.chat.ChatMessageListener; @@ -109,6 +111,8 @@ public class SkyblockerMod implements ClientModInitializer { CreeperBeams.init(); ItemRarityBackgrounds.init(); MuseumItemCache.init(); + SecretsTracker.init(); + ApiUtils.init(); containerSolverManager.init(); statusBarTracker.init(); Scheduler.INSTANCE.scheduleCyclic(Utils::update, 20); diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index 15017995..68520cab 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -552,6 +552,9 @@ public class SkyblockerConfig { @SerialEntry public int mapY = 2; + + @SerialEntry + public boolean playerSecretsTracker = false; @SerialEntry public boolean starredMobGlow = true; diff --git a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java index fdb13892..02913a28 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/DungeonsCategory.java @@ -241,6 +241,14 @@ public class DungeonsCategory { newValue -> config.locations.dungeons.mapScaling = newValue) .controller(FloatFieldControllerBuilder::create) .build()) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.secretsTracker")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.secretsTracker.@Tooltip"))) + .binding(defaults.locations.dungeons.playerSecretsTracker, + () -> config.locations.dungeons.playerSecretsTracker, + newValue -> config.locations.dungeons.playerSecretsTracker = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) .option(Option.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.starredMobGlow")) .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dungeons.starredMobGlow.@Tooltip"))) diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretsTracker.java b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretsTracker.java new file mode 100644 index 00000000..0690952e --- /dev/null +++ b/src/main/java/de/hysky/skyblocker/skyblock/dungeon/secrets/SecretsTracker.java @@ -0,0 +1,174 @@ +package de.hysky.skyblocker.skyblock.dungeon.secrets; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import de.hysky.skyblocker.config.SkyblockerConfigManager; +import de.hysky.skyblocker.skyblock.tabhud.util.PlayerListMgr; +import de.hysky.skyblocker.skyblock.tabhud.widget.DungeonPlayerWidget; +import de.hysky.skyblocker.utils.ApiUtils; +import de.hysky.skyblocker.utils.Constants; +import de.hysky.skyblocker.utils.Http; +import de.hysky.skyblocker.utils.Http.ApiResponse; +import de.hysky.skyblocker.utils.Utils; +import it.unimi.dsi.fastutil.ints.IntIntPair; +import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents; +import net.minecraft.client.MinecraftClient; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.text.HoverEvent; +import net.minecraft.text.Text; +import net.minecraft.util.Formatting; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Tracks the amount of secrets players get every run + */ +public class SecretsTracker { + private static final Logger LOGGER = LoggerFactory.getLogger(SecretsTracker.class); + private static final Pattern TEAM_SCORE_PATTERN = Pattern.compile(" +Team Score: [0-9]+ \\([A-z+]+\\)"); + + private static volatile TrackedRun currentRun = null; + private static volatile TrackedRun lastRun = null; + private static volatile long lastRunEnded = 0L; + + public static void init() { + ClientReceiveMessageEvents.GAME.register(SecretsTracker::onMessage); + } + + //If -1 is somehow encountered, it would be very rare, so I just disregard its possibility for now + //people would probably recognize if it was inaccurate so yeah + private static void calculate(RunPhase phase) { + switch (phase) { + case START -> CompletableFuture.runAsync(() -> { + TrackedRun newlyStartedRun = new TrackedRun(); + + //Initialize players in new run + for (int i = 0; i < 5; i++) { + String playerName = getPlayerNameAt(i + 1); + + //The player name will be blank if there isn't a player at that index + if (!playerName.isEmpty()) { + + //If the player was a part of the last run (and didn't have -1 secret count) and that run ended less than 5 mins ago then copy the secrets over + if (lastRun != null && System.currentTimeMillis() <= lastRunEnded + 300_000 && lastRun.secretCounts().getOrDefault(playerName, -1) != -1) { + newlyStartedRun.secretCounts().put(playerName, lastRun.secretCounts().getInt(playerName)); + } else { + newlyStartedRun.secretCounts().put(playerName, getPlayerSecrets(playerName).leftInt()); + } + } + } + + currentRun = newlyStartedRun; + }); + + case END -> CompletableFuture.runAsync(() -> { + //In case the game crashes from something + if (currentRun != null) { + Object2ObjectOpenHashMap secretsFound = new Object2ObjectOpenHashMap<>(); + + //Update secret counts + for (Entry entry : currentRun.secretCounts().object2IntEntrySet()) { + String playerName = entry.getKey(); + int startingSecrets = entry.getIntValue(); + IntIntPair secretsNow = getPlayerSecrets(playerName); + int secretsPlayerFound = secretsNow.leftInt() - startingSecrets; + + secretsFound.put(playerName, IntIntPair.of(secretsPlayerFound, secretsNow.rightInt())); + entry.setValue(secretsNow.leftInt()); + } + + //Print the results all in one go, so its clean and less of a chance of it being broken up + for (Map.Entry entry : secretsFound.entrySet()) { + sendResultMessage(entry.getKey(), entry.getValue().leftInt(), entry.getValue().rightInt(), true); + } + + //Swap the current and last run as well as mark the run end time + lastRunEnded = System.currentTimeMillis(); + lastRun = currentRun; + currentRun = null; + } else { + sendResultMessage(null, -1, -1, false); + } + }); + } + } + + private static void sendResultMessage(String player, int secrets, int cacheAge, boolean success) { + PlayerEntity playerEntity = MinecraftClient.getInstance().player; + if (playerEntity != null) { + if (success) { + playerEntity.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.dungeons.secretsTracker.feedback", Text.literal(player).styled(Constants.WITH_COLOR.apply(0xf57542)), "§7" + secrets, getCacheText(cacheAge)))); + } else { + playerEntity.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.dungeons.secretsTracker.failFeedback"))); + } + } + } + + private static Text getCacheText(int cacheAge) { + return Text.literal("\u2139").styled(style -> style.withColor(cacheAge == -1 ? 0x218bff : 0xeac864).withHoverEvent( + new HoverEvent(HoverEvent.Action.SHOW_TEXT, cacheAge == -1 ? Text.translatable("skyblocker.api.cache.MISS") : Text.translatable("skyblocker.api.cache.HIT", cacheAge)))); + } + + private static void onMessage(Text text, boolean overlay) { + if (Utils.isInDungeons() && SkyblockerConfigManager.get().locations.dungeons.playerSecretsTracker) { + String message = Formatting.strip(text.getString()); + + try { + if (message.equals("[NPC] Mort: Here, I found this map when I first entered the dungeon.")) calculate(RunPhase.START); + if (TEAM_SCORE_PATTERN.matcher(message).matches()) calculate(RunPhase.END); + } catch (Exception e) { + LOGGER.error("[Skyblocker] Encountered an unknown error while trying to track player secrets!", e); + } + } + } + + private static String getPlayerNameAt(int index) { + Matcher matcher = PlayerListMgr.regexAt(1 + (index - 1) * 4, DungeonPlayerWidget.PLAYER_PATTERN); + + return matcher != null ? matcher.group("name") : ""; + } + + private static IntIntPair getPlayerSecrets(String name) { + String uuid = ApiUtils.name2Uuid(name); + + if (!uuid.isEmpty()) { + try (ApiResponse response = Http.sendHypixelRequest("player", "?uuid=" + uuid)) { + return IntIntPair.of(getSecretCountFromAchievements(JsonParser.parseString(response.content()).getAsJsonObject()), response.age()); + } catch (Exception e) { + LOGGER.error("[Skyblocker] Encountered an error while trying to fetch {} secret count!", name + "'s", e); + } + } + + return IntIntPair.of(-1, -1); + } + + /** + * Gets a player's secret count from their hypixel achievements + */ + private static int getSecretCountFromAchievements(JsonObject playerJson) { + JsonObject player = playerJson.get("player").getAsJsonObject(); + JsonObject achievements = (player.has("achievements")) ? player.get("achievements").getAsJsonObject() : null; + return (achievements != null && achievements.has("skyblock_treasure_hunter")) ? achievements.get("skyblock_treasure_hunter").getAsInt() : 0; + } + + /** + * This will either reflect the value at the start or the end depending on when this is called + */ + private record TrackedRun(Object2IntOpenHashMap secretCounts) { + private TrackedRun() { + this(new Object2IntOpenHashMap<>()); + } + } + + private enum RunPhase { + START, END + } +} diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/MuseumItemCache.java b/src/main/java/de/hysky/skyblocker/skyblock/item/MuseumItemCache.java index cb11d702..ac9b1bf0 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/item/MuseumItemCache.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/item/MuseumItemCache.java @@ -73,9 +73,7 @@ public class MuseumItemCache { private static void updateData4ProfileMember(String uuid, String profileId) { CompletableFuture.runAsync(() -> { - try { - ApiResponse response = Http.sendHypixelRequest("skyblock/museum", "?profile=" + profileId); - + try (ApiResponse response = Http.sendHypixelRequest("skyblock/museum", "?profile=" + profileId)) { //The request was successful if (response.ok()) { JsonObject profileData = JsonParser.parseString(response.content()).getAsJsonObject(); diff --git a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/DungeonPlayerWidget.java b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/DungeonPlayerWidget.java index be1a3c6e..d71eb190 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/DungeonPlayerWidget.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/tabhud/widget/DungeonPlayerWidget.java @@ -27,7 +27,7 @@ public class DungeonPlayerWidget extends Widget { // group 3: level (or nothing, if pre dungeon start) // this regex filters out the ironman icon as well as rank prefixes and emblems // \[\d*\] (?:\[[A-Za-z]+\] )?(?[A-Za-z0-9_]*) (?:.* )?\((?\S*) ?(?[LXVI]*)\) - private static final Pattern PLAYER_PATTERN = Pattern + public static final Pattern PLAYER_PATTERN = Pattern .compile("\\[\\d*\\] (?:\\[[A-Za-z]+\\] )?(?[A-Za-z0-9_]*) (?:.* )?\\((?\\S*) ?(?[LXVI]*)\\)"); private static final HashMap ICOS = new HashMap<>(); diff --git a/src/main/java/de/hysky/skyblocker/utils/ApiUtils.java b/src/main/java/de/hysky/skyblocker/utils/ApiUtils.java new file mode 100644 index 00000000..c0648eba --- /dev/null +++ b/src/main/java/de/hysky/skyblocker/utils/ApiUtils.java @@ -0,0 +1,53 @@ +package de.hysky.skyblocker.utils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.gson.JsonParser; +import com.mojang.util.UndashedUuid; + +import de.hysky.skyblocker.utils.Http.ApiResponse; +import de.hysky.skyblocker.utils.scheduler.Scheduler; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.session.Session; + +/* + * Contains only basic helpers for using Http APIs + */ +public class ApiUtils { + private static final Logger LOGGER = LoggerFactory.getLogger(ApiUtils.class); + /** + * Do not iterate over this map, it will be accessed and modified by multiple threads. + */ + private static final Object2ObjectOpenHashMap NAME_2_UUID_CACHE = new Object2ObjectOpenHashMap<>(); + + public static void init() { + //Clear cache every 20 minutes + Scheduler.INSTANCE.scheduleCyclic(NAME_2_UUID_CACHE::clear, 24_000, true); + } + + /** + * Multithreading is to be handled by the method caller + */ + public static String name2Uuid(String name) { + Session session = MinecraftClient.getInstance().getSession(); + + if (session.getUsername().equals(name)) return UndashedUuid.toString(session.getUuidOrNull()); + if (NAME_2_UUID_CACHE.containsKey(name)) return NAME_2_UUID_CACHE.get(name); + + try (ApiResponse response = Http.sendName2UuidRequest(name)) { + if (response.ok()) { + String uuid = JsonParser.parseString(response.content()).getAsJsonObject().get("id").getAsString(); + + NAME_2_UUID_CACHE.put(name, uuid); + + return uuid; + } + } catch (Exception e) { + LOGGER.error("[Skyblocker] Name to uuid lookup failed! Name: {}", name, e); + } + + return ""; + } +} diff --git a/src/main/java/de/hysky/skyblocker/utils/Http.java b/src/main/java/de/hysky/skyblocker/utils/Http.java index eabb02e4..573c3458 100644 --- a/src/main/java/de/hysky/skyblocker/utils/Http.java +++ b/src/main/java/de/hysky/skyblocker/utils/Http.java @@ -49,9 +49,11 @@ public class Http { HttpResponse response = HTTP_CLIENT.send(request, BodyHandlers.ofInputStream()); InputStream decodedInputStream = getDecodedInputStream(response); + String body = new String(decodedInputStream.readAllBytes()); + HttpHeaders headers = response.headers(); - return new ApiResponse(body, response.statusCode(), getCacheStatus(response.headers())); + return new ApiResponse(body, response.statusCode(), getCacheStatus(headers), getAge(headers)); } public static HttpHeaders sendHeadRequest(String url) throws IOException, InterruptedException { @@ -66,8 +68,8 @@ public class Http { return response.headers(); } - public static String sendName2UuidRequest(String name) throws IOException, InterruptedException { - return sendGetRequest(NAME_2_UUID + name); + public static ApiResponse sendName2UuidRequest(String name) throws IOException, InterruptedException { + return sendCacheableGetRequest(NAME_2_UUID + name); } /** @@ -115,12 +117,16 @@ public class Http { * * @see Cloudflare Cache Docs */ - public static String getCacheStatus(HttpHeaders headers) { + private static String getCacheStatus(HttpHeaders headers) { return headers.firstValue("CF-Cache-Status").orElse("UNKNOWN"); } + private static int getAge(HttpHeaders headers) { + return Integer.parseInt(headers.firstValue("Age").orElse("-1")); + } + //TODO If ever needed, we could just replace cache status with the response headers and go from there - public record ApiResponse(String content, int statusCode, String cacheStatus) { + public record ApiResponse(String content, int statusCode, String cacheStatus, int age) implements AutoCloseable { public boolean ok() { return statusCode == 200; @@ -129,5 +135,11 @@ public class Http { public boolean cached() { return cacheStatus.equals("HIT"); } + + @Override + public void close() { + //Allows for nice syntax when dealing with api requests in try catch blocks + //Maybe one day we'll have some resources to free + } } } diff --git a/src/main/java/de/hysky/skyblocker/utils/Utils.java b/src/main/java/de/hysky/skyblocker/utils/Utils.java index b1a347f9..71e08865 100644 --- a/src/main/java/de/hysky/skyblocker/utils/Utils.java +++ b/src/main/java/de/hysky/skyblocker/utils/Utils.java @@ -33,10 +33,10 @@ import java.util.List; public class Utils { private static final Logger LOGGER = LoggerFactory.getLogger(Utils.class); private static final String ALTERNATE_HYPIXEL_ADDRESS = System.getProperty("skyblocker.alternateHypixelAddress", ""); + private static final String DUNGEONS_LOCATION = "dungeon"; private static final String PROFILE_PREFIX = "Profile: "; private static boolean isOnHypixel = false; private static boolean isOnSkyblock = false; - private static boolean isInDungeons = false; private static boolean isInjected = false; /** * The profile name parsed from the player list. @@ -79,7 +79,7 @@ public class Utils { } public static boolean isInDungeons() { - return isInDungeons; + return getLocationRaw().equals(DUNGEONS_LOCATION) || FabricLoader.getInstance().isDevelopmentEnvironment(); } public static boolean isInTheRift() { @@ -164,7 +164,6 @@ public class Utils { sidebar = Collections.emptyList(); } else { isOnSkyblock = false; - isInDungeons = false; return; } } @@ -188,7 +187,6 @@ public class Utils { } else { onLeaveSkyblock(); } - isInDungeons = fabricLoader.isDevelopmentEnvironment() || isOnSkyblock && string.contains("The Catacombs"); } else if (isOnHypixel) { isOnHypixel = false; onLeaveSkyblock(); @@ -205,7 +203,6 @@ public class Utils { private static void onLeaveSkyblock() { if (isOnSkyblock) { isOnSkyblock = false; - isInDungeons = false; SkyblockEvents.LEAVE.invoker().onSkyblockLeave(); } } diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index c0f3c7ba..31e7bb9c 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -280,6 +280,12 @@ "skyblocker.dungeons.secrets.customWaypointAdded": "§rAdded a custom waypoint at X: %d, Y: %d, Z: %d for room %s secret #%d of category %s with name '%s'.", "skyblocker.dungeons.secrets.customWaypointRemoved": "§rRemoved custom waypoint at X: %d, Y: %d, Z: %d for room %s secret #%d of category %s with name '%s'.", "skyblocker.dungeons.secrets.customWaypointNotFound": "§cNo custom waypoint found at X: %d, Y: %d, Z: %d for room %s.", + + "skyblocker.dungeons.secretsTracker.feedback": "%s§f found %s§f secrets. %s", + "skyblocker.dungeons.secretsTracker.failFeedback": "§cUnable to calculate the amount of secrets everybody did this run!", + + "skyblocker.api.cache.HIT": "This data was cached!\nIt's %d seconds old.", + "skyblocker.api.cache.MISS": "This data wasn't cached!", "skyblocker.exotic.crystal": "CRYSTAL", "skyblocker.exotic.fairy": "FAIRY", @@ -343,4 +349,4 @@ "skyblocker.itemProtection.unableToProtect": "§cUnable to protect this item :( (Are you in skyblock?, are you holding an item?)", "emi.category.skyblocker.skyblock": "Skyblock" -} +} \ No newline at end of file -- cgit