Advertisement
Guest User

GuiCulinary

a guest
Sep 21st, 2012
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.30 KB | None | 0 0
  1. package KBI.agricrafture.core;
  2.  
  3. import net.minecraft.src.*;
  4. import KBI.agricrafture.api.*;
  5. import java.util.logging.Level;
  6. import cpw.mods.fml.common.FMLLog;
  7.  
  8. import org.lwjgl.opengl.GL11;
  9.  
  10. public class GuiCulinary extends GuiContainer
  11. {
  12.  
  13.         private TileEntityCulinary te;
  14.  
  15.         public GuiCulinary (InventoryPlayer inventoryPlayer, TileEntityCulinary tileEntity)
  16.         {
  17.                 //the container is instanciated and passed to the superclass for handling
  18.                 super(new ContainerCulinary(inventoryPlayer, tileEntity));
  19.                 te = tileEntity;
  20.         }
  21.  
  22.         @Override
  23.         protected void drawGuiContainerForegroundLayer()
  24.         {
  25.                 //draw text and stuff here
  26.                 //the parameters for drawString are: string, x, y, color
  27.                 fontRenderer.drawString(StatCollector.translateToLocal("tile.blockCulinary.name"), 8, 6, 4210752);
  28.                 //draws "Inventory" or your regional equivalent
  29.                 fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
  30.         }
  31.  
  32.         @Override
  33.         protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
  34.         {
  35.                 int texture = mc.renderEngine.getTexture("/KBI/agricrafture/resources/culinarygui.png");
  36.                 GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  37.                 this.mc.renderEngine.bindTexture(texture);
  38.                 int x = (this.width - this.xSize) / 2;
  39.                 int y = (this.height - this.ySize) / 2;
  40.                 this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
  41.                
  42.                 if (this.te.isWorking())
  43.                 {
  44.                     int var7 = this.te.getWorkProgressScaled(24);
  45.                     this.drawTexturedModalRect(x + 101, y + 34, 176, 1, var7 + 1, 16);
  46.                 }
  47.         }
  48.        
  49.         @Override
  50.         public void initGui()
  51.         {
  52.             FMLLog.log(Level.FINE, "Initiating GuiCulinary.");
  53.             int x = (this.width - this.xSize) / 2;
  54.             int y = (this.height - this.ySize) / 2;
  55.             this.controlList.add(new GuiButton(1420, x + 52, x + 33, 34, 18, "Work"));
  56.             FMLLog.log(Level.FINE, "GuiCulinary intitiated.");
  57.         }
  58.        
  59.         protected void actionPerformed(GuiButton par1GuiButton)
  60.         {
  61.             if (par1GuiButton.enabled)
  62.             {
  63.                 if (par1GuiButton.id == 1420)
  64.                 {
  65.                     te.workItem();
  66.                 }
  67.             }
  68.         }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement