2015-11-17 22:48:06 +01:00
|
|
|
package techreborn.client.gui;
|
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
import java.io.IOException;
|
|
|
|
|
2015-11-18 09:35:34 +01:00
|
|
|
import net.minecraft.client.gui.GuiButton;
|
2015-11-17 22:48:06 +01:00
|
|
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
2016-02-21 15:16:55 +01:00
|
|
|
import net.minecraft.client.renderer.GlStateManager;
|
2015-11-17 22:48:06 +01:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
2016-03-13 17:08:30 +01:00
|
|
|
import net.minecraft.util.text.translation.I18n;
|
2015-11-17 22:48:06 +01:00
|
|
|
import reborncore.client.gui.GuiUtil;
|
2015-11-18 09:35:34 +01:00
|
|
|
import reborncore.client.multiblock.MultiblockSet;
|
|
|
|
import reborncore.common.misc.Location;
|
2015-11-23 19:41:29 +01:00
|
|
|
import reborncore.common.multiblock.CoordTriplet;
|
2015-11-18 09:35:34 +01:00
|
|
|
import techreborn.client.ClientMultiBlocks;
|
2015-11-17 22:48:06 +01:00
|
|
|
import techreborn.client.container.ContainerVacuumFreezer;
|
2015-11-18 09:35:34 +01:00
|
|
|
import techreborn.proxies.ClientProxy;
|
2015-11-17 22:48:06 +01:00
|
|
|
import techreborn.tiles.TileVacuumFreezer;
|
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
public class GuiVacuumFreezer extends GuiContainer
|
|
|
|
{
|
2015-11-17 22:48:06 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
public static final ResourceLocation texture = new ResourceLocation("techreborn",
|
|
|
|
"textures/gui/vacuum_freezer.png");
|
2015-11-17 22:48:06 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
TileVacuumFreezer crafter;
|
|
|
|
ContainerVacuumFreezer containerVacuumFreezer;
|
2015-11-17 22:48:06 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
public GuiVacuumFreezer(EntityPlayer player, TileVacuumFreezer tilealloysmelter)
|
|
|
|
{
|
|
|
|
super(new ContainerVacuumFreezer(tilealloysmelter, player));
|
|
|
|
this.xSize = 176;
|
|
|
|
this.ySize = 167;
|
|
|
|
crafter = tilealloysmelter;
|
|
|
|
this.containerVacuumFreezer = (ContainerVacuumFreezer) this.inventorySlots;
|
|
|
|
}
|
2015-11-17 22:48:06 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
@Override
|
|
|
|
public void initGui()
|
|
|
|
{
|
|
|
|
int k = (this.width - this.xSize) / 2;
|
|
|
|
int l = (this.height - this.ySize) / 2;
|
|
|
|
GuiButton button = new GuiButton(212, k + this.xSize - 24, l + 4, 20, 20, "");
|
|
|
|
buttonList.add(button);
|
|
|
|
super.initGui();
|
|
|
|
CoordTriplet coordinates = new CoordTriplet(crafter.getPos().getX(), crafter.getPos().getY() - 5,
|
|
|
|
crafter.getPos().getZ());
|
|
|
|
if (coordinates.equals(ClientProxy.multiblockRenderEvent.anchor))
|
|
|
|
{
|
|
|
|
ClientProxy.multiblockRenderEvent.setMultiblock(null);
|
|
|
|
button.displayString = "B";
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
button.displayString = "A";
|
|
|
|
}
|
|
|
|
}
|
2015-11-17 22:48:06 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
@Override
|
|
|
|
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
|
|
|
|
{
|
|
|
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
|
|
|
this.mc.getTextureManager().bindTexture(texture);
|
|
|
|
int k = (this.width - this.xSize) / 2;
|
|
|
|
int l = (this.height - this.ySize) / 2;
|
|
|
|
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
2015-11-17 22:48:06 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
int j = 0;
|
2015-11-17 22:48:06 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
j = crafter.getProgressScaled(24);
|
|
|
|
if (j > 0)
|
|
|
|
{
|
|
|
|
this.drawTexturedModalRect(k + 79, l + 37, 176, 14, j + 1, 16);
|
|
|
|
}
|
2015-11-17 22:48:06 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
j = crafter.getEnergyScaled(12);
|
|
|
|
if (j > 0)
|
|
|
|
{
|
|
|
|
this.drawTexturedModalRect(k + 26, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
|
|
|
}
|
2015-11-17 22:48:06 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
if (containerVacuumFreezer.machineStatus == 0)
|
|
|
|
{
|
|
|
|
GuiUtil.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
|
|
|
|
this.fontRendererObj.drawString(I18n.translateToLocal("techreborn.message.missingmultiblock"), k + 38,
|
|
|
|
l + 52 + 12 - 0, -1);
|
|
|
|
}
|
|
|
|
}
|
2015-11-17 22:48:06 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
|
|
|
|
{
|
|
|
|
String name = I18n.translateToLocal("tile.techreborn.vacuumfreezer.name");
|
|
|
|
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
|
|
|
|
4210752);
|
|
|
|
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
|
|
|
|
this.ySize - 96 + 2, 4210752);
|
|
|
|
}
|
2015-11-18 09:35:34 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
@Override
|
|
|
|
public void actionPerformed(GuiButton button) throws IOException
|
|
|
|
{
|
|
|
|
super.actionPerformed(button);
|
|
|
|
if (button.id == 212)
|
|
|
|
{
|
|
|
|
if (ClientProxy.multiblockRenderEvent.currentMultiblock == null)
|
|
|
|
{
|
|
|
|
{// This code here makes a basic multiblock and then sets to the
|
|
|
|
// selected one.
|
|
|
|
MultiblockSet set = new MultiblockSet(ClientMultiBlocks.frezzer);
|
|
|
|
ClientProxy.multiblockRenderEvent.setMultiblock(set);
|
|
|
|
ClientProxy.multiblockRenderEvent.partent = new Location(crafter.getPos().getX(),
|
|
|
|
crafter.getPos().getY(), crafter.getPos().getZ(), crafter.getWorld());
|
|
|
|
ClientProxy.multiblockRenderEvent.anchor = new CoordTriplet(crafter.getPos().getX(),
|
|
|
|
crafter.getPos().getY() - 5, crafter.getPos().getZ());
|
|
|
|
}
|
|
|
|
button.displayString = "A";
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
ClientProxy.multiblockRenderEvent.setMultiblock(null);
|
|
|
|
button.displayString = "B";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-11-17 22:48:06 +01:00
|
|
|
}
|