aboutsummaryrefslogtreecommitdiff
path: root/main/java/gregtech/common/gui/GT_GUIContainer_FusionReactor.java
blob: 3550fffd4bc0a644adcf256e3116b60f2232d436 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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);
        }
    }
}