Use inventory and interact
API 4 exposes two narrow operations:
inventory.ensure_heldselects a matching item already available to the hotbar.interact.usesubmits one use against an observed entity or block target.
Hold a tool
local held = hexis.await(hexis.inventory.ensure_held({
selector = {name_patterns = {"Pickaxe", "Drill"}},
}), {timeout = 5})
if not held.ok then return end
Your bundle needs inventory. This is not a general inventory organizer. It
does not move arbitrary stacks between containers.
Use an observed entity
local found = hexis.world.entities.find({
area = {kind = "radius", radius = 6.0},
selector = {type_ids = {"minecraft:player"}},
limit = 16,
})
local target = found.entities[1]
if not target then return end
local used = hexis.await(hexis.interact.use({
target = {kind = "entity", ref = target.ref},
}), {timeout = 3})
Your bundle needs interaction and the observation capability used to find
the target. Add held to the request when one specific item must be selected
before use.
Success means Hexis submitted the bounded use according to the action contract. Verify the expected consequence with a new GUI or world observation.
foraging.catch_tadpole is a separate bounded interaction that also requires
inventory. It is task-specific, not a general fishing API.