Skip to content

Commit

Permalink
Merge pull request #561 from LifeIsAParadox/small-fixes
Browse files Browse the repository at this point in the history
4 small changes
  • Loading branch information
LifeIsAParadox authored Feb 20, 2024
2 parents 20117e7 + da44f96 commit a15ce2a
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 21 deletions.
10 changes: 5 additions & 5 deletions src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,6 @@ public static class General {
@SerialEntry
public boolean dungeonQuality = true;

@SerialEntry
public boolean visitorHelper = true;

@SerialEntry
public TabHudConf tabHud = new TabHudConf();

Expand Down Expand Up @@ -468,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 {
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,6 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
newValue -> config.general.dungeonQuality = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>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()
Expand Down Expand Up @@ -642,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.<Float>createBuilder()
.option(Option.<Integer>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.<Float>createBuilder()
.option(Option.<Integer>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())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
newValue -> config.locations.garden.dicerTitlePrevent = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>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();
}
Expand Down
36 changes: 34 additions & 2 deletions src/main/java/de/hysky/skyblocker/mixin/HandledScreenMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -75,13 +76,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<Boolean> 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);
}

Expand Down Expand Up @@ -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<String> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static void getTooltip(ItemStack stack, TooltipContext context, List<Text
boolean bazaarOpened = lines.stream().anyMatch(each -> 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)));
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/skyblocker/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down

0 comments on commit a15ce2a

Please sign in to comment.