Package pneumaticCraft.client.gui

Source Code of pneumaticCraft.client.gui.GuiAirCompressor

package pneumaticCraft.client.gui;

import java.util.List;

import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraftforge.common.util.ForgeDirection;

import org.apache.commons.lang3.tuple.Pair;
import org.lwjgl.opengl.GL11;

import pneumaticCraft.api.tileentity.IPneumaticMachine;
import pneumaticCraft.common.inventory.ContainerAirCompressor;
import pneumaticCraft.common.tileentity.TileEntityAirCompressor;
import pneumaticCraft.lib.PneumaticValues;
import pneumaticCraft.lib.Textures;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class GuiAirCompressor extends GuiPneumaticContainerBase<TileEntityAirCompressor>{

    public GuiAirCompressor(InventoryPlayer player, TileEntityAirCompressor te){

        super(new ContainerAirCompressor(player, te), te, Textures.GUI_AIR_COMPRESSOR_LOCATION);
    }

    @Override
    protected void drawGuiContainerForegroundLayer(int x, int y){

        super.drawGuiContainerForegroundLayer(x, y);
        fontRendererObj.drawString("Upgr.", 28, 19, 4210752);
    }

    @Override
    protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y){
        super.drawGuiContainerBackgroundLayer(opacity, x, y);

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        bindGuiTexture();

        int i1 = te.getBurnTimeRemainingScaled(12);
        int xStart = (width - xSize) / 2;
        int yStart = (height - ySize) / 2;

        if(te.burnTime > 0) drawTexturedModalRect(xStart + 80, yStart + 38 + 12 - i1, 176, 12 - i1, 14, i1 + 2);
    }

    @Override
    protected void addPressureStatInfo(List<String> pressureStatText){
        super.addPressureStatInfo(pressureStatText);
        if(te.burnTime > 0 || TileEntityFurnace.isItemFuel(te.getStackInSlot(0)) && te.redstoneAllows()) {
            pressureStatText.add("\u00a77Currently producing:");
            pressureStatText.add("\u00a70" + (double)Math.round(PneumaticValues.PRODUCTION_COMPRESSOR * te.getSpeedMultiplierFromUpgrades(te.getUpgradeSlots())) + " mL/tick.");
        }
    }

    @Override
    protected void addProblems(List<String> textList){
        super.addProblems(textList);
        if(te.burnTime <= 0 && !TileEntityFurnace.isItemFuel(te.getStackInSlot(0))) {
            textList.add("\u00a77No fuel!");
            textList.add("\u00a70Insert any burnable item.");
        }
        List<Pair<ForgeDirection, IPneumaticMachine>> teSurrounding = te.getConnectedPneumatics();
        if(teSurrounding.isEmpty()) {
            textList.add("\u00a77Air leaking!");
            textList.add("\u00a70Add pipes / machines");
            textList.add("\u00a70to the output.");
        }
    }
}
TOP

Related Classes of pneumaticCraft.client.gui.GuiAirCompressor

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.