diff options
author | Anthony Hilyard <anthony.hilyard@gmail.com> | 2023-08-07 10:32:03 -0700 |
---|---|---|
committer | Anthony Hilyard <anthony.hilyard@gmail.com> | 2023-08-07 10:32:03 -0700 |
commit | f37e965d1f2a8d8aa26c9673bc1c1fb732c22ecc (patch) | |
tree | 555ce3ecfd68a51668f2a2024261d024e0cdd9eb /src/main/java/com/anthonyhilyard/iceberg/mixin/TooltipRenderUtilMixin.java | |
parent | 4916249af135eec5ca9624d9af1716f2c2364682 (diff) | |
download | Iceberg-f37e965d1f2a8d8aa26c9673bc1c1fb732c22ecc.tar.gz Iceberg-f37e965d1f2a8d8aa26c9673bc1c1fb732c22ecc.tar.bz2 Iceberg-f37e965d1f2a8d8aa26c9673bc1c1fb732c22ecc.zip |
Ported to 1.20.
Diffstat (limited to 'src/main/java/com/anthonyhilyard/iceberg/mixin/TooltipRenderUtilMixin.java')
-rw-r--r-- | src/main/java/com/anthonyhilyard/iceberg/mixin/TooltipRenderUtilMixin.java | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/src/main/java/com/anthonyhilyard/iceberg/mixin/TooltipRenderUtilMixin.java b/src/main/java/com/anthonyhilyard/iceberg/mixin/TooltipRenderUtilMixin.java index 18ef9e4..6007283 100644 --- a/src/main/java/com/anthonyhilyard/iceberg/mixin/TooltipRenderUtilMixin.java +++ b/src/main/java/com/anthonyhilyard/iceberg/mixin/TooltipRenderUtilMixin.java @@ -1,6 +1,5 @@ package com.anthonyhilyard.iceberg.mixin; -import org.joml.Matrix4f; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -10,8 +9,8 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import com.anthonyhilyard.iceberg.util.Tooltips; -import com.mojang.blaze3d.vertex.BufferBuilder; +import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.inventory.tooltip.TooltipRenderUtil; import net.minecraft.network.chat.TextColor; @@ -33,32 +32,32 @@ public class TooltipRenderUtilMixin @Final private static int BORDER_COLOR_BOTTOM; - @Inject(method = "renderTooltipBackground", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil;renderHorizontalLine(Lnet/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil$BlitPainter;Lorg/joml/Matrix4f;Lcom/mojang/blaze3d/vertex/BufferBuilder;IIIII)V", shift = At.Shift.BEFORE, ordinal = 0)) - private static void icebergRenderTooltipBackgroundOne(TooltipRenderUtil.BlitPainter painter, Matrix4f matrix, BufferBuilder bufferbuilder, int x, int y, int width, int height, int z, CallbackInfo info) + @Inject(method = "renderTooltipBackground", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil;renderHorizontalLine(Lnet/minecraft/client/gui/GuiGraphics;IIIII)V", shift = At.Shift.BEFORE, ordinal = 0)) + private static void icebergRenderTooltipBackgroundOne(GuiGraphics painter, int x, int y, int width, int height, int z, CallbackInfo info) { horizontalLineColor = Tooltips.currentColors.backgroundColorStart(); } - @Inject(method = "renderTooltipBackground", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil;renderHorizontalLine(Lnet/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil$BlitPainter;Lorg/joml/Matrix4f;Lcom/mojang/blaze3d/vertex/BufferBuilder;IIIII)V", shift = At.Shift.BEFORE, ordinal = 1)) - private static void icebergRenderTooltipBackgroundTwo(TooltipRenderUtil.BlitPainter painter, Matrix4f matrix, BufferBuilder bufferbuilder, int x, int y, int width, int height, int z, CallbackInfo info) + @Inject(method = "renderTooltipBackground", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil;renderHorizontalLine(Lnet/minecraft/client/gui/GuiGraphics;IIIII)V", shift = At.Shift.BEFORE, ordinal = 1)) + private static void icebergRenderTooltipBackgroundTwo(GuiGraphics painter, int x, int y, int width, int height, int z, CallbackInfo info) { horizontalLineColor = Tooltips.currentColors.backgroundColorEnd(); } - @Inject(method = "renderFrameGradient", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil;renderHorizontalLine(Lnet/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil$BlitPainter;Lorg/joml/Matrix4f;Lcom/mojang/blaze3d/vertex/BufferBuilder;IIIII)V", shift = At.Shift.BEFORE, ordinal = 0)) - private static void icebergRenderFrameGradientOne(TooltipRenderUtil.BlitPainter painter, Matrix4f matrix, BufferBuilder bufferbuilder, int x, int y, int width, int height, int z, int color1, int color2, CallbackInfo info) + @Inject(method = "renderFrameGradient", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil;renderHorizontalLine(Lnet/minecraft/client/gui/GuiGraphics;IIIII)V", shift = At.Shift.BEFORE, ordinal = 0)) + private static void icebergRenderFrameGradientOne(GuiGraphics painter, int x, int y, int width, int height, int z, int color1, int color2, CallbackInfo info) { horizontalLineColor = Tooltips.currentColors.borderColorStart(); } - @Inject(method = "renderFrameGradient", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil;renderHorizontalLine(Lnet/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil$BlitPainter;Lorg/joml/Matrix4f;Lcom/mojang/blaze3d/vertex/BufferBuilder;IIIII)V", shift = At.Shift.BEFORE, ordinal = 1)) - private static void icebergRenderFrameGradientTwo(TooltipRenderUtil.BlitPainter painter, Matrix4f matrix, BufferBuilder bufferbuilder, int x, int y, int width, int height, int z, int color1, int color2, CallbackInfo info) + @Inject(method = "renderFrameGradient", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/tooltip/TooltipRenderUtil;renderHorizontalLine(Lnet/minecraft/client/gui/GuiGraphics;IIIII)V", shift = At.Shift.BEFORE, ordinal = 1)) + private static void icebergRenderFrameGradientTwo(GuiGraphics painter, int x, int y, int width, int height, int z, int color1, int color2, CallbackInfo info) { horizontalLineColor = Tooltips.currentColors.borderColorEnd(); } @Inject(method = "renderHorizontalLine", at = @At(value = "HEAD"), cancellable = true) - private static void icebergRenderHorizontalLine(TooltipRenderUtil.BlitPainter painter, Matrix4f matrix, BufferBuilder bufferbuilder, int x, int y, int width, int z, int color, CallbackInfo info) + private static void icebergRenderHorizontalLine(GuiGraphics painter, int x, int y, int width, int z, int color, CallbackInfo info) { if (color != BACKGROUND_COLOR && color != BORDER_COLOR_TOP && color != BORDER_COLOR_BOTTOM) { @@ -68,13 +67,13 @@ public class TooltipRenderUtilMixin { // Replace the rendered colors with the ones previously stored. int renderColor = horizontalLineColor.getValue(); - painter.blit(matrix, bufferbuilder, x, y, x + width, y + 1, z, renderColor, renderColor); + painter.fillGradient(x, y, x + width, y + 1, z, renderColor, renderColor); info.cancel(); } } @Inject(method = "renderRectangle", at = @At(value = "HEAD"), cancellable = true) - private static void icebergRenderRectangle(TooltipRenderUtil.BlitPainter painter, Matrix4f matrix, BufferBuilder bufferbuilder, int x, int y, int width, int height, int z, int color, CallbackInfo info) + private static void icebergRenderRectangle(GuiGraphics painter, int x, int y, int width, int height, int z, int color, CallbackInfo info) { if (color != BACKGROUND_COLOR) { @@ -83,13 +82,13 @@ public class TooltipRenderUtilMixin else { // Replace the rendered colors with the ones previously stored. - painter.blit(matrix, bufferbuilder, x, y, x + width, y + height, z, Tooltips.currentColors.backgroundColorStart().getValue(), Tooltips.currentColors.backgroundColorEnd().getValue()); + painter.fillGradient(x, y, x + width, y + height, z, Tooltips.currentColors.backgroundColorStart().getValue(), Tooltips.currentColors.backgroundColorEnd().getValue()); info.cancel(); } } @Inject(method = "renderVerticalLine", at = @At(value = "HEAD"), cancellable = true) - private static void icebergRenderVerticalLine(TooltipRenderUtil.BlitPainter painter, Matrix4f matrix, BufferBuilder bufferbuilder, int x, int y, int height, int z, int color, CallbackInfo info) + private static void icebergRenderVerticalLine(GuiGraphics painter, int x, int y, int height, int z, int color, CallbackInfo info) { if (color != BACKGROUND_COLOR) { @@ -98,13 +97,13 @@ public class TooltipRenderUtilMixin else { // Replace the rendered colors with the ones previously stored. - painter.blit(matrix, bufferbuilder, x, y, x + 1, y + height, z, Tooltips.currentColors.backgroundColorStart().getValue(), Tooltips.currentColors.backgroundColorEnd().getValue()); + painter.fillGradient(x, y, x + 1, y + height, z, Tooltips.currentColors.backgroundColorStart().getValue(), Tooltips.currentColors.backgroundColorEnd().getValue()); info.cancel(); } } @Inject(method = "renderVerticalLineGradient", at = @At(value = "HEAD"), cancellable = true) - private static void icebergRenderVerticalLineGradient(TooltipRenderUtil.BlitPainter painter, Matrix4f matrix, BufferBuilder bufferbuilder, int x, int y, int height, int z, int startColor, int endColor, CallbackInfo info) + private static void icebergRenderVerticalLineGradient(GuiGraphics painter, int x, int y, int height, int z, int startColor, int endColor, CallbackInfo info) { if (startColor != BORDER_COLOR_TOP || endColor != BORDER_COLOR_BOTTOM) { @@ -113,7 +112,7 @@ public class TooltipRenderUtilMixin else { // Replace the rendered colors with the ones previously stored. - painter.blit(matrix, bufferbuilder, x, y, x + 1, y + height, z, Tooltips.currentColors.borderColorStart().getValue(), Tooltips.currentColors.borderColorEnd().getValue()); + painter.fillGradient(x, y, x + 1, y + height, z, Tooltips.currentColors.borderColorStart().getValue(), Tooltips.currentColors.borderColorEnd().getValue()); info.cancel(); } } |