further work on improving/separating the gate API, #2107
This commit is contained in:
parent
489a3cc6f7
commit
8728885c2c
66 changed files with 236 additions and 358 deletions
|
@ -41,7 +41,7 @@ public abstract class GateExpansionController {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isTriggerActive(ITrigger trigger, ITriggerParameter parameter) {
|
||||
public boolean isTriggerActive(ITrigger trigger, IStatementParameter[] parameters) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,6 @@ package buildcraft.api.gates;
|
|||
|
||||
public interface IAction extends IStatement {
|
||||
|
||||
void actionActivate(IGate gate, IActionParameter[] parameters);
|
||||
void actionActivate(IGate gate, IStatementParameter[] parameters);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.gates;
|
||||
|
||||
public interface IActionParameter extends IStatementParameter {
|
||||
|
||||
}
|
|
@ -18,13 +18,13 @@ import buildcraft.api.transport.IPipeTile;
|
|||
public interface IActionProvider {
|
||||
|
||||
/**
|
||||
* Returns the list of actions that are available from the pipe holding the
|
||||
* Returns the list of actions that are available from the tile holding the
|
||||
* gate.
|
||||
*/
|
||||
Collection<IAction> getPipeActions(IPipeTile pipe);
|
||||
Collection<IAction> getInternalActions(TileEntity tile);
|
||||
|
||||
/**
|
||||
* Returns the list of actions available to a gate next to the given block.
|
||||
*/
|
||||
Collection<IAction> getNeighborActions(ForgeDirection side, Block block, TileEntity tile);
|
||||
Collection<IAction> getExternalActions(ForgeDirection side, TileEntity tile);
|
||||
}
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
package buildcraft.api.gates;
|
||||
|
||||
public interface IActionReceptor {
|
||||
void actionActivated(IAction action, IActionParameter[] parameters);
|
||||
void actionActivated(IAction action, IStatementParameter[] parameters);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,6 @@ package buildcraft.api.gates;
|
|||
|
||||
public interface ITrigger extends IStatement {
|
||||
|
||||
boolean isTriggerActive(IGate gate, ITriggerParameter[] parameters);
|
||||
boolean isTriggerActive(IGate gate, IStatementParameter[] parameters);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.gates;
|
||||
|
||||
public interface ITriggerParameter extends IStatementParameter {
|
||||
|
||||
}
|
|
@ -18,13 +18,13 @@ import buildcraft.api.transport.IPipeTile;
|
|||
public interface ITriggerProvider {
|
||||
|
||||
/**
|
||||
* Returns the list of triggers that are available from the pipe holding the gate.
|
||||
* Returns the list of triggers that are available from the object holding the gate.
|
||||
*/
|
||||
Collection<ITrigger> getPipeTriggers(IPipeTile pipe);
|
||||
Collection<ITrigger> getInternalTriggers(TileEntity tile);
|
||||
|
||||
/**
|
||||
* Returns the list of triggers available to a gate next to the given block.
|
||||
*/
|
||||
Collection<ITrigger> getNeighborTriggers(ForgeDirection side, Block block, TileEntity tile);
|
||||
Collection<ITrigger> getExternalTriggers(ForgeDirection side, TileEntity tile);
|
||||
|
||||
}
|
||||
|
|
|
@ -52,11 +52,11 @@ public final class StatementManager {
|
|||
parameters.put(createParameter(param).getUniqueTag(), param);
|
||||
}
|
||||
|
||||
public static List<ITrigger> getNeighborTriggers(ForgeDirection side, Block block, TileEntity entity) {
|
||||
public static List<ITrigger> getExternalTriggers(ForgeDirection side, TileEntity entity) {
|
||||
List<ITrigger> result = new LinkedList<ITrigger>();
|
||||
|
||||
for (ITriggerProvider provider : triggerProviders) {
|
||||
Collection<ITrigger> toAdd = provider.getNeighborTriggers(side, block, entity);
|
||||
Collection<ITrigger> toAdd = provider.getExternalTriggers(side, entity);
|
||||
|
||||
if (toAdd != null) {
|
||||
for (ITrigger t : toAdd) {
|
||||
|
@ -70,11 +70,11 @@ public final class StatementManager {
|
|||
return result;
|
||||
}
|
||||
|
||||
public static List<IAction> getNeighborActions(ForgeDirection side, Block block, TileEntity entity) {
|
||||
public static List<IAction> getExternalActions(ForgeDirection side, TileEntity entity) {
|
||||
List<IAction> result = new LinkedList<IAction>();
|
||||
|
||||
for (IActionProvider provider : actionProviders) {
|
||||
Collection<IAction> toAdd = provider.getNeighborActions(side, block, entity);
|
||||
Collection<IAction> toAdd = provider.getExternalActions(side, entity);
|
||||
|
||||
if (toAdd != null) {
|
||||
for (IAction t : toAdd) {
|
||||
|
@ -88,11 +88,11 @@ public final class StatementManager {
|
|||
return result;
|
||||
}
|
||||
|
||||
public static List<ITrigger> getPipeTriggers(IPipeTile pipe) {
|
||||
public static List<ITrigger> getInternalTriggers(TileEntity tile) {
|
||||
List<ITrigger> result = new LinkedList<ITrigger>();
|
||||
|
||||
for (ITriggerProvider provider : triggerProviders) {
|
||||
Collection<ITrigger> toAdd = provider.getPipeTriggers(pipe);
|
||||
Collection<ITrigger> toAdd = provider.getInternalTriggers(tile);
|
||||
|
||||
if (toAdd != null) {
|
||||
for (ITrigger t : toAdd) {
|
||||
|
@ -106,11 +106,11 @@ public final class StatementManager {
|
|||
return result;
|
||||
}
|
||||
|
||||
public static List<IAction> getPipeActions(IPipeTile pipe) {
|
||||
public static List<IAction> getInternalActions(TileEntity tile) {
|
||||
List<IAction> result = new LinkedList<IAction>();
|
||||
|
||||
for (IActionProvider provider : actionProviders) {
|
||||
Collection<IAction> toAdd = provider.getPipeActions(pipe);
|
||||
Collection<IAction> toAdd = provider.getInternalActions(tile);
|
||||
|
||||
if (toAdd != null) {
|
||||
for (IAction t : toAdd) {
|
||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.util.IIcon;
|
|||
import buildcraft.api.core.NetworkData;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
|
||||
public class ActionParameterItemStack implements IActionParameter {
|
||||
public class StatementParameterItemStack implements IStatementParameter {
|
||||
@NetworkData
|
||||
protected ItemStack stack;
|
||||
|
||||
|
@ -53,8 +53,8 @@ public class ActionParameterItemStack implements IActionParameter {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (object instanceof ActionParameterItemStack) {
|
||||
ActionParameterItemStack param = (ActionParameterItemStack) object;
|
||||
if (object instanceof StatementParameterItemStack) {
|
||||
StatementParameterItemStack param = (StatementParameterItemStack) object;
|
||||
|
||||
return ItemStack.areItemStacksEqual(stack, param.stack)
|
||||
&& ItemStack.areItemStackTagsEqual(stack, param.stack);
|
|
@ -1,98 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.gates;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import buildcraft.api.core.NetworkData;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
|
||||
public class TriggerParameterItemStack implements ITriggerParameter {
|
||||
|
||||
@NetworkData
|
||||
protected ItemStack stack;
|
||||
|
||||
@Override
|
||||
public IIcon getIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Object source, IStatement stmt, ItemStack stack, int mouseButton) {
|
||||
if (stack != null) {
|
||||
this.stack = stack.copy();
|
||||
this.stack.stackSize = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound) {
|
||||
if (stack != null) {
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
stack.writeToNBT(tagCompound);
|
||||
compound.setTag("stack", tagCompound);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
// Legacy code to prevent existing gates from losing their contents
|
||||
int itemID = compound.getInteger("itemID");
|
||||
if (itemID != 0) {
|
||||
stack = new ItemStack((Item) Item.itemRegistry.getObject(itemID), 1, compound.getInteger("itemDMG"));
|
||||
return;
|
||||
}
|
||||
|
||||
stack = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("stack"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (object instanceof TriggerParameterItemStack) {
|
||||
TriggerParameterItemStack param = (TriggerParameterItemStack) object;
|
||||
|
||||
return ItemStack.areItemStacksEqual(stack, param.stack)
|
||||
&& ItemStack.areItemStackTagsEqual(stack, param.stack);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
if (stack != null) {
|
||||
return stack.getDisplayName();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueTag() {
|
||||
return "buildcraft:stackTrigger";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStatementParameter rotateLeft() {
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -63,11 +63,11 @@ import buildcraft.api.core.IIconProvider;
|
|||
import buildcraft.api.core.IWorldProperty;
|
||||
import buildcraft.api.core.JavaTools;
|
||||
import buildcraft.api.fuels.BuildcraftFuelRegistry;
|
||||
import buildcraft.api.gates.ActionParameterItemStack;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.api.gates.ITrigger;
|
||||
import buildcraft.api.gates.StatementManager;
|
||||
import buildcraft.api.gates.TriggerParameterItemStack;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
import buildcraft.api.recipes.BuildcraftRecipeRegistry;
|
||||
import buildcraft.core.BlockSpring;
|
||||
import buildcraft.core.BuildCraftConfiguration;
|
||||
|
@ -344,8 +344,8 @@ public class BuildCraftCore extends BuildCraftMod {
|
|||
|
||||
NetworkIdRegistry.instance = new NetworkIdRegistry();
|
||||
|
||||
StatementManager.registerParameterClass(TriggerParameterItemStack.class);
|
||||
StatementManager.registerParameterClass(ActionParameterItemStack.class);
|
||||
StatementManager.registerParameterClass(StatementParameterItemStack.class);
|
||||
StatementManager.registerParameterClass(StatementParameterItemStack.class);
|
||||
StatementManager.registerParameterClass(StatementParameterDirection.class);
|
||||
StatementManager.registerParameterClass(StatementParameterRedstoneGateSideOnly.class);
|
||||
StatementManager.registerTriggerProvider(new DefaultTriggerProvider());
|
||||
|
|
|
@ -19,7 +19,7 @@ import buildcraft.BuildCraftCore;
|
|||
import buildcraft.api.core.IAreaProvider;
|
||||
import buildcraft.api.filler.FillerManager;
|
||||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.IActionReceptor;
|
||||
import buildcraft.builders.statements.ActionFiller;
|
||||
import buildcraft.core.Box;
|
||||
|
@ -314,7 +314,7 @@ public class TileFiller extends TileAbstractBuilder implements IMachine, IAction
|
|||
}
|
||||
|
||||
@Override
|
||||
public void actionActivated(IAction action, IActionParameter[] parameters) {
|
||||
public void actionActivated(IAction action, IStatementParameter[] parameters) {
|
||||
if (action == BuildCraftCore.actionOn) {
|
||||
lastMode = ActionMachineControl.Mode.On;
|
||||
} else if (action == BuildCraftCore.actionOff) {
|
||||
|
|
|
@ -27,12 +27,12 @@ public class BuildersActionProvider implements IActionProvider {
|
|||
private final HashMap<String, ActionFiller> actionMap = new HashMap<String, ActionFiller>();
|
||||
|
||||
@Override
|
||||
public Collection<IAction> getPipeActions(IPipeTile pipe) {
|
||||
public Collection<IAction> getInternalActions(TileEntity tile) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IAction> getNeighborActions(ForgeDirection side, Block block, TileEntity tile) {
|
||||
public Collection<IAction> getExternalActions(ForgeDirection side, TileEntity tile) {
|
||||
LinkedList<IAction> actions = new LinkedList<IAction>();
|
||||
if (tile instanceof TileFiller) {
|
||||
for (IFillerPattern p : FillerManager.registry.getPatterns()) {
|
||||
|
|
|
@ -12,9 +12,9 @@ import java.util.ArrayList;
|
|||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import buildcraft.api.gates.ActionParameterItemStack;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.TriggerParameterItemStack;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
|
||||
/**
|
||||
* Returns true if the stack matches any one one of the filter stacks.
|
||||
|
@ -26,7 +26,7 @@ public class StatementParameterStackFilter extends ArrayStackOrListFilter {
|
|||
|
||||
for (IStatementParameter s : parameters) {
|
||||
if (s != null) {
|
||||
if (s instanceof ActionParameterItemStack || s instanceof TriggerParameterItemStack) {
|
||||
if (s instanceof StatementParameterItemStack || s instanceof StatementParameterItemStack) {
|
||||
tmp.add(s.getItemStack());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.gates.ActionParameterItemStack;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
|
@ -130,7 +130,7 @@ public class AIRobotSearchStackRequest extends AIRobot {
|
|||
for (ActionSlot s : new ActionIterator(pipe)) {
|
||||
if (s.action instanceof ActionStationRequestItems) {
|
||||
for (IStatementParameter p : s.parameters) {
|
||||
ActionParameterItemStack param = (ActionParameterItemStack) p;
|
||||
StatementParameterItemStack param = (StatementParameterItemStack) p;
|
||||
|
||||
if (param != null && !isBlacklisted(param.getItemStack())) {
|
||||
StackRequest req = new StackRequest();
|
||||
|
|
|
@ -18,8 +18,8 @@ import net.minecraft.world.World;
|
|||
|
||||
import buildcraft.api.boards.RedstoneBoardRobot;
|
||||
import buildcraft.api.core.BlockIndex;
|
||||
import buildcraft.api.gates.ActionParameterItemStack;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.core.TickHandlerCore;
|
||||
|
@ -129,9 +129,9 @@ public abstract class BoardRobotGenericBreakBlock extends RedstoneBoardRobot {
|
|||
|
||||
for (ActionSlot slot : new ActionIterator(station.getPipe().pipe)) {
|
||||
if (slot.action instanceof ActionRobotFilter) {
|
||||
for (IActionParameter p : slot.parameters) {
|
||||
if (p != null && p instanceof ActionParameterItemStack) {
|
||||
ActionParameterItemStack param = (ActionParameterItemStack) p;
|
||||
for (IStatementParameter p : slot.parameters) {
|
||||
if (p != null && p instanceof StatementParameterItemStack) {
|
||||
StatementParameterItemStack param = (StatementParameterItemStack) p;
|
||||
ItemStack stack = param.getItemStack();
|
||||
|
||||
if (stack != null && stack.getItem() instanceof ItemBlock) {
|
||||
|
|
|
@ -24,8 +24,8 @@ import buildcraft.api.boards.RedstoneBoardRobot;
|
|||
import buildcraft.api.boards.RedstoneBoardRobotNBT;
|
||||
import buildcraft.api.core.BlockIndex;
|
||||
import buildcraft.api.core.BuildCraftAPI;
|
||||
import buildcraft.api.gates.ActionParameterItemStack;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.core.TickHandlerCore;
|
||||
|
@ -116,9 +116,9 @@ public class BoardRobotPump extends RedstoneBoardRobot {
|
|||
|
||||
for (ActionSlot slot : new ActionIterator(station.getPipe().pipe)) {
|
||||
if (slot.action instanceof ActionRobotFilter) {
|
||||
for (IActionParameter p : slot.parameters) {
|
||||
if (p != null && p instanceof ActionParameterItemStack) {
|
||||
ActionParameterItemStack param = (ActionParameterItemStack) p;
|
||||
for (IStatementParameter p : slot.parameters) {
|
||||
if (p != null && p instanceof StatementParameterItemStack) {
|
||||
StatementParameterItemStack param = (StatementParameterItemStack) p;
|
||||
ItemStack stack = param.getItemStack();
|
||||
|
||||
if (stack != null) {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
package buildcraft.core.statements;
|
||||
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
public class ActionRedstoneOutput extends BCActionPassive {
|
||||
|
@ -28,8 +28,8 @@ public class ActionRedstoneOutput extends BCActionPassive {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IActionParameter createParameter(int index) {
|
||||
IActionParameter param = null;
|
||||
public IStatementParameter createParameter(int index) {
|
||||
IStatementParameter param = null;
|
||||
|
||||
if (index == 0) {
|
||||
param = new StatementParameterRedstoneGateSideOnly();
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
package buildcraft.core.statements;
|
||||
|
||||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
|
||||
public abstract class BCActionActive extends BCStatement implements IAction {
|
||||
|
||||
|
@ -18,7 +18,7 @@ public abstract class BCActionActive extends BCStatement implements IAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IActionParameter createParameter(int index) {
|
||||
public IStatementParameter createParameter(int index) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
package buildcraft.core.statements;
|
||||
|
||||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.IGate;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
|
||||
public abstract class BCActionPassive extends BCStatement implements IAction {
|
||||
|
||||
|
@ -19,11 +19,11 @@ public abstract class BCActionPassive extends BCStatement implements IAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IActionParameter createParameter(int index) {
|
||||
public IStatementParameter createParameter(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void actionActivate(IGate gate, IActionParameter[] parameters) {
|
||||
public final void actionActivate(IGate gate, IStatementParameter[] parameters) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
|
||||
import buildcraft.api.gates.IGate;
|
||||
import buildcraft.api.gates.ITrigger;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.TriggerParameterItemStack;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
import buildcraft.transport.Pipe;
|
||||
|
||||
/**
|
||||
|
@ -30,8 +30,8 @@ public abstract class BCTrigger extends BCStatement implements ITrigger {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(IGate gate, ITriggerParameter[] parameters) {
|
||||
ITriggerParameter p = parameters[0];
|
||||
public boolean isTriggerActive(IGate gate, IStatementParameter[] parameters) {
|
||||
IStatementParameter p = parameters[0];
|
||||
Pipe<?> pipe = (Pipe<?>) gate.getPipe();
|
||||
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
|
@ -43,12 +43,12 @@ public abstract class BCTrigger extends BCStatement implements ITrigger {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isTriggerActive(ForgeDirection side, TileEntity tile, ITriggerParameter parameter) {
|
||||
public boolean isTriggerActive(ForgeDirection side, TileEntity tile, IStatementParameter parameter) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITriggerParameter createParameter(int index) {
|
||||
return new TriggerParameterItemStack();
|
||||
public IStatementParameter createParameter(int index) {
|
||||
return new StatementParameterItemStack();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,12 +26,12 @@ import buildcraft.core.IMachine;
|
|||
public class DefaultActionProvider implements IActionProvider {
|
||||
|
||||
@Override
|
||||
public Collection<IAction> getPipeActions(IPipeTile pipe) {
|
||||
public Collection<IAction> getInternalActions(TileEntity tile) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IAction> getNeighborActions(ForgeDirection side, Block block, TileEntity tile) {
|
||||
public Collection<IAction> getExternalActions(ForgeDirection side, TileEntity tile) {
|
||||
LinkedList<IAction> res = new LinkedList<IAction>();
|
||||
|
||||
res.add(BuildCraftCore.actionRedstone);
|
||||
|
|
|
@ -29,7 +29,7 @@ import buildcraft.core.IMachine;
|
|||
public class DefaultTriggerProvider implements ITriggerProvider {
|
||||
|
||||
@Override
|
||||
public LinkedList<ITrigger> getNeighborTriggers(ForgeDirection side, Block block, TileEntity tile) {
|
||||
public LinkedList<ITrigger> getExternalTriggers(ForgeDirection side, TileEntity tile) {
|
||||
LinkedList<ITrigger> res = new LinkedList<ITrigger>();
|
||||
|
||||
if (tile instanceof IInventory && ((IInventory) tile).getSizeInventory() > 0) {
|
||||
|
@ -65,16 +65,11 @@ public class DefaultTriggerProvider implements ITriggerProvider {
|
|||
res.add(BuildCraftCore.triggerEnergyLow);
|
||||
}
|
||||
|
||||
if (block != null && block.canProvidePower()) {
|
||||
// res.add(BuildCraftCore.triggerRedstoneActive);
|
||||
// res.add(BuildCraftCore.triggerRedstoneInactive);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedList<ITrigger> getPipeTriggers(IPipeTile pipe) {
|
||||
public LinkedList<ITrigger> getInternalTriggers(TileEntity pipe) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,15 +14,15 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.core.NetworkData;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.IStatement;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.transport.IPipe;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
public class StatementParameterDirection implements IActionParameter, ITriggerParameter {
|
||||
public class StatementParameterDirection implements IStatementParameter {
|
||||
|
||||
@NetworkData
|
||||
public ForgeDirection direction = ForgeDirection.UNKNOWN;
|
||||
|
|
|
@ -5,15 +5,15 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import buildcraft.api.core.NetworkData;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.IStatement;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
public class StatementParameterRedstoneGateSideOnly implements
|
||||
IActionParameter, ITriggerParameter {
|
||||
IStatementParameter {
|
||||
@NetworkData
|
||||
public boolean isOn = false;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import cofh.api.energy.IEnergyHandler;
|
||||
|
||||
import buildcraft.api.gates.IGate;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
public class TriggerEnergy extends BCTrigger {
|
||||
|
@ -58,7 +58,7 @@ public class TriggerEnergy extends BCTrigger {
|
|||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isTriggerActive(IGate gate, ITriggerParameter[] parameters) {
|
||||
public boolean isTriggerActive(IGate gate, IStatementParameter[] parameters) {
|
||||
if (gate.getPipe() instanceof IEnergyHandler) {
|
||||
if (isValidEnergyHandler((IEnergyHandler) gate.getPipe())) {
|
||||
return isTriggeredEnergyHandler((IEnergyHandler) gate.getPipe());
|
||||
|
@ -72,7 +72,7 @@ public class TriggerEnergy extends BCTrigger {
|
|||
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(ForgeDirection side, TileEntity tile, ITriggerParameter parameter) {
|
||||
public boolean isTriggerActive(ForgeDirection side, TileEntity tile, IStatementParameter parameter) {
|
||||
if (tile instanceof IEnergyHandler) {
|
||||
// Since we return false upon the trigger being invalid anyway,
|
||||
// we can skip the isValidEnergyHandler(...) check.
|
||||
|
|
|
@ -18,7 +18,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
public class TriggerFluidContainer extends BCTrigger {
|
||||
|
@ -45,7 +45,7 @@ public class TriggerFluidContainer extends BCTrigger {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(ForgeDirection side, TileEntity tile, ITriggerParameter parameter) {
|
||||
public boolean isTriggerActive(ForgeDirection side, TileEntity tile, IStatementParameter parameter) {
|
||||
if (tile instanceof IFluidHandler) {
|
||||
IFluidHandler container = (IFluidHandler) tile;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
public class TriggerFluidContainerLevel extends BCTrigger {
|
||||
|
@ -52,7 +52,7 @@ public class TriggerFluidContainerLevel extends BCTrigger {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(ForgeDirection side, TileEntity tile, ITriggerParameter parameter) {
|
||||
public boolean isTriggerActive(ForgeDirection side, TileEntity tile, IStatementParameter parameter) {
|
||||
if (tile instanceof IFluidHandler) {
|
||||
IFluidHandler container = (IFluidHandler) tile;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.core.IInvSlot;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.ItemList;
|
||||
import buildcraft.core.inventory.InventoryIterator;
|
||||
import buildcraft.core.inventory.StackHelper;
|
||||
|
@ -48,7 +48,7 @@ public class TriggerInventory extends BCTrigger {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(ForgeDirection side, TileEntity tile, ITriggerParameter parameter) {
|
||||
public boolean isTriggerActive(ForgeDirection side, TileEntity tile, IStatementParameter parameter) {
|
||||
ItemStack searchedStack = null;
|
||||
|
||||
if (parameter != null) {
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.core.IInvSlot;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.inventory.InventoryIterator;
|
||||
import buildcraft.core.inventory.StackHelper;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
@ -58,7 +58,7 @@ public class TriggerInventoryLevel extends BCTrigger {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(ForgeDirection side, TileEntity tile, ITriggerParameter parameter) {
|
||||
public boolean isTriggerActive(ForgeDirection side, TileEntity tile, IStatementParameter parameter) {
|
||||
// A parameter is required
|
||||
if (parameter == null) {
|
||||
return false;
|
||||
|
|
|
@ -12,7 +12,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.IMachine;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
|
@ -32,7 +32,7 @@ public class TriggerMachine extends BCTrigger {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(ForgeDirection side, TileEntity tile, ITriggerParameter parameter) {
|
||||
public boolean isTriggerActive(ForgeDirection side, TileEntity tile, IStatementParameter parameter) {
|
||||
if (tile instanceof IMachine) {
|
||||
IMachine machine = (IMachine) tile;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
package buildcraft.core.statements;
|
||||
|
||||
import buildcraft.api.gates.IGate;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.transport.TileGenericPipe;
|
||||
|
||||
|
@ -28,8 +28,8 @@ public class TriggerRedstoneInput extends BCTrigger {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ITriggerParameter createParameter(int index) {
|
||||
ITriggerParameter param = null;
|
||||
public IStatementParameter createParameter(int index) {
|
||||
IStatementParameter param = null;
|
||||
|
||||
if (index == 0) {
|
||||
param = new StatementParameterRedstoneGateSideOnly();
|
||||
|
@ -44,7 +44,7 @@ public class TriggerRedstoneInput extends BCTrigger {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(IGate gate, ITriggerParameter[] parameters) {
|
||||
public boolean isTriggerActive(IGate gate, IStatementParameter[] parameters) {
|
||||
TileGenericPipe tile = (TileGenericPipe) gate.getPipe().getTile();
|
||||
int level = tile.redstoneInput;
|
||||
if (parameters.length > 0 && parameters[0] instanceof StatementParameterRedstoneGateSideOnly &&
|
||||
|
|
|
@ -17,12 +17,12 @@ import buildcraft.energy.TileEngine;
|
|||
public class EnergyStatementProvider implements ITriggerProvider {
|
||||
|
||||
@Override
|
||||
public Collection<ITrigger> getPipeTriggers(IPipeTile pipe) {
|
||||
public Collection<ITrigger> getInternalTriggers(TileEntity pipe) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ITrigger> getNeighborTriggers(ForgeDirection side, Block block, TileEntity tile) {
|
||||
public Collection<ITrigger> getExternalTriggers(ForgeDirection side, TileEntity tile) {
|
||||
LinkedList<ITrigger> triggers = new LinkedList<ITrigger>();
|
||||
|
||||
if (tile instanceof TileEngine) {
|
||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.statements.BCTrigger;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
import buildcraft.energy.TileEngine;
|
||||
|
@ -37,7 +37,7 @@ public class TriggerEngineHeat extends BCTrigger {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(ForgeDirection side, TileEntity tile, ITriggerParameter parameter) {
|
||||
public boolean isTriggerActive(ForgeDirection side, TileEntity tile, IStatementParameter parameter) {
|
||||
if (tile instanceof TileEngine) {
|
||||
TileEngine engine = (TileEngine) tile;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import buildcraft.api.core.NetworkData;
|
|||
import buildcraft.api.core.Position;
|
||||
import buildcraft.api.core.SafeTimeTracker;
|
||||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.IActionReceptor;
|
||||
import buildcraft.api.power.ILaserTarget;
|
||||
import buildcraft.api.power.ILaserTargetBlock;
|
||||
|
@ -299,7 +299,7 @@ public class TileLaser extends TileBuildCraft implements IActionReceptor, IMachi
|
|||
}
|
||||
|
||||
@Override
|
||||
public void actionActivated(IAction action, IActionParameter[] parameters) {
|
||||
public void actionActivated(IAction action, IStatementParameter[] parameters) {
|
||||
if (action == BuildCraftCore.actionOn) {
|
||||
lastMode = ActionMachineControl.Mode.On;
|
||||
} else if (action == BuildCraftCore.actionOff) {
|
||||
|
|
|
@ -16,7 +16,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.IActionReceptor;
|
||||
import buildcraft.api.power.ILaserTarget;
|
||||
import buildcraft.core.IMachine;
|
||||
|
@ -220,7 +220,7 @@ public abstract class TileLaserTableBase extends TileBuildCraft implements ILase
|
|||
}
|
||||
|
||||
@Override
|
||||
public void actionActivated(IAction action, IActionParameter[] parameters) {
|
||||
public void actionActivated(IAction action, IStatementParameter[] parameters) {
|
||||
if (action == BuildCraftCore.actionOn) {
|
||||
lastMode = ActionMachineControl.Mode.On;
|
||||
} else if (action == BuildCraftCore.actionOff) {
|
||||
|
|
|
@ -15,8 +15,8 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import buildcraft.api.gates.ActionParameterItemStack;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.robots.IDockingStation;
|
||||
import buildcraft.core.inventory.filters.ArrayFluidFilter;
|
||||
import buildcraft.core.inventory.filters.ArrayStackOrListFilter;
|
||||
|
@ -59,8 +59,8 @@ public class ActionRobotFilter extends BCActionPassive {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IActionParameter createParameter(int index) {
|
||||
return new ActionParameterItemStack();
|
||||
public IStatementParameter createParameter(int index) {
|
||||
return new StatementParameterItemStack();
|
||||
}
|
||||
|
||||
public static Collection<ItemStack> getGateFilterStacks(IDockingStation station) {
|
||||
|
@ -68,9 +68,9 @@ public class ActionRobotFilter extends BCActionPassive {
|
|||
|
||||
for (ActionSlot slot : new ActionIterator(((DockingStation) station).getPipe().pipe)) {
|
||||
if (slot.action instanceof ActionRobotFilter) {
|
||||
for (IActionParameter p : slot.parameters) {
|
||||
if (p != null && p instanceof ActionParameterItemStack) {
|
||||
ActionParameterItemStack param = (ActionParameterItemStack) p;
|
||||
for (IStatementParameter p : slot.parameters) {
|
||||
if (p != null && p instanceof StatementParameterItemStack) {
|
||||
StatementParameterItemStack param = (StatementParameterItemStack) p;
|
||||
ItemStack stack = param.getItemStack();
|
||||
|
||||
if (stack != null) {
|
||||
|
|
|
@ -12,8 +12,8 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.core.BlockIndex;
|
||||
import buildcraft.api.gates.ActionParameterItemStack;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.IGate;
|
||||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.core.ItemMapLocation;
|
||||
|
@ -43,7 +43,7 @@ public class ActionRobotGotoStation extends BCActionActive {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void actionActivate(IGate gate, IActionParameter[] parameters) {
|
||||
public void actionActivate(IGate gate, IStatementParameter[] parameters) {
|
||||
Pipe<?> pipe = (Pipe<?>) gate.getPipe();
|
||||
TileGenericPipe tile = pipe.container;
|
||||
RobotRegistry registry = RobotRegistry.getRegistry(pipe.getWorld());
|
||||
|
@ -62,7 +62,7 @@ public class ActionRobotGotoStation extends BCActionActive {
|
|||
DockingStation newStation = station;
|
||||
|
||||
if (parameters[0] != null) {
|
||||
ActionParameterItemStack stackParam = (ActionParameterItemStack) parameters[0];
|
||||
StatementParameterItemStack stackParam = (StatementParameterItemStack) parameters[0];
|
||||
ItemStack item = stackParam.getItemStack();
|
||||
|
||||
if (item.getItem() instanceof ItemMapLocation) {
|
||||
|
@ -92,8 +92,8 @@ public class ActionRobotGotoStation extends BCActionActive {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IActionParameter createParameter(int index) {
|
||||
return new ActionParameterItemStack();
|
||||
public IStatementParameter createParameter(int index) {
|
||||
return new StatementParameterItemStack();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ package buildcraft.silicon.statements;
|
|||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.core.IZone;
|
||||
import buildcraft.api.gates.ActionParameterItemStack;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.ItemMapLocation;
|
||||
import buildcraft.core.statements.BCActionPassive;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
@ -39,7 +39,7 @@ public class ActionRobotWorkInArea extends BCActionPassive {
|
|||
return null;
|
||||
}
|
||||
|
||||
ItemStack stack = ((ActionParameterItemStack) slot.parameters[0]).getItemStack();
|
||||
ItemStack stack = ((StatementParameterItemStack) slot.parameters[0]).getItemStack();
|
||||
|
||||
if (!(stack.getItem() instanceof ItemMapLocation)) {
|
||||
return null;
|
||||
|
@ -59,7 +59,7 @@ public class ActionRobotWorkInArea extends BCActionPassive {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IActionParameter createParameter(int index) {
|
||||
return new ActionParameterItemStack();
|
||||
public IStatementParameter createParameter(int index) {
|
||||
return new StatementParameterItemStack();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
package buildcraft.silicon.statements;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import buildcraft.api.gates.ActionParameterItemStack;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.statements.BCActionPassive;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class ActionStationAcceptFluids extends BCActionPassive {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IActionParameter createParameter(int index) {
|
||||
return new ActionParameterItemStack();
|
||||
public IStatementParameter createParameter(int index) {
|
||||
return new StatementParameterItemStack();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.core.IInvSlot;
|
||||
import buildcraft.api.gates.ActionParameterItemStack;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.inventory.ITransactor;
|
||||
import buildcraft.core.inventory.Transactor;
|
||||
import buildcraft.core.robots.DockingStation;
|
||||
|
@ -47,8 +47,8 @@ public class ActionStationAcceptItemsInv extends ActionStationInputItems {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IActionParameter createParameter(int index) {
|
||||
return new ActionParameterItemStack();
|
||||
public IStatementParameter createParameter(int index) {
|
||||
return new StatementParameterItemStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,8 +11,8 @@ package buildcraft.silicon.statements;
|
|||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
import buildcraft.api.core.IInvSlot;
|
||||
import buildcraft.api.gates.ActionParameterItemStack;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.robots.DockingStation;
|
||||
import buildcraft.core.robots.EntityRobot;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
@ -42,8 +42,8 @@ public class ActionStationAcceptItemsPipe extends ActionStationInputItems {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IActionParameter createParameter(int index) {
|
||||
return new ActionParameterItemStack();
|
||||
public IStatementParameter createParameter(int index) {
|
||||
return new StatementParameterItemStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
package buildcraft.silicon.statements;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import buildcraft.api.gates.ActionParameterItemStack;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.statements.BCActionPassive;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class ActionStationAllowCraft extends BCActionPassive {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IActionParameter createParameter(int index) {
|
||||
return new ActionParameterItemStack();
|
||||
public IStatementParameter createParameter(int index) {
|
||||
return new StatementParameterItemStack();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ package buildcraft.silicon.statements;
|
|||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.gates.ActionParameterItemStack;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.core.ItemRobot;
|
||||
import buildcraft.core.robots.DockingStation;
|
||||
|
@ -47,8 +47,8 @@ public class ActionStationForbidRobot extends BCActionPassive {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IActionParameter createParameter(int index) {
|
||||
return new ActionParameterItemStack();
|
||||
public IStatementParameter createParameter(int index) {
|
||||
return new StatementParameterItemStack();
|
||||
}
|
||||
|
||||
public static boolean isForbidden(DockingStation station, EntityRobotBase robot) {
|
||||
|
@ -64,9 +64,9 @@ public class ActionStationForbidRobot extends BCActionPassive {
|
|||
}
|
||||
|
||||
public static boolean isForbidden(ActionSlot slot, EntityRobotBase robot) {
|
||||
for (IActionParameter p : slot.parameters) {
|
||||
for (IStatementParameter p : slot.parameters) {
|
||||
if (p != null) {
|
||||
ActionParameterItemStack actionStack = (ActionParameterItemStack) p;
|
||||
StatementParameterItemStack actionStack = (StatementParameterItemStack) p;
|
||||
ItemStack stack = p.getItemStack();
|
||||
|
||||
if (stack != null && stack.getItem() instanceof ItemRobot) {
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
package buildcraft.silicon.statements;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import buildcraft.api.gates.ActionParameterItemStack;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.statements.BCActionPassive;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class ActionStationProvideFluids extends BCActionPassive {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IActionParameter createParameter(int index) {
|
||||
return new ActionParameterItemStack();
|
||||
public IStatementParameter createParameter(int index) {
|
||||
return new StatementParameterItemStack();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
package buildcraft.silicon.statements;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import buildcraft.api.gates.ActionParameterItemStack;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.statements.BCActionPassive;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class ActionStationProvideItems extends BCActionPassive {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IActionParameter createParameter(int index) {
|
||||
return new ActionParameterItemStack();
|
||||
public IStatementParameter createParameter(int index) {
|
||||
return new StatementParameterItemStack();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.core.IInvSlot;
|
||||
import buildcraft.api.gates.ActionParameterItemStack;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.inventory.ITransactor;
|
||||
import buildcraft.core.inventory.Transactor;
|
||||
import buildcraft.core.robots.DockingStation;
|
||||
|
@ -52,8 +52,8 @@ public class ActionStationRequestItems extends ActionStationInputItems {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IActionParameter createParameter(int index) {
|
||||
return new ActionParameterItemStack();
|
||||
public IStatementParameter createParameter(int index) {
|
||||
return new StatementParameterItemStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,14 +34,18 @@ import buildcraft.transport.TileGenericPipe;
|
|||
public class RobotsActionProvider implements IActionProvider {
|
||||
|
||||
@Override
|
||||
public Collection<IAction> getPipeActions(IPipeTile pipe) {
|
||||
public Collection<IAction> getInternalActions(TileEntity tile) {
|
||||
if (!(tile instanceof TileGenericPipe)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
LinkedList<IAction> result = new LinkedList<IAction>();
|
||||
|
||||
ArrayList<DockingStation> stations = new ArrayList<DockingStation>();
|
||||
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (((TileGenericPipe) pipe).getStation(dir) != null) {
|
||||
stations.add(((TileGenericPipe) pipe).getStation(dir));
|
||||
if (((TileGenericPipe) tile).getStation(dir) != null) {
|
||||
stations.add(((TileGenericPipe) tile).getStation(dir));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,32 +59,32 @@ public class RobotsActionProvider implements IActionProvider {
|
|||
result.add(BuildCraftSilicon.actionRobotFilter);
|
||||
result.add(BuildCraftSilicon.actionStationForbidRobot);
|
||||
|
||||
if (((TileGenericPipe) pipe).pipe.transport instanceof PipeTransportItems) {
|
||||
if (((TileGenericPipe) tile).pipe.transport instanceof PipeTransportItems) {
|
||||
result.add(BuildCraftSilicon.actionStationDropInPipe);
|
||||
}
|
||||
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
TileEntity tile = ((TileGenericPipe) pipe).getTile(dir);
|
||||
Block block = ((TileGenericPipe) pipe).getBlock(dir);
|
||||
TileEntity sideTile = ((TileGenericPipe) tile).getTile(dir);
|
||||
Block sideBlock = ((TileGenericPipe) tile).getBlock(dir);
|
||||
|
||||
if (tile instanceof IInventory) {
|
||||
if (sideTile instanceof IInventory) {
|
||||
result.add(BuildCraftSilicon.actionStationProvideItems);
|
||||
result.add(BuildCraftSilicon.actionStationRequestItems);
|
||||
result.add(BuildCraftSilicon.actionStationAcceptItems);
|
||||
}
|
||||
|
||||
if (tile instanceof IFluidHandler) {
|
||||
if (sideTile instanceof IFluidHandler) {
|
||||
result.add(BuildCraftSilicon.actionStationAcceptFluids);
|
||||
result.add(BuildCraftSilicon.actionStationProvideFluids);
|
||||
}
|
||||
|
||||
if (tile instanceof IRequestProvider) {
|
||||
if (sideTile instanceof IRequestProvider) {
|
||||
result.add(BuildCraftSilicon.actionStationMachineRequestItems);
|
||||
}
|
||||
|
||||
if (tile instanceof TileEntityFurnace
|
||||
|| tile instanceof TileAssemblyTable
|
||||
|| block instanceof BlockWorkbench) {
|
||||
if (sideTile instanceof TileEntityFurnace
|
||||
|| sideTile instanceof TileAssemblyTable
|
||||
|| sideBlock instanceof BlockWorkbench) {
|
||||
result.add(BuildCraftSilicon.actionRobotAllowCraft);
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +93,7 @@ public class RobotsActionProvider implements IActionProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Collection<IAction> getNeighborActions(ForgeDirection side, Block block, TileEntity tile) {
|
||||
public Collection<IAction> getExternalActions(ForgeDirection side, TileEntity tile) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,13 +25,17 @@ import buildcraft.transport.TileGenericPipe;
|
|||
public class RobotsTriggerProvider implements ITriggerProvider {
|
||||
|
||||
@Override
|
||||
public Collection<ITrigger> getPipeTriggers(IPipeTile pipe) {
|
||||
public Collection<ITrigger> getInternalTriggers(TileEntity tile) {
|
||||
LinkedList<ITrigger> result = new LinkedList<ITrigger>();
|
||||
|
||||
if (!(tile instanceof TileGenericPipe)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
boolean stationFound = false;
|
||||
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (((TileGenericPipe) pipe).getStation(dir) != null) {
|
||||
if (((TileGenericPipe) tile).getStation(dir) != null) {
|
||||
stationFound = true;
|
||||
break;
|
||||
}
|
||||
|
@ -47,7 +51,7 @@ public class RobotsTriggerProvider implements ITriggerProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Collection<ITrigger> getNeighborTriggers(ForgeDirection side, Block block, TileEntity tile) {
|
||||
public Collection<ITrigger> getExternalTriggers(ForgeDirection side, TileEntity tile) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ package buildcraft.silicon.statements;
|
|||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.gates.IGate;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.robots.AIRobotSleep;
|
||||
import buildcraft.core.robots.DockingStation;
|
||||
import buildcraft.core.robots.EntityRobot;
|
||||
|
@ -37,7 +37,7 @@ public class TriggerRobotSleep extends BCTrigger {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(IGate gate, ITriggerParameter[] parameters) {
|
||||
public boolean isTriggerActive(IGate gate, IStatementParameter[] parameters) {
|
||||
Pipe<?> pipe = (Pipe<?>) gate.getPipe();
|
||||
TileGenericPipe tile = pipe.container;
|
||||
|
||||
|
|
|
@ -25,14 +25,13 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
import buildcraft.BuildCraftTransport;
|
||||
import buildcraft.api.gates.GateExpansionController;
|
||||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.IActionReceptor;
|
||||
import buildcraft.api.gates.IGate;
|
||||
import buildcraft.api.gates.IGateExpansion;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.ITrigger;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.StatementManager;
|
||||
import buildcraft.api.gates.TriggerParameterItemStack;
|
||||
import buildcraft.api.gates.StatementParameterItemStack;
|
||||
import buildcraft.api.transport.IPipe;
|
||||
import buildcraft.api.transport.PipeWire;
|
||||
import buildcraft.core.GuiIds;
|
||||
|
@ -56,10 +55,10 @@ public final class Gate implements IGate {
|
|||
public final BiMap<IGateExpansion, GateExpansionController> expansions = HashBiMap.create();
|
||||
|
||||
public ITrigger[] triggers = new ITrigger[MAX_STATEMENTS];
|
||||
public ITriggerParameter[][] triggerParameters = new ITriggerParameter[8][MAX_PARAMETERS];
|
||||
public IStatementParameter[][] triggerParameters = new IStatementParameter[MAX_STATEMENTS][MAX_PARAMETERS];
|
||||
|
||||
public IAction[] actions = new IAction[MAX_STATEMENTS];
|
||||
public IActionParameter[][] actionParameters = new IActionParameter[8][MAX_PARAMETERS];
|
||||
public IStatementParameter[][] actionParameters = new IStatementParameter[MAX_STATEMENTS][MAX_PARAMETERS];
|
||||
|
||||
public ActionActiveState[] actionsState = new ActionActiveState[MAX_STATEMENTS];
|
||||
public ArrayList<ActionSlot> activeActions = new ArrayList<ActionSlot>();
|
||||
|
@ -106,19 +105,19 @@ public final class Gate implements IGate {
|
|||
return actions[position];
|
||||
}
|
||||
|
||||
public void setTriggerParameter(int trigger, int param, ITriggerParameter p) {
|
||||
public void setTriggerParameter(int trigger, int param, IStatementParameter p) {
|
||||
triggerParameters[trigger][param] = p;
|
||||
}
|
||||
|
||||
public void setActionParameter(int action, int param, IActionParameter p) {
|
||||
public void setActionParameter(int action, int param, IStatementParameter p) {
|
||||
actionParameters[action][param] = p;
|
||||
}
|
||||
|
||||
public ITriggerParameter getTriggerParameter(int trigger, int param) {
|
||||
public IStatementParameter getTriggerParameter(int trigger, int param) {
|
||||
return triggerParameters[trigger][param];
|
||||
}
|
||||
|
||||
public IActionParameter getActionParameter(int action, int param) {
|
||||
public IStatementParameter getActionParameter(int action, int param) {
|
||||
return actionParameters[action][param];
|
||||
}
|
||||
|
||||
|
@ -203,14 +202,14 @@ public final class Gate implements IGate {
|
|||
|
||||
// This is for legacy trigger loading
|
||||
if (data.hasKey("triggerParameters[" + i + "]")) {
|
||||
triggerParameters[i][0] = new TriggerParameterItemStack();
|
||||
triggerParameters[i][0] = new StatementParameterItemStack();
|
||||
triggerParameters[i][0].readFromNBT(data.getCompoundTag("triggerParameters[" + i + "]"));
|
||||
}
|
||||
|
||||
for (int j = 0; j < material.numTriggerParameters; ++j) {
|
||||
if (data.hasKey("triggerParameters[" + i + "][" + j + "]")) {
|
||||
NBTTagCompound cpt = data.getCompoundTag("triggerParameters[" + i + "][" + j + "]");
|
||||
triggerParameters[i][j] = (ITriggerParameter) StatementManager.createParameter(cpt.getString("kind"));
|
||||
triggerParameters[i][j] = StatementManager.createParameter(cpt.getString("kind"));
|
||||
triggerParameters[i][j].readFromNBT(cpt);
|
||||
}
|
||||
}
|
||||
|
@ -218,7 +217,7 @@ public final class Gate implements IGate {
|
|||
for (int j = 0; j < material.numActionParameters; ++j) {
|
||||
if (data.hasKey("actionParameters[" + i + "][" + j + "]")) {
|
||||
NBTTagCompound cpt = data.getCompoundTag("actionParameters[" + i + "][" + j + "]");
|
||||
actionParameters[i][j] = (IActionParameter) StatementManager.createParameter(cpt.getString("kind"));
|
||||
actionParameters[i][j] = StatementManager.createParameter(cpt.getString("kind"));
|
||||
actionParameters[i][j].readFromNBT(cpt);
|
||||
}
|
||||
}
|
||||
|
@ -394,7 +393,7 @@ public final class Gate implements IGate {
|
|||
actionsState[it] = ActionActiveState.Deactivated;
|
||||
|
||||
ITrigger trigger = triggers[it];
|
||||
ITriggerParameter[] parameter = triggerParameters[it];
|
||||
IStatementParameter[] parameter = triggerParameters[it];
|
||||
|
||||
if (trigger != null) {
|
||||
if (isTriggerActive(trigger, parameter)) {
|
||||
|
@ -504,7 +503,7 @@ public final class Gate implements IGate {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean isTriggerActive(ITrigger trigger, ITriggerParameter[] parameters) {
|
||||
public boolean isTriggerActive(ITrigger trigger, IStatementParameter[] parameters) {
|
||||
if (trigger == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -516,7 +515,7 @@ public final class Gate implements IGate {
|
|||
// TODO: This can probably be refactored with regular triggers instead
|
||||
// of yet another system.
|
||||
for (GateExpansionController expansion : expansions.values()) {
|
||||
if (expansion.isTriggerActive(trigger, parameters[0])) {
|
||||
if (expansion.isTriggerActive(trigger, parameters)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -540,12 +539,12 @@ public final class Gate implements IGate {
|
|||
|
||||
public List<ITrigger> getAllValidTriggers() {
|
||||
ArrayList<ITrigger> allTriggers = new ArrayList<ITrigger>(64);
|
||||
allTriggers.addAll(StatementManager.getPipeTriggers(pipe.container));
|
||||
allTriggers.addAll(StatementManager.getInternalTriggers(pipe.container));
|
||||
|
||||
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
||||
TileEntity tile = pipe.container.getTile(o);
|
||||
Block block = pipe.container.getBlock(o);
|
||||
allTriggers.addAll(StatementManager.getNeighborTriggers(o, block, tile));
|
||||
allTriggers.addAll(StatementManager.getExternalTriggers(o, tile));
|
||||
}
|
||||
|
||||
return allTriggers;
|
||||
|
@ -566,12 +565,12 @@ public final class Gate implements IGate {
|
|||
|
||||
public List<IAction> getAllValidActions() {
|
||||
ArrayList<IAction> allActions = new ArrayList<IAction>(64);
|
||||
allActions.addAll(StatementManager.getPipeActions(pipe.container));
|
||||
allActions.addAll(StatementManager.getInternalActions(pipe.container));
|
||||
|
||||
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
||||
TileEntity tile = pipe.container.getTile(o);
|
||||
Block block = pipe.container.getBlock(o);
|
||||
allActions.addAll(StatementManager.getNeighborActions(o, block, tile));
|
||||
allActions.addAll(StatementManager.getExternalActions(o, tile));
|
||||
}
|
||||
|
||||
return allActions;
|
||||
|
|
|
@ -13,7 +13,7 @@ import buildcraft.api.transport.IPipeTile;
|
|||
public class PipeActionProvider implements IActionProvider {
|
||||
|
||||
@Override
|
||||
public Collection<IAction> getPipeActions(IPipeTile tile) {
|
||||
public Collection<IAction> getInternalActions(TileEntity tile) {
|
||||
LinkedList<IAction> result = new LinkedList<IAction>();
|
||||
Pipe<?> pipe = null;
|
||||
if (tile instanceof TileGenericPipe) {
|
||||
|
@ -36,7 +36,7 @@ public class PipeActionProvider implements IActionProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Collection<IAction> getNeighborActions(ForgeDirection side, Block block, TileEntity tile) {
|
||||
public Collection<IAction> getExternalActions(ForgeDirection side, TileEntity tile) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import buildcraft.transport.statements.TriggerPipeContents;
|
|||
public class PipeTriggerProvider implements ITriggerProvider {
|
||||
|
||||
@Override
|
||||
public LinkedList<ITrigger> getPipeTriggers(IPipeTile tile) {
|
||||
public LinkedList<ITrigger> getInternalTriggers(TileEntity tile) {
|
||||
LinkedList<ITrigger> result = new LinkedList<ITrigger>();
|
||||
Pipe<?> pipe = null;
|
||||
if (tile instanceof TileGenericPipe) {
|
||||
|
@ -46,7 +46,7 @@ public class PipeTriggerProvider implements ITriggerProvider {
|
|||
result.add(BuildCraftCore.triggerRedstoneActive);
|
||||
result.add(BuildCraftCore.triggerRedstoneInactive);
|
||||
|
||||
switch (tile.getPipeType()) {
|
||||
switch (((TileGenericPipe) tile).getPipeType()) {
|
||||
case ITEM:
|
||||
result.add(TriggerPipeContents.PipeContents.empty.trigger);
|
||||
result.add(TriggerPipeContents.PipeContents.containsItems.trigger);
|
||||
|
@ -74,7 +74,7 @@ public class PipeTriggerProvider implements ITriggerProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LinkedList<ITrigger> getNeighborTriggers(ForgeDirection side, Block block, TileEntity tile) {
|
||||
public LinkedList<ITrigger> getExternalTriggers(ForgeDirection side, TileEntity tile) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
package buildcraft.transport.gates;
|
||||
|
||||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
|
||||
public class ActionSlot {
|
||||
public IAction action;
|
||||
public IActionParameter[] parameters;
|
||||
public IStatementParameter[] parameters;
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ import buildcraft.BuildCraftTransport;
|
|||
import buildcraft.api.gates.GateExpansionController;
|
||||
import buildcraft.api.gates.IGate;
|
||||
import buildcraft.api.gates.IGateExpansion;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.ITrigger;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.transport.statements.TriggerClockTimer;
|
||||
import buildcraft.transport.statements.TriggerClockTimer.Time;
|
||||
|
||||
|
@ -67,12 +67,12 @@ public final class GateExpansionTimer extends GateExpansionBuildcraft implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(ITrigger trigger, ITriggerParameter parameter) {
|
||||
public boolean isTriggerActive(ITrigger trigger, IStatementParameter[] parameters) {
|
||||
if (trigger instanceof TriggerClockTimer) {
|
||||
TriggerClockTimer timerTrigger = (TriggerClockTimer) trigger;
|
||||
return timers[timerTrigger.time.ordinal()].isActive();
|
||||
}
|
||||
return super.isTriggerActive(trigger, parameter);
|
||||
return super.isTriggerActive(trigger, parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,10 +21,10 @@ import net.minecraft.inventory.Slot;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.IStatement;
|
||||
import buildcraft.api.gates.ITrigger;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.StatementManager;
|
||||
import buildcraft.core.gui.BuildCraftContainer;
|
||||
import buildcraft.core.network.RPC;
|
||||
|
@ -320,7 +320,7 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
|||
}
|
||||
|
||||
@RPC(RPCSide.BOTH)
|
||||
public void setTriggerParameter(int trigger, int param, ITriggerParameter parameter, boolean notifyServer) {
|
||||
public void setTriggerParameter(int trigger, int param, IStatementParameter parameter, boolean notifyServer) {
|
||||
if (gate == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
|||
}
|
||||
}
|
||||
|
||||
public ITriggerParameter getTriggerParameter(int trigger, int param) {
|
||||
public IStatementParameter getTriggerParameter(int trigger, int param) {
|
||||
if (gate == null) {
|
||||
return null;
|
||||
} else {
|
||||
|
@ -385,7 +385,7 @@ public class ContainerGateInterface extends BuildCraftContainer {
|
|||
}
|
||||
|
||||
@RPC(RPCSide.BOTH)
|
||||
public void setActionParameter(int action, int param, IActionParameter parameter, boolean notifyServer) {
|
||||
public void setActionParameter(int action, int param, IStatementParameter parameter, boolean notifyServer) {
|
||||
if (gate == null) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -22,11 +22,11 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.IStatement;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.ITrigger;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.gui.AdvancedSlot;
|
||||
import buildcraft.core.gui.GuiAdvancedInterface;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
@ -183,7 +183,7 @@ public class GuiGateInterface extends GuiAdvancedInterface {
|
|||
|
||||
@Override
|
||||
public void setParameter(IStatementParameter param, boolean notifyServer) {
|
||||
container.setTriggerParameter(statementSlot.slot, slot, (ITriggerParameter) param, notifyServer);
|
||||
container.setTriggerParameter(statementSlot.slot, slot, (IStatementParameter) param, notifyServer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ public class GuiGateInterface extends GuiAdvancedInterface {
|
|||
|
||||
@Override
|
||||
public void setParameter(IStatementParameter param, boolean notifyServer) {
|
||||
container.setActionParameter(statementSlot.slot, slot, (IActionParameter) param, notifyServer);
|
||||
container.setActionParameter(statementSlot.slot, slot, (IStatementParameter) param, notifyServer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import buildcraft.api.core.NetworkData;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.IStatement;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.transport.IPipe;
|
||||
|
@ -24,7 +24,7 @@ import buildcraft.api.transport.PipeWire;
|
|||
import buildcraft.core.statements.StatementIconProvider;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
public class ActionParameterSignal implements IActionParameter {
|
||||
public class ActionParameterSignal implements IStatementParameter {
|
||||
|
||||
@NetworkData
|
||||
public PipeWire color = null;
|
||||
|
|
|
@ -12,7 +12,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
|||
import net.minecraft.util.IIcon;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.statements.BCActionPassive;
|
||||
import buildcraft.core.statements.StatementParameterRedstoneGateSideOnly;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
@ -45,8 +45,8 @@ public class ActionRedstoneFaderOutput extends BCActionPassive {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IActionParameter createParameter(int index) {
|
||||
IActionParameter param = null;
|
||||
public IStatementParameter createParameter(int index) {
|
||||
IStatementParameter param = null;
|
||||
|
||||
if (index == 0) {
|
||||
param = new StatementParameterRedstoneGateSideOnly();
|
||||
|
|
|
@ -10,7 +10,7 @@ package buildcraft.transport.statements;
|
|||
|
||||
import java.util.Locale;
|
||||
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.IGate;
|
||||
import buildcraft.api.transport.PipeWire;
|
||||
import buildcraft.core.statements.BCActionActive;
|
||||
|
@ -54,17 +54,17 @@ public class ActionSignalOutput extends BCActionActive {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IActionParameter createParameter(int index) {
|
||||
public IStatementParameter createParameter(int index) {
|
||||
return new ActionParameterSignal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionActivate(IGate iGate, IActionParameter[] parameters) {
|
||||
public void actionActivate(IGate iGate, IStatementParameter[] parameters) {
|
||||
Gate gate = (Gate) iGate;
|
||||
|
||||
gate.broadcastSignal(color);
|
||||
|
||||
for (IActionParameter param : parameters) {
|
||||
for (IStatementParameter param : parameters) {
|
||||
if (param != null) {
|
||||
ActionParameterSignal signal = (ActionParameterSignal) param;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.Locale;
|
|||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.gates.IActionParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.IGate;
|
||||
import buildcraft.api.transport.IPipe;
|
||||
import buildcraft.core.statements.BCActionActive;
|
||||
|
@ -68,8 +68,8 @@ public class ActionValve extends BCActionActive {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IActionParameter createParameter(int index) {
|
||||
IActionParameter param = null;
|
||||
public IStatementParameter createParameter(int index) {
|
||||
IStatementParameter param = null;
|
||||
|
||||
if (index == 0) {
|
||||
param = new StatementParameterDirection();
|
||||
|
@ -79,7 +79,7 @@ public class ActionValve extends BCActionActive {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void actionActivate(IGate gate, IActionParameter[] parameters) {
|
||||
public void actionActivate(IGate gate, IStatementParameter[] parameters) {
|
||||
IPipe pipe = gate.getPipe();
|
||||
|
||||
if (pipe != null && pipe instanceof Pipe) {
|
||||
|
|
|
@ -17,13 +17,13 @@ import net.minecraft.util.IIcon;
|
|||
import buildcraft.api.core.NetworkData;
|
||||
import buildcraft.api.gates.IStatement;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.api.transport.PipeWire;
|
||||
import buildcraft.core.statements.StatementIconProvider;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
||||
public class TriggerParameterSignal implements ITriggerParameter {
|
||||
public class TriggerParameterSignal implements IStatementParameter {
|
||||
|
||||
@NetworkData
|
||||
public boolean active = false;
|
||||
|
|
|
@ -18,7 +18,7 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
|
|||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import buildcraft.api.gates.IGate;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.inventory.StackHelper;
|
||||
import buildcraft.core.statements.BCTrigger;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
@ -64,9 +64,9 @@ public class TriggerPipeContents extends BCTrigger {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(IGate gate, ITriggerParameter[] parameters) {
|
||||
public boolean isTriggerActive(IGate gate, IStatementParameter[] parameters) {
|
||||
Pipe<?> pipe = (Pipe<?>) gate.getPipe();
|
||||
ITriggerParameter parameter = parameters[0];
|
||||
IStatementParameter parameter = parameters[0];
|
||||
|
||||
if (pipe.transport instanceof PipeTransportItems) {
|
||||
PipeTransportItems transportItems = (PipeTransportItems) pipe.transport;
|
||||
|
|
|
@ -11,7 +11,7 @@ package buildcraft.transport.statements;
|
|||
import java.util.Locale;
|
||||
|
||||
import buildcraft.api.gates.IGate;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.api.transport.PipeWire;
|
||||
import buildcraft.core.statements.BCTrigger;
|
||||
import buildcraft.core.statements.StatementIconProvider;
|
||||
|
@ -42,7 +42,7 @@ public class TriggerPipeSignal extends BCTrigger {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(IGate gate, ITriggerParameter[] parameters) {
|
||||
public boolean isTriggerActive(IGate gate, IStatementParameter[] parameters) {
|
||||
Pipe<?> pipe = (Pipe<?>) gate.getPipe();
|
||||
|
||||
if (active) {
|
||||
|
@ -55,7 +55,7 @@ public class TriggerPipeSignal extends BCTrigger {
|
|||
}
|
||||
}
|
||||
|
||||
for (ITriggerParameter param : parameters) {
|
||||
for (IStatementParameter param : parameters) {
|
||||
if (param != null) {
|
||||
TriggerParameterSignal signal = (TriggerParameterSignal) param;
|
||||
|
||||
|
@ -106,7 +106,7 @@ public class TriggerPipeSignal extends BCTrigger {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ITriggerParameter createParameter(int index) {
|
||||
public IStatementParameter createParameter(int index) {
|
||||
return new TriggerParameterSignal();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import buildcraft.api.gates.IGate;
|
||||
import buildcraft.api.gates.ITriggerParameter;
|
||||
import buildcraft.api.gates.IStatementParameter;
|
||||
import buildcraft.core.statements.BCTrigger;
|
||||
import buildcraft.core.statements.StatementParameterRedstoneGateSideOnly;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
@ -34,7 +34,7 @@ public class TriggerRedstoneFaderInput extends BCTrigger {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isTriggerActive(IGate gate, ITriggerParameter[] parameters) {
|
||||
public boolean isTriggerActive(IGate gate, IStatementParameter[] parameters) {
|
||||
TileGenericPipe tile = (TileGenericPipe) gate.getPipe().getTile();
|
||||
int inputLevel = tile.redstoneInput;
|
||||
if (parameters.length > 0 && parameters[0] instanceof StatementParameterRedstoneGateSideOnly &&
|
||||
|
@ -52,8 +52,8 @@ public class TriggerRedstoneFaderInput extends BCTrigger {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ITriggerParameter createParameter(int index) {
|
||||
ITriggerParameter param = null;
|
||||
public IStatementParameter createParameter(int index) {
|
||||
IStatementParameter param = null;
|
||||
|
||||
if (index == 0) {
|
||||
param = new StatementParameterRedstoneGateSideOnly();
|
||||
|
|
Loading…
Reference in a new issue