Expose `isMouseInRelativeRange` in `IComponentRenderContext`
ChiriVulpes opened this issue ยท 0 comments
Moved from discord discussion.
We have setHoverTooltip
now but no easy way to check if the mouse is actually hovering.
To check that, it currently requires this kind of thing (which shouldn't be done anyway cause GuiBook
is a non-api import):
@Override
public void onDisplayed (IComponentRenderContext context) {
this.parent = (GuiBook) context.getGui();
}
@Override
public void render (IComponentRenderContext context, float ticks, int mouseX, int mouseY) {
if (parent.isMouseInRelativeRange(mouseX, mouseY, iconX, iconY, 11, 11)) {
parent.setTooltip("text");
}
}