API reference / @jsprismarine/prismarine / blockentity/BlockEntities / ItemFrame
Class: ItemFrame
Defined in: packages/prismarine/src/blockentity/BlockEntities.ts:264
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
position
readonlyposition:Vector3
Defined in: packages/prismarine/src/blockentity/BlockEntity.ts:28
Inherited from
ID
readonlystaticID:"ItemFrame"='ItemFrame'
Defined in: packages/prismarine/src/blockentity/BlockEntities.ts:265
Vanilla's id string - Chest, Sign, Furnace. Not a namespaced identifier.
Overrides
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
getItem()
getItem():
NBTTagCompound|null
Defined in: packages/prismarine/src/blockentity/BlockEntities.ts:272
Returns
NBTTagCompound | null
getPosition()
getPosition():
Vector3
Defined in: packages/prismarine/src/blockentity/BlockEntity.ts:45
Returns
Inherited from
getRotation()
getRotation():
number
Defined in: packages/prismarine/src/blockentity/BlockEntities.ts:278
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
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
Inherited from
fromNBT()
staticfromNBT(nbt):ItemFrame
Defined in: packages/prismarine/src/blockentity/BlockEntities.ts:267
Parameters
nbt
Returns
ItemFrame