Guest User

GuiCookingFurnace

a guest
Feb 21st, 2015
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.72 KB | None | 0 0
  1. package com.chef.mod.gui;
  2.  
  3. import com.chef.mod.Reference;
  4. import com.chef.mod.container.ContainerCookingFurnace;
  5.  
  6. import net.minecraft.client.gui.inventory.GuiContainer;
  7. import net.minecraft.client.renderer.GlStateManager;
  8. import net.minecraft.entity.player.InventoryPlayer;
  9. import net.minecraft.inventory.ContainerFurnace;
  10. import net.minecraft.inventory.IInventory;
  11. import net.minecraft.tileentity.TileEntityFurnace;
  12. import net.minecraft.util.ResourceLocation;
  13. import net.minecraftforge.fml.relauncher.Side;
  14. import net.minecraftforge.fml.relauncher.SideOnly;
  15.  
  16. @SideOnly(Side.CLIENT)
  17. public class GuiCookingFurnace extends GuiContainer
  18. {
  19.     private static final ResourceLocation furnaceGuiTextures = new ResourceLocation(Reference.MOD_ID + ":" + "textures/gui/container/cookFurnace.png");
  20.     private final InventoryPlayer playerInventory;
  21.     private IInventory tileFurnace;
  22.  
  23.     public GuiCookingFurnace(InventoryPlayer playerInv, IInventory furnaceInv)
  24.     {
  25.         super(new ContainerCookingFurnace(playerInv, furnaceInv));
  26.         this.playerInventory = playerInv;
  27.         this.tileFurnace = furnaceInv;
  28.     }
  29.  
  30.     protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
  31.     {
  32.         String s = this.tileFurnace.getDisplayName().getUnformattedText();
  33.         this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
  34.         this.fontRendererObj.drawString(this.playerInventory.getDisplayName().getUnformattedText(), 8, this.ySize - 96 + 2, 4210752);
  35.     }
  36.  
  37.     protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
  38.     {
  39.         GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  40.         this.mc.getTextureManager().bindTexture(furnaceGuiTextures);
  41.         int k = (this.width - this.xSize) / 2;
  42.         int l = (this.height - this.ySize) / 2;
  43.         this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
  44.         int i1;
  45.  
  46.         if (TileEntityFurnace.isBurning(this.tileFurnace))
  47.         {
  48.             i1 = this.func_175382_i(13);
  49.             this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
  50.         }
  51.  
  52.         i1 = this.func_175381_h(24);
  53.         this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16);
  54.     }
  55.  
  56.     private int func_175381_h(int p_175381_1_)
  57.     {
  58.         int j = this.tileFurnace.getField(2);
  59.         int k = this.tileFurnace.getField(3);
  60.         return k != 0 && j != 0 ? j * p_175381_1_ / k : 0;
  61.     }
  62.  
  63.     private int func_175382_i(int p_175382_1_)
  64.     {
  65.         int j = this.tileFurnace.getField(1);
  66.  
  67.         if (j == 0)
  68.         {
  69.             j = 200;
  70.         }
  71.  
  72.         return this.tileFurnace.getField(0) * p_175382_1_ / j;
  73.     }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment