diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index ae8522520c..699f91ef22 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -1,5 +1,6 @@ package de.hysky.skyblocker.config; +import de.hysky.skyblocker.SkyblockerMod; import de.hysky.skyblocker.skyblock.item.CustomArmorTrims; import de.hysky.skyblocker.utils.chat.ChatFilterResult; import de.hysky.skyblocker.utils.waypoint.Waypoint; @@ -10,6 +11,7 @@ import net.minecraft.client.resource.language.I18n; import net.minecraft.text.Text; import net.minecraft.util.Formatting; +import net.minecraft.util.Identifier; import java.util.ArrayList; import java.util.List; @@ -497,10 +499,32 @@ public static class ItemInfoDisplay { @SerialEntry public boolean itemRarityBackgrounds = false; + @SerialEntry + public RarityBackgroundStyle itemRarityBackgroundStyle = RarityBackgroundStyle.CIRCULAR; + @SerialEntry public float itemRarityBackgroundsOpacity = 1f; } + public enum RarityBackgroundStyle { + CIRCULAR(new Identifier(SkyblockerMod.NAMESPACE, "item_rarity_background_circular")), + SQUARE(new Identifier(SkyblockerMod.NAMESPACE, "item_rarity_background_square")); + + public final Identifier tex; + + private RarityBackgroundStyle(Identifier tex) { + this.tex = tex; + } + + @Override + public String toString() { + return switch (this) { + case CIRCULAR -> "Circular"; + case SQUARE -> "Square"; + }; + } + } + public static class WikiLookup { @SerialEntry public boolean enableWikiLookup = true; diff --git a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java index 3cbb1b94ff..46f54a61fb 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/GeneralCategory.java @@ -386,6 +386,14 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig newValue -> config.general.itemInfoDisplay.itemRarityBackgrounds = newValue) .controller(ConfigUtils::createBooleanController) .build()) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.general.itemInfoDisplay.itemRarityBackgroundStyle")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.general.itemInfoDisplay.itemRarityBackgroundStyle.@Tooltip"))) + .binding(defaults.general.itemInfoDisplay.itemRarityBackgroundStyle, + () -> config.general.itemInfoDisplay.itemRarityBackgroundStyle, + newValue -> config.general.itemInfoDisplay.itemRarityBackgroundStyle = newValue) + .controller(ConfigUtils::createEnumCyclingListController) + .build()) .option(Option.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.general.itemInfoDisplay.itemRarityBackgroundsOpacity")) .binding(defaults.general.itemInfoDisplay.itemRarityBackgroundsOpacity, diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/ItemRarityBackgrounds.java b/src/main/java/de/hysky/skyblocker/skyblock/item/ItemRarityBackgrounds.java index da357738cc..8867af914e 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/item/ItemRarityBackgrounds.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/item/ItemRarityBackgrounds.java @@ -1,8 +1,14 @@ package de.hysky.skyblocker.skyblock.item; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; + import com.google.common.collect.ImmutableMap; import com.mojang.blaze3d.systems.RenderSystem; -import de.hysky.skyblocker.SkyblockerMod; + +import de.hysky.skyblocker.config.SkyblockerConfig; import de.hysky.skyblocker.config.SkyblockerConfigManager; import de.hysky.skyblocker.utils.ItemUtils; import de.hysky.skyblocker.utils.Utils; @@ -16,16 +22,10 @@ import net.minecraft.client.texture.Sprite; import net.minecraft.item.ItemStack; import net.minecraft.text.Text; -import net.minecraft.util.Identifier; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; public class ItemRarityBackgrounds { - private static final Identifier RARITY_BG_TEX = new Identifier(SkyblockerMod.NAMESPACE, "item_rarity_background"); - private static final Supplier SPRITE = () -> MinecraftClient.getInstance().getGuiAtlasManager().getSprite(RARITY_BG_TEX); + private static final SkyblockerConfig.ItemInfoDisplay CONFIG = SkyblockerConfigManager.get().general.itemInfoDisplay; + private static final Supplier SPRITE = () -> MinecraftClient.getInstance().getGuiAtlasManager().getSprite(CONFIG.itemRarityBackgroundStyle.tex); private static final ImmutableMap LORE_RARITIES = ImmutableMap.ofEntries( Map.entry("ADMIN", SkyblockItemRarity.ADMIN), Map.entry("SPECIAL", SkyblockItemRarity.SPECIAL), //Very special is the same color so this will cover it diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 6d94b69b4c..d52ef6129a 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -84,6 +84,8 @@ "text.autoconfig.skyblocker.option.general.itemInfoDisplay.attributeShardInfo.@Tooltip": "Displays the attribute's level as the stack count and the initials of the attribute's name.", "text.autoconfig.skyblocker.option.general.itemInfoDisplay.itemRarityBackgrounds": "Item Rarity Backgrounds", "text.autoconfig.skyblocker.option.general.itemInfoDisplay.itemRarityBackgrounds.@Tooltip": "Displays a colored background behind an item, the color represents the item's rarity.", + "text.autoconfig.skyblocker.option.general.itemInfoDisplay.itemRarityBackgroundStyle": "Item Rarity Background Style", + "text.autoconfig.skyblocker.option.general.itemInfoDisplay.itemRarityBackgroundStyle.@Tooltip": "Choose between a circular or a square background style!", "text.autoconfig.skyblocker.option.general.itemInfoDisplay.itemRarityBackgroundsOpacity": "Item Rarity Backgrounds Opacity", "text.autoconfig.skyblocker.option.general.wikiLookup": "Wiki Lookup", "text.autoconfig.skyblocker.option.general.wikiLookup.enableWikiLookup": "Enable Wiki Lookup", diff --git a/src/main/resources/assets/skyblocker/textures/gui/sprites/item_rarity_background.png b/src/main/resources/assets/skyblocker/textures/gui/sprites/item_rarity_background_circular.png similarity index 100% rename from src/main/resources/assets/skyblocker/textures/gui/sprites/item_rarity_background.png rename to src/main/resources/assets/skyblocker/textures/gui/sprites/item_rarity_background_circular.png diff --git a/src/main/resources/assets/skyblocker/textures/gui/sprites/item_rarity_background_square.png b/src/main/resources/assets/skyblocker/textures/gui/sprites/item_rarity_background_square.png new file mode 100644 index 0000000000..0392b56c4b Binary files /dev/null and b/src/main/resources/assets/skyblocker/textures/gui/sprites/item_rarity_background_square.png differ