aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authoringlettronald <inglettronald@gmail.com>2023-06-11 22:57:55 -0500
committeringlettronald <inglettronald@gmail.com>2023-06-11 22:57:55 -0500
commit8ade4e173a03fcb3080025d11c6e51f5976f3ccc (patch)
tree2adce93925feb17af340dfb53bc79f6bd159a2ca /src/main/java
parenta30fcadbeed2997ad1607d488ba7548c799a6033 (diff)
downloadDulkirMod-Fabric-8ade4e173a03fcb3080025d11c6e51f5976f3ccc.tar.gz
DulkirMod-Fabric-8ade4e173a03fcb3080025d11c6e51f5976f3ccc.tar.bz2
DulkirMod-Fabric-8ade4e173a03fcb3080025d11c6e51f5976f3ccc.zip
wip
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/dulkirfabric/mixin/render/DrawContextMixin.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main/java/com/dulkirfabric/mixin/render/DrawContextMixin.java b/src/main/java/com/dulkirfabric/mixin/render/DrawContextMixin.java
new file mode 100644
index 0000000..9b6cac3
--- /dev/null
+++ b/src/main/java/com/dulkirfabric/mixin/render/DrawContextMixin.java
@@ -0,0 +1,21 @@
+package com.dulkirfabric.mixin.render;
+
+import com.dulkirfabric.features.TooltipImpl;
+import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
+import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
+import net.minecraft.client.gui.DrawContext;
+import net.minecraft.client.gui.tooltip.TooltipPositioner;
+import org.joml.Vector2ic;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+
+@Mixin(DrawContext.class)
+public class DrawContextMixin {
+
+ @WrapOperation(method = "drawTooltip(Lnet/minecraft/client/font/TextRenderer;Ljava/util/List;IILnet/minecraft/client/gui/tooltip/TooltipPositioner;)V",
+ at = @At(target = "Lnet/minecraft/client/gui/tooltip/TooltipPositioner;getPosition(IIIIII)Lorg/joml/Vector2ic;", value = "INVOKE"))
+ public Vector2ic drawTooltip(TooltipPositioner positionerInstance, int sw, int sh, int mx, int my, int tw, int th, Operation<Vector2ic> operation) {
+ Vector2ic v = operation.call(positionerInstance, sw, sh, mx, my, tw, th);
+ return TooltipImpl.INSTANCE.calculatePos(v);
+ }
+}