Search in sources :

Example 1 with IWorldProperty

use of buildcraft.api.core.IWorldProperty 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

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