Advertisement
ThatBenderGuy

GuiLavaHelix.java

Nov 18th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.09 KB | None | 0 0
  1. package tbg.svmod.gui;
  2.  
  3. import net.minecraft.client.gui.inventory.GuiContainer;
  4. import net.minecraft.client.renderer.GlStateManager;
  5. import net.minecraft.inventory.IInventory;
  6. import net.minecraft.util.ResourceLocation;
  7. import tbg.svmod.objects.container.ContainerLavaHelix;
  8. import tbg.svmod.objects.tileentities.TileEntityLavaHelix;
  9. import tbg.svmod.util.Reference;
  10. import tbg.svmod.util.Utils;
  11.  
  12. public class GuiLavaHelix extends GuiContainer
  13. {
  14.    
  15.     private TileEntityLavaHelix te;
  16.     private IInventory playerInv;
  17.    
  18.     public GuiLavaHelix(IInventory playerInv, TileEntityLavaHelix te) {
  19.         super(new ContainerLavaHelix(playerInv, te));      
  20.        
  21.         this.xSize = 176;
  22.         this.ySize = 166;
  23.        
  24.         this.te = te;
  25.         this.playerInv = playerInv;
  26.        
  27.     }
  28.  
  29.     public static final int ID = 0;
  30.    
  31.     public boolean doesGuiPauseGame() {
  32.         return false;
  33.     }
  34.  
  35.     @Override
  36.     protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
  37.         this.drawDefaultBackground();
  38.         this.mc.getTextureManager().bindTexture(new ResourceLocation(Reference.MODID, "textures/gui/container/lava_helix.png"));
  39.         int i = (this.width - this.xSize) / 2;
  40.         int j = (this.height - this.ySize) / 2;
  41.         this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
  42.        
  43.         int l = getCombineProgress(82); // Input width of progress bar
  44.         //Utils.getLogger().info("Length: " + l);
  45.         this.drawTexturedModalRect(i + 47, j + 34, 133, 169, l + 1, 8); // X, Y, TextureX, TextureY, width, height
  46.     }
  47.    
  48.     @Override
  49.     protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
  50.         String s = "Lava Helix";
  51.         this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 6, 4210752);
  52.         this.fontRenderer.drawString(this.playerInv.getDisplayName().getUnformattedText(), 8, this.ySize - 96 + 2, 4210752);
  53.     }
  54.    
  55.     private int getCombineProgress(int pixels)
  56.     {
  57.         int currentTime = te.getField(0);
  58.         int totalTime = te.getField(1);
  59.         Utils.getLogger().info(currentTime + " | " + totalTime);
  60.         return currentTime != 0 ? currentTime * pixels / totalTime : 0;
  61.     }
  62.    
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement