use of buildcraft.core.lib.utils.IBlockFilter in project BuildCraft by BuildCraft.
the class BoardRobotGenericSearchBlock method update.
@Override
public void update() {
updateFilter();
startDelegateAI(new AIRobotSearchAndGotoBlock(robot, false, new IBlockFilter() {
@Override
public boolean matches(World world, BlockPos pos) {
if (isExpectedBlock(world, pos) && !robot.getRegistry().isTaken(new ResourceIdBlock(pos))) {
return matchesGateFilter(world, pos);
} else {
return false;
}
}
}));
}
use of buildcraft.core.lib.utils.IBlockFilter 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));
}
}
use of buildcraft.core.lib.utils.IBlockFilter 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;
}
}
}));
}
}
Aggregations