-
Notifications
You must be signed in to change notification settings - Fork 497
/
BuilderRequirementSlot.java
40 lines (33 loc) · 1.21 KB
/
BuilderRequirementSlot.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
package buildcraft.builders.gui;
import org.lwjgl.opengl.GL11;
import net.minecraft.item.ItemStack;
import buildcraft.core.blueprints.RequirementItemStack;
import buildcraft.core.lib.gui.AdvancedSlot;
import buildcraft.core.lib.gui.GuiAdvancedInterface;
public class BuilderRequirementSlot extends AdvancedSlot {
public RequirementItemStack stack;
public BuilderRequirementSlot(GuiAdvancedInterface gui, int x, int y) {
super(gui, x, y);
}
@Override
public ItemStack getItemStack() {
return stack != null ? stack.stack : null;
}
@Override
public void drawStack(ItemStack item) {
int cornerX = (gui.width - gui.getXSize()) / 2;
int cornerY = (gui.height - gui.getYSize()) / 2;
gui.drawStack(item, cornerX + x, cornerY + y);
if (stack != null) {
// Render real stack size
String s = String.valueOf(stack.size > 999 ? Math.min(99, stack.size / 1000) + "K" : stack.size);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_BLEND);
gui.getFontRenderer().drawStringWithShadow(s,
cornerX + x + 17 - gui.getFontRenderer().getStringWidth(s), cornerY + y + 9, 16777215);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
}
}