From f5d35697f524cda1736740e739f8afd902651c53 Mon Sep 17 00:00:00 2001 From: Anthony Hilyard Date: Sat, 4 Dec 2021 21:27:28 -0800 Subject: Initial 1.18 port. Overhauled tooltip handling, added color code item color support. --- src/main/java/com/anthonyhilyard/iceberg/mixin/ScreenMixin.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/main/java/com/anthonyhilyard/iceberg/mixin/ScreenMixin.java') diff --git a/src/main/java/com/anthonyhilyard/iceberg/mixin/ScreenMixin.java b/src/main/java/com/anthonyhilyard/iceberg/mixin/ScreenMixin.java index bbd2d6b..4c7e0c8 100644 --- a/src/main/java/com/anthonyhilyard/iceberg/mixin/ScreenMixin.java +++ b/src/main/java/com/anthonyhilyard/iceberg/mixin/ScreenMixin.java @@ -2,11 +2,10 @@ package com.anthonyhilyard.iceberg.mixin; import java.util.List; -import com.anthonyhilyard.iceberg.util.StringRecomposer; +import com.anthonyhilyard.iceberg.events.RenderTooltipExtEvent; import com.google.common.collect.Lists; import com.mojang.blaze3d.vertex.PoseStack; -import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -37,11 +36,9 @@ public class ScreenMixin extends AbstractContainerEventHandler @Shadow(remap = false) private ItemStack tooltipStack = ItemStack.EMPTY; - @Final @Shadow private final List children = Lists.newArrayList(); - @SuppressWarnings("removal") @Inject(method = "renderTooltipInternal", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/entity/ItemRenderer;blitOffset:F", ordinal = 2, shift = Shift.AFTER), locals = LocalCapture.CAPTURE_FAILEXCEPTION) @@ -49,7 +46,7 @@ public class ScreenMixin extends AbstractContainerEventHandler { if (!components.isEmpty()) { - MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostText(tooltipStack, StringRecomposer.recompose(components), poseStack, postX, postY, ForgeHooksClient.getTooltipFont(tooltipFont, tooltipStack, font), tooltipWidth, tooltipHeight)); + MinecraftForge.EVENT_BUS.post(new RenderTooltipExtEvent.Post(tooltipStack, poseStack, postX, postY, ForgeHooksClient.getTooltipFont(tooltipFont, tooltipStack, font), tooltipWidth, tooltipHeight, components, false)); } } -- cgit