Search in sources :

Example 1 with AggregateFilter

use of buildcraft.lib.inventory.filter.AggregateFilter in project BuildCraft by BuildCraft.

the class BoardRobotPlanter method update.

@Override
public void update() {
    if (robot.getHeldItem() == null) {
        startDelegateAI(new AIRobotFetchAndEquipItemStack(robot, new AggregateFilter(filter, ActionRobotFilter.getGateFilter(robot.getLinkedStation()))));
    } else {
        final ItemStack itemStack = robot.getHeldItem();
        IBlockFilter blockFilter = new IBlockFilter() {

            @Override
            public boolean matches(World world, BlockPos pos) {
                return !BuildCraftAPI.getWorldProperty("replaceable").get(world, pos) && isPlantable(itemStack, world, pos) && !robot.getRegistry().isTaken(new ResourceIdBlock(pos));
            }
        };
        startDelegateAI(new AIRobotSearchAndGotoBlock(robot, true, blockFilter, 1));
    }
}
Also used : AIRobotSearchAndGotoBlock(buildcraft.robotics.ai.AIRobotSearchAndGotoBlock) AggregateFilter(buildcraft.lib.inventory.filter.AggregateFilter) ResourceIdBlock(buildcraft.api.robots.ResourceIdBlock) BlockPos(net.minecraft.util.math.BlockPos) ItemStack(net.minecraft.item.ItemStack) AIRobotFetchAndEquipItemStack(buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack) World(net.minecraft.world.World) IBlockFilter(buildcraft.core.lib.utils.IBlockFilter) AIRobotFetchAndEquipItemStack(buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack)

Aggregations

ResourceIdBlock (buildcraft.api.robots.ResourceIdBlock)1 IBlockFilter (buildcraft.core.lib.utils.IBlockFilter)1 AggregateFilter (buildcraft.lib.inventory.filter.AggregateFilter)1 AIRobotFetchAndEquipItemStack (buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack)1 AIRobotSearchAndGotoBlock (buildcraft.robotics.ai.AIRobotSearchAndGotoBlock)1 ItemStack (net.minecraft.item.ItemStack)1 BlockPos (net.minecraft.util.math.BlockPos)1 World (net.minecraft.world.World)1