GT5-Unofficial/main/java/gregtech/common/gui/GT_GUIContainer_FusionReactor.java
2015-06-07 21:25:40 +02:00

51 lines
No EOL
2.2 KiB
Java

package gregtech.common.gui;
import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
import net.minecraft.entity.player.InventoryPlayer;
import gregtech.api.gui.GT_Container_MultiMachine;
import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_Utility;
public class GT_GUIContainer_FusionReactor extends GT_GUIContainerMetaTile_Machine {
String mName = "";
public GT_GUIContainer_FusionReactor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName, String aTextureFile) {
super(new GT_Container_MultiMachine(aInventoryPlayer, aTileEntity, false), RES_PATH_GUI + "multimachines/" + (aTextureFile==null?"MultiblockDisplay":aTextureFile));
mName = aName;
}
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
fontRendererObj.drawString(mName, 8, -10, 16448255);
if (mContainer != null) {
if ((((GT_Container_MultiMachine)mContainer).mDisplayErrorCode & 64) != 0) fontRendererObj.drawString("Incomplete Structure.", 10, 8, 16448255);
if (((GT_Container_MultiMachine)mContainer).mDisplayErrorCode == 0) {
if (((GT_Container_MultiMachine)mContainer).mActive == 0) {
fontRendererObj.drawString("Hit with Soft Hammer to (re-)start the Machine if it doesn't start.", -70, 170, 16448255);
} else {
fontRendererObj.drawString("Running perfectly.", 10, 170, 16448255);
}
}
if(this.mContainer!=null){
fontRendererObj.drawString(GT_Utility.formatNumbers(this.mContainer.mEnergy)+" EU", 50, 155, 0x00b0b000);
}
}
}
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
int x = (width - xSize) / 2;
int y = (height - ySize) / 2;
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
if (this.mContainer != null)
{
double tScale = (double) this.mContainer.mEnergy / (double)this.mContainer.mStorage;
drawTexturedModalRect(x + 5, y + 156, 0, 251,Math.min(147, (int)(tScale*148)), 5);
}
}
}