-
Notifications
You must be signed in to change notification settings - Fork 497
/
StatementParameterSlot.java
71 lines (56 loc) · 1.62 KB
/
StatementParameterSlot.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
package buildcraft.core.lib.gui;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import buildcraft.api.statements.IStatementParameter;
/**
* Created by asie on 1/24/15.
*/
public abstract class StatementParameterSlot extends AdvancedSlot {
public int slot;
public StatementSlot statementSlot;
public StatementParameterSlot(GuiAdvancedInterface gui, int x, int y, int slot, StatementSlot iStatementSlot) {
super(gui, x, y);
this.slot = slot;
this.statementSlot = iStatementSlot;
statementSlot.parameters.add(this);
}
@Override
public boolean isDefined() {
return getParameter() != null;
}
@Override
public String getDescription() {
IStatementParameter parameter = getParameter();
if (parameter != null) {
return parameter.getDescription() != null ? parameter.getDescription() : "";
} else {
return null;
}
}
@Override
public ItemStack getItemStack() {
IStatementParameter parameter = getParameter();
if (parameter != null) {
return parameter.getItemStack();
} else {
return null;
}
}
@Override
public IIcon getIcon() {
IStatementParameter parameter = getParameter();
if (parameter != null) {
return parameter.getIcon();
} else {
return null;
}
}
public abstract IStatementParameter getParameter();
public boolean isAllowed() {
return statementSlot.getStatement() != null && slot < statementSlot.getStatement().maxParameters();
}
public boolean isRequired() {
return statementSlot.getStatement() != null && slot < statementSlot.getStatement().minParameters();
}
public abstract void setParameter(IStatementParameter param, boolean notifyServer);
}