use of buildcraft.core.lib.inventory.ITransactor in project BuildCraft by BuildCraft.
the class BoardRobotBomber method delegateAIEnded.
@Override
public void delegateAIEnded(AIRobot ai) {
if (ai instanceof AIRobotGotoStationAndLoad) {
if (!ai.success()) {
startDelegateAI(new AIRobotGotoSleep(robot));
}
} else if (ai instanceof AIRobotSearchRandomGroundBlock) {
if (ai.success()) {
AIRobotSearchRandomGroundBlock aiFind = (AIRobotSearchRandomGroundBlock) ai;
startDelegateAI(new AIRobotGotoBlock(robot, aiFind.blockFound.add(0, flyingHeight, 0)));
} else {
startDelegateAI(new AIRobotGotoSleep(robot));
}
} else if (ai instanceof AIRobotGotoBlock) {
if (ai.success()) {
ITransactor t = Transactor.getTransactorFor(robot, null);
ItemStack stack = t.remove(TNT_FILTER, true);
if (stack != null && stack.stackSize > 0) {
EntityTNTPrimed tnt = new EntityTNTPrimed(robot.worldObj, robot.posX + 0.25, robot.posY - 1, robot.posZ + 0.25, robot);
tnt.setFuse(37);
robot.worldObj.spawnEntityInWorld(tnt);
robot.worldObj.playSoundAtEntity(tnt, "game.tnt.primed", 1.0F, 1.0F);
}
} else {
startDelegateAI(new AIRobotGotoSleep(robot));
}
}
}
Aggregations