Advertisement
Guest User

GuiNetherrackFurnace.java

a guest
Jul 1st, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.26 KB | None | 0 0
  1. package qwertyasdef.alchemtrans.client.gui;
  2.  
  3. import net.minecraft.client.Minecraft;
  4. import net.minecraft.client.gui.inventory.GuiContainer;
  5. import net.minecraft.client.renderer.GlStateManager;
  6. import net.minecraft.inventory.IInventory;
  7. import net.minecraft.util.ResourceLocation;
  8. import qwertyasdef.alchemtrans.AlchemTrans;
  9. import qwertyasdef.alchemtrans.Tile.TileNetherrackFurnace;
  10. import qwertyasdef.alchemtrans.inventory.ContainerNetherrackFurnace;
  11.  
  12. public class GuiNetherrackFurnace extends GuiContainer {
  13.  
  14.     private TileNetherrackFurnace tileEntity;
  15.  
  16.     public GuiNetherrackFurnace(TileNetherrackFurnace tileEntity, ContainerNetherrackFurnace container) {
  17.         super(container);
  18.         this.tileEntity = tileEntity;
  19.  
  20.         this.xSize = 176;
  21.         this.ySize = 166;
  22.     }
  23.  
  24.     public void drawScreen(int mouseX, int mouseY, float partialTicks) {
  25.         this.drawDefaultBackground();
  26.         super.drawScreen(mouseX, mouseY, partialTicks);
  27.         this.renderHoveredToolTip(mouseX, mouseY);
  28.     }
  29.  
  30.     @Override
  31.     protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
  32.         GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  33.         this.mc.getTextureManager().bindTexture(new ResourceLocation(AlchemTrans.MODID, "textures/gui/container/netherrack_furnace.png"));
  34.  
  35.         int i = (this.width - this.xSize) / 2;
  36.         int j = (this.height - this.ySize) / 2;
  37.  
  38.         this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
  39.  
  40.         int l = this.getCookProgressScaled(24);
  41.         this.drawTexturedModalRect(i + 79, j + 34, 176, 0, l + 1, 16);
  42.     }
  43.  
  44.     @Override
  45.     protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
  46.         String s = this.tileEntity.getDisplayName().getUnformattedText();
  47.         this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 6, 4210752);
  48.         this.fontRenderer.drawString(Minecraft.getMinecraft().player.inventory.getDisplayName().getUnformattedText(), 8, this.ySize - 96 + 2, 4210752);
  49.     }
  50.  
  51.     private int getCookProgressScaled(int pixels)
  52.     {
  53.         int i = this.tileEntity.getField(0);
  54.         int j = this.tileEntity.getField(1);
  55.         return j != 0 && i != 0 ? i * pixels / j : 0;
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement