2013-08-26 18:49:32 -04:00
|
|
|
package mekanism.client.gui;
|
2012-12-19 15:23:55 -05:00
|
|
|
|
2013-03-25 12:00:45 -04:00
|
|
|
import mekanism.common.IFactory.RecipeType;
|
2013-03-31 19:12:10 -04:00
|
|
|
import mekanism.common.Tier.FactoryTier;
|
2013-08-26 18:49:32 -04:00
|
|
|
import mekanism.common.inventory.container.ContainerFactory;
|
|
|
|
import mekanism.common.tileentity.TileEntityFactory;
|
2013-11-22 20:58:49 -05:00
|
|
|
import mekanism.common.util.MekanismUtils;
|
2012-12-20 16:53:39 -05:00
|
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
|
|
|
|
|
|
|
import org.lwjgl.opengl.GL11;
|
2012-12-19 15:23:55 -05:00
|
|
|
|
2013-04-13 10:33:37 -04:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
2013-08-26 18:28:55 -04:00
|
|
|
public class GuiFactory extends GuiMekanism
|
2012-12-19 15:23:55 -05:00
|
|
|
{
|
2013-03-20 11:14:26 -04:00
|
|
|
public TileEntityFactory tileEntity;
|
2012-12-19 15:23:55 -05:00
|
|
|
|
2013-03-20 11:14:26 -04:00
|
|
|
public GuiFactory(InventoryPlayer inventory, TileEntityFactory tentity)
|
2012-12-19 15:23:55 -05:00
|
|
|
{
|
2013-11-29 19:11:07 -05:00
|
|
|
super(tentity, new ContainerFactory(inventory, tentity));
|
2012-12-19 15:23:55 -05:00
|
|
|
tileEntity = tentity;
|
2013-08-25 20:54:34 -04:00
|
|
|
|
2013-11-23 14:36:50 -05:00
|
|
|
ySize += 11;
|
|
|
|
|
2013-08-26 18:28:55 -04:00
|
|
|
guiElements.add(new GuiRedstoneControl(this, tileEntity, tileEntity.tier.guiLocation));
|
|
|
|
guiElements.add(new GuiUpgradeManagement(this, tileEntity, tileEntity.tier.guiLocation));
|
2013-10-08 17:47:03 -04:00
|
|
|
guiElements.add(new GuiRecipeType(this, tileEntity, tileEntity.tier.guiLocation));
|
2013-10-30 15:22:43 -04:00
|
|
|
guiElements.add(new GuiConfigurationTab(this, tileEntity, tileEntity.tier.guiLocation));
|
2013-12-01 12:38:34 -05:00
|
|
|
guiElements.add(new GuiSortingTab(this, tileEntity, tileEntity.tier.guiLocation));
|
2012-12-19 15:23:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-05-19 18:43:01 -04:00
|
|
|
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
2013-11-26 20:11:26 -05:00
|
|
|
{
|
2013-05-19 18:43:01 -04:00
|
|
|
int xAxis = (mouseX - (width - xSize) / 2);
|
|
|
|
int yAxis = (mouseY - (height - ySize) / 2);
|
|
|
|
|
2013-11-30 00:28:02 -05:00
|
|
|
fontRenderer.drawString(tileEntity.getInvName(), 48, 4, 0x404040);
|
|
|
|
fontRenderer.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 93) + 2, 0x404040);
|
2013-11-25 18:23:24 -05:00
|
|
|
fontRenderer.drawString(RecipeType.values()[tileEntity.recipeType].getName(), 104, (ySize - 93) + 2, 0x404040);
|
2013-05-19 18:43:01 -04:00
|
|
|
|
|
|
|
if(xAxis >= 165 && xAxis <= 169 && yAxis >= 17 && yAxis <= 69)
|
|
|
|
{
|
2013-11-22 20:58:49 -05:00
|
|
|
drawCreativeTabHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis);
|
2013-05-19 18:43:01 -04:00
|
|
|
}
|
2013-11-24 16:01:35 -06:00
|
|
|
|
|
|
|
if(xAxis >= 8 && xAxis <= 168 && yAxis >= 78 && yAxis <= 83)
|
|
|
|
{
|
2013-11-30 00:28:02 -05:00
|
|
|
drawCreativeTabHoveringText(MekanismUtils.localize("gui.factory.secondaryEnergy") + ": " + tileEntity.secondaryEnergyStored, xAxis, yAxis);
|
2013-11-24 16:01:35 -06:00
|
|
|
}
|
2013-11-26 20:11:26 -05:00
|
|
|
|
|
|
|
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
2012-12-19 15:23:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-08-26 18:28:55 -04:00
|
|
|
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
2012-12-19 15:23:55 -05:00
|
|
|
{
|
2013-08-26 18:28:55 -04:00
|
|
|
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
|
|
|
|
2013-09-28 02:59:47 +01:00
|
|
|
mc.renderEngine.bindTexture(tileEntity.tier.guiLocation);
|
2012-12-19 15:23:55 -05:00
|
|
|
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);
|
|
|
|
|
2013-08-26 18:28:55 -04:00
|
|
|
int xAxis = mouseX - guiWidth;
|
|
|
|
int yAxis = mouseY - guiHeight;
|
2013-08-02 03:16:38 -04:00
|
|
|
|
2012-12-19 15:23:55 -05:00
|
|
|
int displayInt;
|
|
|
|
|
|
|
|
displayInt = tileEntity.getScaledEnergyLevel(52);
|
2013-10-08 17:47:45 -04:00
|
|
|
drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
|
2013-02-14 13:26:13 -05:00
|
|
|
|
2013-03-20 11:14:26 -04:00
|
|
|
if(tileEntity.tier == FactoryTier.BASIC)
|
2012-12-19 15:23:55 -05:00
|
|
|
{
|
|
|
|
for(int i = 0; i < tileEntity.tier.processes; i++)
|
|
|
|
{
|
2013-08-02 03:16:38 -04:00
|
|
|
int xPos = 59 + (i*38);
|
2012-12-19 15:23:55 -05:00
|
|
|
|
|
|
|
displayInt = tileEntity.getScaledProgress(20, i);
|
2013-10-08 17:47:45 -04:00
|
|
|
drawTexturedModalRect(guiWidth + xPos, guiHeight + 33, 176, 52, 8, displayInt);
|
2012-12-19 15:23:55 -05:00
|
|
|
}
|
|
|
|
}
|
2013-03-20 11:14:26 -04:00
|
|
|
else if(tileEntity.tier == FactoryTier.ADVANCED)
|
2012-12-19 15:23:55 -05:00
|
|
|
{
|
|
|
|
for(int i = 0; i < tileEntity.tier.processes; i++)
|
|
|
|
{
|
2013-08-02 03:16:38 -04:00
|
|
|
int xPos = 39 + (i*26);
|
2012-12-19 15:23:55 -05:00
|
|
|
|
|
|
|
displayInt = tileEntity.getScaledProgress(20, i);
|
2013-10-08 17:47:45 -04:00
|
|
|
drawTexturedModalRect(guiWidth + xPos, guiHeight + 33, 176, 52, 8, displayInt);
|
2012-12-19 15:23:55 -05:00
|
|
|
}
|
|
|
|
}
|
2013-03-20 11:14:26 -04:00
|
|
|
else if(tileEntity.tier == FactoryTier.ELITE)
|
2012-12-19 15:23:55 -05:00
|
|
|
{
|
|
|
|
for(int i = 0; i < tileEntity.tier.processes; i++)
|
|
|
|
{
|
2013-08-02 03:16:38 -04:00
|
|
|
int xPos = 33 + (i*19);
|
2012-12-19 15:23:55 -05:00
|
|
|
|
|
|
|
displayInt = tileEntity.getScaledProgress(20, i);
|
2013-10-08 17:47:45 -04:00
|
|
|
drawTexturedModalRect(guiWidth + xPos, guiHeight + 33, 176, 52, 8, displayInt);
|
2012-12-19 15:23:55 -05:00
|
|
|
}
|
|
|
|
}
|
2013-11-23 14:36:50 -05:00
|
|
|
|
|
|
|
int recipeFuelY = ySize;
|
|
|
|
|
|
|
|
if(tileEntity.recipeType == RecipeType.PURIFYING.ordinal())
|
|
|
|
{
|
|
|
|
recipeFuelY += 5;
|
|
|
|
}
|
|
|
|
else if(tileEntity.recipeType == RecipeType.COMBINING.ordinal())
|
|
|
|
{
|
|
|
|
recipeFuelY += 10;
|
|
|
|
}
|
2014-01-01 19:26:20 -05:00
|
|
|
else if(tileEntity.recipeType == RecipeType.INJECTING.ordinal())
|
|
|
|
{
|
|
|
|
recipeFuelY += 15;
|
|
|
|
}
|
2013-11-23 14:36:50 -05:00
|
|
|
|
|
|
|
displayInt = tileEntity.getScaledSecondaryEnergy(160);
|
|
|
|
drawTexturedModalRect(guiWidth + 8, guiHeight + 78, 0, recipeFuelY, displayInt, 5);
|
2012-12-19 15:23:55 -05:00
|
|
|
}
|
|
|
|
}
|