Search in sources :

Example 6 with ITransactor

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));
        }
    }
}
Also used : EntityTNTPrimed(net.minecraft.entity.item.EntityTNTPrimed) ItemStack(net.minecraft.item.ItemStack) ITransactor(buildcraft.core.lib.inventory.ITransactor)

Aggregations

ITransactor (buildcraft.core.lib.inventory.ITransactor)6 ItemStack (net.minecraft.item.ItemStack)5 IInventory (net.minecraft.inventory.IInventory)2 TileEntity (net.minecraft.tileentity.TileEntity)2 EnumFacing (net.minecraft.util.EnumFacing)2 IInvSlot (buildcraft.api.core.IInvSlot)1 IEngine (buildcraft.api.power.IEngine)1 IInjectable (buildcraft.api.transport.IInjectable)1 TravelingItem (buildcraft.transport.TravelingItem)1 Entity (net.minecraft.entity.Entity)1 EntityMinecart (net.minecraft.entity.item.EntityMinecart)1 EntityTNTPrimed (net.minecraft.entity.item.EntityTNTPrimed)1 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)1