-
Notifications
You must be signed in to change notification settings - Fork 497
/
DefaultActionProvider.java
38 lines (31 loc) · 1.11 KB
/
DefaultActionProvider.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
package buildcraft.core.triggers;
import java.util.LinkedList;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
import buildcraft.BuildCraftCore;
import buildcraft.api.gates.IAction;
import buildcraft.api.gates.IActionProvider;
import buildcraft.core.IMachine;
import cpw.mods.fml.common.FMLLog;
import java.util.logging.Level;
public class DefaultActionProvider implements IActionProvider {
@Override
public LinkedList<IAction> getNeighborActions(Block block, TileEntity tile) {
LinkedList<IAction> res = new LinkedList<IAction>();
res.add(BuildCraftCore.actionRedstone);
try {
if (tile instanceof IMachine) {
IMachine machine = (IMachine) tile;
if (machine.allowAction(BuildCraftCore.actionOn))
res.add(BuildCraftCore.actionOn);
if (machine.allowAction(BuildCraftCore.actionOff))
res.add(BuildCraftCore.actionOff);
if (machine.allowAction(BuildCraftCore.actionLoop))
res.add(BuildCraftCore.actionLoop);
}
} catch (Throwable error) {
FMLLog.log("Buildcraft", Level.SEVERE, "Outdated API detected, please update your mods!");
}
return res;
}
}