Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
import de.hysky.skyblocker.skyblock.item.slottext.adders.ChoosePetLevelAdder;
import de.hysky.skyblocker.skyblock.item.slottext.adders.CollectionAdder;
import de.hysky.skyblocker.skyblock.item.slottext.adders.CommunityShopAdder;
import de.hysky.skyblocker.skyblock.item.slottext.adders.CropMilestonesAdder;
import de.hysky.skyblocker.skyblock.item.slottext.adders.EnchantmentAbbreviationAdder;
import de.hysky.skyblocker.skyblock.item.slottext.adders.EnchantmentLevelAdder;
import de.hysky.skyblocker.skyblock.item.slottext.adders.EssenceShopAdder;
import de.hysky.skyblocker.skyblock.item.slottext.adders.EvolvingItemAdder;
import de.hysky.skyblocker.skyblock.item.slottext.adders.GardenUpgradesAdder;
import de.hysky.skyblocker.skyblock.item.slottext.adders.HotfPerkLevelAdder;
import de.hysky.skyblocker.skyblock.item.slottext.adders.HotmPerkLevelAdder;
import de.hysky.skyblocker.skyblock.item.slottext.adders.HuntingToolkitIndicatorAdder;
Expand Down Expand Up @@ -94,6 +96,8 @@ public class SlotTextManager {
new BestiaryLevelAdder(),
new HuntingToolkitIndicatorAdder(),
new ChipLevelAdder(),
new CropMilestonesAdder(),
new GardenUpgradesAdder(),
};
private static final ArrayList<SlotTextAdder> currentScreenAdders = new ArrayList<>();
private static final KeyMapping keyBinding = KeyMappingHelper.registerKeyMapping(new KeyMapping("key.skyblocker.slottext", GLFW.GLFW_KEY_LEFT_ALT, SkyblockerMod.KEYBINDING_CATEGORY));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package de.hysky.skyblocker.skyblock.item.slottext.adders;

import de.hysky.skyblocker.skyblock.item.slottext.SimpleSlotTextAdder;
import de.hysky.skyblocker.skyblock.item.slottext.SlotText;
import de.hysky.skyblocker.utils.ItemUtils;
import java.util.List;
import net.minecraft.network.chat.Component;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.ItemStack;
import org.jspecify.annotations.Nullable;

public class CropMilestonesAdder extends SimpleSlotTextAdder {

private static final ConfigInformation CONFIG_INFORMATION =
new ConfigInformation(
"crop_milestones",
"skyblocker.config.uiAndVisuals.slotText.cropMilestones",
"skyblocker.config.uiAndVisuals.slotText.cropMilestones.@Tooltip"
);

public CropMilestonesAdder() {
super("^Crop Milestones", CONFIG_INFORMATION);
}

@Override
public List<SlotText> getText(
@Nullable Slot slot,
ItemStack stack,
int slotId
) {
String name = stack.getHoverName().getString();
int lastSpace = name.lastIndexOf(' ');
if (lastSpace == -1) return List.of();

String number = name.substring(lastSpace + 1);
if (!number.matches("\\d+")) return List.of();

boolean maxed = ItemUtils.getLoreLineIf(stack, s ->
s.contains("Max tier reached!")
) != null;

return SlotText.bottomRightList(
Component.literal(number).withColor(
maxed ? SlotText.GOLD : SlotText.CREAM
)
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package de.hysky.skyblocker.skyblock.item.slottext.adders;

import de.hysky.skyblocker.skyblock.item.slottext.SlotText;
import de.hysky.skyblocker.skyblock.item.slottext.SimpleSlotTextAdder;
import de.hysky.skyblocker.utils.ItemUtils;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.minecraft.network.chat.Component;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.ItemStack;
import org.jspecify.annotations.Nullable;

public class GardenUpgradesAdder extends SimpleSlotTextAdder {

private static final Pattern TIER_PATTERN = Pattern.compile("Current Tier: (?<tier>\\d+)/(?<max>\\d+)");
private static final ConfigInformation CONFIG_INFORMATION = new ConfigInformation(
"garden_upgrades",
"skyblocker.config.uiAndVisuals.slotText.gardenUpgrades",
"skyblocker.config.uiAndVisuals.slotText.gardenUpgrades.@Tooltip"
);

public GardenUpgradesAdder() {
super("^(?:Crop|Greenhouse) Upgrades", CONFIG_INFORMATION);
}

@Override
public List<SlotText> getText(@Nullable Slot slot, ItemStack stack, int slotId) {
Matcher matcher = ItemUtils.getLoreLineIfMatch(stack, TIER_PATTERN);
if (matcher == null) return List.of();

String tier = matcher.group("tier");
boolean maxed = tier.equals(matcher.group("max"));

return SlotText.bottomRightList(
Component.literal(String.valueOf(tier)).withColor(maxed ? SlotText.GOLD : SlotText.CREAM)
);
}
}
4 changes: 4 additions & 0 deletions src/main/resources/assets/skyblocker/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -1341,12 +1341,16 @@
"skyblocker.config.uiAndVisuals.slotText.collectionLevel": "Collection Level",
"skyblocker.config.uiAndVisuals.slotText.communityShop": "Community Shop",
"skyblocker.config.uiAndVisuals.slotText.communityShop.@Tooltip": "Displays the level of the upgrades in the community shop.",
"skyblocker.config.uiAndVisuals.slotText.cropMilestones": "Crop Milestones",
"skyblocker.config.uiAndVisuals.slotText.cropMilestones.@Tooltip": "Displays the crop milestone levels",
"skyblocker.config.uiAndVisuals.slotText.enchantmentAbbreviation": "Enchantment Abbreviation",
"skyblocker.config.uiAndVisuals.slotText.enchantmentLevel": "Enchantment Book Level",
"skyblocker.config.uiAndVisuals.slotText.essenceShop": "Essence Shop",
"skyblocker.config.uiAndVisuals.slotText.essenceShop.@Tooltip": "Displays the levels and your current amount of essence while in essence shops.",
"skyblocker.config.uiAndVisuals.slotText.evolvingItems": "Evolving Items",
"skyblocker.config.uiAndVisuals.slotText.evolvingItems.@Tooltip": "Displays the time held for Bottle of Jyrre, Moby Duck, Discrite, Dark Cacao Truffle, Training Weights.",
"skyblocker.config.uiAndVisuals.slotText.gardenUpgrades": "Garden Upgrades",
"skyblocker.config.uiAndVisuals.slotText.gardenUpgrades.@Tooltip": "Displays the level of crop and greenhouse upgrades",
"skyblocker.config.uiAndVisuals.slotText.hotfPerkLevel": "HOTF Perk Level",
"skyblocker.config.uiAndVisuals.slotText.hotmPerkLevel": "HOTM Perk Level",
"skyblocker.config.uiAndVisuals.slotText.huntingToolkitIndicator": "Toolkit Indicator",
Expand Down
Loading