Skip to content

Commit

Permalink
Rename slot text option to slotTextMode
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinthegreat1 committed Jul 23, 2024
1 parent 156e708 commit eb2ac7c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import de.hysky.skyblocker.config.SkyblockerConfig;
import de.hysky.skyblocker.config.configs.GeneralConfig;
import de.hysky.skyblocker.skyblock.item.tooltip.adders.CraftPriceTooltip;
import de.hysky.skyblocker.skyblock.item.slottext.SlotTextState;
import de.hysky.skyblocker.skyblock.item.slottext.SlotTextMode;
import de.hysky.skyblocker.skyblock.shortcut.ShortcutsConfigScreen;
import dev.isxander.yacl3.api.*;
import dev.isxander.yacl3.api.controller.FloatSliderControllerBuilder;
Expand Down Expand Up @@ -236,18 +236,18 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
.group(OptionGroup.createBuilder()
.name(Text.translatable("skyblocker.config.general.itemInfoDisplay"))
.collapsed(true)
.option(Option.<SlotTextState>createBuilder()
.option(Option.<SlotTextMode>createBuilder()
.name(Text.translatable("skyblocker.config.general.itemInfoDisplay.slotText"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.general.itemInfoDisplay.slotText.@Tooltip")))
.binding(defaults.general.itemInfoDisplay.slotText,
() -> config.general.itemInfoDisplay.slotText,
newValue -> config.general.itemInfoDisplay.slotText = newValue)
.binding(defaults.general.itemInfoDisplay.slotTextMode,
() -> config.general.itemInfoDisplay.slotTextMode,
newValue -> config.general.itemInfoDisplay.slotTextMode = newValue)
.controller(ConfigUtils::createEnumCyclingListController)
.build())
.option(ButtonOption.createBuilder()
.name(Text.translatable("skyblocker.config.general.itemInfoDisplay.slotText.shortcutToKeybindsSettings"))
.name(Text.translatable("skyblocker.config.shortcutToKeybindsSettings"))
.action((screen, opt) -> MinecraftClient.getInstance().setScreen(new KeybindsScreen(screen, MinecraftClient.getInstance().options)))
.text(Text.translatable("skyblocker.config.general.itemInfoDisplay.slotText.shortcutToKeybindsSettings.@Text"))
.text(Text.translatable("skyblocker.config.shortcutToKeybindsSettings.@Text"))
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.general.itemInfoDisplay.attributeShardInfo"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import de.hysky.skyblocker.SkyblockerMod;
import de.hysky.skyblocker.skyblock.item.CustomArmorAnimatedDyes;
import de.hysky.skyblocker.skyblock.item.CustomArmorTrims;
import de.hysky.skyblocker.skyblock.item.slottext.SlotTextState;
import de.hysky.skyblocker.skyblock.item.slottext.SlotTextMode;
import dev.isxander.yacl3.config.v2.api.SerialEntry;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
Expand Down Expand Up @@ -164,8 +164,12 @@ public String getOrder() {
}

public static class ItemInfoDisplay {
@Deprecated
@SerialEntry
public SlotTextState slotText = SlotTextState.ENABLED;
public boolean slotText = true;

@SerialEntry
public SlotTextMode slotTextMode = SlotTextMode.ENABLED;

@SerialEntry
public boolean slotTextToggled = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public static void renderSlotText(DrawContext context, TextRenderer textRenderer
}

public static boolean isEnabled() {
return switch (SkyblockerConfigManager.get().general.itemInfoDisplay.slotText) {
return switch (SkyblockerConfigManager.get().general.itemInfoDisplay.slotTextMode) {
case ENABLED -> true;
case DISABLED -> false;
case PRESS_TO_TOGGLE -> SkyblockerConfigManager.get().general.itemInfoDisplay.slotTextToggled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* Used in {@link SlotTextManager#isEnabled()} to determine whether the slot text should be shown or not.
*/
public enum SlotTextState {
public enum SlotTextMode {
ENABLED,
HOLD_TO_SHOW,
PRESS_TO_TOGGLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.skyblock.item.slottext.SlotText;
import de.hysky.skyblocker.skyblock.item.slottext.SlotTextState;
import de.hysky.skyblocker.skyblock.item.slottext.SlotTextMode;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.slot.Slot;
import org.jetbrains.annotations.NotNull;
Expand All @@ -25,6 +25,6 @@ public interface SlotTextAdder extends ContainerMatcher {

@Override
default boolean isEnabled() {
return SkyblockerConfigManager.get().general.itemInfoDisplay.slotText != SlotTextState.DISABLED;
return SkyblockerConfigManager.get().general.itemInfoDisplay.slotTextMode != SlotTextMode.DISABLED;
}
}
5 changes: 3 additions & 2 deletions src/main/resources/assets/skyblocker/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@

"skyblocker.config.title": "Skyblocker Settings",

"skyblocker.config.shortcutToKeybindsSettings": "Edit Keybind",
"skyblocker.config.shortcutToKeybindsSettings.@Text": "Click... (Opens up Keybinds Options)",

"skyblocker.config.crimsonIsle": "Crimson Isle",

"skyblocker.config.crimsonIsle.kuudra": "Kuudra",
Expand Down Expand Up @@ -225,8 +228,6 @@
"skyblocker.config.general.itemInfoDisplay.itemRarityBackgroundsOpacity": "Item Rarity Backgrounds Opacity",
"skyblocker.config.general.itemInfoDisplay.slotText": "Slot Text",
"skyblocker.config.general.itemInfoDisplay.slotText.@Tooltip": "Displays information such as enchantment book level, minion level, pet level, potion level, prehistoric egg blocks walked, rancher's boots speed cap, and skill level",
"skyblocker.config.general.itemInfoDisplay.slotText.shortcutToKeybindsSettings": "Slot Text Keybind",
"skyblocker.config.general.itemInfoDisplay.slotText.shortcutToKeybindsSettings.@Text": "Click... (opens up keybinds settings)",

"skyblocker.config.general.itemList": "Item List",
"skyblocker.config.general.itemList.enableItemList": "Enable Item List",
Expand Down

0 comments on commit eb2ac7c

Please sign in to comment.