From 9d37d533dca5e3d7be5758694d4b1360026c18eb Mon Sep 17 00:00:00 2001 From: Yasin Date: Tue, 20 Feb 2024 20:15:02 +0100 Subject: [PATCH 1/4] move visitor helper to location garden --- .../java/de/hysky/skyblocker/config/SkyblockerConfig.java | 6 +++--- .../skyblocker/config/categories/GeneralCategory.java | 7 ------- .../skyblocker/config/categories/LocationsCategory.java | 7 +++++++ .../java/de/hysky/skyblocker/mixin/HandledScreenMixin.java | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index 78458291ce..effd9e0700 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -177,9 +177,6 @@ public static class General { @SerialEntry public boolean dungeonQuality = true; - @SerialEntry - public boolean visitorHelper = true; - @SerialEntry public TabHudConf tabHud = new TabHudConf(); @@ -1091,6 +1088,9 @@ public static class Relics { public static class Garden { @SerialEntry public boolean dicerTitlePrevent = true; + + @SerialEntry + public boolean visitorHelper = true; } public static class Slayer { 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 8a7d832c5c..1e2f806306 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java @@ -86,13 +86,6 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig newValue -> config.general.dungeonQuality = newValue) .controller(ConfigUtils::createBooleanController) .build()) - .option(Option.createBuilder() - .name(Text.translatable("text.autoconfig.skyblocker.option.general.visitorHelper")) - .binding(defaults.general.visitorHelper, - () -> config.general.visitorHelper, - newValue -> config.general.visitorHelper = newValue) - .controller(ConfigUtils::createBooleanController) - .build()) //Tab Hud .group(OptionGroup.createBuilder() 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 75c83a9b75..d97513f85f 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/LocationsCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/LocationsCategory.java @@ -153,6 +153,13 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig newValue -> config.locations.garden.dicerTitlePrevent = newValue) .controller(ConfigUtils::createBooleanController) .build()) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.visitorHelper")) + .binding(defaults.locations.garden.visitorHelper, + () -> config.locations.garden.visitorHelper, + newValue -> config.locations.garden.visitorHelper = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) .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 8a1af570d4..123bbc0a35 100644 --- a/src/main/java/de/hysky/skyblocker/mixin/HandledScreenMixin.java +++ b/src/main/java/de/hysky/skyblocker/mixin/HandledScreenMixin.java @@ -75,13 +75,13 @@ protected HandledScreenMixin(Text title) { public void skyblocker$renderScreen(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { if (!Utils.isOnSkyblock()) return; - if (SkyblockerConfigManager.get().general.visitorHelper && (Utils.getLocationRaw().equals("garden") && !getTitle().getString().contains("Logbook") || getTitle().getString().startsWith("Bazaar"))) + if (SkyblockerConfigManager.get().locations.garden.visitorHelper && (Utils.getLocationRaw().equals("garden") && !getTitle().getString().contains("Logbook") || getTitle().getString().startsWith("Bazaar"))) VisitorHelper.renderScreen(this.getTitle().getString(), context, textRenderer, handler, mouseX, mouseY); } @Inject(at = @At("HEAD"), method = "mouseClicked") public void skyblocker$mouseClicked(double mouseX, double mouseY, int button, CallbackInfoReturnable cir) { - if (SkyblockerConfigManager.get().general.visitorHelper && (Utils.getLocationRaw().equals("garden") && !getTitle().getString().contains("Logbook") || getTitle().getString().startsWith("Bazaar"))) + if (SkyblockerConfigManager.get().locations.garden.visitorHelper && (Utils.getLocationRaw().equals("garden") && !getTitle().getString().contains("Logbook") || getTitle().getString().startsWith("Bazaar"))) VisitorHelper.onMouseClicked(mouseX, mouseY, button, this.textRenderer); } From f94031b5e52a5e7dbf164ff3367288e02f4f3bde Mon Sep 17 00:00:00 2001 From: Yasin Date: Tue, 20 Feb 2024 20:15:34 +0100 Subject: [PATCH 2/4] rename npc price to npc sell price --- .../de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java index d5be7eeea6..fbef1bcb99 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java @@ -51,7 +51,7 @@ public static void getTooltip(ItemStack stack, TooltipContext context, List each.getString().contains("Buy price:") || each.getString().contains("Sell price:")); if (TooltipInfoType.NPC.isTooltipEnabledAndHasOrNullWarning(internalID)) { - lines.add(Text.literal(String.format("%-21s", "NPC Price:")) + lines.add(Text.literal(String.format("%-21s", "NPC Sell Price:")) .formatted(Formatting.YELLOW) .append(getCoinsMessage(TooltipInfoType.NPC.getData().get(internalID).getAsDouble(), count))); } From a19c612eb2c07b70110c31e385823cf28cbea255 Mon Sep 17 00:00:00 2001 From: Yasin Date: Tue, 20 Feb 2024 20:18:17 +0100 Subject: [PATCH 3/4] made flame height/opacity easier to understand --- .../de/hysky/skyblocker/config/SkyblockerConfig.java | 4 ++-- .../skyblocker/config/categories/GeneralCategory.java | 10 ++++++---- .../skyblocker/mixin/InGameOverlayRendererMixin.java | 4 ++-- src/main/resources/assets/skyblocker/lang/en_us.json | 2 ++ 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index effd9e0700..78605c0058 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -465,10 +465,10 @@ public static class TeleportOverlay { public static class FlameOverlay { @SerialEntry - public float flameHeight = 0f; + public int flameHeight = 100; @SerialEntry - public float flameOpacity = 0f; + public int flameOpacity = 100; } public static class SearchOverlay { 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 1e2f806306..afd688d8ba 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java @@ -635,19 +635,21 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig .group(OptionGroup.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.general.flameOverlay")) .collapsed(true) - .option(Option.createBuilder() + .option(Option.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.general.flameOverlay.flameHeight")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.general.flameOverlay.flameHeight.@Tooltip"))) .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)) + .controller(opt -> IntegerSliderControllerBuilder.create(opt).range(0, 100).step(1)) .build()) - .option(Option.createBuilder() + .option(Option.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.general.flameOverlay.flameOpacity")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.general.flameOverlay.flameOpacity.@Tooltip"))) .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)) + .controller(opt -> IntegerSliderControllerBuilder.create(opt).range(0, 100).step(1)) .build()) .build()) diff --git a/src/main/java/de/hysky/skyblocker/mixin/InGameOverlayRendererMixin.java b/src/main/java/de/hysky/skyblocker/mixin/InGameOverlayRendererMixin.java index b957603ab6..4775ce2d5c 100644 --- a/src/main/java/de/hysky/skyblocker/mixin/InGameOverlayRendererMixin.java +++ b/src/main/java/de/hysky/skyblocker/mixin/InGameOverlayRendererMixin.java @@ -11,12 +11,12 @@ 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; + return y - (0.5f - ((float) SkyblockerConfigManager.get().general.flameOverlay.flameHeight / 200.0f)); } @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; + return opacity - (0.8f - ((float) SkyblockerConfigManager.get().general.flameOverlay.flameOpacity / 125.0f)); } } diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 60631ef1b6..dc3d69117f 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -132,7 +132,9 @@ "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.flameHeight.@Tooltip": "100% default height\n0% off", "text.autoconfig.skyblocker.option.general.flameOverlay.flameOpacity": "Flame Opacity", + "text.autoconfig.skyblocker.option.general.flameOverlay.flameOpacity.@Tooltip": "100% default opacity\n0% off", "text.autoconfig.skyblocker.option.general.searchOverlay": "Search Overlay", "text.autoconfig.skyblocker.option.general.searchOverlay.enableBazaar": "Enable For Bazaar", "text.autoconfig.skyblocker.option.general.searchOverlay.enableBazaar.@Tooltip": "Show custom search overlay when searching in bazaar.", From da44f96472797762f162bf477285b693ef70c175 Mon Sep 17 00:00:00 2001 From: Yasin Date: Tue, 20 Feb 2024 20:18:55 +0100 Subject: [PATCH 4/4] made some menu elements not clickable --- .../skyblocker/mixin/HandledScreenMixin.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/main/java/de/hysky/skyblocker/mixin/HandledScreenMixin.java b/src/main/java/de/hysky/skyblocker/mixin/HandledScreenMixin.java index 123bbc0a35..77141688ae 100644 --- a/src/main/java/de/hysky/skyblocker/mixin/HandledScreenMixin.java +++ b/src/main/java/de/hysky/skyblocker/mixin/HandledScreenMixin.java @@ -42,6 +42,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.util.Map; +import java.util.Set; import java.util.regex.Matcher; @Mixin(HandledScreen.class) @@ -167,6 +168,37 @@ protected HandledScreenMixin(Text title) { } if (slot != null) { + // Prevent some menu items from dragging and dropping + String itemName = slot.getStack().getName().getString(); + if (SkyblockerConfigManager.get().general.hideEmptyTooltips) { + Set blockedItemPatterns = Set.of( + " ", // Empty menu item + "Locked Page", + "Quick Crafting Slot", + "Locked Backpack Slot 2", //Regular expressions won't be utilized here since the search by contains is based on plain text rather than regex syntax + "Locked Backpack Slot 3", + "Locked Backpack Slot 4", + "Locked Backpack Slot 5", + "Locked Backpack Slot 6", + "Locked Backpack Slot 7", + "Locked Backpack Slot 8", + "Locked Backpack Slot 9", + "Locked Backpack Slot 10", + "Locked Backpack Slot 11", + "Locked Backpack Slot 12", + "Locked Backpack Slot 13", + "Locked Backpack Slot 14", + "Locked Backpack Slot 15", + "Locked Backpack Slot 16", + "Locked Backpack Slot 17", + "Locked Backpack Slot 18", + "Preparing" + ); + if (blockedItemPatterns.contains(itemName)) { + ci.cancel(); + } + } + // When you click your drop key while hovering over an item if (actionType == SlotActionType.THROW) { ItemStack stack = slot.getStack();