Search in sources :

Example 6 with StatementParameterItemStack

use of buildcraft.api.statements.StatementParameterItemStack 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

StatementParameterItemStack (buildcraft.api.statements.StatementParameterItemStack)6 ItemStack (net.minecraft.item.ItemStack)5 IStatementParameter (buildcraft.api.statements.IStatementParameter)3 StatementSlot (buildcraft.api.statements.StatementSlot)3 DockingStation (buildcraft.api.robots.DockingStation)2 ArrayList (java.util.ArrayList)2 IItemHandlerFiltered (buildcraft.api.inventory.IItemHandlerFiltered)1 IList (buildcraft.api.items.IList)1 IMapLocation (buildcraft.api.items.IMapLocation)1 AIRobot (buildcraft.api.robots.AIRobot)1 IRobotRegistry (buildcraft.api.robots.IRobotRegistry)1 EntityRobot (buildcraft.robotics.EntityRobot)1 AIRobotGoAndLinkToDock (buildcraft.robotics.ai.AIRobotGoAndLinkToDock)1 ActionRobotFilter (buildcraft.robotics.statements.ActionRobotFilter)1 ItemBlock (net.minecraft.item.ItemBlock)1 EnumFacing (net.minecraft.util.EnumFacing)1 BlockPos (net.minecraft.util.math.BlockPos)1 IItemHandler (net.minecraftforge.items.IItemHandler)1