Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.herobrine.future.tile.advancedfurnace;
- import com.herobrine.future.blocks.BlockFurnaceAdvanced;
- 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.util.ResourceLocation;
- public class GuiAdvancedFurnace extends GuiContainer {
- private static final int WIDTH = 176;
- private static final int HEIGHT = 166;
- private final TileAdvancedFurnace te;
- private final InventoryPlayer playerInventory;
- private static final ResourceLocation background = new ResourceLocation("textures/gui/container/furnace.png");
- public GuiAdvancedFurnace(InventoryPlayer playerInventory, TileAdvancedFurnace te) {
- super(new ContainerAdvancedFurnace(playerInventory, te));
- this.te = te;
- this.playerInventory = playerInventory;
- xSize = WIDTH;
- ySize = HEIGHT;
- }
- @Override
- protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
- if(te.getType() == BlockFurnaceAdvanced.FurnaceType.SMOKER) {
- String s = I18n.format("container.Smoker");
- this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 6, 4210752);
- this.fontRenderer.drawString(playerInventory.getDisplayName().getUnformattedText(), 8, this.ySize - 93, 4210752);
- }
- if(te.getType() == BlockFurnaceAdvanced.FurnaceType.BLAST_FURNACE) {
- String s = I18n.format("container.BlastFurnace");
- this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 6, 4210752);
- this.fontRenderer.drawString(playerInventory.getDisplayName().getUnformattedText(), 8, this.ySize - 93, 4210752);
- }
- }
- @Override
- protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- mc.getTextureManager().bindTexture(background);
- int i = (this.width - this.xSize) / 2;
- int j = (this.height - this.ySize) / 2;
- this.drawTexturedModalRect(i, j, 0, 0, WIDTH, HEIGHT);
- if(this.te.isBurning) {
- int k = getBurnLength();
- this.drawTexturedModalRect(i + 56, j + 36 + 12 - k, 176, 12 - k, 14, k + 1);
- }
- int l = getProgressLength();
- this.drawTexturedModalRect(i + 79, j + 34, 176, 14, l + 1, 16);
- }
- @Override
- public void drawScreen(int mouseX, int mouseY, float partialTicks) {
- this.drawDefaultBackground();
- super.drawScreen(mouseX, mouseY, partialTicks);
- this.renderHoveredToolTip(mouseX, mouseY);
- }
- private int getBurnLength() {
- int i = te.itemOriginalFuel;
- if(i == 0) {
- i = 200;
- }
- return te.fuelLeft * 13 / i;
- }
- private int getProgressLength() {
- int progress = te.progress;
- int maxProgress = 100;
- return maxProgress != progress && progress != 0 ? progress * 24 / maxProgress : 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement