Readd PoseStack field to RenderTooltipEvent.

This commit is contained in:
Curle committed 2021-12-01 16:55:29 +00:00
1 parent 530a1e8eb0
commit 7631600b53
2 files changed
+16 -8

No files matched your search

@@ -961,16 +961,16 @@ public class ForgeHooksClient
return stackFont == null ? fallbackFont : stackFont;
}
public static RenderTooltipEvent.Pre onRenderTooltipPre(@Nonnull ItemStack stack, PoseStack matrixStack, int x, int y, int screenWidth, int screenHeight, @Nonnull List<ClientTooltipComponent> components, @Nullable Font forcedFont, @Nonnull Font fallbackFont)
public static RenderTooltipEvent.Pre onRenderTooltipPre(@Nonnull ItemStack stack, PoseStack poseStack, int x, int y, int screenWidth, int screenHeight, @Nonnull List<ClientTooltipComponent> components, @Nullable Font forcedFont, @Nonnull Font fallbackFont)
{
var preEvent = new RenderTooltipEvent.Pre(stack, matrixStack, x, y, screenWidth, screenHeight, getTooltipFont(forcedFont, stack, fallbackFont), components);
var preEvent = new RenderTooltipEvent.Pre(stack, poseStack, x, y, screenWidth, screenHeight, getTooltipFont(forcedFont, stack, fallbackFont), components);
MinecraftForge.EVENT_BUS.post(preEvent);
return preEvent;
}
public static RenderTooltipEvent.Color onRenderTooltipColor(@Nonnull ItemStack stack, PoseStack matrixStack, int x, int y, @Nonnull Font font, @Nonnull List<ClientTooltipComponent> components)
public static RenderTooltipEvent.Color onRenderTooltipColor(@Nonnull ItemStack stack, PoseStack poseStack, int x, int y, @Nonnull Font font, @Nonnull List<ClientTooltipComponent> components)
{
var colorEvent = new RenderTooltipEvent.Color(stack, matrixStack, x, y, font, 0xf0100010, 0x505000FF, 0x5028007f, components);
var colorEvent = new RenderTooltipEvent.Color(stack, poseStack, x, y, font, 0xf0100010, 0x505000FF, 0x5028007f, components);
MinecraftForge.EVENT_BUS.post(colorEvent);
return colorEvent;
}
@@ -50,6 +50,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
{
@Nonnull
protected final ItemStack itemStack;
protected final PoseStack poseStack;
protected int x;
protected int y;
protected Font font;
@@ -59,6 +60,7 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
public RenderTooltipEvent(@Nonnull ItemStack itemStack, PoseStack poseStack, int x, int y, @Nonnull Font font, @Nonnull List<ClientTooltipComponent> components)
{
this.itemStack = itemStack;
this.poseStack = poseStack;
this.components = Collections.unmodifiableList(components);
this.x = x;
this.y = y;
@@ -74,6 +76,12 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
return itemStack;
}
/**
* @return The PoseStack rendering context.
*/
public PoseStack getPoseStack() { return poseStack; }
/**
* The components to be drawn.
* To modify this list use {@link GatherComponents}.
@@ -195,9 +203,9 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
private int screenWidth;
private int screenHeight;
public Pre(@Nonnull ItemStack stack, PoseStack matrixStack, int x, int y, int screenWidth, int screenHeight, @Nonnull Font font, @Nonnull List<ClientTooltipComponent> components)
public Pre(@Nonnull ItemStack stack, PoseStack poseStack, int x, int y, int screenWidth, int screenHeight, @Nonnull Font font, @Nonnull List<ClientTooltipComponent> components)
{
super(stack, matrixStack, x, y, font, components);
super(stack, poseStack, x, y, font, components);
this.screenWidth = screenWidth;
this.screenHeight = screenHeight;
}
@@ -250,9 +258,9 @@ public abstract class RenderTooltipEvent extends net.minecraftforge.eventbus.api
private int borderStart;
private int borderEnd;
public Color(@Nonnull ItemStack stack, PoseStack matrixStack, int x, int y, @Nonnull Font fr, int background, int borderStart, int borderEnd, @Nonnull List<ClientTooltipComponent> components)
public Color(@Nonnull ItemStack stack, PoseStack poseStack, int x, int y, @Nonnull Font fr, int background, int borderStart, int borderEnd, @Nonnull List<ClientTooltipComponent> components)
{
super(stack, matrixStack, x, y, fr, components);
super(stack, poseStack, x, y, fr, components);
this.originalBackground = background;
this.originalBorderStart = borderStart;
this.originalBorderEnd = borderEnd;