Кастомная кнопка

Версия Minecraft
1.7.10
API
Forge

dxAugust

Живёт в подвале
135
2
8
Привет,
Появилась задача, создание кнопки с звуком - нажатия, наведения (Когда курсор на кнопке) и с кастомной текстурой.

Имеется у кого-нибудь пример под 1.7.10 сделать конструктор кнопки и как проигрывать звуки не в мире, а просто в игре.
 
Решение
Прописал класс, но не схватывает его видимо, кнопки нету.
Класс кнопки:
public class Button extends GuiButton
{
    protected static final ResourceLocation buttonTextures = new ResourceLocation(Main.MODID + ":textures/gui/button.png");
    private boolean hovered;

    public Button(int id, int x, int y, int width, int height, String name)
    {
        super(id, x, y, width, height, name);
        this.width = width;
        this.height = height;
        this.xPosition = x;
        this.yPosition = y;
    }

    @Override
    public void drawButton(Minecraft mc, int mouseX, int mouseY)
    {
        if (this.visible)
        {
            FontRenderer fontrenderer = mc.fontRenderer;
            mc.getTextureManager().bindTexture(buttonTextures)...

dxAugust

Живёт в подвале
135
2
8
Прописал класс, но не схватывает его видимо, кнопки нету.
Класс кнопки:
public class Button extends GuiButton
{
    protected static final ResourceLocation buttonTextures = new ResourceLocation(Main.MODID + ":textures/gui/button.png");
    private boolean hovered;

    public Button(int id, int x, int y, int width, int height, String name)
    {
        super(id, x, y, width, height, name);
        this.width = width;
        this.height = height;
        this.xPosition = x;
        this.yPosition = y;
    }

    @Override
    public void drawButton(Minecraft mc, int mouseX, int mouseY)
    {
        if (this.visible)
        {
            FontRenderer fontrenderer = mc.fontRenderer;
            mc.getTextureManager().bindTexture(buttonTextures);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            boolean var5 = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
            int var6 = this.getHoverState(var5);
            this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + var6 * 20, this.width / 2, this.height);
            this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + var6 * 20, this.width / 2, this.height);
            this.mouseDragged(mc, mouseX, mouseY);
            int j = 14737632;

            if (this.packedFGColour != 0)
            {
                j = this.packedFGColour;
            }
            else
                if (!this.enabled)
                {
                    j = 10526880;
                }
                else if (this.hovered)
                {
                    j = 16777120;
                }

            this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, j);
        }
    }

}
 
Последнее редактирование:
Сверху