aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky/skyblocker/utils
diff options
context:
space:
mode:
authorRime <81419447+Emirlol@users.noreply.github.com>2024-06-21 07:38:03 +0300
committerKevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>2024-07-22 14:21:56 +0800
commit8f540ffc0f2e6dc90f8c9a1ac249ff9185243d3c (patch)
tree31866cf4f5a1723e092f0cbebe7dbbcca2209dba /src/main/java/de/hysky/skyblocker/utils
parent4c398333b9802a9000cc65d50ae4a2d13f300ca8 (diff)
downloadSkyblocker-8f540ffc0f2e6dc90f8c9a1ac249ff9185243d3c.tar.gz
Skyblocker-8f540ffc0f2e6dc90f8c9a1ac249ff9185243d3c.tar.bz2
Skyblocker-8f540ffc0f2e6dc90f8c9a1ac249ff9185243d3c.zip
A lot of stuff.
- Refactored SlotTextAdders to take in ItemStack and int slotId rather than Slot - Refactored the renderSlotText method from HandledScreenMixin into SlotTextManager and added an overloading function that takes in the itemstack, slot id, x and y and the previous function with the Slot parameter just delegates to it with the relevant fields from that Slot object - As a result of the above 2 changes the logic in CommunityShopAdder had to be changed too, now it figures out the screen from the method calls to `getText` rather than the Slot's inventory. - Fixed slot text not being rendered in backpack preview - Added private constructor for BackpackPreview (because it's all static methods anyway)
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/utils')
-rw-r--r--src/main/java/de/hysky/skyblocker/utils/container/AbstractContainerSolver.java1
-rw-r--r--src/main/java/de/hysky/skyblocker/utils/container/AbstractSlotTextAdder.java6
2 files changed, 3 insertions, 4 deletions
diff --git a/src/main/java/de/hysky/skyblocker/utils/container/AbstractContainerSolver.java b/src/main/java/de/hysky/skyblocker/utils/container/AbstractContainerSolver.java
index 38bc32dd..d4c52212 100644
--- a/src/main/java/de/hysky/skyblocker/utils/container/AbstractContainerSolver.java
+++ b/src/main/java/de/hysky/skyblocker/utils/container/AbstractContainerSolver.java
@@ -9,7 +9,6 @@ import net.minecraft.item.ItemStack;
import java.util.List;
public interface AbstractContainerSolver extends AbstractContainerMatcher {
-
List<ColorHighlight> getColors(Int2ObjectMap<ItemStack> slots);
default void start(GenericContainerScreen screen) {}
diff --git a/src/main/java/de/hysky/skyblocker/utils/container/AbstractSlotTextAdder.java b/src/main/java/de/hysky/skyblocker/utils/container/AbstractSlotTextAdder.java
index 4034e88d..fce3fcf5 100644
--- a/src/main/java/de/hysky/skyblocker/utils/container/AbstractSlotTextAdder.java
+++ b/src/main/java/de/hysky/skyblocker/utils/container/AbstractSlotTextAdder.java
@@ -1,7 +1,7 @@
package de.hysky.skyblocker.utils.container;
import de.hysky.skyblocker.skyblock.item.slottext.SlotText;
-import net.minecraft.screen.slot.Slot;
+import net.minecraft.item.ItemStack;
import org.jetbrains.annotations.NotNull;
import java.util.List;
@@ -9,7 +9,7 @@ import java.util.List;
public interface AbstractSlotTextAdder extends AbstractContainerMatcher {
/**
- * This method will be called for each rendered slot. Consider using a switch statement on {@link Slot#id} if you wish to add different text to different slots.
+ * This method will be called for each rendered slot. Consider using a switch statement on {@code slotId} if you wish to limit the text to specific slots.
*
* @return A list of positioned text to be rendered. Return {@link List#of()} if no text should be rendered.
* @implNote By minecraft's design, scaled text inexplicably moves around.
@@ -17,5 +17,5 @@ public interface AbstractSlotTextAdder extends AbstractContainerMatcher {
* So, limit your text to 3 characters (or roughly less than 20 width) if you want it to not look horrible.
*/
@NotNull
- List<SlotText> getText(Slot slot);
+ List<SlotText> getText(@NotNull ItemStack itemStack, int slotId);
}