Guest User

Untitled

a guest
Nov 10th, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. package com.mrpablo2000.machinecraft.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.mrpablo2000.machinecraft.MachineCraftBase;
  12. import com.mrpablo2000.machinecraft.container.ContainerGenerator;
  13. import com.mrpablo2000.machinecraft.tileentity.TileEntityGenerator;
  14.  
  15. public class GuiGenerator extends GuiContainer{
  16. public static final ResourceLocation texture = new ResourceLocation(MachineCraftBase.modid, "textures/gui/macerator.png");
  17.  
  18. public TileEntityGenerator macerator;
  19.  
  20. public GuiGenerator(InventoryPlayer invPlayer, TileEntityGenerator entity) {
  21. super(new ContainerGenerator(invPlayer, entity));
  22.  
  23. this.macerator = entity;
  24.  
  25. this.xSize = 176;
  26. this.ySize = 165;
  27. }
  28.  
  29. public void drawGuiContainerForegroundLayer(int par1, int par2){
  30. String s = this.macerator.isInvNameLocalized() ? this.macerator.getInvName() : I18n.format(this.macerator.getInvName());
  31. this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
  32. this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 5, 4210752);
  33. }
  34.  
  35. public void drawGuiContainerBackgroundLayer(float f, int j, int i) {
  36. GL11.glColor4f(1F, 1F, 1F, 1F);
  37.  
  38. Minecraft.getMinecraft().getTextureManager().
  39. bindTexture(texture);
  40.  
  41. drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
  42.  
  43. int i1;
  44.  
  45. if(this.macerator.hasPower()){
  46. i1 = this.macerator.getPowerRemainingScaled(45);
  47. this.drawTexturedModalRect(guiLeft + 8, guiTop + 53 - i1, 176, 62 - i1, 16, i1);
  48. }
  49.  
  50. i1 = this.macerator.getCookProgressScaled(24);
  51. this.drawTexturedModalRect(guiLeft + 79, guiTop + 34, 176, 0, i1 + 1, 16);
  52. }
  53. }
Add Comment
Please, Sign In to add comment