Search in sources :

Example 21 with IStatementParameter

use of buildcraft.api.statements.IStatementParameter 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)21 IStatement (buildcraft.api.statements.IStatement)5 StatementSlot (buildcraft.api.statements.StatementSlot)4 ArrayList (java.util.ArrayList)4 ItemStack (net.minecraft.item.ItemStack)4 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)4 StatementParameterItemStack (buildcraft.api.statements.StatementParameterItemStack)3 EnumPipePart (buildcraft.api.core.EnumPipePart)2 ISprite (buildcraft.api.core.render.ISprite)2 IFilledTemplate (buildcraft.api.filler.IFilledTemplate)2 IGate (buildcraft.api.gates.IGate)2 StatementMouseClick (buildcraft.api.statements.StatementMouseClick)2 IWireManager (buildcraft.api.transport.IWireManager)2 StatementParameterSlot (buildcraft.core.lib.gui.StatementParameterSlot)2 GuiIcon (buildcraft.lib.gui.GuiIcon)2 StatementWrapper (buildcraft.lib.statement.StatementWrapper)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 EnumDyeColor (net.minecraft.item.EnumDyeColor)2 EnumFacing (net.minecraft.util.EnumFacing)2 Theory (org.junit.experimental.theories.Theory)2