Package mekanism.client.gui

Source Code of mekanism.client.gui.GuiEnergyCube

package mekanism.client.gui;

import java.util.List;

import mekanism.api.ListUtils;
import mekanism.api.energy.IStrictEnergyStorage;
import mekanism.client.gui.GuiEnergyGauge.IEnergyInfoHandler;
import mekanism.client.gui.GuiEnergyInfo.IInfoHandler;
import mekanism.client.gui.GuiSlot.SlotOverlay;
import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.common.inventory.container.ContainerEnergyCube;
import mekanism.common.tile.TileEntityEnergyCube;
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 GuiEnergyCube extends GuiMekanism
{
  public TileEntityEnergyCube tileEntity;

  public GuiEnergyCube(InventoryPlayer inventory, TileEntityEnergyCube tentity)
  {
    super(new ContainerEnergyCube(inventory, tentity));
    tileEntity = tentity;
    guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiEnergyCube.png")));
    guiElements.add(new GuiEnergyGauge(new IEnergyInfoHandler()
    {
      @Override
      public IStrictEnergyStorage getEnergyStorage()
      {
        return tileEntity;
      }
    }, GuiEnergyGauge.Type.WIDE, this, MekanismUtils.getResource(ResourceType.GUI, "GuiEnergyCube.png"), 55, 18));
    guiElements.add(new GuiEnergyInfo(new IInfoHandler()
    {
      @Override
      public List<String> getInfo()
      {
        return ListUtils.asList(
            "Storing: " + MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()),
            "Max Output: " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t");
      }
    }, this, MekanismUtils.getResource(ResourceType.GUI, "GuiEnergyCube.png")));
    guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiEnergyCube.png"), 16, 34).with(SlotOverlay.MINUS));
    guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiEnergyCube.png"), 142, 34).with(SlotOverlay.PLUS));
  }

  @Override
  protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
  {
    fontRendererObj.drawString(tileEntity.getInventoryName(), 43, 6, 0x404040);
    fontRendererObj.drawString(MekanismUtils.localize("container.inventory"), 8, ySize - 96 + 2, 0x404040);

    super.drawGuiContainerForegroundLayer(mouseX, mouseY);
  }

  @Override
  protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
  {
    mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiEnergyCube.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);

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

Related Classes of mekanism.client.gui.GuiEnergyCube

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.