-
Notifications
You must be signed in to change notification settings - Fork 497
/
StatementParameterRedstoneGateSideOnly.java
75 lines (59 loc) · 1.66 KB
/
StatementParameterRedstoneGateSideOnly.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
package buildcraft.core.statements;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import buildcraft.api.statements.IStatement;
import buildcraft.api.statements.IStatementContainer;
import buildcraft.api.statements.IStatementParameter;
import buildcraft.api.statements.StatementMouseClick;
import buildcraft.core.lib.utils.StringUtils;
public class StatementParameterRedstoneGateSideOnly implements
IStatementParameter {
private static IIcon icon;
public boolean isOn = false;
public StatementParameterRedstoneGateSideOnly() {
}
@Override
public ItemStack getItemStack() {
return null;
}
@Override
public IIcon getIcon() {
if (!isOn) {
return null;
} else {
return icon;
}
}
@Override
public void onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse) {
isOn = !isOn;
}
@Override
public void writeToNBT(NBTTagCompound compound) {
compound.setByte("isOn", isOn ? (byte) 1 : (byte) 0);
}
@Override
public void readFromNBT(NBTTagCompound compound) {
if (compound.hasKey("isOn")) {
isOn = compound.getByte("isOn") == 1;
}
}
@Override
public String getDescription() {
return isOn ? StringUtils.localize("gate.parameter.redstone.gateSideOnly") : "";
}
@Override
public String getUniqueTag() {
return "buildcraft:redstoneGateSideOnly";
}
@Override
public void registerIcons(IIconRegister iconRegister) {
icon = iconRegister.registerIcon("buildcraft:triggers/redstone_gate_side_only");
}
@Override
public IStatementParameter rotateLeft() {
return this;
}
}