Skip to content

Commit

Permalink
Modified Menu Highlights
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterCheezeCake committed Aug 9, 2024
1 parent 940acbe commit ec0e9ff
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions src/main/java/wtf/cheeze/sbt/features/MenuHighlights.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public static void tryDrawHighlight(DrawContext context, Slot slot) {
var matcher = PLAYER_COUNT_PATTERN.matcher(lines.getFirst().getString());
if (!matcher.matches()) return;
var playerCount = Integer.parseInt(matcher.group(1));
if (playerCount >= 60) context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, HIGHLIGHT_RED);
else if (playerCount >= 40) context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, HIGHLIGHT_ORANGE);
else if (playerCount >= 20) context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, HIGHLIGHT_YELLOW);
else context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, HIGHLIGHT_GREEN);
if (playerCount >= 60) highlight(context, slot, HIGHLIGHT_RED);
else if (playerCount >= 40) highlight(context, slot, HIGHLIGHT_ORANGE);
else if (playerCount >= 20) highlight(context, slot, HIGHLIGHT_YELLOW);
else highlight(context, slot, HIGHLIGHT_GREEN);

}
public static void tryDrawHighlightDH(DrawContext context, Slot slot) {
Expand All @@ -68,26 +68,26 @@ public static void tryDrawHighlightDH(DrawContext context, Slot slot) {
var matcher = PLAYER_COUNT_PATTERN_DH.matcher(lines.getFirst().getString());
if (!matcher.matches()) return;
var playerCount = Integer.parseInt(matcher.group(1));
if (playerCount >= 18) context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, HIGHLIGHT_RED);
else if (playerCount >= 12) context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, HIGHLIGHT_ORANGE);
else if (playerCount >= 6) context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, HIGHLIGHT_YELLOW);
else context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, HIGHLIGHT_GREEN);
if (playerCount >= 18) highlight(context, slot, HIGHLIGHT_RED);
else if (playerCount >= 12) highlight(context, slot, HIGHLIGHT_ORANGE);
else if (playerCount >= 6) highlight(context, slot, HIGHLIGHT_YELLOW);
else highlight(context, slot, HIGHLIGHT_GREEN);
}
public static void tryDrawHighlightHOTM(DrawContext context, Slot slot) {
if (!SkyblockTweaks.CONFIG.config.hubSelectorHighlight.hotmHighlight) return;
var lines = slot.getStack().getOrDefault(DataComponentTypes.LORE, LoreComponent.DEFAULT).lines();
for (var line: lines) {
switch (line.getString()) {
case "ENABLED", "SELECTED" -> {
context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, HIGHLIGHT_GREEN2);
highlight(context, slot, HIGHLIGHT_GREEN2);
return;
}
case "DISABLED", "Click to select!" -> {
context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, HIGHLIGHT_RED2);
highlight(context, slot, HIGHLIGHT_RED2);
return;
}
case "1 Token of the Mountain" -> {
context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, HIGHLIGHT_GREY);
highlight(context, slot, HIGHLIGHT_GREY);
return;
}
}
Expand All @@ -97,9 +97,20 @@ public static void tryDrawHighlightHOTM(DrawContext context, Slot slot) {
public static void tryDrawHighlightWidget(DrawContext context, Slot slot) {
if (!SkyblockTweaks.CONFIG.config.hubSelectorHighlight.widgetHighlight) return;
var name = slot.getStack().getName().getString();
if (!name.contains("✔") && !name.contains("✖")) return;
if (name.contains("✔")) context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, HIGHLIGHT_GREEN2);
else context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, HIGHLIGHT_RED2);
if (!name.contains("✔") && !name.contains("✖")) {
if (name.equals("Third Column")) {
var fistLine = slot.getStack().getOrDefault(DataComponentTypes.LORE, LoreComponent.DEFAULT).lines().getFirst().getString();
if (fistLine.equals("Currently: ENABLED")) highlight(context, slot, HIGHLIGHT_GREEN2);
else highlight(context, slot, HIGHLIGHT_RED2);
}
return;
}
if (name.contains("✔")) highlight(context, slot, HIGHLIGHT_GREEN2);
else 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);
}

public static class Config {
Expand Down

0 comments on commit ec0e9ff

Please sign in to comment.