Appearance
helix / DisplayValue
Class: DisplayValue
Defined in: core/values/display.ts:63
A block_display made of a root block plus child block displays carried as Passengers. Renders to the summon data tag - pass it as the nbt arg:
const d = Display(Block.POLISHED_BASALT.state({ axis: "x" })) .add(Block.WAXED_COPPER_BLOCK, { translation: [-0.5, -3.5, -0.5] }); ctx.summon("minecraft:block_display", Pos.rel(0, 10, 0), d);
Children are kept in a mutable array, so you can build them from a loop and swap blocks programmatically before rendering.
Implements
Constructors
Constructor
new DisplayValue(
block,rootTransform?):DisplayValue
Defined in: core/values/display.ts:70
Parameters
block
rootTransform?
Transform = {}
Returns
DisplayValue
Properties
children
readonlychildren:DisplayChild[] =[]
Defined in: core/values/display.ts:64
id
readonlystaticid:"minecraft:block_display"="minecraft:block_display"
Defined in: core/values/display.ts:76
The entity id to summon this with (ctx.summon(Display.id, ...)).
Accessors
exists
Get Signature
get exists():
EntityCondition
Defined in: core/values/display.ts:150
Condition: the group is currently spawned.
Returns
notExist
Get Signature
get notExist():
EntityCondition
Defined in: core/values/display.ts:155
Condition: the group is not currently spawned.
Returns
Methods
add()
add(
block,transform?):this
Defined in: core/values/display.ts:85
Append a child block display at the given transform.
Parameters
block
transform?
Transform = {}
Returns
this
at()
at(
pos):this
Defined in: core/values/display.ts:135
Set the position this display is summoned at.
Parameters
pos
string | PosValue
Returns
this
boundsMin()
boundsMin():
Vec3
Defined in: core/values/display.ts:191
The min corner of the model's block volume in entity-local space - the smallest member translation on each axis. A block_display member with translation t occupies the cube [entity + t, entity + t + 1], so summoning at worldCorner - boundsMin() makes the model's lowest block land exactly on worldCorner. Used to overlay a display on the real blocks it stands in for.
Returns
boundsSize()
boundsSize():
Vec3
Defined in: core/values/display.ts:201
The model's size in whole blocks on each axis (max translation − min + 1). For a model captured from a 2×16×7 structure this returns [2, 16, 7], the footprint the matching .nbt covers.
Returns
brightness()
brightness(
block,sky?):this
Defined in: core/values/display.ts:97
Pin the rendered light level so the display matches surrounding blocks instead of falling back to dynamic per-entity lighting (which samples one point and usually renders darker / flickers as it moves). Both block and sky are 0–15; sky defaults to the same as block. Use 15, 15 for full-bright. Applies to every member (each passenger is its own entity).
Parameters
block
number
sky?
number = block
Returns
this
getName()
getName():
string
Defined in: core/values/display.ts:125
The display's name/tag; throws if named was never called.
Returns
string
getPivot()
getPivot():
Vec3
Defined in: core/values/display.ts:108
Returns
getPos()
getPos():
string|PosValue
Defined in: core/values/display.ts:140
Returns
string | PosValue
kill()
kill(
ctx):void
Defined in: core/values/display.ts:175
Remove every member of the group.
Parameters
ctx
Returns
void
members()
members():
DisplayChild[]
Defined in: core/values/display.ts:180
Ordered members - root first (index 0), then the added children.
Returns
named()
named(
name):this
Defined in: core/values/display.ts:119
Give the display an identity. Every member is tagged Tags:["<name>", "<name>_<i>"] (root is index 0), so the whole group is addressable by @e[tag=<name>] and each member by @e[tag=<name>_<i>]. Required before summoning/killing/animating. Unnamed displays render with no tags (static packs stay byte-identical).
Parameters
name
string
Returns
this
pivot()
pivot(
p):this
Defined in: core/values/display.ts:103
Set the local-space pivot the group rotates about (default origin).
Parameters
p
Returns
this
render()
render(
version):string
Defined in: core/values/display.ts:210
Parameters
version
Returns
string
Implementation of
selector()
selector():
string
Defined in: core/values/display.ts:145
A selector matching the whole group: @e[tag=<name>].
Returns
string
setBlock()
setBlock(
block):this
Defined in: core/values/display.ts:79
Replace the root block.
Parameters
block
Returns
this
summon()
summon(
ctx):void
Defined in: core/values/display.ts:160
Summon the display at its at position.
Parameters
ctx
Returns
void
summonIf()
summonIf(
ctx,cond):void
Defined in: core/values/display.ts:170
Summon the display only when cond holds (e.g. cog.notExist).
Parameters
ctx
cond
Returns
void