From 8ade4e173a03fcb3080025d11c6e51f5976f3ccc Mon Sep 17 00:00:00 2001 From: inglettronald Date: Sun, 11 Jun 2023 22:57:55 -0500 Subject: wip --- .../dulkirfabric/mixin/render/DrawContextMixin.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/main/java/com/dulkirfabric/mixin/render/DrawContextMixin.java (limited to 'src/main/java') 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 operation) { + Vector2ic v = operation.call(positionerInstance, sw, sh, mx, my, tw, th); + return TooltipImpl.INSTANCE.calculatePos(v); + } +} -- cgit