Search in sources :

Example 1 with AIRobotFetchAndEquipItemStack

use of buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack in project BuildCraft by BuildCraft.

the class BoardRobotPlanter method delegateAIEnded.

@Override
public void delegateAIEnded(AIRobot ai) {
    if (ai instanceof AIRobotSearchAndGotoBlock) {
        if (ai.success()) {
            blockFound = ((AIRobotSearchAndGotoBlock) ai).getBlockFound();
            startDelegateAI(new AIRobotPlant(robot, blockFound));
        } else {
            startDelegateAI(new AIRobotGotoSleep(robot));
        }
    } else if (ai instanceof AIRobotPlant) {
        releaseBlockFound();
    } else if (ai instanceof AIRobotFetchAndEquipItemStack) {
        if (!ai.success()) {
            startDelegateAI(new AIRobotGotoSleep(robot));
        }
    }
}
Also used : AIRobotSearchAndGotoBlock(buildcraft.robotics.ai.AIRobotSearchAndGotoBlock) AIRobotGotoSleep(buildcraft.robotics.ai.AIRobotGotoSleep) AIRobotPlant(buildcraft.robotics.ai.AIRobotPlant) AIRobotFetchAndEquipItemStack(buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack)

Example 2 with AIRobotFetchAndEquipItemStack

use of buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack in project BuildCraft by BuildCraft.

the class BoardRobotFarmer method delegateAIEnded.

@Override
public void delegateAIEnded(AIRobot ai) {
    if (ai instanceof AIRobotSearchAndGotoBlock) {
        if (ai.success()) {
            blockFound = ((AIRobotSearchAndGotoBlock) ai).getBlockFound();
            startDelegateAI(new AIRobotUseToolOnBlock(robot, blockFound));
        } else {
            startDelegateAI(new AIRobotGotoSleep(robot));
        }
    } else if (ai instanceof AIRobotFetchAndEquipItemStack) {
        if (!ai.success()) {
            startDelegateAI(new AIRobotGotoSleep(robot));
        }
    } else if (ai instanceof AIRobotUseToolOnBlock) {
        releaseBlockFound();
    }
}
Also used : AIRobotSearchAndGotoBlock(buildcraft.robotics.ai.AIRobotSearchAndGotoBlock) AIRobotGotoSleep(buildcraft.robotics.ai.AIRobotGotoSleep) AIRobotUseToolOnBlock(buildcraft.robotics.ai.AIRobotUseToolOnBlock) AIRobotFetchAndEquipItemStack(buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack)

Example 3 with AIRobotFetchAndEquipItemStack

use of buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack in project BuildCraft by BuildCraft.

the class BoardRobotStripes method delegateAIEnded.

@Override
public void delegateAIEnded(AIRobot ai) {
    if (ai instanceof AIRobotSearchAndGotoBlock) {
        if (ai.success()) {
            blockFound = ((AIRobotSearchAndGotoBlock) ai).getBlockFound();
            startDelegateAI(new AIRobotStripesHandler(robot, blockFound));
        } else {
            startDelegateAI(new AIRobotGotoSleep(robot));
        }
    } else if (ai instanceof AIRobotFetchAndEquipItemStack) {
        if (!ai.success()) {
            startDelegateAI(new AIRobotGotoSleep(robot));
        }
    } else if (ai instanceof AIRobotStripesHandler) {
        releaseBlockFound();
    }
}
Also used : AIRobotSearchAndGotoBlock(buildcraft.robotics.ai.AIRobotSearchAndGotoBlock) AIRobotGotoSleep(buildcraft.robotics.ai.AIRobotGotoSleep) AIRobotStripesHandler(buildcraft.robotics.ai.AIRobotStripesHandler) AIRobotFetchAndEquipItemStack(buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack)

Example 4 with AIRobotFetchAndEquipItemStack

use of buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack in project BuildCraft by BuildCraft.

the class BuildCraftRobotics method init.

@Mod.EventHandler
public void init(FMLInitializationEvent evt) {
    NetworkRegistry.INSTANCE.registerGuiHandler(instance, new RoboticsGuiHandler());
    MinecraftForge.EVENT_BUS.register(this);
    if (BuildCraftCore.loadDefaultRecipes && Loader.isModLoaded("BuildCraft|Silicon")) {
        loadRecipes();
    }
    BCCreativeTab.get("boards").setIcon(new ItemStack(BuildCraftRobotics.redstoneBoard, 1));
    BuilderAPI.schematicRegistry.registerSchematicBlock(requesterBlock, SchematicTile.class);
    PipeManager.registerPipePluggable(RobotStationPluggable.class, "robotStation");
    EntityRegistry.registerModEntity(EntityRobot.class, "bcRobot", EntityIds.ROBOT, instance, 50, 1, true);
    BCRegistry.INSTANCE.registerTileEntity(TileZonePlan.class, "net.minecraft.src.buildcraft.commander.TileZonePlan");
    BCRegistry.INSTANCE.registerTileEntity(TileRequester.class, "net.minecraft.src.buildcraft.commander.TileRequester");
    RobotManager.registryProvider = new RobotRegistryProvider();
    RobotManager.registerAIRobot(AIRobotMain.class, "aiRobotMain", "buildcraft.core.robots.AIRobotMain");
    RobotManager.registerAIRobot(BoardRobotEmpty.class, "boardRobotEmpty");
    RobotManager.registerAIRobot(BoardRobotBomber.class, "boardRobotBomber", "buildcraft.core.robots.boards.BoardRobotBomber");
    if (Loader.isModLoaded("BuildCraft|Builders")) {
        RobotManager.registerAIRobot(BoardRobotBuilder.class, "boardRobotBuilder", "buildcraft.core.robots.boards.BoardRobotBuilder");
    }
    RobotManager.registerAIRobot(BoardRobotButcher.class, "boardRobotButcher", "buildcraft.core.robots.boards.BoardRobotButcher");
    RobotManager.registerAIRobot(BoardRobotCarrier.class, "boardRobotCarrier", "buildcraft.core.robots.boards.BoardRobotCarrier");
    RobotManager.registerAIRobot(BoardRobotDelivery.class, "boardRobotDelivery", "buildcraft.core.robots.boards.BoardRobotDelivery");
    RobotManager.registerAIRobot(BoardRobotFarmer.class, "boardRobotFarmer", "buildcraft.core.robots.boards.BoardRobotFarmer");
    RobotManager.registerAIRobot(BoardRobotFluidCarrier.class, "boardRobotFluidCarrier", "buildcraft.core.robots.boards.BoardRobotFluidCarrier");
    RobotManager.registerAIRobot(BoardRobotHarvester.class, "boardRobotHarvester", "buildcraft.core.robots.boards.BoardRobotHarvester");
    RobotManager.registerAIRobot(BoardRobotKnight.class, "boardRobotKnight", "buildcraft.core.robots.boards.BoardRobotKnight");
    RobotManager.registerAIRobot(BoardRobotLeaveCutter.class, "boardRobotLeaveCutter", "buildcraft.core.robots.boards.BoardRobotLeaveCutter");
    RobotManager.registerAIRobot(BoardRobotLumberjack.class, "boardRobotLumberjack", "buildcraft.core.robots.boards.BoardRobotLumberjack");
    RobotManager.registerAIRobot(BoardRobotMiner.class, "boardRobotMiner", "buildcraft.core.robots.boards.BoardRobotMiner");
    RobotManager.registerAIRobot(BoardRobotPicker.class, "boardRobotPicker", "buildcraft.core.robots.boards.BoardRobotPicker");
    RobotManager.registerAIRobot(BoardRobotPlanter.class, "boardRobotPlanter", "buildcraft.core.robots.boards.BoardRobotPlanter");
    RobotManager.registerAIRobot(BoardRobotPump.class, "boardRobotPump", "buildcraft.core.robots.boards.BoardRobotPump");
    RobotManager.registerAIRobot(BoardRobotShovelman.class, "boardRobotShovelman", "buildcraft.core.robots.boards.BoardRobotShovelman");
    RobotManager.registerAIRobot(BoardRobotStripes.class, "boardRobotStripes", "buildcraft.core.robots.boards.BoardRobotStripes");
    RobotManager.registerAIRobot(AIRobotAttack.class, "aiRobotAttack", "buildcraft.core.robots.AIRobotAttack");
    RobotManager.registerAIRobot(AIRobotBreak.class, "aiRobotBreak", "buildcraft.core.robots.AIRobotBreak");
    RobotManager.registerAIRobot(AIRobotDeliverRequested.class, "aiRobotDeliverRequested", "buildcraft.core.robots.AIRobotDeliverRequested");
    RobotManager.registerAIRobot(AIRobotDisposeItems.class, "aiRobotDisposeItems", "buildcraft.core.robots.AIRobotDisposeItems");
    RobotManager.registerAIRobot(AIRobotFetchAndEquipItemStack.class, "aiRobotFetchAndEquipItemStack", "buildcraft.core.robots.AIRobotFetchAndEquipItemStack");
    RobotManager.registerAIRobot(AIRobotFetchItem.class, "aiRobotFetchItem", "buildcraft.core.robots.AIRobotFetchItem");
    RobotManager.registerAIRobot(AIRobotGoAndLinkToDock.class, "aiRobotGoAndLinkToDock", "buildcraft.core.robots.AIRobotGoAndLinkToDock");
    RobotManager.registerAIRobot(AIRobotGoto.class, "aiRobotGoto", "buildcraft.core.robots.AIRobotGoto");
    RobotManager.registerAIRobot(AIRobotGotoBlock.class, "aiRobotGotoBlock", "buildcraft.core.robots.AIRobotGotoBlock");
    RobotManager.registerAIRobot(AIRobotGotoSleep.class, "aiRobotGotoSleep", "buildcraft.core.robots.AIRobotGotoSleep");
    RobotManager.registerAIRobot(AIRobotGotoStation.class, "aiRobotGotoStation", "buildcraft.core.robots.AIRobotGotoStation");
    RobotManager.registerAIRobot(AIRobotGotoStationAndLoad.class, "aiRobotGotoStationAndLoad", "buildcraft.core.robots.AIRobotGotoStationAndLoad");
    RobotManager.registerAIRobot(AIRobotGotoStationAndLoadFluids.class, "aiRobotGotoStationAndLoadFluids", "buildcraft.core.robots.AIRobotGotoStationAndLoadFluids");
    RobotManager.registerAIRobot(AIRobotGotoStationAndUnload.class, "aiRobotGotoStationAndUnload", "buildcraft.core.robots.AIRobotGotoStationAndUnload");
    RobotManager.registerAIRobot(AIRobotGotoStationToLoad.class, "aiRobotGotoStationToLoad", "buildcraft.core.robots.AIRobotGotoStationToLoad");
    RobotManager.registerAIRobot(AIRobotGotoStationToLoadFluids.class, "aiRobotGotoStationToLoadFluids", "buildcraft.core.robots.AIRobotGotoStationToLoadFluids");
    RobotManager.registerAIRobot(AIRobotGotoStationToUnload.class, "aiRobotGotoStationToUnload", "buildcraft.core.robots.AIRobotGotoStationToUnload");
    RobotManager.registerAIRobot(AIRobotGotoStationToUnloadFluids.class, "aiRobotGotoStationToUnloadFluids", "buildcraft.core.robots.AIRobotGotoStationToUnloadFluids");
    RobotManager.registerAIRobot(AIRobotHarvest.class, "aiRobotHarvest");
    RobotManager.registerAIRobot(AIRobotLoad.class, "aiRobotLoad", "buildcraft.core.robots.AIRobotLoad");
    RobotManager.registerAIRobot(AIRobotLoadFluids.class, "aiRobotLoadFluids", "buildcraft.core.robots.AIRobotLoadFluids");
    RobotManager.registerAIRobot(AIRobotPlant.class, "aiRobotPlant");
    RobotManager.registerAIRobot(AIRobotPumpBlock.class, "aiRobotPumpBlock", "buildcraft.core.robots.AIRobotPumpBlock");
    RobotManager.registerAIRobot(AIRobotRecharge.class, "aiRobotRecharge", "buildcraft.core.robots.AIRobotRecharge");
    RobotManager.registerAIRobot(AIRobotSearchAndGotoBlock.class, "aiRobotSearchAndGoToBlock");
    RobotManager.registerAIRobot(AIRobotSearchAndGotoStation.class, "aiRobotSearchAndGotoStation", "buildcraft.core.robots.AIRobotSearchAndGotoStation");
    RobotManager.registerAIRobot(AIRobotSearchBlock.class, "aiRobotSearchBlock", "buildcraft.core.robots.AIRobotSearchBlock");
    RobotManager.registerAIRobot(AIRobotSearchEntity.class, "aiRobotSearchEntity", "buildcraft.core.robots.AIRobotSearchEntity");
    RobotManager.registerAIRobot(AIRobotSearchRandomGroundBlock.class, "aiRobotSearchRandomGroundBlock", "buildcraft.core.robots.AIRobotSearchRandomGroundBlock");
    RobotManager.registerAIRobot(AIRobotSearchStackRequest.class, "aiRobotSearchStackRequest", "buildcraft.core.robots.AIRobotSearchStackRequest");
    RobotManager.registerAIRobot(AIRobotSearchStation.class, "aiRobotSearchStation", "buildcraft.core.robots.AIRobotSearchStation");
    RobotManager.registerAIRobot(AIRobotShutdown.class, "aiRobotShutdown");
    RobotManager.registerAIRobot(AIRobotSleep.class, "aiRobotSleep", "buildcraft.core.robots.AIRobotSleep");
    RobotManager.registerAIRobot(AIRobotStraightMoveTo.class, "aiRobotStraightMoveTo", "buildcraft.core.robots.AIRobotStraightMoveTo");
    RobotManager.registerAIRobot(AIRobotUnload.class, "aiRobotUnload", "buildcraft.core.robots.AIRobotUnload");
    RobotManager.registerAIRobot(AIRobotUnloadFluids.class, "aiRobotUnloadFluids", "buildcraft.core.robots.AIRobotUnloadFluids");
    RobotManager.registerAIRobot(AIRobotUseToolOnBlock.class, "aiRobotUseToolOnBlock", "buildcraft.core.robots.AIRobotUseToolOnBlock");
    RobotManager.registerDockingStation(DockingStationPipe.class, "dockingStationPipe");
    RoboticsProxy.proxy.init();
    ListRegistry.itemClassAsType.add(ItemRobot.class);
}
Also used : RoboticsGuiHandler(buildcraft.robotics.RoboticsGuiHandler) RobotRegistryProvider(buildcraft.robotics.RobotRegistryProvider) ItemStack(net.minecraft.item.ItemStack) AIRobotFetchAndEquipItemStack(buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack)

Example 5 with AIRobotFetchAndEquipItemStack

use of buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack 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));
    }
}
Also used : AIRobotSearchAndGotoBlock(buildcraft.robotics.ai.AIRobotSearchAndGotoBlock) AggregateFilter(buildcraft.lib.inventory.filter.AggregateFilter) ResourceIdBlock(buildcraft.api.robots.ResourceIdBlock) BlockPos(net.minecraft.util.math.BlockPos) ItemStack(net.minecraft.item.ItemStack) AIRobotFetchAndEquipItemStack(buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack) World(net.minecraft.world.World) IBlockFilter(buildcraft.core.lib.utils.IBlockFilter) AIRobotFetchAndEquipItemStack(buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack)

Aggregations

AIRobotFetchAndEquipItemStack (buildcraft.robotics.ai.AIRobotFetchAndEquipItemStack)5 AIRobotSearchAndGotoBlock (buildcraft.robotics.ai.AIRobotSearchAndGotoBlock)4 AIRobotGotoSleep (buildcraft.robotics.ai.AIRobotGotoSleep)3 ItemStack (net.minecraft.item.ItemStack)2 ResourceIdBlock (buildcraft.api.robots.ResourceIdBlock)1 IBlockFilter (buildcraft.core.lib.utils.IBlockFilter)1 AggregateFilter (buildcraft.lib.inventory.filter.AggregateFilter)1 RobotRegistryProvider (buildcraft.robotics.RobotRegistryProvider)1 RoboticsGuiHandler (buildcraft.robotics.RoboticsGuiHandler)1 AIRobotPlant (buildcraft.robotics.ai.AIRobotPlant)1 AIRobotStripesHandler (buildcraft.robotics.ai.AIRobotStripesHandler)1 AIRobotUseToolOnBlock (buildcraft.robotics.ai.AIRobotUseToolOnBlock)1 BlockPos (net.minecraft.util.math.BlockPos)1 World (net.minecraft.world.World)1