Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.expansion.gui;
- import com.expansion.container.ContainerGrinder;
- import com.expansion.main.Main;
- import com.expansion.tileentity.TileEntityGrinder;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.gui.inventory.GuiContainer;
- import net.minecraft.client.renderer.GlStateManager;
- import net.minecraft.client.resources.I18n;
- import net.minecraft.entity.player.InventoryPlayer;
- import net.minecraft.inventory.Container;
- import net.minecraft.inventory.IInventory;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.tileentity.TileEntityFurnace;
- import net.minecraft.util.ResourceLocation;
- public class GuiGrinder extends GuiContainer{
- public static final ResourceLocation BGround = new ResourceLocation(Main.modID + ":" + "textures/gui/Grinder.png");
- private final InventoryPlayer playerInventory;
- private TileEntityGrinder grinder;
- public GuiGrinder(InventoryPlayer playerInv, TileEntityGrinder entity)
- {
- super(new ContainerGrinder(playerInv, entity));
- this.playerInventory = playerInv;
- this.grinder = entity;
- this.grinder = entity;
- this.xSize = 176;
- this.ySize = 166;
- }
- protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
- {
- String s = this.grinder.getDisplayName().getUnformattedText();
- this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
- this.fontRendererObj.drawString(this.playerInventory.getDisplayName().getUnformattedText(), 120, this.ySize - 96 + 2, 4210752);
- }
- @Override
- protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
- {
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- Minecraft.getMinecraft().getTextureManager().bindTexture(BGround);
- this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
- if(grinder.isBurning())
- {
- int k = this.GetBurnTimeProgressScaled(40);
- int j = 40 - k;
- this.drawTexturedModalRect(guiLeft + 29, guiTop + 65, 176, 0 , 40 - k, 10);
- }
- int k = this.GetCookProgressScaled(24);
- this.drawTexturedModalRect(guiLeft + 79, guiTop + 34, 176, 14, k + 1, 16);
- }
- private int GetCookProgressScaled(int Progress)
- {
- int j = this.grinder.getField(2);
- int k = this.grinder.getField(3);
- return k != 0 && j != 0 ? j * Progress / k : 0;
- }
- private int GetBurnTimeProgressScaled(int progress)
- {
- int j = this.grinder.getField(1);
- if(j == 0)
- {
- j = 200;
- }
- return this.grinder.getField(0) * progress / j;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement