Package mekanism.client.gui

Source Code of mekanism.client.gui.GuiChemicalOxidizer

package mekanism.client.gui;

import java.util.List;

import mekanism.api.ListUtils;
import mekanism.api.gas.GasTank;
import mekanism.client.gui.GuiEnergyInfo.IInfoHandler;
import mekanism.client.gui.GuiGasGauge.IGasInfoHandler;
import mekanism.client.gui.GuiProgress.IProgressInfoHandler;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.client.gui.GuiSlot.SlotOverlay;
import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.common.inventory.container.ContainerChemicalOxidizer;
import mekanism.common.tile.TileEntityChemicalOxidizer;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;

import net.minecraft.entity.player.InventoryPlayer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

import org.lwjgl.opengl.GL11;

@SideOnly(Side.CLIENT)
public class GuiChemicalOxidizer extends GuiMekanism
{
  public TileEntityChemicalOxidizer tileEntity;

  public GuiChemicalOxidizer(InventoryPlayer inventory, TileEntityChemicalOxidizer tentity)
  {
    super(tentity, new ContainerChemicalOxidizer(inventory, tentity));
    tileEntity = tentity;

    guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png")));
    guiElements.add(new GuiUpgradeManagement(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png")));
    guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
      @Override
      public List<String> getInfo()
      {
        String multiplier = MekanismUtils.getEnergyDisplay(MekanismUtils.getEnergyPerTick(tileEntity, tileEntity.ENERGY_USAGE));
        return ListUtils.asList("Using: " + multiplier + "/t", "Needed: " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
      }
    }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png")));
    guiElements.add(new GuiGasGauge(new IGasInfoHandler() {
      @Override
      public GasTank getTank()
      {
        return tileEntity.gasTank;
      }
    }, GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 133, 13));

    guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 154, 4).with(SlotOverlay.POWER));
    guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 25, 35));
    guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 154, 24).with(SlotOverlay.PLUS));

    guiElements.add(new GuiProgress(new IProgressInfoHandler()
    {
      @Override
      public double getProgress()
      {
        return tileEntity.getScaledProgress();
      }
    }, ProgressBar.LARGE_RIGHT, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 62, 39));
  }

  @Override
  protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
  {
    int xAxis = (mouseX - (width - xSize) / 2);
    int yAxis = (mouseY - (height - ySize) / 2);

    fontRendererObj.drawString(tileEntity.getInventoryName(), 45, 6, 0x404040);
    fontRendererObj.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
   
    if(xAxis >= 116 && xAxis <= 168 && yAxis >= 76 && yAxis <= 80)
    {
      drawCreativeTabHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis);
    }

    super.drawGuiContainerForegroundLayer(mouseX, mouseY);
  }

  @Override
  protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
  {
    mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"));
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int guiWidth = (width - xSize) / 2;
    int guiHeight = (height - ySize) / 2;
    drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);

    int xAxis = mouseX - guiWidth;
    int yAxis = mouseY - guiHeight;
   
    int displayInt;

    displayInt = tileEntity.getScaledEnergyLevel(52);
    drawTexturedModalRect(guiWidth + 116, guiHeight + 76, 176, 0, displayInt, 4);

    super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
  }
}
TOP

Related Classes of mekanism.client.gui.GuiChemicalOxidizer

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.