Skip to content

API reference / @jsprismarine/prismarine / blockentity/BlockEntities / Skull

Class: Skull ​

Defined in: packages/prismarine/src/blockentity/BlockEntities.ts:212

A block that carries state of its own: a chest and what is in it, a sign and what it says.

Nothing is ever dropped ​

fromNBT keeps the entire compound it was given. A subclass lifts out the fields it models and deletes them from that copy; toNBT starts from what is left and puts the modeled fields back. A type nobody has modeled becomes GenericBlockEntity, whose remainder is everything, so it round-trips byte for byte.

That is not tidiness. A world is full of blocks written by versions and behavior packs this server knows nothing about, and a provider that quietly wrote back only the fields it understood would erase a player's chests one save at a time, with nothing to say it had happened.

Extends ​

Properties ​

constructor ​

constructor: typeof BlockEntity

Defined in: packages/prismarine/src/blockentity/BlockEntity.ts:23

TypeScript types this.constructor as Function. Declaring it as the class itself lets BlockEntity.getId read the static ID the subclass set. Emits nothing.

Inherited from ​

BlockEntity.constructor


position ​

readonly position: Vector3

Defined in: packages/prismarine/src/blockentity/BlockEntity.ts:28

Inherited from ​

BlockEntity.position


ID ​

readonly static ID: "Skull" = 'Skull'

Defined in: packages/prismarine/src/blockentity/BlockEntities.ts:213

Vanilla's id string - Chest, Sign, Furnace. Not a namespaced identifier.

Overrides ​

BlockEntity.ID

Methods ​

canReuseSerialization() ​

canReuseSerialization(): boolean

Defined in: packages/prismarine/src/blockentity/BlockEntity.ts:53

Whether a caller can safely reuse a previously serialized form of this block entity. Mutable getters and setters disable reuse because their changes cannot be observed here.

Returns ​

boolean

Inherited from ​

BlockEntity.canReuseSerialization


getId() ​

getId(): string

Defined in: packages/prismarine/src/blockentity/BlockEntity.ts:41

Returns ​

string

Inherited from ​

BlockEntity.getId


getPosition() ​

getPosition(): Vector3

Defined in: packages/prismarine/src/blockentity/BlockEntity.ts:45

Returns ​

Vector3

Inherited from ​

BlockEntity.getPosition


getRotation() ​

getRotation(): number

Defined in: packages/prismarine/src/blockentity/BlockEntities.ts:224

Returns ​

number


getSkullType() ​

getSkullType(): number

Defined in: packages/prismarine/src/blockentity/BlockEntities.ts:220

Returns ​

number


isMovable() ​

isMovable(): boolean

Defined in: packages/prismarine/src/blockentity/BlockEntity.ts:63

Whether a piston may push this. Vanilla stores it on every block entity.

Returns ​

boolean

Inherited from ​

BlockEntity.isMovable


toNBT() ​

toNBT(): NBTTagCompound

Defined in: packages/prismarine/src/blockentity/BlockEntity.ts:87

The compound to write back: the untouched remainder, then the fields this class models. Subclasses override, call super.toNBT(), and add theirs to the result.

Returns ​

NBTTagCompound

Inherited from ​

BlockEntity.toNBT


fromNBT() ​

static fromNBT(nbt): Skull

Defined in: packages/prismarine/src/blockentity/BlockEntities.ts:215

Parameters ​

nbt ​

NBTTagCompound

Returns ​

Skull