diff options
| author | victo <victor.branchu@gmail.com> | 2023-09-13 20:16:32 +0200 |
|---|---|---|
| committer | victo <victor.branchu@gmail.com> | 2023-09-13 20:16:32 +0200 |
| commit | a7ba4feaaacc95b505b75ec78a169fed66aead93 (patch) | |
| tree | 9cd1eeae9d5b2b2684be11e07f544ea9fa44a317 /src/main/java/me/xmrvizzy/skyblocker/mixin/accessor | |
| parent | 99c6a8a6f1f09feee4a8fb1cae5af40ec0217c7e (diff) | |
| download | Skyblocker-a7ba4feaaacc95b505b75ec78a169fed66aead93.tar.gz Skyblocker-a7ba4feaaacc95b505b75ec78a169fed66aead93.tar.bz2 Skyblocker-a7ba4feaaacc95b505b75ec78a169fed66aead93.zip | |
Add tooltip display for personal compactor items
This update integrates a tooltip display for personal compactor items in the Skyblocker mod. The tooltip shows the contents of the personal compactor when hovered over. This is useful for players to quickly check the contents of their compactor without needing to open it. The commit includes creating a new Java file 'CompactorPreviewTooltipComponent.java' for the compactor tooltip component, adding new inject method 'skyblocker$addTooltipComponent' in 'HandledScreenMixin.java' executed when drawing mouseover tooltip, adding 'DrawContextInvoker.java' for invoking the 'drawTooltip' method in the 'DrawContext' class, and adding 'getItemStack' method in the 'ItemRegistry.java'.
Diffstat (limited to 'src/main/java/me/xmrvizzy/skyblocker/mixin/accessor')
| -rw-r--r-- | src/main/java/me/xmrvizzy/skyblocker/mixin/accessor/DrawContextInvoker.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/mixin/accessor/DrawContextInvoker.java b/src/main/java/me/xmrvizzy/skyblocker/mixin/accessor/DrawContextInvoker.java new file mode 100644 index 00000000..55ef0774 --- /dev/null +++ b/src/main/java/me/xmrvizzy/skyblocker/mixin/accessor/DrawContextInvoker.java @@ -0,0 +1,18 @@ +package me.xmrvizzy.skyblocker.mixin.accessor; + +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.gui.tooltip.TooltipComponent; +import net.minecraft.client.gui.tooltip.TooltipPositioner; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Invoker; + +import java.util.List; + +@Mixin(DrawContext.class) +public interface DrawContextInvoker { + + @SuppressWarnings("unused") + @Invoker("drawTooltip") + void invokeDrawTooltip(TextRenderer textRenderer, List<TooltipComponent> components, int x, int y, TooltipPositioner positioner); +} |
