package net.geforcemods.securitycraft.screen.components;

import net.minecraft.client.gui.widget.Widget;

public class HoverChecker
{
	private int top;
	private int bottom;
	private int left;
	private int right;
	private Widget widget;

	public HoverChecker(int top, int bottom, int left, int right)
	{
		this.top = top;
		this.bottom = bottom;
		this.left = left;
		this.right = right;
	}

	public HoverChecker(Widget widget)
	{
		this(widget.x, widget.x + widget.getHeight(), widget.y, widget.y + widget.getWidth()); //x, y, getWidth

		this.widget = widget;
	}

	public boolean checkHover(int mouseX, int mouseY)
	{
		if(widget != null && !widget.visible) //visible
			return false;

		return mouseX >= left && mouseX <= right && mouseY >= top && mouseY <= bottom;
	}
}

@@ -537,25 +537,8 @@
 ());
- //x, y, getWidth
 %0D%0A%0D%0A
@@ -643,20 +643,30 @@
  != null
- && 
+)%0D%0A%09%09%7B%0D%0A%09%09%09if(
 !widget.
@@ -677,42 +677,77 @@
 ble)
- //visible%0D%0A%09%09%09return false;%0D%0A%0D%0A%09%09
+%0D%0A%09%09%09%09return false;%0D%0A%09%09%09else return widget.isHovered();%0D%0A%09%09%7D%0D%0A%09%09else 
 retu

fix hover checker for widgets