Skip to content

Commit

Permalink
/sblevel highlights
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterCheezeCake committed Sep 17, 2024
1 parent e956e34 commit 9e48706
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main/java/wtf/cheeze/sbt/SkyblockTweaks.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@

public class SkyblockTweaks implements ModInitializer {
public static final Gson GSON = new Gson();
public static final Logger LOGGER = LoggerFactory.getLogger("SkyBlockTweaks");
public static final Logger LOGGER = LoggerFactory.getLogger("SkyblockTweaks");
public static final SkyblockData DATA = new SkyblockData();
public static final PersistentData PD = PersistentData.load();
public static final SkyblockTweaksConfig CONFIG = new SkyblockTweaksConfig();
public static final ArrayList<HUD> HUDS = new ArrayList<HUD>();
public static final Version VERSION = new Version(Version.VersionType.ALPHA, 0, 1, 0, 5);
public static final Version VERSION = new Version(Version.VersionType.ALPHA, 0, 1, 0, 6);
public static final MinecraftClient mc = MinecraftClient.getInstance();


Expand Down
2 changes: 0 additions & 2 deletions src/main/java/wtf/cheeze/sbt/config/categories/General.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ public static ConfigCategory getCategory(ConfigImpl defaults, ConfigImpl config)
.group(InventoryTweaks.getGroup(defaults, config))
.group(MenuHighlights.Config.getGroup(defaults, config))
.group(BrewingStandOverlay.Config.getGroup(defaults, config))
.group(PartyFeatures.Config.getGroup(defaults, config))
.option(PartyFeatures.Config.getBlackList(defaults, config))
.group(HudTweaks.getGroup(defaults, config))
.group(ActionBarTransformer.Config.getGroup(defaults, config))
.build();
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/wtf/cheeze/sbt/features/MenuHighlights.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ public static void tryDrawHighlightWidget(DrawContext context, Slot slot) {
else highlight(context, slot, HIGHLIGHT_RED2);
}

public static void tryDrawHighlightTasks(DrawContext context, Slot slot) {
if (!SkyblockTweaks.CONFIG.config.hubSelectorHighlight.sblevelHighlight) return;
var lines = slot.getStack().getOrDefault(DataComponentTypes.LORE, LoreComponent.DEFAULT).lines();
for (var line: lines) {
var s = line.getString();
if (s.equals("Total Progress: 100%")) highlight(context, slot, HIGHLIGHT_GREEN2);
else if (s.contains("Total Progress: ")) highlight(context, slot, HIGHLIGHT_RED2);
}
}

private static void highlight(DrawContext context, Slot slot, int color) {
context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, color);
}
Expand All @@ -126,6 +136,9 @@ public static class Config {
@SerialEntry
public boolean widgetHighlight = true;

@SerialEntry
public boolean sblevelHighlight = true;

public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
var enabled = Option.<Boolean>createBuilder()
.name(Text.literal("Hub Selector Highlights"))
Expand Down Expand Up @@ -168,6 +181,16 @@ public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
value -> config.hubSelectorHighlight.widgetHighlight = (Boolean) value
)
.build();
var sblevelHighlight = Option.<Boolean>createBuilder()
.name(Text.literal("Task Highlights"))
.description(OptionDescription.of(Text.literal("Whether or not to highlight items in the /sblevel menu based on their completion status")))
.controller(SkyblockTweaksConfig::generateBooleanController)
.binding(
defaults.hubSelectorHighlight.sblevelHighlight,
() -> config.hubSelectorHighlight.sblevelHighlight,
value -> config.hubSelectorHighlight.sblevelHighlight = (Boolean) value
)
.build();

return OptionGroup.createBuilder()
.name(Text.literal("Menu Highlights"))
Expand All @@ -176,6 +199,7 @@ public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
.option(enabledDungeon)
.option(hotmHighlight)
.option(widgetHighlight)
.option(sblevelHighlight)
.build();
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/wtf/cheeze/sbt/mixin/HandledScreenMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ public abstract class HandledScreenMixin<T extends ScreenHandler> extends Screen
// We do this so it only attempts to handle Skyblock brewing stands, not vanilla ones
if (this.handler instanceof BrewingStandScreenHandler) return;
if (slot.id == 13) BrewingStandOverlay.render(handler.slots, context);

}
}
if (title.contains("Widget") || title.contains("Setting")) {
MenuHighlights.tryDrawHighlightWidget(context, slot);
} else if (title.startsWith("Tasks")) {
MenuHighlights.tryDrawHighlightTasks(context, slot);
}
}

Expand Down

0 comments on commit 9e48706

Please sign in to comment.