Search in sources :

Example 1 with AIRobotGotoStationAndUnloadFluids

use of buildcraft.robotics.ai.AIRobotGotoStationAndUnloadFluids in project BuildCraft by BuildCraft.

the class BoardRobotPump method delegateAIEnded.

@Override
public void delegateAIEnded(AIRobot ai) {
    if (ai instanceof AIRobotSearchAndGotoBlock) {
        if (ai.success()) {
            blockFound = ((AIRobotSearchAndGotoBlock) ai).getBlockFound();
            startDelegateAI(new AIRobotPumpBlock(robot, blockFound));
        } else {
            startDelegateAI(new AIRobotGotoSleep(robot));
        }
    } else if (ai instanceof AIRobotPumpBlock) {
        releaseBlockFound();
    } else if (ai instanceof AIRobotGotoStationAndUnloadFluids) {
        if (!ai.success()) {
            startDelegateAI(new AIRobotGotoSleep(robot));
        }
    }
}
Also used : AIRobotSearchAndGotoBlock(buildcraft.robotics.ai.AIRobotSearchAndGotoBlock) AIRobotGotoSleep(buildcraft.robotics.ai.AIRobotGotoSleep) AIRobotGotoStationAndUnloadFluids(buildcraft.robotics.ai.AIRobotGotoStationAndUnloadFluids) AIRobotPumpBlock(buildcraft.robotics.ai.AIRobotPumpBlock)

Example 2 with AIRobotGotoStationAndUnloadFluids

use of buildcraft.robotics.ai.AIRobotGotoStationAndUnloadFluids in project BuildCraft by BuildCraft.

the class BoardRobotFluidCarrier method update.

@Override
public void update() {
    if (!robotHasFluid()) {
        IFluidFilter filter = ActionRobotFilter.getGateFluidFilter(robot.getLinkedStation());
        startDelegateAI(new AIRobotGotoStationAndLoadFluids(robot, filter));
    } else {
        startDelegateAI(new AIRobotGotoStationAndUnloadFluids(robot));
    }
}
Also used : IFluidFilter(buildcraft.api.core.IFluidFilter) AIRobotGotoStationAndUnloadFluids(buildcraft.robotics.ai.AIRobotGotoStationAndUnloadFluids) AIRobotGotoStationAndLoadFluids(buildcraft.robotics.ai.AIRobotGotoStationAndLoadFluids)

Example 3 with AIRobotGotoStationAndUnloadFluids

use of buildcraft.robotics.ai.AIRobotGotoStationAndUnloadFluids in project BuildCraft by BuildCraft.

the class BoardRobotPump method update.

@Override
public void update() {
    final IWorldProperty isFluidSource = BuildCraftAPI.getWorldProperty("fluidSource");
    FluidStack tank = robot.getTankInfo(null)[0].fluid;
    if (tank != null && tank.amount > 0) {
        startDelegateAI(new AIRobotGotoStationAndUnloadFluids(robot));
    } else {
        updateFilter();
        startDelegateAI(new AIRobotSearchAndGotoBlock(robot, false, new IBlockFilter() {

            @Override
            public boolean matches(World world, BlockPos pos) {
                if (isFluidSource.get(world, pos) && !robot.getRegistry().isTaken(new ResourceIdBlock(pos))) {
                    return matchesGateFilter(world, pos);
                } else {
                    return false;
                }
            }
        }));
    }
}
Also used : AIRobotSearchAndGotoBlock(buildcraft.robotics.ai.AIRobotSearchAndGotoBlock) FluidStack(net.minecraftforge.fluids.FluidStack) ResourceIdBlock(buildcraft.api.robots.ResourceIdBlock) AIRobotGotoStationAndUnloadFluids(buildcraft.robotics.ai.AIRobotGotoStationAndUnloadFluids) BlockPos(net.minecraft.util.math.BlockPos) World(net.minecraft.world.World) IWorldProperty(buildcraft.api.core.IWorldProperty) IBlockFilter(buildcraft.core.lib.utils.IBlockFilter)

Aggregations

AIRobotGotoStationAndUnloadFluids (buildcraft.robotics.ai.AIRobotGotoStationAndUnloadFluids)3 AIRobotSearchAndGotoBlock (buildcraft.robotics.ai.AIRobotSearchAndGotoBlock)2 IFluidFilter (buildcraft.api.core.IFluidFilter)1 IWorldProperty (buildcraft.api.core.IWorldProperty)1 ResourceIdBlock (buildcraft.api.robots.ResourceIdBlock)1 IBlockFilter (buildcraft.core.lib.utils.IBlockFilter)1 AIRobotGotoSleep (buildcraft.robotics.ai.AIRobotGotoSleep)1 AIRobotGotoStationAndLoadFluids (buildcraft.robotics.ai.AIRobotGotoStationAndLoadFluids)1 AIRobotPumpBlock (buildcraft.robotics.ai.AIRobotPumpBlock)1 BlockPos (net.minecraft.util.math.BlockPos)1 World (net.minecraft.world.World)1 FluidStack (net.minecraftforge.fluids.FluidStack)1