SoulFire TypeScript SDK 2.10.3
    Preparing search index...

    Class SoulFireBot

    One bot's lifecycle, actions, live state, and server tasks.

    Obtain a handle through SoulFireClient.createBot, SoulFireInstance.getOrCreateBot, or SoulFireInstance.bot. Direct construction requires RPC clients and is intended for transport integration.

    Call connect before reading state. Operations are lazy Effects or Streams. Actions fail through the Effect error channel when rejected. Use tasks for server jobs, or collect for a workflow that owns collection until completion and cancels unfinished work on interruption.

    Index
    • Parameters

      • instanceId: string
      • id: string
      • botClient: Client<typeof BotService>
      • liveClient: Client<typeof BotLiveService>
      • OptionaltaskClient: Client<
            GenService<
                {
                    cancelBotTask: {
                        input: GenMessage<CancelBotTaskRequest>;
                        methodKind: "unary";
                        output: GenMessage<BotTask>;
                    };
                    getBotTask: {
                        input: GenMessage<GetBotTaskRequest>;
                        methodKind: "unary";
                        output: GenMessage<BotTask>;
                    };
                    listBotTasks: {
                        input: GenMessage<ListBotTasksRequest>;
                        methodKind: "unary";
                        output: GenMessage<ListBotTasksResponse>;
                    };
                    runBotTask: {
                        input: GenMessage<StartBotTaskRequest>;
                        methodKind: "server_streaming";
                        output: GenMessage<BotTaskEvent>;
                    };
                    startBotTask: {
                        input: GenMessage<StartBotTaskRequest>;
                        methodKind: "unary";
                        output: GenMessage<BotTask>;
                    };
                    watchBotTask: {
                        input: GenMessage<WatchBotTaskRequest>;
                        methodKind: "server_streaming";
                        output: GenMessage<BotTaskEvent>;
                    };
                    watchBotTasks: {
                        input: GenMessage<WatchBotTasksRequest>;
                        methodKind: "server_streaming";
                        output: GenMessage<BotTaskEvent>;
                    };
                },
            >,
        >
      • OptionalpathfinderClient: Client<
            GenService<
                {
                    planPath: {
                        input: GenMessage<PlanPathRequest>;
                        methodKind: "unary";
                        output: GenMessage<PlanPathResponse>;
                    };
                },
            >,
        >
      • OptionalchatClient: Client<
            GenService<
                {
                    sendCommand: {
                        input: GenMessage<SendCommandRequest>;
                        methodKind: "unary";
                        output: GenMessage<ChatActionResponse>;
                    };
                    sendPublicChat: {
                        input: GenMessage<SendPublicChatRequest>;
                        methodKind: "unary";
                        output: GenMessage<ChatActionResponse>;
                    };
                    sendWhisper: {
                        input: GenMessage<SendWhisperRequest>;
                        methodKind: "unary";
                        output: GenMessage<ChatActionResponse>;
                    };
                    tabComplete: {
                        input: GenMessage<TabCompleteRequest>;
                        methodKind: "unary";
                        output: GenMessage<TabCompleteResponse>;
                    };
                },
            >,
        >
      • OptionalinventoryClient: Client<
            GenService<
                {
                    closeSemanticContainer: {
                        input: GenMessage<CloseSemanticContainerRequest>;
                        methodKind: "unary";
                        output: GenMessage<InventoryMutationResponse>;
                    };
                    countItems: {
                        input: GenMessage<CountItemsRequest>;
                        methodKind: "unary";
                        output: GenMessage<CountItemsResponse>;
                    };
                    equipItem: {
                        input: GenMessage<EquipItemRequest>;
                        methodKind: "unary";
                        output: GenMessage<InventoryMutationResponse>;
                    };
                    findInventorySlots: {
                        input: GenMessage<FindInventorySlotsRequest>;
                        methodKind: "unary";
                        output: GenMessage<FindInventorySlotsResponse>;
                    };
                    getContainerSnapshot: {
                        input: GenMessage<GetContainerSnapshotRequest>;
                        methodKind: "unary";
                        output: GenMessage<GetContainerSnapshotResponse>;
                    };
                    moveInventoryItem: {
                        input: GenMessage<MoveInventoryItemRequest>;
                        methodKind: "unary";
                        output: GenMessage<InventoryMutationResponse>;
                    };
                    openBlockContainer: {
                        input: GenMessage<OpenBlockContainerRequest>;
                        methodKind: "unary";
                        output: GenMessage<InventoryMutationResponse>;
                    };
                    rankInventoryItems: {
                        input: GenMessage<RankInventoryItemsRequest>;
                        methodKind: "unary";
                        output: GenMessage<RankInventoryItemsResponse>;
                    };
                    selectHotbarItem: {
                        input: GenMessage<SelectHotbarItemRequest>;
                        methodKind: "unary";
                        output: GenMessage<InventoryMutationResponse>;
                    };
                    tossItems: {
                        input: GenMessage<TossItemsRequest>;
                        methodKind: "unary";
                        output: GenMessage<InventoryMutationResponse>;
                    };
                    transferItems: {
                        input: GenMessage<TransferItemsRequest>;
                        methodKind: "unary";
                        output: GenMessage<InventoryMutationResponse>;
                    };
                    unequipItem: {
                        input: GenMessage<UnequipItemRequest>;
                        methodKind: "unary";
                        output: GenMessage<InventoryMutationResponse>;
                    };
                },
            >,
        >
      • OptionalrecipeClient: Client<
            GenService<
                {
                    canCraft: {
                        input: GenMessage<CanCraftRequest>;
                        methodKind: "unary";
                        output: GenMessage<CanCraftResponse>;
                    };
                    listRecipes: {
                        input: GenMessage<ListRecipesRequest>;
                        methodKind: "unary";
                        output: GenMessage<ListRecipesResponse>;
                    };
                    listVillagerTrades: {
                        input: GenMessage<ListVillagerTradesRequest>;
                        methodKind: "unary";
                        output: GenMessage<ListVillagerTradesResponse>;
                    };
                },
            >,
        >
      • OptionalregistryClient: Client<
            GenService<
                {
                    getRegistryEntry: {
                        input: GenMessage<GetRegistryEntryRequest>;
                        methodKind: "unary";
                        output: GenMessage<GetRegistryEntryResponse>;
                    };
                    getRegistryIdentity: {
                        input: GenMessage<GetRegistryIdentityRequest>;
                        methodKind: "unary";
                        output: GenMessage<GetRegistryIdentityResponse>;
                    };
                    listRegistryEntries: {
                        input: GenMessage<ListRegistryEntriesRequest>;
                        methodKind: "unary";
                        output: GenMessage<ListRegistryEntriesResponse>;
                    };
                    listRegistryTags: {
                        input: GenMessage<ListRegistryTagsRequest>;
                        methodKind: "unary";
                        output: GenMessage<ListRegistryTagsResponse>;
                    };
                },
            >,
        >
      • OptionalworldClient: Client<
            GenService<
                {
                    canSeeBlock: {
                        input: GenMessage<CanSeeBlockRequest>;
                        methodKind: "unary";
                        output: GenMessage<CanSeeBlockResponse>;
                    };
                    estimateDigTime: {
                        input: GenMessage<EstimateDigTimeRequest>;
                        methodKind: "unary";
                        output: GenMessage<EstimateDigTimeResponse>;
                    };
                    estimateExplosionDamage: {
                        input: GenMessage<EstimateExplosionDamageRequest>;
                        methodKind: "unary";
                        output: GenMessage<EstimateExplosionDamageResponse>;
                    };
                    getPlayerSnapshot: {
                        input: GenMessage<GetPlayerSnapshotRequest>;
                        methodKind: "unary";
                        output: GenMessage<GetPlayerSnapshotResponse>;
                    };
                    getWorldBlock: {
                        input: GenMessage<GetWorldBlockRequest>;
                        methodKind: "unary";
                        output: GenMessage<GetWorldBlockResponse>;
                    };
                    getWorldEntity: {
                        input: GenMessage<GetWorldEntityRequest>;
                        methodKind: "unary";
                        output: GenMessage<GetWorldEntityResponse>;
                    };
                    queryBlocks: {
                        input: GenMessage<QueryBlocksRequest>;
                        methodKind: "unary";
                        output: GenMessage<QueryBlocksResponse>;
                    };
                    queryEntities: {
                        input: GenMessage<QueryEntitiesRequest>;
                        methodKind: "unary";
                        output: GenMessage<QueryEntitiesResponse>;
                    };
                    raycast: {
                        input: GenMessage<RaycastRequest>;
                        methodKind: "unary";
                        output: GenMessage<RaycastResponse>;
                    };
                },
            >,
        >
      • OptionalprotocolClient: Client<
            GenService<
                {
                    getProtocolInfo: {
                        input: GenMessage<BotProtocolRequest>;
                        methodKind: "unary";
                        output: GenMessage<BotProtocolInfo>;
                    };
                    listPacketSchemas: {
                        input: GenMessage<ListPacketSchemasRequest>;
                        methodKind: "unary";
                        output: GenMessage<ListPacketSchemasResponse>;
                    };
                    sendRawPacket: {
                        input: GenMessage<SendRawPacketRequest>;
                        methodKind: "unary";
                        output: GenMessage<SendRawPacketResponse>;
                    };
                    watchPackets: {
                        input: GenMessage<WatchPacketsRequest>;
                        methodKind: "server_streaming";
                        output: GenMessage<RawPacketEvent>;
                    };
                },
            >,
        >

      Returns SoulFireBot

    id: string
    instanceId: string
    • get state(): BotSessionState

      Latest state from the session attached by connect.

      This synchronous property performs no request. It returns empty state before connection and after scope cleanup. State can lag behind the server; use a session predicate to wait for a required update.

      Returns BotSessionState

    • Clicks a button of the open container: a stonecutter recipe or a loom pattern (its position in the menu's list), an enchanting option (0-2), or a lectern's previous page (1), next page (2) or take book (3). Villagers, beacons, crafters and other containers don't react to it on a vanilla server. Doesn't wait for the server, which may refuse the click (too few levels, no such recipe) without an error.

      Parameters

      • buttonId: number
      • Optionaloptions: CallOptions

      Returns Effect<void, SoulFireOperationError>

    • Clicks slot of the open menu like a mouse; -999 clicks outside it, dropping what the cursor holds. clickType defaults to LEFT_CLICK. hotbarSlot (0-8) is the slot SWAP_HOTBAR swaps with, and defaults to 0.

      Parameters

      • slot: number
      • clickType: ClickType = ClickType.LEFT_CLICK
      • hotbarSlot: number = 0
      • Optionaloptions: CallOptions

      Returns Effect<void, SoulFireOperationError>

    • Collect matching blocks and wait for the typed task result.

      Parameters

      • target: string | readonly string[]

        Block IDs or tags prefixed with #, as one string or an array.

      • options: CollectBlocksTaskOptions = {}

        Count, search distance, pathfinding, and scheduling options.

      Returns Effect<CollectBlocksTaskResult, SoulFireOperationError>

      An Effect that produces the collection result on successful completion.

      This helper owns the task. Interruption or failure before completion requests cancellation of unfinished server work. Use SoulFireTasks.collectBlocks for a handle with explicit ownership. Non-successful terminal status fails with SoulFireTaskFailed through the Effect error channel.

      const result = yield* bot.collect("#minecraft:logs", { count: 16 });
      yield* Effect.logInfo(result);
    • Start the bot if necessary and wait for its initial player snapshot.

      Parameters

      • options: Pick<GetOrCreateBotOptions, "readyTimeoutMs" | "call"> = {}

        Readiness deadline and per-RPC call options.

      Returns Effect<void, SoulFireOperationError, Scope>

      An Effect with no result value that requires Scope.

      An attached session makes this operation a no-op. Otherwise, it reads the bot's desired state, starts a stopped bot, and attaches observation. Scope cleanup stops the bot only if this operation started it. A previously running bot keeps its running state.

      readyTimeoutMs defaults to 30,000 milliseconds and must be positive and finite. It bounds startup and the initial player snapshot. An expired deadline fails with SoulFireTimeoutError; RPC failures use the Effect error channel. start alone does not attach observation.

    • Picks up the stack in fromSlot and puts it in toSlot; what stays on the cursor goes back.

      Parameters

      • fromSlot: number
      • toSlot: number
      • Optionaloptions: CallOptions

      Returns Effect<void, SoulFireOperationError>

    • Open a scoped session that maintains state from bot events.

      Parameters

      • Optionaloptions: BotSessionOptions

        Filters, buffering, readiness, and resumption configuration.

      Returns Effect<BotSession, SoulFireOperationError, Scope>

      An Effect that produces a BotSession and requires Scope.

      With no custom options, reuse an attached session if present. Otherwise, this operation creates a separate session. It does not start the bot or attach the new session to state; read the returned session's state instead. The scope closes the subscription.

    • Same as camera.capture.

      Parameters

      • request: {
            cameraX?: number;
            cameraY?: number;
            cameraZ?: number;
            fov?: number;
            height?: number;
            includeDebugTrace?: boolean;
            includeHands?: boolean;
            includeHud?: boolean;
            maxDistance?: number;
            width?: number;
            xRot?: number;
            yRot?: number;
        } = {}
      • Optionaloptions: CallOptions

      Returns Effect<BotRenderPovResponse, SoulFireOperationError>