-
Notifications
You must be signed in to change notification settings - Fork 497
/
GuiLaserTable.java
77 lines (62 loc) · 2.79 KB
/
GuiLaserTable.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
package buildcraft.silicon.gui;
import buildcraft.BuildCraftCore;
import buildcraft.core.CoreIconProvider;
import buildcraft.core.gui.BuildCraftContainer;
import buildcraft.core.gui.GuiBuildCraft;
import buildcraft.core.utils.StringUtils;
import buildcraft.silicon.TileLaserTableBase;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
public abstract class GuiLaserTable extends GuiBuildCraft {
private class LaserTableLedger extends Ledger {
int headerColour = 0xe1c92f;
int subheaderColour = 0xaaafb8;
int textColour = 0x000000;
public LaserTableLedger() {
maxHeight = 94;
overlayColor = 0xd46c1f;
}
@Override
public void draw(int x, int y) {
// Draw background
drawBackground(x, y);
// Draw icon
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
drawIcon(BuildCraftCore.iconProvider.getIcon(CoreIconProvider.ENERGY), x + 3, y + 4);
if (!isFullyOpened())
return;
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.energy"), x + 22, y + 8, headerColour);
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.assemblyCurrentRequired") + ":", x + 22, y + 20, subheaderColour);
fontRenderer.drawString(String.format("%2.1f MJ", table.clientRequiredEnergy), x + 22, y + 32, textColour);
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.stored") + ":", x + 22, y + 44, subheaderColour);
fontRenderer.drawString(String.format("%2.1f MJ", table.getEnergy()), x + 22, y + 56, textColour);
fontRenderer.drawStringWithShadow(StringUtils.localize("gui.assemblyRate") + ":", x + 22, y + 68, subheaderColour);
fontRenderer.drawString(String.format("%3.2f MJ/t", table.getRecentEnergyAverage() / 100.0f), x + 22, y + 80, textColour);
}
@Override
public String getTooltip() {
return String.format("%3.2f MJ/t", table.getRecentEnergyAverage() / 100.0f);
}
}
protected final TileLaserTableBase table;
public GuiLaserTable(InventoryPlayer playerInventory, BuildCraftContainer container, TileLaserTableBase table, ResourceLocation texture) {
super(container, table, texture);
this.table = table;
}
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
super.drawGuiContainerForegroundLayer(par1, par2);
String title = table.getInvName();
fontRenderer.drawString(title, getCenteredOffset(title), 6, 0x404040);
fontRenderer.drawString(StringUtils.localize("gui.inventory"), 8, ySize - 97, 0x404040);
}
@Override
protected void initLedgers(IInventory inventory) {
super.initLedgers(inventory);
ledgerManager.add(new LaserTableLedger());
}
}