use of buildcraft.api.robots.ResourceIdBlock in project BuildCraft by BuildCraft.
the class AIRobotSearchBlock method takeResource.
public boolean takeResource() {
boolean taken = false;
if (robot.getRegistry().take(new ResourceIdBlock(blockFound), robot)) {
taken = true;
}
unreserve();
return taken;
}
use of buildcraft.api.robots.ResourceIdBlock 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.api.robots.ResourceIdBlock 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.api.robots.ResourceIdBlock in project BuildCraft by BuildCraft.
the class BoardRobotPump method releaseBlockFound.
private void releaseBlockFound() {
if (blockFound != null) {
robot.getRegistry().release(new ResourceIdBlock(blockFound));
blockFound = null;
}
}
use of buildcraft.api.robots.ResourceIdBlock 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