2016-03-21 16:30:32 +01:00
|
|
|
package techreborn.client.gui;
|
|
|
|
|
|
|
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
|
|
|
import net.minecraft.util.text.translation.I18n;
|
|
|
|
import reborncore.common.powerSystem.PowerSystem;
|
|
|
|
import techreborn.client.container.ContainerBatbox;
|
|
|
|
import techreborn.tiles.storage.TileBatBox;
|
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
public class GuiBatbox extends GuiContainer
|
|
|
|
{
|
2016-03-21 16:30:32 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
public static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/batbox.png");
|
2016-03-21 16:30:32 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
TileBatBox generator;
|
2016-03-21 16:30:32 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
ContainerBatbox containerGenerator;
|
2016-03-21 16:30:32 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
public GuiBatbox(EntityPlayer player, TileBatBox generator)
|
|
|
|
{
|
|
|
|
super(new ContainerBatbox(generator, player));
|
|
|
|
this.xSize = 176;
|
|
|
|
this.ySize = 167;
|
|
|
|
this.generator = generator;
|
|
|
|
this.containerGenerator = (ContainerBatbox) this.inventorySlots;
|
|
|
|
}
|
2016-03-21 16:30:32 +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;
|
|
|
|
super.initGui();
|
|
|
|
}
|
2016-03-21 16:30:32 +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_)
|
|
|
|
{
|
|
|
|
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);
|
2016-03-21 16:30:32 +01:00
|
|
|
|
2016-07-21 17:22:56 +02:00
|
|
|
int j = (int)(generator.getEnergy() * 24f / generator.getMaxPower());
|
2016-03-25 10:47:34 +01:00
|
|
|
if (j > 0)
|
|
|
|
{
|
|
|
|
this.drawTexturedModalRect(k + 109, l + 21 + 12, 176, 0, j + 1, 16);
|
|
|
|
}
|
|
|
|
//
|
|
|
|
// if (containerGenerator.burnTime != 0)
|
|
|
|
// {
|
|
|
|
// j = containerGenerator.getScaledBurnTime(13);
|
|
|
|
// this.drawTexturedModalRect(k + 80, l + 38 + 12 - j, 176, 30 - j, 14,
|
|
|
|
// j + 1);
|
|
|
|
// }
|
|
|
|
}
|
2016-03-21 16:30:32 +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.batbox.name");
|
|
|
|
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6,
|
|
|
|
4210752);
|
2016-03-21 16:52:46 +01:00
|
|
|
|
2016-03-25 10:47:34 +01:00
|
|
|
this.fontRendererObj.drawString(I18n.translateToLocalFormatted("container.inventory", new Object[0]), 8,
|
|
|
|
this.ySize - 96 + 2, 4210752);
|
2016-07-21 16:51:55 +02:00
|
|
|
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(generator.getMaxPower()), 25, this.ySize - 140,
|
2016-03-25 10:47:34 +01:00
|
|
|
4210752);
|
2016-07-21 16:51:55 +02:00
|
|
|
this.fontRendererObj.drawString(PowerSystem.getLocalizedPower(containerGenerator.energy), 25, this.ySize - 150,
|
2016-03-25 10:47:34 +01:00
|
|
|
4210752);
|
|
|
|
}
|
2016-03-21 16:30:32 +01:00
|
|
|
}
|