- 128
- 12
Я загрузил по пути textures/gui/widgets.png текстуры кнопок, но у них всё равно стоит стандартная текстура. Что делать?
Java:
package ru.whitewarrior.testmod;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import sun.font.FontScaler;
public class GuiForge extends GuiScreen {
private byte list;
protected static final ResourceLocation BUTTON_TEXTURES = new ResourceLocation(Main.modid, "textures/gui/widgets.png");
GuiButton Button1;
GuiButton Button2;
GuiButton Button3;
GuiButton Button4;
GuiButton Button5;
GuiButton Button6;
GuiButton Button7;
GuiButton Button8;
GuiButton Button9;
GuiButton Button10;
GuiButton Button11;
GuiButton Button12;
GuiButton Button13;
GuiButton Button14;
GuiButton Button15;
GuiButton Button16;
GuiButton Button17;
GuiButton Button18;
GuiButton Next;
GuiButton Prev;
EntityPlayer player = (EntityPlayer)Minecraft.getMinecraft().thePlayer;
int guiWidth = 256;
int guiHeight = 256;
Minecraft mc = Minecraft.getMinecraft();
@Override
public void drawScreen(int x, int y, float ticks) {
ScaledResolution scale = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
int width = scale.getScaledWidth();
int height = scale.getScaledHeight();
int tabWidth = 40;
int tabHeight = 20;
int guiX = (width - guiWidth) / 2;
int guiY = (height - guiHeight) / 2;
GL11.glColor4f(1, 1, 1, 1);
drawDefaultBackground();
mc.renderEngine.bindTexture(new ResourceLocation(Main.modid, "textures/gui/ForgeGUI.png"));
drawTexturedModalRect(guiX, guiY, 0, 0, guiWidth, guiHeight);
GL11.glPushMatrix();
GL11.glScalef(2.0F, 2.0F, zLevel);
fontRendererObj.drawStringWithShadow("Forge", guiX - 54, guiY + 2, 0xFFFF1);
GL11.glPopMatrix();
fontRendererObj.drawString("Choose type of item.", guiX + 95, guiY + 15, 0xF);
super.drawScreen(x, y, ticks);
}
@Override
public void initGui() {
int guiX = (width - guiWidth) / 2;
int guiY = (height - guiHeight) / 2;
buttonList.clear();
buttonList.add(Button13 = new GuiButton(12, guiX + 70, guiY + 30, 120, 15, "Dwarven"));
buttonList.add(Button14 = new GuiButton(13, guiX + 70, guiY + 45, 120, 15, "Orcish"));
buttonList.add(Button15 = new GuiButton(14, guiX + 70, guiY + 60, 120, 15, "Ebony"));
buttonList.add(Button16 = new GuiButton(15, guiX + 70, guiY + 75, 120, 15, "Dragon Plate"));
buttonList.add(Button17 = new GuiButton(16, guiX + 70, guiY + 90, 120, 16, "Daedric"));
buttonList.add(Button1 = new GuiButton(0, guiX + 70, guiY + 30, 120, 15, "Leather"));
buttonList.add(Button2 = new GuiButton(1, guiX + 70, guiY + 45, 120, 15, "Iron"));
buttonList.add(Button3 = new GuiButton(2, guiX + 70, guiY + 60, 120, 15, "Hide"));
buttonList.add(Button4 = new GuiButton(3, guiX + 70, guiY + 75, 120, 15, "Studded"));
buttonList.add(Button6 = new GuiButton(5, guiX + 70, guiY + 90, 120, 15, "Elven"));
buttonList.add(Button7 = new GuiButton(6, guiX + 70, guiY + 105, 120, 15, "Scaled"));
buttonList.add(Button8 = new GuiButton(7, guiX + 70, guiY + 120, 120, 15, "Glass"));
buttonList.add(Button9 = new GuiButton(8, guiX + 70, guiY + 135, 120, 15, "Dragon Scale"));
buttonList.add(Button10 = new GuiButton(9, guiX + 70, guiY + 150, 120, 15, "Ancient Nord"));
buttonList.add(Button11 = new GuiButton(10, guiX + 70, guiY + 165, 120, 15, "Imperial"));
buttonList.add(Button12 = new GuiButton(11, guiX + 70, guiY + 180, 120, 15, "Steel"));
buttonList.add(Prev = new GuiButton(1337, guiX + 10, guiY + 105, 40, 15, "Prev Page"));
buttonList.add(Next = new GuiButton(1488, guiX + 205, guiY + 105, 40, 15, "Next page"));
super.initGui();
}