TurnBasedMinecraftMod/src/main/java/com/burnedkirby/TurnBasedMinecraft/client/ItemSelectionButton.java

30 lines
906 B
Java
Raw Normal View History

2019-11-25 06:29:25 +00:00
package com.burnedkirby.TurnBasedMinecraft.client;
2019-10-21 07:13:11 +00:00
import net.minecraft.client.gui.widget.button.Button;
2019-10-21 07:13:11 +00:00
public class ItemSelectionButton extends Button
{
2019-10-21 07:13:11 +00:00
private int itemStackID;
2019-10-21 07:13:11 +00:00
public ItemSelectionButton(int x, int y, int widthIn, int heightIn, String buttonText, int itemStackID, Button.IPressable onPress) {
super(x, y, widthIn, heightIn, buttonText, onPress);
this.itemStackID = itemStackID;
}
2019-10-21 07:13:11 +00:00
public int getID() {
return itemStackID;
}
@Override
2019-10-21 07:13:11 +00:00
public void render(int mouseX, int mouseY, float partialTicks) {
if(visible) {
boolean hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
if(hovered) {
fill(x, y, x + width, y + height, 0x80FFFFFF);
} else {
fill(x, y, x + width, y + height, 0x20707070);
}
}
}
}