ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/common/inventory/gui/GuiBioReactor.java

64 lines
2.4 KiB
Java
Raw Normal View History

2020-09-09 16:49:01 +02:00
package de.ellpeck.actuallyadditions.common.inventory.gui;
2016-09-14 21:42:03 +02:00
2020-09-09 16:49:01 +02:00
import de.ellpeck.actuallyadditions.common.inventory.ContainerBioReactor;
import de.ellpeck.actuallyadditions.common.tile.TileEntityBase;
import de.ellpeck.actuallyadditions.common.tile.TileEntityBioReactor;
import de.ellpeck.actuallyadditions.common.util.AssetUtil;
2016-09-14 21:42:03 +02:00
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
2016-09-14 21:42:03 +02:00
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
2019-05-02 09:10:29 +02:00
public class GuiBioReactor extends GuiWtfMojang {
2016-09-14 21:42:03 +02:00
2016-11-19 23:12:22 +01:00
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_bio_reactor");
2016-09-14 21:42:03 +02:00
private final TileEntityBioReactor tile;
private EnergyDisplay energy;
2019-05-02 09:10:29 +02:00
public GuiBioReactor(InventoryPlayer inventory, TileEntityBase tile) {
2016-09-14 21:42:03 +02:00
super(new ContainerBioReactor(inventory, tile));
2019-05-02 09:10:29 +02:00
this.tile = (TileEntityBioReactor) tile;
2016-09-14 21:42:03 +02:00
this.xSize = 176;
2019-05-02 09:10:29 +02:00
this.ySize = 93 + 86;
2016-09-14 21:42:03 +02:00
}
@Override
2019-05-02 09:10:29 +02:00
public void initGui() {
2016-09-14 21:42:03 +02:00
super.initGui();
2019-05-02 09:10:29 +02:00
this.energy = new EnergyDisplay(this.guiLeft + 116, this.guiTop + 5, this.tile.storage);
2016-09-14 21:42:03 +02:00
}
@Override
2019-05-02 09:10:29 +02:00
public void drawScreen(int x, int y, float f) {
2016-09-14 21:42:03 +02:00
super.drawScreen(x, y, f);
this.energy.drawOverlay(x, y);
}
@Override
2019-05-02 09:10:29 +02:00
public void drawGuiContainerForegroundLayer(int x, int y) {
AssetUtil.displayNameString(this.fontRenderer, this.xSize, -10, this.tile);
2016-09-14 21:42:03 +02:00
}
@Override
2019-05-02 09:10:29 +02:00
public void drawGuiContainerBackgroundLayer(float f, int x, int y) {
2016-09-14 21:42:03 +02:00
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
2019-05-02 09:10:29 +02:00
this.drawTexturedModalRect(this.guiLeft, this.guiTop + 93, 0, 0, 176, 86);
2016-09-14 21:42:03 +02:00
this.mc.getTextureManager().bindTexture(RES_LOC);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
2019-05-02 09:10:29 +02:00
if (this.tile.burnTime > 0) {
int i = this.tile.burnTime * 13 / this.tile.maxBurnTime;
this.drawTexturedModalRect(this.guiLeft + 87, this.guiTop + 51 + 12 - i, 176, 96 - i, 14, i);
2016-09-14 21:42:03 +02:00
}
2019-05-02 09:10:29 +02:00
if (this.tile.producePerTick > 0) {
this.drawCenteredString(this.fontRenderer, this.tile.producePerTick + " " + I18n.format("actuallyadditions.cft"), this.guiLeft + 87, this.guiTop + 86, 0xFFFFFF);
2016-09-14 21:42:03 +02:00
}
this.energy.draw();
}
}