package micdoodle8.mods.galacticraft.core.client.gui.container; import micdoodle8.mods.galacticraft.core.Constants; import micdoodle8.mods.galacticraft.core.energy.EnergyDisplayHelper; import micdoodle8.mods.galacticraft.core.inventory.ContainerCoalGenerator; import micdoodle8.mods.galacticraft.core.tile.TileEntityCoalGenerator; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class GuiCoalGenerator extends GuiContainer { private static final ResourceLocation coalGeneratorTexture = new ResourceLocation(Constants.ASSET_PREFIX, "textures/gui/coal_generator.png"); private TileEntityCoalGenerator tileEntity; public GuiCoalGenerator(InventoryPlayer playerInventory, TileEntityCoalGenerator tileEntity) { super(new ContainerCoalGenerator(playerInventory, tileEntity)); this.tileEntity = tileEntity; } @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { this.fontRendererObj.drawString(this.tileEntity.getName(), 55, 6, 4210752); String displayText = GCCoreUtil.translate("gui.status.generating.name"); if (this.tileEntity.heatGJperTick <= 0 || this.tileEntity.heatGJperTick < TileEntityCoalGenerator.MIN_GENERATE_GJ_PER_TICK) { displayText = GCCoreUtil.translate("gui.status.not_generating.name"); } this.fontRendererObj.drawString(displayText, 122 - this.fontRendererObj.getStringWidth(displayText) / 2, 33, 4210752); if (this.tileEntity.heatGJperTick < TileEntityCoalGenerator.MIN_GENERATE_GJ_PER_TICK) { displayText = GCCoreUtil.translate("gui.status.hull_heat.name") + ": " + (int) (this.tileEntity.heatGJperTick / TileEntityCoalGenerator.MIN_GENERATE_GJ_PER_TICK * 100) + "%"; } else { displayText = EnergyDisplayHelper.getEnergyDisplayS(this.tileEntity.heatGJperTick - TileEntityCoalGenerator.MIN_GENERATE_GJ_PER_TICK) + "/t"; } this.fontRendererObj.drawString(displayText, 122 - this.fontRendererObj.getStringWidth(displayText) / 2, 45, 4210752); this.fontRendererObj.drawString(GCCoreUtil.translate("container.inventory"), 8, this.ySize - 96 + 2, 4210752); } @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { this.mc.renderEngine.bindTexture(GuiCoalGenerator.coalGeneratorTexture); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); int containerWidth = (this.width - this.xSize) / 2; int containerHeight = (this.height - this.ySize) / 2; this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.xSize, this.ySize); } }