Advertisement
Neoublie

Gui button code (issue)

Oct 27th, 2012
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.21 KB | None | 0 0
  1. public class GuiBasicSafe extends GuiContainer {
  2.  
  3.     //public final int xSizeOfTexture = 176;
  4.     //public final int ySizeOfTexture = 88;
  5.    
  6.     public void initGui(){
  7.        
  8.         try {
  9.             this.controlList.clear();
  10.  
  11.                      int posX = (10);
  12.                      int posY = (10);
  13.             this.controlList.add(new GuiButton(1, posX+ 10, posY + 10, 10, 10, "1"));
  14.             this.controlList.add(new GuiButton(2, posX+ 10, posY + 20, 10, 10, "2"));
  15.             this.controlList.add(new GuiButton(3, posX+ 10, posY + 30, 10, 10, "3"));
  16.             this.controlList.add(new GuiButton(4, posX+ 20, posY + 10, 10, 10, "4"));
  17.             this.controlList.add(new GuiButton(5, posX+ 20, posY + 20, 10, 10, "5"));
  18.             this.controlList.add(new GuiButton(6, posX+ 20, posY + 30, 10, 10, "6"));
  19.             this.controlList.add(new GuiButton(7, posX+ 30, posY + 10, 10, 10, "7"));
  20.             this.controlList.add(new GuiButton(8, posX+ 30, posY + 20, 10, 10, "8"));
  21.             this.controlList.add(new GuiButton(9, posX+ 30, posY + 30, 10, 10, "9"));
  22.  
  23.             this.controlList.add(new GuiButton(10, posX+ 10, posY + 10, 30, 15, "enter"));
  24.             this.controlList.add(new GuiButton(11, posX+ 40, posY + 10, 30, 15, "reset"));
  25.         } catch (Exception e) {
  26.             // TODO Auto-generated catch block
  27.             e.printStackTrace();
  28.         }
  29.        
  30.     }
  31.    
  32.     public GuiBasicSafe (TileBasicSafe tileEntity, InventoryPlayer inventoryPlayer) {
  33.         super(new ContainerBasicSafe(tileEntity, inventoryPlayer));
  34.     }
  35.  
  36.     @Override
  37.     protected void drawGuiContainerForegroundLayer() {
  38.         //draw text and stuff here
  39.         //the parameters for drawString are: string, x, y, color
  40.         fontRenderer.drawString("LockBox", 8, 6, 4210752);
  41.         //draws "Inventory" or your regional equivalent
  42.         fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 4210752);
  43.     }
  44.  
  45.     @Override
  46.     protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
  47.         //draw your Gui here, only thing you need to change is the path
  48.         int texture = mc.renderEngine.getTexture(CommonProxy.GUI_BLANK);
  49.         GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  50.         this.mc.renderEngine.bindTexture(texture);
  51.         int x = (width - xSize) / 2;
  52.         int y = (height - ySize) / 2;
  53.         this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement