public void RenderItemstackTooltip(ItemSlot slot, double renderX, double renderY, float dt) { parentBounds.fixedX = renderX / RuntimeEnv.GUIScale; parentBounds.fixedY = renderY / RuntimeEnv.GUIScale; parentBounds.CalcWorldBounds(); renderedTooltipSlot.Itemstack = slot.Itemstack; stackInfo.SetSourceSlot(renderedTooltipSlot); bool newRightOverlap = capi.Input.MouseX + stackInfoBounds.OuterWidth > capi.Render.FrameWidth - 5; bool newBottomOverlap = capi.Input.MouseY + stackInfoBounds.OuterHeight > capi.Render.FrameHeight - 5; if (recalcAlignmentOffset || bottomOverlap != newBottomOverlap || newRightOverlap != rightOverlap) { stackInfoBounds.WithFixedAlignmentOffset( newRightOverlap ? -stackInfoBounds.OuterWidth / RuntimeEnv.GUIScale - tooltipOffsetX : 0, newBottomOverlap ? -stackInfoBounds.OuterHeight / RuntimeEnv.GUIScale - tooltipOffsetY : 0 ); stackInfoBounds.CalcWorldBounds(); stackInfoBounds.fixedOffsetY += Math.Max(0, -stackInfoBounds.renderY); stackInfoBounds.CalcWorldBounds(); bottomOverlap = newBottomOverlap; rightOverlap = newRightOverlap; recalcAlignmentOffset = false; } capi.Render.GlScissorFlag(false); stackInfo.RenderInteractiveElements(dt); capi.Render.GlScissorFlag(true); }