Types¶
Named types used throughout the API. An alias names the values a string parameter or field accepts; a table type describes the fields of a table you pass to a function or get back from one. Your editor's Lua language server knows them too, so it completes the values and flags typos.
Aliases¶
AttackMode¶
How a mob attacks in an attack task, see MobEntity:startAttack.
Values
- "auto" — Shoot if the mob is able to shoot and holds a bow, a crossbow or a trident, or if it cannot hit at all, like a snow golem. Hit otherwise.
- "melee" — Always hit.
- "ranged" — Shoot if the mob is able to, for example to make a witch throw potions rather than punch. A mob that cannot shoot, like a zombie or a skeleton without a bow, hits instead.
BotMessageKind¶
Where a player would see a text that a bot got, see BotMessageEvent.
Values
- "actionbar" — Above the hotbar, like the text of
/title ... actionbar. - "chat" — In the chat: what a player wrote there.
- "emote" — In the chat: a
/me. - "say" — In the chat: a
/say. - "subtitle" — In the middle of the screen, below the title, like the text of
/title ... subtitle. A player only sees it together with a title. - "system" — In the chat, without a sender: the answer of a command, what a spell prints, a
/tellraw, or news like "Bob joined the game". - "team" — In the chat: a
/teammsgof a member of the bot's team. - "title" — In the middle of the screen, like the text of
/title ... title. - "whisper" — In the chat: a
/msg,/tellor/wto the bot.
ClickMode¶
How a bot clicks a menu slot, see Bot:clickSlot. The names follow the vanilla click types.
Values
- "clone" — Middle click: takes a full stack of the slot's item onto the cursor. Creative only.
- "pickup" — Left (button 0) or right (button 1) click: picks up, places or swaps what the cursor holds.
- "pickup_all" — Double click: gathers all items like the one on the cursor onto it.
- "quick_craft" — One step of dragging items across slots; the button encodes the step.
- "quick_move" — Shift click: moves the slot's items into the other part of the menu.
- "swap" — Number key: swaps the slot with a hotbar slot (button 0 to 8) or the off hand (button 40).
- "throw" — Q: drops one item (button 0) or the stack (button 1) of the slot.
CompassDirection¶
One of the four horizontal directions.
Values
- "north" — Toward negative z.
- "east" — Toward positive x.
- "south" — Toward positive z.
- "west" — Toward negative x.
Difficulty¶
The difficulty of the game. A hardcore world is always "hard".
Values
- "peaceful"
- "easy"
- "normal"
- "hard"
DimensionName¶
The name of a dimension. Besides the vanilla ones, any dimension id is accepted, such as one added by a data pack.
Values
- "overworld"
- "the_nether"
- "the_end"
- string
EquipmentSlot¶
An equipment slot of a living entity.
Values
- Hand
- "feet" — Boots.
- "legs" — Leggings.
- "chest" — Chestplate or elytra.
- "head" — Helmet, or anything else worn on the head.
- "body" — Armor of an animal, like horse armor or a llama's carpet.
- "saddle" — The saddle of a horse, pig or strider.
GameMode¶
A player's game mode.
Values
- "survival"
- "creative"
- "adventure"
- "spectator"
Hand¶
One of the two hands of a living entity.
Values
- "mainhand" — The main hand; for a player it holds the selected hotbar item.
- "offhand" — The off hand.
HiddenAspect¶
Something a living entity shows or lets hear that can be hidden from the players, see
LivingEntity:setHidden.
Values
- "equipment" — What the entity holds and wears. Its hands and armor slots look empty to the players who see it; a player whose equipment is hidden still sees it on themselves.
- "arrows" — The arrows and bee stingers that stick in the entity. Hiding them removes the ones that stick in it now, and none are added while they are hidden.
- "effectParticles" — The particles that rise from the entity's effects.
- "stepParticles" — The dust the entity raises when it sprints and when it lands after a fall. A player whose step particles are hidden still sees their own sprint dust.
- "stepSounds" — The sounds of the entity's steps and of its swimming. Sculk sensors still notice its steps. A player whose step sounds are hidden still hears their own.
HitType¶
What a raycast hit.
Values
- "block" — A block; the result is a
BlockHitResult. - "entity" — An entity; the result is an
EntityHitResult. - "miss" — Nothing.
LogTarget¶
Where the output of log(...) is sent, see WizardsOfLua.log.
Values
- "source" — To the spell's command source.
- "operators" — To all server operators.
- "console" — To the Minecraft server console.
- "none" — Nowhere; the output is discarded.
MoveDirection¶
A direction to move in: an absolute one, or one relative to the yaw.
Values
- Side
- "forward" — In the direction of the yaw.
- "back" — Against the direction of the yaw.
- "left" — To the left of the yaw.
- "right" — To the right of the yaw.
Side¶
One of the six sides of a block, or a direction along one of the three axes.
Values
- CompassDirection
- "up" — Toward positive y.
- "down" — Toward negative y.
SkinReason¶
Why Skin:lookup found no skin.
Values
- "not_found" — No account of that name exists.
- "timeout" — The wait ended before the answer arrived. The lookup goes on, and a later one may find the answer remembered.
- "unavailable" — The lookup failed, for example because the server has no internet access. Asking again looks it up again.
TaskName¶
The kind of task a mob or bot executes, as MobEntity.task.name and Bot.task.name tell it.
Values
- "path" — Started by
startPathToorstartPathAlong. - "attack" — Started by
startAttack. - "follow" — Started by
startFollow. - "flee" — Started by
startFleeFrom. - "stay" — Started by
startStay. - "break" — Started by
startBreakBlock. - "place" — Started by
startPlaceBlock. - "put" — Started by
startPutInto. - "take" — Started by
startTakeFrom.
TaskReason¶
Why a mob or bot task did not start, failed or was interrupted. A start... function returns it
as its second value, and MobEntity.task.reason or Bot.task.reason holds it once the task has
ended that way.
Values
- "no_path" — No route to the target could be found within
searchRange. - "unreachable" — The mob or bot could not get there, or got stuck on the way.
- "invalid_target" — The target is dead or gone, or the game refuses it as a target, which is the case for players in creative or spectator mode and for ghasts; a bot can't follow or attack itself. For
startBreakBlock: the block is air or a fluid. - "other_dimension" — The target is in another world. For
startPathAlong: the path was searched in another world. - "off_path" — The mob or bot isn't on the path it should walk along. Only
startPathAlongreturns it. - "ai_disabled" — The mob's
aiisfalse, so it executes no tasks at all. - "ai_blocked" — The mob's own behavior did not hand over control within a second. This happens while it is doing something it cannot be interrupted in, such as a dolphin swimming up for air, and it can happen with mobs added by other mods.
- "self_preservation" — The mob had to take care of itself, for example to breathe.
- "no_damage" — The mob has no attack damage of its own and none was given. Only an attack task ends this way, and only if the attack damage is taken away while it runs.
- "died" — The mob died.
- "unloaded" — The mob was unloaded, or the mob or bot changed world, which cancels its task.
- "offline" — The bot left the server. Bots only.
- "unbreakable" — The block cannot be broken at all, like bedrock.
- "not_allowed" — The game doesn't let the bot break the block, or place one there: in adventure mode, near the world spawn for a player who is no operator, beyond the world border, or when a spell cancels the break with
BeforePlayerBlockBreakEvent. Or the container doesn't open for the bot. Bots only. - "target_changed" — The block was replaced by another one, or the container is gone.
- "occupied" — A block or another entity is where the block should be placed.
- "not_a_block" — The item in the hand cannot be placed as a block.
- "hand_empty" — The hand that should give an item holds none.
- "no_items" — The bot's inventory holds none of the items to put in. Bots only.
- "cannot_place" — The block cannot stay where it should be placed, like a torch above a hole. For a bot also: there is no neighboring block to place it against, or the click placed nothing, for example because a spell cancelled it.
- "hand_full" — The hand that should take items holds something else, or a full stack.
- "inventory_full" — The bot's inventory took none of the items. Bots only.
- "invalid_slot" — The container has no such
slot. Bots only. - "no_container" — There is no container at the given position.
- "container_full" — The container took none of the items.
- "nothing_to_take" — Nothing in the container matched.
- "replaced" — Another task was started.
- "stopped" — The task was stopped by
stopTask, or, for a bot, by assigninginput.
TaskState¶
The state of a mob or bot task, as MobEntity.task.state and Bot.task.state tell it.
Values
- "running" — The task is being executed.
- "finished" — The task reached its goal.
- "failed" — The task could not reach its goal;
reasontells why. - "interrupted" — Something else ended the task: another task replaced it, it was stopped, or the mob's
aiwas switched off.reasontells which.
Tables¶
BotAttackOptions¶
The options of Bot:startAttack.
Has the fields of BotJumpOptions as well.
Fields
- cooldown?: number — The number of ticks between two hits or shots, an integer. Defaults to waiting until the weapon has recharged and the entity has stopped flashing red, see
Bot:startAttack. - distance?: number — How far away the bot may shoot from, in blocks. Defaults to 15.
- chase?: boolean — Whether the bot may move toward the entity at all; with
falseit holds its position, faces the entity and attacks whenever it comes within reach. Defaults totrue. - searchInterval?: number|false — The number of ticks between two path searches, an integer of at least 1, or
falsefor a single search. Defaults to 8. - watchTarget?: Entity|Vec3 — An entity or a position the bot keeps looking at until it hits or shoots. Defaults to looking where it goes.
BotFindPathOptions¶
The options of Bot:findPath: those that tell where a path may lead, as for Bot:startPathTo.
Fields
- targetRadius?: number — The distance in blocks at which the target counts as reached, an integer. Defaults to 1.
- searchRange?: number — How far in blocks a path search looks ahead, an integer. Defaults to 50.
- ladders?: boolean — Whether the path may lead along ladders and vines. Defaults to
true. - doors?: boolean — Whether the path may lead through wooden doors, fence gates and trapdoors, which the bot clicks. Defaults to
true. - maxFall?: number — The deepest drop in blocks the path may lead down onto the ground (into water, any), an integer. Defaults to the bot's
safe_fall_distanceattribute rounded down: 3 for a player. - jumps?: boolean — Whether the path may lead across gaps, which the bot jumps. Defaults to
false. - jumpTries?: number — The most jumps the search may try, an integer; only with
jumps. Defaults to 10000.
BotFleeFromOptions¶
The options of Bot:startFleeFrom. The bot runs on foot, never across gaps, so there is no
jumps. Unlike for the other tasks, sprint defaults to true.
Has the fields of BotWalkOptions as well.
Fields
- distance?: number — The distance in blocks at which the bot stops running. Defaults to 10.
- watchTarget?: Entity|Vec3 — An entity or a position the bot keeps looking at while it runs. Defaults to looking where it goes.
BotFollowOptions¶
The options of Bot:startFollow.
Has the fields of BotJumpOptions as well.
Fields
- distance?: number — The distance in blocks to keep. Defaults to 2.
- searchInterval?: number|false — The number of ticks between two path searches, an integer of at least 1, or
falsefor a single search. Defaults to 8. - watchTarget?: Entity|Vec3 — An entity or a position the bot keeps looking at. Defaults to looking where it goes, and at the entity it follows while it waits.
BotInput¶
The movement keys a bot holds down, see Bot.input. A key that is missing or false is up.
Fields
- forward?: boolean — Walks forward, in the direction the bot looks.
- back?: boolean — Walks backward.
- left?: boolean — Steps to the left.
- right?: boolean — Steps to the right.
- jump?: boolean — Jumps, again and again while held down; swims up in water, and flies up while flying.
- sneak?: boolean — Sneaks, which also makes it slower; dives in water, and flies down while flying.
- sprint?: boolean — Sprints while walking forward, as long as the bot isn't too hungry.
BotJumpOptions¶
The options of the bot tasks that walk, and on the way may jump across gaps: all but
Bot:startFleeFrom and Bot:startPathAlong. Bot:startBreakBlock takes these alone.
Has the fields of BotWalkOptions as well.
Fields
- jumps?: boolean — Whether the bot's paths may lead across gaps, which it jumps, see
Bot:startPathTo. Defaults tofalse. - jumpTries?: number — The most jumps a path search may try, an integer; only with
jumps. More tries find longer and harder ways, but take longer. Defaults to 10000.
BotMenu¶
A copy of the menu a bot has open, see Bot.menu.
Fields
- type: string — The menu type, like "generic_9x3" for a chest, or "inventory" for the bot's own inventory, which is open whenever no other menu is.
- size: number — The number of slots. Slot indices go from 0 to
size - 1: first the container's slots, then the bot's inventory. - carried?: Item — A copy of the item on the cursor, or
nilif there is none.
BotPathAlongOptions¶
The options of Bot:startPathAlong: those that tell how the bot walks, as for
Bot:startPathTo. Where the path leads was decided when it was searched.
Fields
- sprint?: boolean — Whether the bot sprints, as long as it isn't too hungry. Defaults to
false. - sprintJumps?: boolean — Whether the bot sprints, and jumps along straight, level stretches of its way. Defaults to
false. - closeDoors?: boolean — Whether the bot puts back the doors, fence gates and trapdoors it clicked behind itself. Defaults to
true. - watchTarget?: Entity|Vec3 — An entity or a position the bot keeps looking at on its way. Defaults to looking where it goes.
BotPathToOptions¶
The options of Bot:startPathTo.
Has the fields of BotJumpOptions as well.
Fields
- targetRadius?: number — The distance in blocks at which the target counts as reached, an integer. Defaults to 1.
- watchTarget?: Entity|Vec3 — An entity or a position the bot keeps looking at on its way. Defaults to looking where it goes.
BotPlaceBlockOptions¶
The options of Bot:startPlaceBlock.
Has the fields of BotJumpOptions as well.
Fields
- hand?: Hand — The hand holding the block. Defaults to "mainhand".
- against?: Side — The side of the position where the block rests. Defaults to any side with a block to click, the one below first.
BotPutIntoOptions¶
The options of Bot:startPutInto.
Has the fields of BotJumpOptions as well.
Fields
- item?: string|string[ ] — An item id, an item tag starting with "#", or a list of them. Defaults to the stack the bot has selected.
- count?: number — The most items to put in, an integer. Defaults to all of them.
- slot?: number — The container's slot to put them into, an integer from 0, as
Bot:clickSlotcounts it. Defaults to where the container's menu sends them.
BotStayOptions¶
The options of Bot:startStay. The options of BotJumpOptions only count while the bot holds
its spot.
Has the fields of BotJumpOptions as well.
Fields
- duration?: number — The number of ticks to stay, an integer, counted from when the bot first stands on its spot. Defaults to no limit.
- pos?: Vec3 — The position whose block the bot walks to and holds. Defaults to where it stands.
- radius?: number — How far, in blocks, the bot may be moved off its spot before it goes back. Defaults to
0withpos, and to not holding the spot without. - watchTarget?: Entity|Vec3 — An entity or a position the bot keeps looking at. Defaults to looking where it looks, or where it goes.
BotTakeFromOptions¶
The options of Bot:startTakeFrom.
Has the fields of BotJumpOptions as well.
Fields
- item?: string|string[ ] — An item id, an item tag starting with "#", or a list of them. Defaults to any item.
- count?: number — The most items to take, an integer. Defaults to all of them.
- slot?: number — The container's slot to take from, an integer from 0, as
Bot:clickSlotcounts it. Defaults to all its slots.
BotTask¶
A copy of a bot's task, as Bot.task gives it. The first four fields are always there; the
others only for the tasks that have them, as each field tells.
Fields
- name: TaskName — The kind of task: "path", "follow", "flee", "attack", "break", "place", "put", "take" or "stay".
- state: TaskState — The state of the task.
- reason?: TaskReason — Why the task failed or was interrupted: "unreachable", "invalid_target", "other_dimension", "not_allowed", "target_changed", "hand_empty", "no_items", "not_a_block", "occupied", "cannot_place", "container_full", "nothing_to_take", "inventory_full", "invalid_slot", "died", "offline" (the bot left the server), "unloaded" (it changed world), "replaced" or "stopped".
nilwhile it runs and after it finished. - age: number — The number of ticks since the task started.
- target?: Vec3|Entity — The position the task was started with, as a copy, with whole-number coordinates for a block, or the entity, as a reference. All tasks but stay.
- searchRange?: number — The maximum path length in blocks. All tasks but stay.
- sprint?: boolean — Whether the bot sprints. All tasks but stay.
- sprintJumps?: boolean — Whether the bot sprints, and jumps along straight, level stretches. All tasks but stay.
- ladders?: boolean — Whether the bot's paths may lead along ladders and vines. All tasks but stay.
- doors?: boolean — Whether the bot clicks wooden doors, fence gates and trapdoors on its way. All tasks but stay.
- closeDoors?: boolean — Whether the bot puts back the doors, fence gates and trapdoors it clicked behind itself. All tasks but stay.
- maxFall?: number — The deepest drop in blocks the bot's paths may lead down. All tasks but stay.
- jumps?: boolean — Whether the bot's paths may lead across gaps, which it jumps. All tasks but stay.
- jumpTries?: number — The most jumps a path search may try, if
jumpsistrue. All tasks but stay. - targetRadius?: number — The distance in blocks at which the target counts as reached. Path.
- traveled?: number — The distance in blocks the bot has come along its path so far. Path.
- remainingDistance?: number — The length in blocks of the rest of the path. Path.
- reachable?: boolean —
falsewhen the path stops short of the target. While the bot works out jumps, of the path on foot (Path), or of the last path it got (Follow, Attack).nilwhile a bot that follows or attacks has no path: before its first search, and while it is close enough. Path, Follow, Attack. - searching?: boolean —
truewhile the bot works out a path with jumps. Path, Follow, Attack. - searchInterval?: number|false — The number of ticks between two path searches, or
falseif the bot searches only once. Follow, Attack. - watchTarget?: Entity|Vec3 — What the bot keeps looking at, if it was given: the entity, as a reference, or the position, as a copy. Path, Follow, Flee, Stay.
- distance?: number — The distance in blocks to keep from the target (Follow), at which the bot stops running (Flee), or from which the bot may shoot (Attack).
- mode?: "melee"|"ranged" — Whether the bot hits or shoots, depending on what it holds. Attack.
- cooldown?: number — The number of ticks between two hits or shots, if it was given. Attack.
- chase?: boolean — Whether the bot may move toward its target. Attack.
- hits?: number — The number of hits and arrows that hurt the target so far. Attack.
- shots?: number — The number of arrows the bot fired so far. Attack.
- progress?: number — How far the bot has dug the block, from 0 to 1. It starts over when the bot stops digging, and is 1 once the block is gone. Break.
- hand?: Hand — The hand holding the block. Place.
- against?: Side — The side of the position where the block rests, if it was given. Place.
- count?: number — The maximum number of items to move, if it was given. Put, Take.
- moved?: number — The number of items moved so far. Put, Take.
- slot?: number — The container's slot to put into or take from, if it was given. Put, Take.
- duration?: number — The number of ticks to stand still, if it was given. Stay.
- remaining?: number — The number of ticks left to stand still, if a duration was given. Stay.
- pos?: Vec3 — A copy of the spot the bot holds. Stay, while the bot holds its spot.
- radius?: number — How far, in blocks, the bot may be moved off its spot before it goes back. Stay, while the bot holds its spot.
- away?: boolean —
truewhile the bot is on its way to its spot. Stay, while the bot holds its spot.
BotWalkOptions¶
The options that all bot tasks share which walk along a path: all but Bot:startPathAlong.
Fields
- searchRange?: number — How far in blocks a path search looks ahead, an integer. Defaults to 50.
- sprint?: boolean — Whether the bot sprints, as long as it isn't too hungry. Defaults to
false, forBot:startFleeFromtotrue. - sprintJumps?: boolean — Whether the bot sprints, and jumps along straight, level stretches of its way, as players often do. Defaults to
false. - ladders?: boolean — Whether the bot's paths may lead along ladders and vines. Defaults to
true. - doors?: boolean — Whether the bot clicks wooden doors, fence gates and trapdoors on its way. Defaults to
true. - closeDoors?: boolean — Whether the bot puts back the doors, fence gates and trapdoors it clicked behind itself. Defaults to
true. - maxFall?: number — The deepest drop in blocks the bot's paths may lead down onto the ground (into water, any), an integer. Defaults to the bot's
safe_fall_distanceattribute rounded down, the most it falls without damage: 3 for a player.
CommandSpec¶
The definition of a dynamic command, see WizardsOfLua.setCommand and
WizardsOfLua.listCommands.
Fields
- id: string — The unique identifier of the command, which is also its permission node.
- level?: number — The operator level required to run the command, from 0 to 4. Defaults to 0.
- pattern: string — The command syntax with
%-placeholders, like "coins add amount:%i to list:%players". - code: string — The Lua code to compile and run when the command is invoked.
FindBlockEntitiesCriteria¶
The criteria of Spell:findBlockEntities.
Fields
- block?: string|string[ ] — A block id like "chest", a block tag starting with "#", or a list of them. Defaults to any block.
- maxradius: number — The radius of the sphere to search in blocks, at most 256.
- limit?: number — The maximum number of block entities to return, the nearest ones, an integer from 1 to 10000. Defaults to 1000.
FindBlocksCriteria¶
The criteria of Spell:findBlocks.
Fields
- block: string|string[ ] — A block id like "stone", a block tag starting with "#", or a list of them.
- maxradius: number — The radius of the sphere to search in blocks, at most 64.
- limit?: number — The maximum number of positions to return, the nearest ones, an integer from 1 to 10000. Defaults to 100.
MobAttackOptions¶
The options of MobEntity:startAttack.
Fields
- damage?: number — The damage per hit. Defaults to the mob's attack damage attribute; required for a mob that has none, like a pig.
- reach?: number — The distance in blocks at which the mob can hit. Defaults to the reach the mob has in the game, which depends on its size.
- cooldown?: number — The number of ticks between two attacks. Defaults to 20.
- distance?: number — The distance in blocks a shooting mob keeps from its target; a mob that hits always closes in. Defaults to 15.
- chase?: boolean — Whether the mob may move toward its target at all. Defaults to
true. - mode?: AttackMode — Whether the mob hits or shoots. Defaults to "auto".
- wearTool?: boolean — Whether attacking wears out the weapon. Defaults to
false. - searchRange?: number — The maximum path length in blocks, an integer. Defaults to 50.
- speed?: number — A factor applied to the mob's normal movement speed. Defaults to 1.
MobBreakBlockOptions¶
The options of MobEntity:startBreakBlock.
Fields
- duration?: number — The number of ticks it takes to break the block, an integer. Defaults to the time a player with the same tool would need.
- drops?: boolean — Whether the block drops items. Defaults to
true. - wearTool?: boolean — Whether breaking wears out the tool. Defaults to
true. - reach?: number — The distance in blocks from the mob's eyes to the center of the block at which it can hit the block. A mob that stands on the block or right next to it can always hit it. Defaults to 2, which brings it right up to the block.
- searchRange?: number — The maximum path length in blocks, an integer. Defaults to 50.
- speed?: number — A factor applied to the mob's normal movement speed. Defaults to 1.
MobFleeFromOptions¶
The options of MobEntity:startFleeFrom.
Fields
- distance?: number — The distance in blocks at which the mob stops running. Defaults to 10.
- searchRange?: number — The maximum path length in blocks, an integer. Defaults to 50.
- speed?: number — A factor applied to the mob's normal movement speed. Defaults to 1.
MobFollowOptions¶
The options of MobEntity:startFollow.
Fields
- distance?: number — The distance in blocks to keep. Defaults to 2.
- searchRange?: number — The maximum path length in blocks, an integer. Defaults to 50.
- speed?: number — A factor applied to the mob's normal movement speed. Defaults to 1.
MobPathToOptions¶
The options of MobEntity:startPathTo.
Fields
- targetRadius?: number — The distance in blocks at which the target counts as reached, an integer. Defaults to 1.
- searchRange?: number — The maximum path length in blocks, an integer. Defaults to 50.
- speed?: number — A factor applied to the mob's normal movement speed, so 2 makes it walk twice as fast as it usually does. Defaults to 1.
MobPlaceBlockOptions¶
The options of MobEntity:startPlaceBlock.
Fields
- hand?: Hand — The hand holding the block. Defaults to "mainhand".
- against?: Side — The side of the position where the block rests. Defaults to "down".
- reach?: number — The distance in blocks from the mob's eyes to the center of the block at which it can place the block. Defaults to 2.
- searchRange?: number — The maximum path length in blocks, an integer. Defaults to 50.
- speed?: number — A factor applied to the mob's normal movement speed. Defaults to 1.
MobPutIntoOptions¶
The options of MobEntity:startPutInto.
Fields
- hand?: Hand — The hand holding the items. Defaults to "mainhand".
- side?: Side — The side the items go in from. Defaults to the side the mob stands at, then "up".
- count?: number — The maximum number of items to put in, an integer. Defaults to the whole stack.
- reach?: number — The distance in blocks from the mob's eyes to the center of the container at which it can reach it. A mob that stands on the container or right next to it can always reach it. Defaults to 2.
- searchRange?: number — The maximum path length in blocks, an integer. Defaults to 50.
- speed?: number — A factor applied to the mob's normal movement speed. Defaults to 1.
MobStayOptions¶
The options of MobEntity:startStay.
Fields
- duration?: number — The number of ticks to stand still, an integer, counted from when the mob first stands on its spot. Defaults to no limit.
- pos?: Vec3 — The position whose block the mob walks to and holds. Defaults to staying where it is.
- radius?: number — How far, in blocks, the mob may be moved off its spot before it goes back. Defaults to
0withpos, and to not holding the spot without. - searchRange?: number — The maximum path length in blocks on the way to the spot, an integer. Only counts while the mob holds its spot. Defaults to 50.
- speed?: number — The factor applied to the mob's normal movement speed on the way to the spot. Only counts while the mob holds its spot. Defaults to 1.
MobTakeFromOptions¶
The options of MobEntity:startTakeFrom.
Fields
- item?: string|string[ ] — An item id, an item tag starting with "#", or a list of them. Defaults to any item.
- count?: number — The maximum number of items to take, an integer. Defaults to as many as fit in the hand.
- hand?: Hand — The hand to take the items into. Defaults to "mainhand".
- side?: Side — The side the items are taken from. Defaults to "down".
- reach?: number — The distance in blocks from the mob's eyes to the center of the container at which it can reach it. A mob that stands on the container or right next to it can always reach it. Defaults to 2.
- searchRange?: number — The maximum path length in blocks, an integer. Defaults to 50.
- speed?: number — A factor applied to the mob's normal movement speed. Defaults to 1.
MobTask¶
A copy of a mob's task, as MobEntity.task gives it. The first four fields are always there;
the others only for the tasks that have them, as each field tells.
Fields
- name: TaskName — The kind of task.
- state: TaskState — The state of the task.
- reason?: TaskReason — Why the task failed or was interrupted.
nilwhile it runs and after it finished. - age: number — The number of ticks since the task started.
- target?: Vec3|Entity — The position or entity the task was started with: a copy of the position, with whole-number coordinates for a block, or a reference to the entity. All tasks but stay.
- speed?: number — The factor applied to the mob's normal movement speed. All tasks; stay only while the mob holds its spot.
- searchRange?: number — The maximum path length in blocks. All tasks; stay only while the mob holds its spot.
- targetRadius?: number — The distance in blocks at which the target counts as reached. Path.
- traveled?: number — The distance in blocks the mob has come along its path so far. Path.
- remainingDistance?: number — The length in blocks of the rest of the path. Path.
- reachable?: boolean —
falsewhen the path stops short of the target. Path. - distance?: number — The distance in blocks to keep from the target, or at which to stop running. Attack, follow, flee.
- mode?: AttackMode — How the mob attacks at the moment: "melee" or "ranged", never "auto". It changes when the mob's weapon does. Attack.
- damage?: number — The damage per hit, if it was given. Attack.
- reach?: number — The distance in blocks at which the mob can hit. Attack (if given), break, place, put, take.
- cooldown?: number — The number of ticks between two attacks. Attack.
- chase?: boolean — Whether the mob may move toward its target. Attack.
- hits?: number — The number of hits that hurt the target so far, by hand or by what the mob shot or threw. Attack.
- shots?: number — The number of shots the mob fired so far: arrows, potions, snowballs and the like. Attack.
- wearTool?: boolean — Whether attacking or breaking wears out the tool. Attack, break.
- duration?: number — The number of ticks the task takes: the break time, or the time to stand still if one was given. Break, stay.
- progress?: number — How far the block is broken, from 0 to 1. Break.
- drops?: boolean — Whether the block drops items. Break.
- remaining?: number — The number of ticks left to stand still, if a duration was given. Stay.
- pos?: Vec3 — A copy of the spot the mob holds. Stay, while the mob holds its spot.
- radius?: number — How far, in blocks, the mob may be moved off its spot before it goes back. Stay, while the mob holds its spot.
- away?: boolean —
truewhile the mob is on its way to its spot. Stay, while the mob holds its spot. - hand?: Hand — The hand holding the block or the items. Place, put, take.
- against?: Side — The side of the position where the block rests. Place.
- side?: Side — The side the items go in from or are taken from, if it was given. Put, take.
- item?: string|string[ ] — The item id, item tag or list of them to take, if it was given. Take.
- count?: number — The maximum number of items to move, if it was given. Put, take.
- moved?: number — The number of items moved so far. Put, take.
SpellCriteria¶
The criteria of Spell:findSpells. A spell must match all criteria given.
Fields
- name?: string — The spell's name.
- owner?: string — The name of the spell's owner.
- tag?: string — A tag the spell carries.
- sid?: number — The spell's id.
- maxradius?: number — The maximum distance in blocks from this spell.
- minradius?: number — The minimum distance in blocks from this spell.
- excludeSelf?: boolean — Whether to leave out this spell. Defaults to
false.