-
Notifications
You must be signed in to change notification settings - Fork 497
/
BptSlot.java
79 lines (58 loc) · 2.02 KB
/
BptSlot.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
package buildcraft.core.blueprints;
import java.util.LinkedList;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import buildcraft.api.blueprints.BlueprintManager;
import buildcraft.api.blueprints.BptSlotInfo;
import buildcraft.api.blueprints.IBptContext;
public class BptSlot extends BptSlotInfo {
public enum Mode {
ClearIfInvalid, Build
};
public Mode mode = Mode.Build;
public ItemStack stackToUse;
public boolean isValid(IBptContext context) {
return BlueprintManager.blockBptProps[blockId].isValid(this, context);
}
public void rotateLeft(IBptContext context) {
BlueprintManager.blockBptProps[blockId].rotateLeft(this, context);
}
public boolean ignoreBuilding() {
return BlueprintManager.blockBptProps[blockId].ignoreBuilding(this);
}
public void initializeFromWorld(IBptContext context, int xs, int ys, int zs) {
BlueprintManager.blockBptProps[blockId].initializeFromWorld(this, context, xs, ys, zs);
}
public void postProcessing(IBptContext context) {
BlueprintManager.blockBptProps[blockId].postProcessing(this, context);
}
public LinkedList<ItemStack> getRequirements(IBptContext context) {
LinkedList<ItemStack> res = new LinkedList<ItemStack>();
BlueprintManager.blockBptProps[blockId].addRequirements(this, context, res);
return res;
}
public final void buildBlock(IBptContext context) {
BlueprintManager.blockBptProps[blockId].buildBlock(this, context);
}
// returns what was used
public ItemStack useItem(IBptContext context, ItemStack req, ItemStack stack) {
return BlueprintManager.blockBptProps[blockId].useItem(this, context, req, stack);
}
@SuppressWarnings("unchecked")
@Override
public BptSlot clone() {
BptSlot obj = new BptSlot();
obj.x = x;
obj.y = y;
obj.z = z;
obj.blockId = blockId;
obj.meta = meta;
obj.cpt = (NBTTagCompound) cpt.copy();
obj.storedRequirements = (LinkedList<ItemStack>) storedRequirements.clone();
if (stackToUse != null) {
obj.stackToUse = stackToUse.copy();
}
obj.mode = mode;
return obj;
}
}