Guest User

GuiSauceMaker.java

a guest
Dec 5th, 2014
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. package com.morefood.mod.gui;
  2.  
  3. import net.minecraft.client.Minecraft;
  4. import net.minecraft.client.gui.inventory.GuiContainer;
  5. import net.minecraft.client.resources.I18n;
  6. import net.minecraft.entity.player.InventoryPlayer;
  7. import net.minecraft.util.ResourceLocation;
  8.  
  9. import org.lwjgl.opengl.GL11;
  10.  
  11. import com.morefood.mod.Morefood;
  12. import com.morefood.mod.container.ContainerSauceMaker;
  13. import com.morefood.mod.tileentity.TileEntitySauceMaker;
  14.  
  15. public class GuiSauceMaker extends GuiContainer {
  16.  
  17. public static final ResourceLocation bground = new ResourceLocation(Morefood.modid + ":" + "textures/gui/GuiSauceMaker.png");
  18.  
  19. public TileEntitySauceMaker saucemaker;
  20.  
  21. public GuiSauceMaker(InventoryPlayer inventoryPlayer, TileEntitySauceMaker entity) {
  22. super(new ContainerSauceMaker(inventoryPlayer, entity));
  23.  
  24. this.saucemaker = entity;
  25.  
  26. this.xSize = 176;
  27. this.ySize = 166;
  28. }
  29.  
  30.  
  31. public void drawGuiContainerForegroundLayer(int par1, int par2) {
  32.  
  33. String name = "Sauce Maker";
  34. this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
  35. this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8 , this.ySize - 96 + 2 , 4210752);
  36. }
  37.  
  38. @Override
  39. protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
  40.  
  41. GL11.glColor4f(1F, 1F, 1F, 1F);
  42. Minecraft.getMinecraft().getTextureManager().bindTexture(bground);
  43. int k = (this.width - this.xSize) / 2;
  44. int l = (this.height - this.ySize) / 2;
  45. this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, this.xSize, this.ySize);
  46.  
  47. if (this.saucemaker.isBurning())
  48. {
  49.  
  50. //Fuel Remaining reserve bar
  51. float time2 = this.saucemaker.getBurnTimeRemainingScaled(16);
  52. int time = (int) time2;
  53. if(time2 < 1) {
  54. time = 1;
  55. }
  56. /**
  57. * guiLeft = pixels measured from the left side
  58. * guiTop = pixels measured from the top
  59. */
  60. this.drawTexturedModalRect(guiLeft + 23, guiTop + 30 + 16 - time, 176, 16 - time, 11, time);
  61.  
  62. //Progress bar
  63. time = this.saucemaker.getCookProgressScaled(44);
  64. this.drawTexturedModalRect(guiLeft + 47, guiTop + 20, 176, 16, time + 0, 27);
  65.  
  66. }
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment