-
Notifications
You must be signed in to change notification settings - Fork 497
/
GuiEngine.java
65 lines (49 loc) · 1.93 KB
/
GuiEngine.java
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package buildcraft.energy.gui;
import buildcraft.core.DefaultProps;
import buildcraft.core.gui.BuildCraftContainer;
import buildcraft.core.gui.GuiBuildCraft;
import buildcraft.core.utils.StringUtil;
import buildcraft.energy.Engine;
import buildcraft.energy.TileEngine;
import net.minecraft.inventory.IInventory;
public abstract class GuiEngine extends GuiBuildCraft {
protected class EngineLedger extends Ledger {
Engine engine;
int headerColour = 0xe1c92f;
int subheaderColour = 0xaaafb8;
int textColour = 0x000000;
public EngineLedger(Engine engine) {
this.engine = engine;
maxHeight = 94;
overlayColor = 0xd46c1f;
}
@Override
public void draw(int x, int y) {
// Draw background
drawBackground(x, y);
// Draw icon
drawIcon(DefaultProps.TEXTURE_ICONS, 0, x + 3, y + 4);
if (!isFullyOpened())
return;
fontRenderer.drawStringWithShadow(StringUtil.localize("gui.energy"), x + 22, y + 8, headerColour);
fontRenderer.drawStringWithShadow(StringUtil.localize("gui.currentOutput") + ":", x + 22, y + 20, subheaderColour);
fontRenderer.drawString(engine.getCurrentOutput() + " MJ/t", x + 22, y + 32, textColour);
fontRenderer.drawStringWithShadow(StringUtil.localize("gui.stored") + ":", x + 22, y + 44, subheaderColour);
fontRenderer.drawString(engine.getEnergyStored() + " MJ", x + 22, y + 56, textColour);
fontRenderer.drawStringWithShadow(StringUtil.localize("gui.heat") + ":", x + 22, y + 68, subheaderColour);
fontRenderer.drawString(((double) engine.getHeat() / (double) 10) + " \u00B0C", x + 22, y + 80, textColour);
}
@Override
public String getTooltip() {
return engine.getCurrentOutput() + " MJ/t";
}
}
public GuiEngine(BuildCraftContainer container, IInventory inventory) {
super(container, inventory);
}
@Override
protected void initLedgers(IInventory inventory) {
super.initLedgers(inventory);
ledgerManager.add(new EngineLedger(((TileEngine) tile).engine));
}
}