aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip
diff options
context:
space:
mode:
authorKevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>2024-06-09 13:11:44 +0800
committerKevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>2024-06-10 12:21:45 +0800
commit075353427a81f2455e10367c6eb76031048826f2 (patch)
tree20f72bdbaad7f53ba8f899aa5346c5ed06a29dd4 /src/main/java/de/hysky/skyblocker/skyblock/item/tooltip
parentd20c5ae5b9a263e7eb790527c7dfe12b96714b0e (diff)
downloadSkyblocker-075353427a81f2455e10367c6eb76031048826f2.tar.gz
Skyblocker-075353427a81f2455e10367c6eb76031048826f2.tar.bz2
Skyblocker-075353427a81f2455e10367c6eb76031048826f2.zip
Add AbstractContainerMatcher
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/skyblock/item/tooltip')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/TooltipAdder.java17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/TooltipAdder.java b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/TooltipAdder.java
index 7c43957e..07b9ac30 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/TooltipAdder.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/item/tooltip/TooltipAdder.java
@@ -1,6 +1,6 @@
package de.hysky.skyblocker.skyblock.item.tooltip;
-import de.hysky.skyblocker.skyblock.ChestValue;
+import de.hysky.skyblocker.utils.render.gui.AbstractContainerMatcher;
import net.minecraft.screen.slot.Slot;
import net.minecraft.text.Text;
@@ -10,13 +10,7 @@ import java.util.regex.Pattern;
/**
* Extend this class and add it to {@link TooltipManager#adders} to add additional text to tooltips.
*/
-public abstract class TooltipAdder {
- /**
- * The title of the screen must match this pattern for this adder to be applied. Null means it will be applied to all screens.
- * @implNote Don't end your regex with a {@code $} as {@link ChestValue} appends text to the end of the title,
- * so the regex will stop matching if the player uses it.
- */
- public final Pattern titlePattern;
+public abstract class TooltipAdder extends AbstractContainerMatcher {
/**
* The priority of this adder. Lower priority means it will be applied first.
* @apiNote Consider taking this value on your class' constructor and setting it from {@link TooltipManager#adders} to make it easy to read and maintain.
@@ -24,11 +18,12 @@ public abstract class TooltipAdder {
public final int priority;
protected TooltipAdder(String titlePattern, int priority) {
- this(Pattern.compile(titlePattern), priority);
+ super(titlePattern);
+ this.priority = priority;
}
protected TooltipAdder(Pattern titlePattern, int priority) {
- this.titlePattern = titlePattern;
+ super(titlePattern);
this.priority = priority;
}
@@ -36,7 +31,7 @@ public abstract class TooltipAdder {
* Creates a TooltipAdder that will be applied to all screens.
*/
protected TooltipAdder(int priority) {
- this.titlePattern = null;
+ super();
this.priority = priority;
}