-
Notifications
You must be signed in to change notification settings - Fork 497
/
GuiEngine.java
81 lines (65 loc) · 2.65 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.energy.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
import buildcraft.BuildCraftCore;
import buildcraft.core.CoreIconProvider;
import buildcraft.core.gui.BuildCraftContainer;
import buildcraft.core.gui.GuiBuildCraft;
import buildcraft.core.utils.StringUtils;
import buildcraft.energy.TileEngine;
public abstract class GuiEngine extends GuiBuildCraft {
private static final ResourceLocation ITEM_TEXTURE = TextureMap.locationItemsTexture;
protected class EngineLedger extends Ledger {
TileEngine engine;
int headerColour = 0xe1c92f;
int subheaderColour = 0xaaafb8;
int textColour = 0x000000;
public EngineLedger(TileEngine engine) {
this.engine = engine;
maxHeight = 94;
overlayColor = 0xd46c1f;
}
@Override
public void draw(int x, int y) {
// Draw background
drawBackground(x, y);
// Draw icon
Minecraft.getMinecraft().renderEngine.bindTexture(ITEM_TEXTURE);
drawIcon(BuildCraftCore.iconProvider.getIcon(CoreIconProvider.ENERGY), x + 3, y + 4);
if (!isFullyOpened()) {
return;
}
fontRendererObj.drawStringWithShadow(StringUtils.localize("gui.energy"), x + 22, y + 8, headerColour);
fontRendererObj.drawStringWithShadow(StringUtils.localize("gui.currentOutput") + ":", x + 22, y + 20, subheaderColour);
fontRendererObj.drawString(String.format("%d RF/t", engine.currentOutput),
x + 22, y + 32, textColour);
fontRendererObj.drawStringWithShadow(StringUtils.localize("gui.stored") + ":", x + 22, y + 44, subheaderColour);
fontRendererObj.drawString(String.format("%d RF", engine.getEnergyStored()), x + 22,
y + 56, textColour);
fontRendererObj.drawStringWithShadow(StringUtils.localize("gui.heat") + ":", x + 22, y + 68, subheaderColour);
fontRendererObj.drawString(String.format("%.2f \u00B0C", engine.getHeat()), x + 22, y + 80, textColour);
}
@Override
public String getTooltip() {
return String.format("%d RF/t", engine.currentOutput);
}
}
public GuiEngine(BuildCraftContainer container, IInventory inventory, ResourceLocation texture) {
super(container, inventory, texture);
}
@Override
protected void initLedgers(IInventory inventory) {
super.initLedgers(inventory);
ledgerManager.add(new EngineLedger((TileEngine) tile));
}
}