diff --git a/src/common/java/com/minelittlepony/gui/IconicButton.java b/src/common/java/com/minelittlepony/gui/IconicButton.java new file mode 100644 index 00000000..418b7f87 --- /dev/null +++ b/src/common/java/com/minelittlepony/gui/IconicButton.java @@ -0,0 +1,31 @@ +package com.minelittlepony.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; + +public class IconicButton extends Button { + + private ItemStack itemStack = ItemStack.EMPTY; + + public IconicButton(int x, int y, IGuiAction callback) { + super(x, y, 20, 20, "", callback); + } + + public IconicButton setIcon(ItemStack stack) { + itemStack = stack; + return this; + } + + public IconicButton setIcon(ItemStack stack, int colour) { + Items.LEATHER_LEGGINGS.setColor(stack, colour); + return setIcon(stack); + } + + @Override + public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) { + super.drawButton(mc, mouseX, mouseY, partialTicks); + + mc.getRenderItem().renderItemIntoGUI(itemStack, x + 2, y + 2); + } +} diff --git a/src/hdskins/java/com/minelittlepony/gui/Button.java b/src/hdskins/java/com/minelittlepony/gui/Button.java index 7963ca56..da1392a4 100644 --- a/src/hdskins/java/com/minelittlepony/gui/Button.java +++ b/src/hdskins/java/com/minelittlepony/gui/Button.java @@ -9,13 +9,13 @@ import net.minecraft.client.gui.GuiButton; public class Button extends GuiButton implements IActionable, IGuiTooltipped { - private IGuiAction