Search in sources :

Example 1 with ActionRobotFilter

use of buildcraft.robotics.statements.ActionRobotFilter 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

IStatementParameter (buildcraft.api.statements.IStatementParameter)1 StatementParameterItemStack (buildcraft.api.statements.StatementParameterItemStack)1 StatementSlot (buildcraft.api.statements.StatementSlot)1 ActionRobotFilter (buildcraft.robotics.statements.ActionRobotFilter)1 ItemBlock (net.minecraft.item.ItemBlock)1 ItemStack (net.minecraft.item.ItemStack)1