Advertisement
Guest User

Untitled

a guest
Mar 25th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.69 KB | None | 0 0
  1. package com.aiko.cenamicolmod.gui;
  2.  
  3. import com.aiko.cenamicolmod.container.AnvilContainer;
  4. import com.aiko.cenamicolmod.te.TileEntityAnvil;
  5. import com.aiko.cenamicolmod.utils.ref;
  6. import net.minecraft.client.gui.inventory.GuiContainer;
  7. import net.minecraft.entity.player.InventoryPlayer;
  8. import net.minecraft.util.ResourceLocation;
  9.  
  10. public class AnvilGui extends GuiContainer {
  11.  
  12.     private static final ResourceLocation background = new ResourceLocation(ref.MODID,"textures/gui/container/custom_furnace.png");
  13.     private TileEntityAnvil tile;
  14.  
  15.     public AnvilGui(TileEntityAnvil tile, InventoryPlayer playerInv) {
  16.         super(new AnvilContainer(tile, playerInv));
  17.         this.tile = tile;
  18.     }
  19.  
  20.     @Override
  21.     protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
  22.         int i = (this.width - this.xSize) / 2;
  23.         int j = (this.height - this.ySize) / 2;
  24.         this.drawDefaultBackground();
  25.         this.mc.getTextureManager().bindTexture(background);
  26.         this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
  27.  
  28.         int timePassed = this.tile.getField(1);
  29.         int textureWidth = (int) (23f / 200f * timePassed);
  30.         this.drawTexturedModalRect(i + 81, j + 24, 177, 18, textureWidth, 7);
  31.  
  32.         if (this.tile.isBurning()) {
  33.             int burningTime = this.tile.getField(0);
  34.             int textureHeight = (int) (12f / this.tile.getFullBurnTime() * burningTime);
  35.             this.drawTexturedModalRect(i + 37, j + 26 + 12 - textureHeight,
  36.                     177, 12 - textureHeight, 27, textureHeight);
  37.         }
  38.  
  39.         this.fontRenderer.drawString(this.tile.getName(), i + 80, j + 45, 0xFFFFFF);
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement