Skip to content

Commit 3d590db

Browse files
committed
feat(EnchantManager): Enchantment Lore Parsing's Highlight Enchantments now supports RGB colors instead of just restricted colors
feat: migrate hardcoded § tooltip strings to Component with translation keys perf: cache first tooltip components by ItemStack reference equality fix(PlayerListener): skip enchantment lore lines during Roman numeral replacement fix: improved text replacement for Enchantment and Roman Numerals Parsing refactor: EnchantmentSettingsGui removed, merged into SettingsGui refactor(EnchantManager): migrate enchant formatting from § strings to Component refactor(RomanNumeralParser): replace string-based numeral replacement with Component-aware approach
1 parent 3c7b4ab commit 3d590db

File tree

14 files changed

+467
-409
lines changed

14 files changed

+467
-409
lines changed

src/main/java/com/fix3dll/skyblockaddons/core/feature/FeatureSetting.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ public enum FeatureSetting {
7171
SHOW_SKILL_XP_GAINED("settings.showSkillXPGained", Feature.SKILL_DISPLAY),
7272
SHOW_SALVAGE_ESSENCES_COUNTER("settings.showSalvageEssencesCounter", Feature.DUNGEONS_COLLECTED_ESSENCES_DISPLAY),
7373
HEALING_CIRCLE_OPACITY("settings.healingCircleOpacity", Feature.SHOW_HEALING_CIRCLE_WALL),
74+
HIDE_ENCHANTMENT_LORE("settings.hideEnchantDescription", Feature.ENCHANTMENT_LORE_PARSING),
75+
HIDE_GREY_ENCHANTS("settings.hideGreyEnchants", Feature.ENCHANTMENT_LORE_PARSING),
76+
ENCHANT_LAYOUT("enchantLayout.title", Feature.ENCHANTMENT_LORE_PARSING),
7477
HIGHLIGHT_ENCHANTMENTS("settings.highlightSpecialEnchantments", Feature.ENCHANTMENT_LORE_PARSING),
7578
PERFECT_ENCHANT_COLOR("enchants.superTier", Feature.ENCHANTMENT_LORE_PARSING),
7679
GREAT_ENCHANT_COLOR("enchants.highTier", Feature.ENCHANTMENT_LORE_PARSING),
7780
GOOD_ENCHANT_COLOR("enchants.midTier", Feature.ENCHANTMENT_LORE_PARSING),
7881
POOR_ENCHANT_COLOR("enchants.lowTier", Feature.ENCHANTMENT_LORE_PARSING),
7982
COMMA_ENCHANT_COLOR("enchants.commas", Feature.ENCHANTMENT_LORE_PARSING),
80-
HIDE_ENCHANTMENT_LORE("settings.hideEnchantDescription", Feature.ENCHANTMENT_LORE_PARSING),
81-
HIDE_GREY_ENCHANTS("settings.hideGreyEnchants", Feature.ENCHANTMENT_LORE_PARSING),
82-
ENCHANT_LAYOUT("enchantLayout.title", Feature.ENCHANTMENT_LORE_PARSING),
8383
TREVOR_TRACKED_ENTITY_PROXIMITY_INDICATOR("settings.trevorTheTrapper.trackedEntityProximityIndicator", Feature.TREVOR_THE_TRAPPER_FEATURES),
8484
TREVOR_HIGHLIGHT_TRACKED_ENTITY("settings.trevorTheTrapper.highlightTrackedEntity", Feature.TREVOR_THE_TRAPPER_FEATURES),
8585
TREVOR_SHOW_QUEST_COOLDOWN("settings.trevorTheTrapper.showQuestCooldown", Feature.TREVOR_THE_TRAPPER_FEATURES),

src/main/java/com/fix3dll/skyblockaddons/features/enchants/EnchantManager.java

Lines changed: 228 additions & 116 deletions
Large diffs are not rendered by default.

src/main/java/com/fix3dll/skyblockaddons/gui/buttons/ButtonArrow.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.fix3dll.skyblockaddons.gui.buttons;
22

33
import com.fix3dll.skyblockaddons.SkyblockAddons;
4-
import com.fix3dll.skyblockaddons.gui.screens.EnchantmentSettingsGui;
54
import com.fix3dll.skyblockaddons.gui.screens.SettingsGui;
65
import com.fix3dll.skyblockaddons.gui.screens.SkyblockAddonsGui;
76
import com.fix3dll.skyblockaddons.utils.EnumUtils;
@@ -58,13 +57,6 @@ public void onClick(@NonNull MouseButtonEvent event, boolean isDoubleClick) {
5857
MC.setScreen(new SkyblockAddonsGui(page, gui.getTab()));
5958

6059
if (gui.getTab() == EnumUtils.GuiTab.GENERAL_SETTINGS) gui.setCancelClose(false);
61-
62-
} else if (MC.screen instanceof EnchantmentSettingsGui gui) {
63-
gui.setClosingGui(true);
64-
65-
int page = gui.getPage() + (arrowType == ArrowType.LEFT ? -1 : +1);
66-
MC.setScreen(new EnchantmentSettingsGui(page, gui.getLastPage(), gui.getLastTab()));
67-
6860
} else if (MC.screen instanceof SettingsGui gui) {
6961
gui.setClosingGui(true);
7062

src/main/java/com/fix3dll/skyblockaddons/gui/buttons/feature/ButtonSettings.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.fix3dll.skyblockaddons.SkyblockAddons;
44
import com.fix3dll.skyblockaddons.core.feature.Feature;
5-
import com.fix3dll.skyblockaddons.gui.screens.EnchantmentSettingsGui;
65
import com.fix3dll.skyblockaddons.gui.screens.SettingsGui;
76
import com.fix3dll.skyblockaddons.gui.screens.SkyblockAddonsGui;
87
import com.fix3dll.skyblockaddons.utils.EnumUtils.GUIType;
@@ -42,14 +41,10 @@ public void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float par
4241
public void onClick(@NonNull MouseButtonEvent event, boolean isDoubleClick) {
4342
if (MC.screen instanceof SkyblockAddonsGui gui) {
4443
main.getUtils().setFadingIn(false);
45-
if (this.feature == Feature.ENCHANTMENT_LORE_PARSING) {
46-
MC.setScreen(new EnchantmentSettingsGui(0, gui.getPage(), gui.getTab()));
47-
} else {
48-
boolean generalSettings = gui.getTab() == GuiTab.GENERAL_SETTINGS;
49-
if (generalSettings) gui.setCancelClose(true);
50-
MC.setScreen(new SettingsGui(this.feature, 1, gui.getPage(), gui.getTab(), GUIType.MAIN));
51-
if (generalSettings) gui.setCancelClose(false);
52-
}
44+
boolean generalSettings = gui.getTab() == GuiTab.GENERAL_SETTINGS;
45+
if (generalSettings) gui.setCancelClose(true);
46+
MC.setScreen(new SettingsGui(this.feature, 1, gui.getPage(), gui.getTab(), GUIType.MAIN));
47+
if (generalSettings) gui.setCancelClose(false);
5348
}
5449
}
5550

src/main/java/com/fix3dll/skyblockaddons/gui/screens/EnchantmentSettingsGui.java

Lines changed: 0 additions & 126 deletions
This file was deleted.

src/main/java/com/fix3dll/skyblockaddons/gui/screens/SettingsGui.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.fix3dll.skyblockaddons.core.feature.FeatureSetting;
99
import com.fix3dll.skyblockaddons.features.discordrpc.DiscordStatus;
1010
import com.fix3dll.skyblockaddons.features.dungeonmap.DungeonMapManager;
11+
import com.fix3dll.skyblockaddons.features.enchants.EnchantLayout;
1112
import com.fix3dll.skyblockaddons.gui.buttons.ButtonArrow;
1213
import com.fix3dll.skyblockaddons.gui.buttons.ButtonCycling;
1314
import com.fix3dll.skyblockaddons.gui.buttons.ButtonInputFieldWrapper;
@@ -480,6 +481,30 @@ private void addButton(FeatureSetting setting, Object settingValue) {
480481
if (setting == FeatureSetting.TANK_COLOR) row += 0.4F; // Last spacing
481482
break;
482483

484+
case PERFECT_ENCHANT_COLOR:
485+
case GREAT_ENCHANT_COLOR:
486+
case GOOD_ENCHANT_COLOR:
487+
case POOR_ENCHANT_COLOR:
488+
case COMMA_ENCHANT_COLOR:
489+
boxWidth = 100;
490+
x = halfWidth - (boxWidth / 2);
491+
y = getRowHeightSetting(row);
492+
addRenderableWidget(new ButtonOpenColorMenu(x, y, 100, 20, setting.getMessage(), setting));
493+
if (setting == FeatureSetting.COMMA_ENCHANT_COLOR) row += 0.4F; // Last spacing
494+
break;
495+
496+
case ENCHANT_LAYOUT:
497+
boxWidth = 140;
498+
x = halfWidth - (boxWidth / 2);
499+
addRenderableWidget(new ButtonText(halfWidth, (int) y - 10, Translations.getMessage("enchantLayout.title"), true, 0xFFFFFFFF));
500+
addRenderableWidget(new ButtonCycling(x, (int) y, boxWidth, 20,
501+
Arrays.asList(EnchantLayout.values()),
502+
feature.getAsEnum(setting).ordinal(),
503+
index -> feature.set(setting, EnchantLayout.values()[index])
504+
));
505+
row += 0.5F;
506+
break;
507+
483508
case BAZAAR_PRICES_UPDATE_INTERVAL:
484509
boxWidth = 150;
485510
x = halfWidth - (boxWidth / 2);

0 commit comments

Comments
 (0)