Skip to content

Commit

Permalink
Config Updates + Actionbar Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterCheezeCake committed Sep 28, 2024
1 parent 002b707 commit 043a059
Show file tree
Hide file tree
Showing 30 changed files with 716 additions and 327 deletions.
32 changes: 31 additions & 1 deletion src/main/java/wtf/cheeze/sbt/command/SBTCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ingame.GenericContainerScreen;
import net.minecraft.text.Text;
import wtf.cheeze.sbt.SkyblockTweaks;
import wtf.cheeze.sbt.config.SBTConfig;
Expand Down Expand Up @@ -76,6 +77,35 @@ public static void registerEvents() {
)

)
.then(literal("dumpComponents")
.then(literal("hand")
.executes(context -> {
var components = SkyblockTweaks.mc.player.getMainHandStack().getComponents();
components.forEach((component) -> {
context.getSource().sendFeedback(Text.of(PREFIX + " §3" + component.toString()));
});
return 1;
}))
.then(literal("slot")
.then(argument("number" , IntegerArgumentType.integer())
.executes(context -> {
new Thread(() -> {
try {
Thread.sleep(1500);
var screen = (GenericContainerScreen) SkyblockTweaks.mc.currentScreen;
var components = screen.getScreenHandler().getSlot(IntegerArgumentType.getInteger(context, "number")).getStack().getComponents();
components.forEach((component) -> {
context.getSource().sendFeedback(Text.of(PREFIX + " §3" + component.toString()));
});
} catch (Exception e) {
SkyblockTweaks.LOGGER.error("Error while sleeping", e);
}

}).start();
return 1;
})
)
)
.executes(context -> {
var source = context.getSource();
source.sendFeedback(Text.literal(PREFIX + " §3Debug Information"));
Expand Down Expand Up @@ -325,7 +355,7 @@ public static void registerEvents() {
context.getSource().sendFeedback(Text.of(PREFIX + " §cInvalid arguments"));
return 0;
})

)
.executes(context -> {
MinecraftClient mc = context.getSource().getClient();
Screen screen = new SkyblockTweaksScreenMain(null);
Expand Down
14 changes: 12 additions & 2 deletions src/main/java/wtf/cheeze/sbt/config/categories/Chat.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package wtf.cheeze.sbt.config.categories;

import dev.isxander.yacl3.api.ConfigCategory;
import dev.isxander.yacl3.api.OptionDescription;
import net.minecraft.text.Text;
import wtf.cheeze.sbt.config.ConfigImpl;
import wtf.cheeze.sbt.features.chat.ChatProtections;
Expand All @@ -10,11 +11,20 @@ public class Chat {

public static ConfigCategory getCategory(ConfigImpl defaults, ConfigImpl config) {
return ConfigCategory.createBuilder()
.name(Text.literal("Chat"))
.tooltip(Text.literal("Settings for chat related features"))
.name(Text.translatable("sbt.config.chat"))
.tooltip(Text.translatable("sbt.config.chat.desc"))
.group(PartyFeatures.Config.getGroup(defaults, config))
.group(PartyFeatures.Config.getBlackList(defaults, config))
.group(ChatProtections.Config.getGroup(defaults, config))
.build();
}

public static final String BASE_KEY = "sbt.config.chat.";

public static Text key(String key) {
return Text.translatable(BASE_KEY + key);
}
public static OptionDescription keyD(String key) {
return OptionDescription.of(Text.translatable(BASE_KEY + key + ".desc"));
}
}
49 changes: 29 additions & 20 deletions src/main/java/wtf/cheeze/sbt/config/categories/General.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
public class General {
public static ConfigCategory getCategory(ConfigImpl defaults, ConfigImpl config) {
return ConfigCategory.createBuilder()
.name(Text.literal("General"))
.tooltip(Text.literal("General settings for SkyblockTweaks"))
.name(Text.translatable("sbt.config.general"))
.tooltip(Text.translatable("sbt.config.general.desc"))
.option(Version.getStreamOption(defaults, config))
.group(InventoryTweaks.getGroup(defaults, config))
.group(MenuHighlights.Config.getGroup(defaults, config))
Expand All @@ -27,6 +27,15 @@ public static ConfigCategory getCategory(ConfigImpl defaults, ConfigImpl config)
.build();
}

public static final String BASE_KEY = "sbt.config.general.";

public static Text key(String key) {
return Text.translatable(BASE_KEY + key);
}
public static OptionDescription keyD(String key) {
return OptionDescription.of(Text.translatable(BASE_KEY + key + ".desc"));
}

// These are subclassed because their features live in mixins and so can't control their own config
public static class InventoryTweaks {
@SerialEntry
Expand All @@ -37,8 +46,8 @@ public static class InventoryTweaks {

public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
var noRenderPotionHud = Option.<Boolean>createBuilder()
.name(Text.literal("Disable Potion HUD"))
.description(OptionDescription.of(Text.literal("Disables rendering of the potion HUD in your inventory")))
.name(key("inventory.noRenderPotionHud"))
.description(keyD("inventory.noRenderPotionHud"))
.controller(SBTConfig::generateBooleanController)
.binding(
defaults.inventory.noRenderPotionHud,
Expand All @@ -47,8 +56,8 @@ public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
)
.build();
var redirectRecipeBook = Option.<Boolean>createBuilder()
.name(Text.literal("Redirect Recipe Book Clicks"))
.description(OptionDescription.of(Text.literal("Redirects the recipe book button to the SkyBlock recipe book")))
.name(key("inventory.redirectRecipeBook"))
.description(keyD("inventory.redirectRecipeBook"))
.controller(SBTConfig::generateBooleanController)
.binding(
defaults.inventory.redirectRecipeBook,
Expand All @@ -58,8 +67,8 @@ public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
.build();

return OptionGroup.createBuilder()
.name(Text.literal("Inventory Tweaks"))
.description(OptionDescription.of(Text.literal("Various tweaks to the inventory screen")))
.name(key("inventory"))
.description(keyD("inventory"))
.option(noRenderPotionHud)
.option(redirectRecipeBook)
.build();
Expand All @@ -84,8 +93,8 @@ public static class HudTweaks {

public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
var noShadowActionBar = Option.<Boolean>createBuilder()
.name(Text.literal("Disable Action Bar Shadow"))
.description(OptionDescription.of(Text.literal("Removes the shadow from the action bar")))
.name(key("hudTweaks.noShadowActionBar"))
.description(keyD("hudTweaks.noShadowActionBar"))
.controller(SBTConfig::generateBooleanController)
.binding(
defaults.hudTweaks.noShadowActionBar,
Expand All @@ -95,8 +104,8 @@ public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
.build();

var noRenderBossBar = Option.<Boolean>createBuilder()
.name(Text.literal("Disable Boss Bar"))
.description(OptionDescription.of(Text.literal("Disables rendering of boss bars")))
.name(key("hudTweaks.noRenderBossBar"))
.description(keyD("hudTweaks.noRenderBossBar"))
.controller(SBTConfig::generateBooleanController)
.binding(
defaults.hudTweaks.noRenderBossBar,
Expand All @@ -108,8 +117,8 @@ public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {


var noRenderHearts = Option.<Boolean>createBuilder()
.name(Text.literal("Disable Hearts"))
.description(OptionDescription.of(Text.literal("Disables rendering of health hearts ")))
.name(key("hudTweaks.noRenderHearts"))
.description(keyD("hudTweaks.noRenderHearts"))
.controller(SBTConfig::generateBooleanController)
.binding(
defaults.hudTweaks.noRenderHearts,
Expand All @@ -118,8 +127,8 @@ public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
)
.build();
var noRenderArmor = Option.<Boolean>createBuilder()
.name(Text.literal("Disable Armor Bar"))
.description(OptionDescription.of(Text.literal("Disables rendering of the armor bar")))
.name(key("hudTweaks.noRenderArmor"))
.description(keyD("hudTweaks.noRenderArmor"))
.controller(SBTConfig::generateBooleanController)
.binding(
defaults.hudTweaks.noRenderArmor,
Expand All @@ -129,8 +138,8 @@ public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
.build();

var noRenderHunger = Option.<Boolean>createBuilder()
.name(Text.literal("Disable Hunger Bar"))
.description(OptionDescription.of(Text.literal("Disables rendering of the hunger bar")))
.name(key("hudTweaks.noRenderHunger"))
.description(keyD("hudTweaks.noRenderHunger"))
.controller(SBTConfig::generateBooleanController)
.binding(
defaults.hudTweaks.noRenderHunger,
Expand All @@ -140,8 +149,8 @@ public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
.build();

return OptionGroup.createBuilder()
.name(Text.literal("HUD Tweaks"))
.description(OptionDescription.of(Text.literal("Various tweaks to Minecraft's HUD")))
.name(key("hudTweaks"))
.description(keyD("hudTweaks"))
.option(noShadowActionBar)
.option(noRenderBossBar)
.option(noRenderHearts)
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/wtf/cheeze/sbt/config/categories/Huds.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public class Huds {

public static ConfigCategory getCategory(ConfigImpl defaults, ConfigImpl config) {
return ConfigCategory.createBuilder()
.name(Text.literal("HUDs"))
.tooltip(Text.literal("Settings for various HUDs"))
.name(Text.translatable("sbt.config.huds"))
.tooltip(Text.translatable("sbt.config.huds.desc"))
.group(SkillHUDManager.SkillHUD.Config.getGroup(defaults, config))
.group(SkillHUDManager.SkillBar.Config.getGroup(defaults, config))
.group(HealthHUD.Config.getGroup(defaults, config))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* We use these instead of the cute names so that profiles, even across accounts, will never inherit the persistent data of another
*/
public class PersistentData {

public HashMap<String, ProfileData> profiles = new HashMap<String, ProfileData>();
private static final Path configPath = FabricLoader.getInstance().getConfigDir().resolve("skyblocktweaks-persistent.json");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import wtf.cheeze.sbt.SkyblockTweaks;
import wtf.cheeze.sbt.config.ConfigImpl;
import wtf.cheeze.sbt.config.SBTConfig;
import wtf.cheeze.sbt.config.categories.General;
import wtf.cheeze.sbt.utils.render.RenderUtils;

public class BrewingStandOverlay {
Expand Down Expand Up @@ -60,8 +61,8 @@ public static class Config {

public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
var enabled = Option.<Boolean>createBuilder()
.name(Text.literal("Brewing Stand Overlay"))
.description(OptionDescription.of(Text.literal("Enables the overlay for the brewing stand")))
.name(General.key("brewingStandOverlay.enabled"))
.description(General.keyD("brewingStandOverlay.enabled"))
.controller(SBTConfig::generateBooleanController)
.binding(
defaults.brewingStandOverlay.enabled,
Expand All @@ -71,8 +72,8 @@ public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
.build();

return OptionGroup.createBuilder()
.name(Text.literal("Brewing Stand Overlay"))
.description(OptionDescription.of(Text.literal("Options for the brewing stand overlay")))
.name(General.key("brewingStandOverlay"))
.description(General.keyD("brewingStandOverlay"))
.option(enabled)
.build();

Expand Down
26 changes: 14 additions & 12 deletions src/main/java/wtf/cheeze/sbt/features/MenuHighlights.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import wtf.cheeze.sbt.config.SBTConfig;

import java.util.regex.Pattern;
import static wtf.cheeze.sbt.config.categories.General.key;
import static wtf.cheeze.sbt.config.categories.General.keyD;

public class MenuHighlights {

Expand Down Expand Up @@ -141,8 +143,8 @@ public static class Config {

public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
var enabled = Option.<Boolean>createBuilder()
.name(Text.literal("Hub Selector Highlights"))
.description(OptionDescription.of(Text.literal("Whether or not to highlight hubs in the hub selector based on their capacity")))
.name(key("menuHighlights.enabledRegular"))
.description(keyD("menuHighlights.enabledRegular"))
.controller(SBTConfig::generateBooleanController)
.binding(
defaults.hubSelectorHighlight.enabledRegular,
Expand All @@ -151,8 +153,8 @@ public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
)
.build();
var enabledDungeon = Option.<Boolean>createBuilder()
.name(Text.literal("Dungeon Hub Selector Highlights"))
.description(OptionDescription.of(Text.literal("Whether or not to highlight hubs in the dungeon hub selector based on their capacity")))
.name(key("menuHighlights.enabledDungeon"))
.description(keyD("menuHighlights.enabledDungeon"))
.controller(SBTConfig::generateBooleanController)
.binding(
defaults.hubSelectorHighlight.enabledDungeon,
Expand All @@ -161,8 +163,8 @@ public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
)
.build();
var hotmHighlight = Option.<Boolean>createBuilder()
.name(Text.literal("HOTM Highlights"))
.description(OptionDescription.of(Text.literal("Whether or not to highlight HOTM perks based on their status (enabled/disabled)")))
.name(key("menuHighlights.hotmHighlight"))
.description(keyD("menuHighlights.hotmHighlight"))
.controller(SBTConfig::generateBooleanController)
.binding(
defaults.hubSelectorHighlight.hotmHighlight,
Expand All @@ -172,8 +174,8 @@ public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
.build();

var widgetHighlight = Option.<Boolean>createBuilder()
.name(Text.literal("Widget Highlights"))
.description(OptionDescription.of(Text.literal("Whether or not to highlight items in the /widgets menu based on their status (enabled/disabled)")))
.name(key("menuHighlights.widgetHighlight"))
.description(keyD("menuHighlights.widgetHighlight"))
.controller(SBTConfig::generateBooleanController)
.binding(
defaults.hubSelectorHighlight.widgetHighlight,
Expand All @@ -182,8 +184,8 @@ public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
)
.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")))
.name(key("menuHighlights.sblevelHighlight"))
.description(keyD("menuHighlights.sblevelHighlight"))
.controller(SBTConfig::generateBooleanController)
.binding(
defaults.hubSelectorHighlight.sblevelHighlight,
Expand All @@ -193,8 +195,8 @@ public static OptionGroup getGroup(ConfigImpl defaults, ConfigImpl config) {
.build();

return OptionGroup.createBuilder()
.name(Text.literal("Menu Highlights"))
.description(OptionDescription.of(Text.literal("Settings for Menu Highlights and coloring")))
.name(key("menuHighlights"))
.description(keyD("menuHighlights"))
.option(enabled)
.option(enabledDungeon)
.option(hotmHighlight)
Expand Down
Loading

0 comments on commit 043a059

Please sign in to comment.