diff options
| author | Kevin <92656833+kevinthegreat1@users.noreply.github.com> | 2024-06-15 16:26:19 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-15 04:26:19 -0400 |
| commit | 37d4d758844ee8b183338966e3efc2f36a2ca672 (patch) | |
| tree | 8f0211a322901d22d3cbd1f1a4aff6a3f25085cd /src/main/java/de/hysky/skyblocker/skyblock/item | |
| parent | e825fbae40201cc74a78ba5f84371ad0b6dfa088 (diff) | |
| download | Skyblocker-37d4d758844ee8b183338966e3efc2f36a2ca672.tar.gz Skyblocker-37d4d758844ee8b183338966e3efc2f36a2ca672.tar.bz2 Skyblocker-37d4d758844ee8b183338966e3efc2f36a2ca672.zip | |
Add docs to ItemTooltip#getNeuName and ItemRepository#getItemStack (#772)
Fix farming hud icon stack id
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/skyblock/item')
| -rw-r--r-- | src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java index e6a364e4..dd8fdfc3 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/ItemTooltip.java @@ -23,16 +23,22 @@ public class ItemTooltip { public static final GeneralConfig.ItemTooltip config = SkyblockerConfigManager.get().general.itemTooltip; private static volatile boolean sentNullWarning = false; + /** + * Gets the NEU id from an id and an api id. + * @param id the id of the skyblock item, gotten from {@link de.hysky.skyblocker.utils.ItemUtils#getItemId(net.minecraft.item.ItemStack) ItemUtils#getItemId(ItemStack)} or {@link net.minecraft.item.ItemStack#getSkyblockId() ItemStack#getSkyblockId()} + * @param apiId the api id of the skyblock item, matching the id of the item on the Skyblocker api, gotten from {@link net.minecraft.item.ItemStack#getSkyblockApiId() ItemStack#getSkyblockApiId()} + * @return the NEU id of the skyblock item, matching the id of the item gotten from {@link io.github.moulberry.repo.data.NEUItem#getSkyblockItemId() NEUItem#getSkyblockItemId()} or {@link net.minecraft.item.ItemStack#getNeuName() ItemStack#getNeuName()} + */ @NotNull - public static String getNeuName(String internalID, String neuName) { - switch (internalID) { + public static String getNeuName(String id, String apiId) { + switch (id) { case "PET" -> { - neuName = neuName.replaceAll("LVL_\\d*_", ""); - String[] parts = neuName.split("_"); + apiId = apiId.replaceAll("LVL_\\d*_", ""); + String[] parts = apiId.split("_"); String type = parts[0]; - neuName = neuName.replaceAll(type + "_", ""); - neuName = neuName + "-" + type; - neuName = neuName.replace("UNCOMMON", "1") + apiId = apiId.replaceAll(type + "_", ""); + apiId = apiId + "-" + type; + apiId = apiId.replace("UNCOMMON", "1") .replace("COMMON", "0") .replace("RARE", "2") .replace("EPIC", "3") @@ -40,13 +46,13 @@ public class ItemTooltip { .replace("MYTHIC", "5") .replace("-", ";"); } - case "RUNE" -> neuName = neuName.replaceAll("_(?!.*_)", ";"); - case "POTION" -> neuName = ""; + case "RUNE" -> apiId = apiId.replaceAll("_(?!.*_)", ";"); + case "POTION" -> apiId = ""; case "ATTRIBUTE_SHARD" -> - neuName = internalID + "+" + neuName.replace("SHARD-", "").replaceAll("_(?!.*_)", ";"); - default -> neuName = neuName.replace(":", "-"); + apiId = id + "+" + apiId.replace("SHARD-", "").replaceAll("_(?!.*_)", ";"); + default -> apiId = apiId.replace(":", "-"); } - return neuName; + return apiId; } public static void nullWarning() { |
