diff options
author | Rime <81419447+Emirlol@users.noreply.github.com> | 2024-06-06 15:39:39 +0300 |
---|---|---|
committer | Rime <81419447+Emirlol@users.noreply.github.com> | 2024-06-08 04:13:47 +0300 |
commit | fda12a425035591d2fa27ea700a1fd471d5119be (patch) | |
tree | 1e76fcd317bf7289756ae501a64671e492ee35e7 /src/main | |
parent | 5dc2720ad8d9ffce2d0b1c906c0ea71cd5680019 (diff) | |
download | Skyblocker-fda12a425035591d2fa27ea700a1fd471d5119be.tar.gz Skyblocker-fda12a425035591d2fa27ea700a1fd471d5119be.tar.bz2 Skyblocker-fda12a425035591d2fa27ea700a1fd471d5119be.zip |
Fix SupercraftReminder adding conditions to not display when unnecessary
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/adders/SupercraftReminder.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/adders/SupercraftReminder.java b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/adders/SupercraftReminder.java index e0376d22..3affa64b 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/adders/SupercraftReminder.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/adders/SupercraftReminder.java @@ -1,5 +1,6 @@ package de.hysky.skyblocker.skyblock.item.tooltip.adders; +import de.hysky.skyblocker.utils.ItemUtils; import net.minecraft.item.Items; import net.minecraft.screen.slot.Slot; import net.minecraft.text.Text; @@ -9,13 +10,20 @@ import java.util.List; import java.util.regex.Pattern; public class SupercraftReminder extends TooltipAdder { + private static final byte SUPERCRAFT_SLOT = 32; + private static final byte RECIPE_RESULT_SLOT = 25; + public SupercraftReminder() { super(Pattern.compile("^.+ Recipe$"), Integer.MIN_VALUE); } @Override public void addToTooltip(List<Text> lines, Slot focusedSlot) { - if (focusedSlot.id != 32 || !focusedSlot.getStack().isOf(Items.GOLDEN_PICKAXE)) return; - lines.add(lines.size()-1, Text.literal("Shift-Click to maximize the amount!").formatted(Formatting.GOLD)); + if (focusedSlot.id != SUPERCRAFT_SLOT || !focusedSlot.getStack().isOf(Items.GOLDEN_PICKAXE)) return; + String UUID = ItemUtils.getItemUuid(focusedSlot.inventory.getStack(RECIPE_RESULT_SLOT)); + if (!UUID.isEmpty()) return; //Items with UUID can't be stacked, and therefore the shift-click feature doesn't matter + int index = lines.size()-1; + if (lines.get(lines.size()-2).getString().equals("Recipe not unlocked!")) index--; //Place it right below the "Right-Click to set amount" line + lines.add(index, Text.literal("Shift-Click to maximize the amount!").formatted(Formatting.GOLD)); } } |