aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/anthonyhilyard/iceberg/util
diff options
context:
space:
mode:
authorAnthony Hilyard <anthony.hilyard@gmail.com>2021-09-29 13:27:28 -0700
committerAnthony Hilyard <anthony.hilyard@gmail.com>2021-09-29 13:27:28 -0700
commit8c02a2a7e0d2e2951cdc6a4382a6aa8f235ec63b (patch)
tree6afeb1c55253dbcbce3510fb7d64b55dda647dcd /src/main/java/com/anthonyhilyard/iceberg/util
parent211793ac73a3aaa98835c9ac25fa4583a72bb03a (diff)
downloadIceberg-8c02a2a7e0d2e2951cdc6a4382a6aa8f235ec63b.tar.gz
Iceberg-8c02a2a7e0d2e2951cdc6a4382a6aa8f235ec63b.tar.bz2
Iceberg-8c02a2a7e0d2e2951cdc6a4382a6aa8f235ec63b.zip
Added extended tooltip rendering events to facilitate customization.
Diffstat (limited to 'src/main/java/com/anthonyhilyard/iceberg/util')
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/util/Tooltips.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main/java/com/anthonyhilyard/iceberg/util/Tooltips.java b/src/main/java/com/anthonyhilyard/iceberg/util/Tooltips.java
index 69039db..bc5f081 100644
--- a/src/main/java/com/anthonyhilyard/iceberg/util/Tooltips.java
+++ b/src/main/java/com/anthonyhilyard/iceberg/util/Tooltips.java
@@ -5,6 +5,7 @@ import java.util.List;
import javax.annotation.Nonnull;
+import com.anthonyhilyard.iceberg.events.RenderTooltipExtEvent;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
@@ -85,11 +86,18 @@ public class Tooltips
}
}
- @SuppressWarnings("deprecation")
public static void renderItemTooltip(@Nonnull final ItemStack stack, MatrixStack mStack, TooltipInfo info,
Rectangle2d rect, int screenWidth, int screenHeight,
int backgroundColor, int borderColorStart, int borderColorEnd)
{
+ renderItemTooltip(stack, mStack, info, rect, screenWidth, screenHeight, backgroundColor, borderColorStart, borderColorEnd, false);
+ }
+
+ @SuppressWarnings("deprecation")
+ public static void renderItemTooltip(@Nonnull final ItemStack stack, MatrixStack mStack, TooltipInfo info,
+ Rectangle2d rect, int screenWidth, int screenHeight,
+ int backgroundColor, int borderColorStart, int borderColorEnd, boolean comparison)
+ {
if (info.getLines().isEmpty())
{
return;
@@ -99,7 +107,7 @@ public class Tooltips
int rectY = rect.getY() + 18;
int maxTextWidth = rect.getWidth() - 8;
- RenderTooltipEvent.Pre event = new RenderTooltipEvent.Pre(stack, info.getLines(), mStack, rectX, rectY, screenWidth, screenHeight, maxTextWidth, info.getFont());
+ RenderTooltipExtEvent.Pre event = new RenderTooltipExtEvent.Pre(stack, info.getLines(), mStack, rectX, rectY, screenWidth, screenHeight, maxTextWidth, info.getFont(), comparison);
if (MinecraftForge.EVENT_BUS.post(event))
{
return;
@@ -171,7 +179,7 @@ public class Tooltips
}
final int zLevel = 400;
- RenderTooltipEvent.Color colorEvent = new RenderTooltipEvent.Color(stack, info.getLines(), mStack, tooltipX, tooltipY, info.getFont(), backgroundColor, borderColorStart, borderColorEnd);
+ RenderTooltipExtEvent.Color colorEvent = new RenderTooltipExtEvent.Color(stack, info.getLines(), mStack, tooltipX, tooltipY, info.getFont(), backgroundColor, borderColorStart, borderColorEnd, comparison);
MinecraftForge.EVENT_BUS.post(colorEvent);
backgroundColor = colorEvent.getBackground();
borderColorStart = colorEvent.getBorderStart();
@@ -216,7 +224,7 @@ public class Tooltips
renderType.endBatch();
mStack.popPose();
- MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostText(stack, info.getLines(), mStack, tooltipX, tooltipTop, info.getFont(), tooltipTextWidth, tooltipHeight));
+ MinecraftForge.EVENT_BUS.post(new RenderTooltipExtEvent.PostText(stack, info.getLines(), mStack, tooltipX, tooltipTop, info.getFont(), tooltipTextWidth, tooltipHeight, comparison));
RenderSystem.enableDepthTest();
RenderSystem.enableRescaleNormal();