API reference / @jsprismarine/prismarine / entity/data/DataEntity / MobBody
Class: MobBody
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:298
Everything about a live entity that exists before its components do.
The split is forced rather than chosen: a goal component builds its GoalSupport while the EntityInstance is being constructed, and that support reads the actuator and the goal world there and then. So everything those two seams touch has to exist first, which is where it is - the position, the walk, the attack target, the home and the carried item.
Both AI systems drive this one object: EntityActuator for the goals and BrainNavigation for the brains. The camel and the happy ghast run both, and they have to agree about where the entity is.
Constructors
Constructor
new MobBody(
id,position,typeFacts):MobBody
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:863
Parameters
id
number
The runtime id, unique for the length of the session.
position
typeFacts
What the type's base components declare, which MobBody.facts falls back to.
Returns
MobBody
Properties
blockJumpFactor
blockJumpFactor: () =>
number
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:351
The block jump factor where the body stands, Java's Entity.getBlockJumpFactor: 0.5 on honey, 1 elsewhere. EntityRuntime sets it to read the world.
Returns
number
Java See
Entity.getBlockJumpFactor
conditions
readonlyconditions:WatchedSet<string>
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:357
The boolean facts a brain reads off the body, such as on_ground or aggressive. The SHOWN_CONDITIONS are logged.
damage
readonlydamage:DamageLog
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:700
Who has hurt the entity, with the running total each has dealt.
equipmentInventorySlots
readonlyequipmentInventorySlots:ObservedMap<"head"|"chest"|"feet"|"mainhand"|"offhand"|"body"|"legs",number>
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:640
Equipment slots read and written through an inventory slot, such as a horse's armor or a llama's carpet, by the container index. Logged as a field, and kept in step with MobBody.inventory's aliases.
equipmentRevision
equipmentRevision:
number=0
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:606
How many times an equipment slot has changed, by a slot write, an alias or an undo.
A reader that caches what a mob shows compares this counter rather than encoding five items per mob to find out whether anything changed. Equipment changes a handful of times in a mob's life, so the steady state is this number not moving.
horizontalCollision
horizontalCollision:
boolean=false
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:859
Whether the body's last step was stopped short across x or z, Java's Entity.horizontalCollision, which DoorInteractGoal reads to find the door in the way.
id
readonlyid:number
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:865
The runtime id, unique for the length of the session.
inventory
readonlyinventory:EntityInventory<"armor"|"mainhand"|"offhand"|"inventory"|"body">
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:591
What the entity holds and wears and carries, laid out by mobLayout: one slot each for the main hand, the off hand and the body, four armor slots and an inventory container of the size its minecraft:inventory gives (MobBody.containerCapacity).
Every slot write reaches MobBody.onSlotWrite, and a write to a slot an equipment slot reads moves MobBody.equipmentRevision and calls MobBody.onEquipmentChanged. A store player's body leaves it empty: the player's own inventory is the store player's.
lastPusher
lastPusher:
number|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:706
Who last knocked the entity about, which target_when_pushed reads.
onEquipmentChanged
onEquipmentChanged: ((
slot,equipped) =>void) |undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:612
Called after an equipment slot changes, once the entity's component state is active, with whether the slot holds something now. An undo does not call it.
onImpulse
onImpulse: ((
impulse) =>void) |undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:326
Takes the impulses aimed at a body whose client owns its movement, such as a player's.
Set by EntityRuntime for those bodies only. The server cannot move such a body, so MobBody.push hands the impulse here, where it becomes an occurrence replication sends to the client, and the body's velocity stays as it was.
onMove
onMove: (() =>
void) |undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:307
Told whenever the entity moves, so an index over positions can keep up.
EntityRuntime sets it to refile the body in its spatial index. An accessor rather than a field because the index is wrong the instant it misses a move, and there are five places that write a position: the walk, the impulse, a knockback, a teleport and being carried.
onNeedsSync
onNeedsSync: (() =>
void) |undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:332
Told by MobBody.needsSync. EntityRuntime sets it so replication sends the entity's movement on this tick rather than at its next update interval.
onSlotWrite
onSlotWrite:
BodySlotObserver|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:597
Told about every write to a slot of MobBody.inventory, with the slot's logged value before and after it. EntityRuntime sets it to log an inventory-slot entry.
onWrite
onWrite:
BodyWriteObserver|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:317
Told about every change to a field a save or a digest reads, with the value before and after it.
EntityRuntime sets it to append the change to the world's change log. A write that leaves a field as it was is not reported, and a position is compared by its coordinates.
school
readonlyschool:SchoolMembership
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:703
The entity's place in a fish school, which minecraft:flocking keeps. Not saved, as Java saves none.
statusEffects
readonlystatusEffects:ObservedMap<string,StatusEffect>
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:363
The entity's active status effects, which its store actor shows clients.
tags
readonlytags:ObservedSet<string>
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:360
The entity's dynamic string tags, shared with /tag and has_tag filters.
target
target:
number|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:366
Who the entity is fighting, by runtime id, or undefined when it is fighting nobody.
tradingPlayer
tradingPlayer:
number|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:761
The player with the entity's trade screen open, by runtime id.
typeFacts
readonlytypeFacts:EntityFacts
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:868
What the type's base components declare, which MobBody.facts falls back to.
Accessors
actorTags
Get Signature
get actorTags():
Uint8Array<ArrayBufferLike> |undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:731
The actor record tags this server does not model, as network NBT bytes. A copy each way, so a change to the bytes in place cannot reach the body, or the entries that logged them, without a write.
Returns
Uint8Array<ArrayBufferLike> | undefined
Set Signature
set actorTags(
tags):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:735
Parameters
tags
Uint8Array<ArrayBufferLike> | undefined
Returns
void
airborne
Get Signature
get airborne():
boolean
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1014
Whether an impulse is still carrying the entity, which suspends its walk.
Returns
boolean
beamTarget
Get Signature
get beamTarget():
EntityPosition|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:453
The block an end crystal's beam points at, or undefined for no beam.
Sent to the client as the BLOCK_TARGET actor data. The client treats the zero position the same as an absent key, so clearing a beam it has already seen means writing { x: 0, y: 0, z: 0 } rather than undefined.
Returns
EntityPosition | undefined
Set Signature
set beamTarget(
beamTarget):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:457
Parameters
beamTarget
EntityPosition | undefined
Returns
void
breedCooldown
Get Signature
get breedCooldown():
number
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:798
How many ticks before the entity may breed again, from Java's AgeableMob.ageUp.
Java See
AgeableMob.ageUp(I)V
Returns
number
Set Signature
set breedCooldown(
breedCooldown):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:802
Parameters
breedCooldown
number
Returns
void
canPickUpLoot
Get Signature
get canPickUpLoot():
boolean|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:519
Whether a mob whose pickup goal declares pickup_based_on_chance picks up items: Java's Mob.canPickUpLoot, which Zombie.finalizeSpawn and AbstractSkeleton.finalizeSpawn roll once. Undefined until the first pickup asks, which rolls it.
Returns
boolean | undefined
Set Signature
set canPickUpLoot(
canPickUpLoot):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:523
Parameters
canPickUpLoot
boolean | undefined
Returns
void
color
Get Signature
get color():
number|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:417
The palette color set by an accepted dye, overriding minecraft:color from the definition.
Returns
number | undefined
Set Signature
set color(
color):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:421
Parameters
color
number | undefined
Returns
void
containerCapacity
Get Signature
get containerCapacity():
number
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:615
How many slots the inventory container has, which the active minecraft:inventory decides.
Returns
number
curedBy
Get Signature
get curedBy():
string|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:752
The identity of the player who cured this villager. A zombie villager holds the player who fed it the golden apple here, and the villager it becomes inherits it.
Returns
string | undefined
Set Signature
set curedBy(
curedBy):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:756
Parameters
curedBy
string | undefined
Returns
void
deathTime
Get Signature
get deathTime():
number
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:559
Ticks since a living entity died, Java's LivingEntity.deathTime. It stays in the world for its death animation, and EntityRuntime removes it once this reaches Java's limit.
Java See
LivingEntity.deathTime
Returns
number
Set Signature
set deathTime(
deathTime):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:563
Parameters
deathTime
number
Returns
void
facts
Get Signature
get facts():
EntityFacts
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:973
The entity's facts as its components make them now.
Everything that reads a stat off a body reads it here, and minecraft:movement is why: fifteen vanilla types, the zombie and the slime among them, declare it only in a component group their spawn event adds, so the type's figure is zero and a body that trusted it never moved a block.
The type's own facts until MobBody.watch runs, because a body exists before the component state does - a goal component reads the actuator while the EntityInstance is still being built.
Returns
fireTicks
Get Signature
get fireTicks():
number
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:545
Ticks an ignited entity remains visibly on fire after leaving sunlight.
Returns
number
Set Signature
set fireTicks(
fireTicks):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:549
Parameters
fireTicks
number
Returns
void
fuseTicks
Get Signature
get fuseTicks():
number|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:426
Ticks remaining on an active minecraft:explode fuse, if this component is lit.
Returns
number | undefined
Set Signature
set fuseTicks(
fuseTicks):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:430
Parameters
fuseTicks
number | undefined
Returns
void
headYaw
Get Signature
get headYaw():
number
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:390
Where the entity's head faces, in degrees, Java's yHeadRot. A look turns it; the body's MobBody.yaw is what the walk steers, and the head stays within MAX_HEAD_TURN of it while the body walks.
Returns
number
Set Signature
set headYaw(
headYaw):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:394
Parameters
headYaw
number
Returns
void
home
Get Signature
get home():
EntityPosition|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:572
The entity's home position, from minecraft:home or a set_home_position event. The instance keeps it, since its components set it while it is built; the body reads it from there so the goals, the filters and the save all see the same home.
Returns
EntityPosition | undefined
Set Signature
set home(
home):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:576
Parameters
home
EntityPosition | undefined
Returns
void
identifier
Get Signature
get identifier():
string
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:999
The namespaced identifier, such as minecraft:zombie.
Returns
string
invulnerable
Get Signature
get invulnerable():
boolean
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:536
Whether the entity refuses all damage, as the respawn sequence's crystals do.
Returns
boolean
Set Signature
set invulnerable(
invulnerable):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:540
Parameters
invulnerable
boolean
Returns
void
loveTicks
Get Signature
get loveTicks():
number
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:785
How many ticks the entity stays in love, which is what feeding it a breeding item sets and what minecraft:behavior.breed spends.
Returns
number
Set Signature
set loveTicks(
loveTicks):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:789
Parameters
loveTicks
number
Returns
void
movement
Get Signature
get movement():
number
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1086
The body's movement_speed with Speed and Slowness applied, as Java's add_multiplied_total modifiers on the attribute apply them: 20 % more a level of Speed and 15 % less a level of Slowness, each scaling the total.
Java See
MobEffects.SPEED
Java See
MobEffects.SLOWNESS
Returns
number
nameTag
Get Signature
get nameTag():
string|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:408
The custom name set by an accepted name tag.
Returns
string | undefined
Set Signature
set nameTag(
nameTag):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:412
Parameters
nameTag
string | undefined
Returns
void
owner
Get Signature
get owner():
number|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:709
The online owner's runtime id, or undefined while its owner is offline or absent.
Returns
number | undefined
Set Signature
set owner(
owner):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:713
Parameters
owner
number | undefined
Returns
void
ownerIdentity
Get Signature
get ownerIdentity():
string|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:740
Stable player identity behind MobBody.owner, retained across server restarts.
Returns
string | undefined
Set Signature
set ownerIdentity(
ownerIdentity):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:744
Parameters
ownerIdentity
string | undefined
Returns
void
paddles
Get Signature
get paddles():
number
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:481
Which paddles a boat's controller rows with, as riding.ts's paddle bits.
Returns
number
Set Signature
set paddles(
paddles):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:485
Parameters
paddles
number
Returns
void
pitch
Get Signature
get pitch():
number
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:399
The entity's head pitch, in degrees.
Returns
number
Set Signature
set pitch(
pitch):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:403
Parameters
pitch
number
Returns
void
position
Get Signature
get position():
EntityPosition
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:989
Where the entity is now.
Returns
Set Signature
set position(
position):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:993
Parameters
position
Returns
void
projectileAge
Get Signature
get projectileAge():
number
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:816
Ticks spent in flight by minecraft:projectile, retained across a world restart.
Returns
number
Set Signature
set projectileAge(
projectileAge):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:820
Parameters
projectileAge
number
Returns
void
projectileStuck
Get Signature
get projectileStuck():
boolean
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:825
Whether the projectile has stuck to a block and should remain there until expiry.
Returns
boolean
Set Signature
set projectileStuck(
projectileStuck):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:829
Parameters
projectileStuck
boolean
Returns
void
seat
Get Signature
get seat():
RiderSeat|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:472
The seat this body last sat in. It stays once the body gets off, as a Bedrock client keeps the seat it was last sent.
Returns
RiderSeat | undefined
Set Signature
set seat(
seat):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:476
Parameters
seat
RiderSeat | undefined
Returns
void
showBottom
Get Signature
get showBottom():
boolean|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:527
Returns
boolean | undefined
Set Signature
set showBottom(
showBottom):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:531
Parameters
showBottom
boolean | undefined
Returns
void
sitting
Get Signature
get sitting():
boolean
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:764
Whether the entity is sat down, which the sit goals hold while they run.
Returns
boolean
Set Signature
set sitting(
sitting):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:768
Parameters
sitting
boolean
Returns
void
sleeping
Get Signature
get sleeping():
boolean
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:773
Whether the entity is asleep, which the sleep and nap goals hold while they run.
Returns
boolean
Set Signature
set sleeping(
sleeping):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:777
Parameters
sleeping
boolean
Returns
void
sleepingPos
Get Signature
get sleepingPos():
EntityPosition|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:498
Returns
EntityPosition | undefined
Set Signature
set sleepingPos(
sleepingPos):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:502
Parameters
sleepingPos
EntityPosition | undefined
Returns
void
statusEffectClock
Get Signature
get statusEffectClock():
StatusEffectClock|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:718
The status effect clock as it was last written; see StatusEffectClock.
Returns
StatusEffectClock | undefined
Set Signature
set statusEffectClock(
clock):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:722
Parameters
clock
StatusEffectClock | undefined
Returns
void
steeredBy
Get Signature
get steeredBy():
number|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:490
The player steering this vehicle, whose client moves it, or undefined while none does.
Returns
number | undefined
Set Signature
set steeredBy(
steeredBy):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:494
Parameters
steeredBy
number | undefined
Returns
void
stuck
Get Signature
get stuck():
boolean
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1009
Whether the entity has stopped making progress towards its destination.
Returns
boolean
teleports
Get Signature
get teleports():
number
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1153
How many times the server has moved the entity instantly; see LoggedBodyState.teleports.
Returns
number
Set Signature
set teleports(
teleports):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1157
Parameters
teleports
number
Returns
void
tradeTier
Get Signature
get tradeTier():
number|undefined
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:438
A trader's level, from zero for a novice, which a villager's badge shows, or undefined for an entity that has drawn no offers.
Returns
number | undefined
Set Signature
set tradeTier(
tradeTier):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:442
Parameters
tradeTier
number | undefined
Returns
void
velocity
Get Signature
get velocity():
EntityPosition
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:807
Movement velocity in blocks per tick, including projectile flight.
Returns
Set Signature
set velocity(
velocity):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:811
Parameters
velocity
Returns
void
walking
Get Signature
get walking():
boolean
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1004
Whether a walk is under way.
Returns
boolean
yaw
Get Signature
get yaw():
number
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:375
Where the entity faces, in degrees.
Returns
number
Set Signature
set yaw(
yaw):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:379
Parameters
yaw
number
Returns
void
Methods
driftInWater()
driftInWater(
drag,canOccupy):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1127
Carries a body that swam last tick and has stopped on through the water, as Java's LivingEntity.travelInFluid and the swimmers' own travel keep the velocity a swim built up and scale it by the water drag each tick: the body moves on by the last swim times drag, and keeps that times drag again as velocity for the physics to spend.
Parameters
drag
number
The share of its speed the mob keeps each tick in water.
canOccupy
(position) => boolean
Whether the body fits at a position, which stops the drift at a wall.
Returns
void
faceAt()
faceAt(
position):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1204
Aims the head and the body at a position at once, for a turn that is not a look, such as a shot.
Parameters
position
Returns
void
jump()
jump():
void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1042
Jumps from the ground or applies Java's upward fluid impulse while swimming.
Returns
void
land()
land():
void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1034
Drops the impulse, which is what landing does.
Returns
void
lookAt()
lookAt(
position):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1166
Points the entity's head at a position, as Java's LookControl turns yHeadRot and the pitch and leaves the body's yaw to the move control. MobBody.settleHead lines the two up once the tick's walk is done.
Parameters
position
Returns
void
moveTo()
moveTo(
position,speedMultiplier):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1095
Starts the body walking toward a position at a share of its movement.
Parameters
position
speedMultiplier
number
The goal's share of the movement speed, such as 1.25 for a panic.
Returns
void
needsSync()
needsSync():
void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:341
Has the body's movement sent on this tick rather than at its next update interval: Java's Entity.needsSync, which a jump, a knockback or a push sets, and a dropped stack whose speed changed sharply, as when it lands.
Returns
void
Java See
Entity.needsSync
push()
push(
velocity):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1020
Adds to the entity's own velocity, which is what a leap or a charge is.
Parameters
velocity
Returns
void
rest()
rest():
void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1111
Drops the walk's momentum, for a tick the body takes no step. A goal that stops and starts again within one tick, as a re-aimed path does, keeps it, as Java's velocity would.
Returns
void
restore()
restore<
K>(field,value):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:934
Writes a saved value back into one field without running the setter's side effects: no MobBody.onWrite report and no slot report. A position still refiles the body in its index, because the index is derived from the position, and a home still reaches the instance that keeps it. This is how the entity store undoes a change.
Type Parameters
K
K extends keyof LoggedBodyState
Parameters
field
K
value
Returns
void
restoreEquipmentInventorySlots()
restoreEquipmentInventorySlots(
entries):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:662
Writes the alias map back without reporting it, which is how the entity store undoes a change to MobBody.equipmentInventorySlots.
Parameters
entries
Iterable<readonly ["head" | "chest" | "feet" | "mainhand" | "offhand" | "body" | "legs", number]>
Returns
void
restoreSlot()
restoreSlot(
container,slot,value,content?):boolean
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:649
Writes a logged value back into one slot without calling MobBody.onSlotWrite or MobBody.onEquipmentChanged, which is how the entity store undoes a slot write.
Parameters
container
string
The container an inventory-slot entry names.
slot
number
value
content?
The content build, which decides the item's maximum durability.
Returns
boolean
Whether the body has that container and slot.
setContainerCapacity()
setContainerCapacity(
size):Item[]
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:627
Resizes the inventory container, as a llama's capacity follows its strength.
The slots a shrink takes away are emptied first, each a logged slot write, and the size is logged after them, so an undo restores the size before it writes the stacks back.
Parameters
size
number
The new number of slots.
Returns
Item[]
The stacks that were in the slots that went, which the caller drops.
settleHead()
settleHead():
void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1188
Lines the head and the body up after the tick's walk, as Java's LookControl and BodyRotationControl do: a head a look turned stays within MAX_HEAD_TURN of a body that walks and turns the body after it when the body stands, and a head nothing looked with follows the body.
Returns
void
step()
step(
options?):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1229
Advances the walk by one tick.
The step uses the entity's minecraft:movement on land and minecraft:underwater_movement in water, scaled by whatever the goal asked for, so a goal's speed_multiplier means the same thing here as it does in the behavior pack.
Parameters
options?
Returns
void
stopMoving()
stopMoving():
void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1103
Abandons the current walk.
Returns
void
teleportTo()
teleportTo(
position):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1143
Moves instantly, clears the current impulse, and counts a teleport, which clients snap to.
Parameters
position
Returns
void
watch()
watch(
instance):void
Defined in: packages/prismarine/src/entity/data/DataEntity.ts:983
Points the body's facts at the component state, which is what makes them live.
Called by DataEntity's constructor, the first moment both halves of an entity exist, so no caller has to remember to.
Parameters
instance
Returns
void