Search in sources :

Example 6 with StatementSlot

use of buildcraft.api.statements.StatementSlot in project BuildCraft by BuildCraft.

the class PipeItemsEmzuli method actionsActivated.

@Override
protected void actionsActivated(Collection<StatementSlot> actions) {
    super.actionsActivated(actions);
    activeFlags.clear();
    for (StatementSlot action : actions) {
        if (action.statement instanceof ActionExtractionPreset) {
            setActivePreset(((ActionExtractionPreset) action.statement).color);
        }
    }
}
Also used : StatementSlot(buildcraft.api.statements.StatementSlot) ActionExtractionPreset(buildcraft.transport.statements.ActionExtractionPreset)

Example 7 with StatementSlot

use of buildcraft.api.statements.StatementSlot in project BuildCraft by BuildCraft.

the class ActionRobotFilter method getGateFilterStacks.

public static Collection<ItemStack> getGateFilterStacks(DockingStation station) {
    ArrayList<ItemStack> result = new ArrayList<>();
    for (StatementSlot slot : station.getActiveActions()) {
        if (slot.statement instanceof ActionRobotFilter) {
            for (IStatementParameter p : slot.parameters) {
                if (p != null && p instanceof StatementParameterItemStack) {
                    StatementParameterItemStack param = (StatementParameterItemStack) p;
                    ItemStack stack = param.getItemStack();
                    if (stack != null) {
                        result.add(stack);
                    }
                }
            }
        }
    }
    return result;
}
Also used : StatementSlot(buildcraft.api.statements.StatementSlot) ArrayList(java.util.ArrayList) IStatementParameter(buildcraft.api.statements.IStatementParameter) StatementParameterItemStack(buildcraft.api.statements.StatementParameterItemStack) StatementParameterItemStack(buildcraft.api.statements.StatementParameterItemStack) ItemStack(net.minecraft.item.ItemStack)

Example 8 with StatementSlot

use of buildcraft.api.statements.StatementSlot in project BuildCraft by BuildCraft.

the class BoardRobotGenericSearchBlock method updateFilter.

public final void updateFilter() {
    blockFilter.clear();
    for (StatementSlot slot : robot.getLinkedStation().getActiveActions()) {
        if (slot.statement instanceof ActionRobotFilter) {
            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) {
                        ItemBlock item = (ItemBlock) stack.getItem();
                        blockFilter.add(item.block.getStateFromMeta(stack.getMetadata()));
                    }
                }
            }
        }
    }
}
Also used : StatementSlot(buildcraft.api.statements.StatementSlot) IStatementParameter(buildcraft.api.statements.IStatementParameter) StatementParameterItemStack(buildcraft.api.statements.StatementParameterItemStack) StatementParameterItemStack(buildcraft.api.statements.StatementParameterItemStack) ItemStack(net.minecraft.item.ItemStack) ItemBlock(net.minecraft.item.ItemBlock) ActionRobotFilter(buildcraft.robotics.statements.ActionRobotFilter)

Aggregations

StatementSlot (buildcraft.api.statements.StatementSlot)8 IStatementParameter (buildcraft.api.statements.IStatementParameter)4 StatementParameterItemStack (buildcraft.api.statements.StatementParameterItemStack)3 ItemStack (net.minecraft.item.ItemStack)3 ArrayList (java.util.ArrayList)2 IGate (buildcraft.api.gates.IGate)1 IStatement (buildcraft.api.statements.IStatement)1 IWireManager (buildcraft.api.transport.IWireManager)1 PipeEvent (buildcraft.api.transport.pipe.PipeEvent)1 PipeEventActionActivate (buildcraft.api.transport.pipe.PipeEventActionActivate)1 ActionRobotFilter (buildcraft.robotics.statements.ActionRobotFilter)1 ActionExtractionPreset (buildcraft.transport.statements.ActionExtractionPreset)1 ActionPipeDirection (buildcraft.transport.statements.ActionPipeDirection)1 EnumDyeColor (net.minecraft.item.EnumDyeColor)1 ItemBlock (net.minecraft.item.ItemBlock)1 EnumFacing (net.minecraft.util.EnumFacing)1