@minecraft/server / TextPrimitive
Class: TextPrimitive ​
Defined in: @minecraft/server/index.d.ts:20706
A primitive shape class that represents a text label in the world with a background.
Extends ​
Constructors ​
Constructor ​
new TextPrimitive(
location,text):TextPrimitive
Defined in: @minecraft/server/index.d.ts:20753
Parameters ​
location ​
text ​
string | RawMessage
Returns ​
TextPrimitive
Overrides ​
PrimitiveShape.constructor
Properties ​
attachedTo? ​
optionalattachedTo?:Entity
Defined in: @minecraft/server/index.d.ts:18559
Remarks ​
The entity this shape is attached to. When set, this shape will copy the root location of the attached entity and the shape's position will be used as an offset.
Inherited from ​
backfaceVisible ​
backfaceVisible:
boolean
Defined in: @minecraft/server/index.d.ts:20714
Remarks ​
If set to true, the text primitive will render the back-face of the background. Defaults to true but will always be false if 'useRotation' is set to false.
backgroundColorOverride? ​
optionalbackgroundColorOverride?:RGBA
Defined in: @minecraft/server/index.d.ts:20721
Remarks ​
The color of the background plate of the text. If set to undefined, it will use the default color.
color ​
color:
RGBA
Defined in: @minecraft/server/index.d.ts:18565
Remarks ​
The color of the shape.
Inherited from ​
depthTest ​
depthTest:
boolean
Defined in: @minecraft/server/index.d.ts:20729
Remarks ​
If set to true, the text will be hidden behind blocks or entities. By default this is set to false (will always render).
dimension ​
readonlydimension:Dimension
Defined in: @minecraft/server/index.d.ts:18572
Remarks ​
The dimension the shape is visible within. If the dimension is undefined, it will display in all dimensions.
Inherited from ​
hasDuration ​
readonlyhasDuration:boolean
Defined in: @minecraft/server/index.d.ts:18579
Remarks ​
Returns true if the shape has a limited time span before being removed.
Inherited from ​
location ​
readonlylocation:Vector3
Defined in: @minecraft/server/index.d.ts:18585
Remarks ​
The location of the shape.
Inherited from ​
maximumRenderDistance? ​
optionalmaximumRenderDistance?:number
Defined in: @minecraft/server/index.d.ts:18595
Remarks ​
If defined, this distance will be used to determine how far away this primitive will be rendered for each client. By default the distance will match the client's render distance setting.
Minimum Value: 0
Inherited from ​
PrimitiveShape.maximumRenderDistance
rotation ​
rotation:
Vector3
Defined in: @minecraft/server/index.d.ts:18602
Remarks ​
The rotation of the shape (Euler angles - [Pitch, Yaw, Roll]).
Inherited from ​
scale ​
scale:
number
Defined in: @minecraft/server/index.d.ts:18609
Remarks ​
The scale of the shape.
Bounds: [-1000, 1000]
Inherited from ​
text ​
readonlytext:string|RawMessage
Defined in: @minecraft/server/index.d.ts:20737
Remarks ​
Get the text of the debug text shape. Returns the RawText of the debug text if setText was called with a RawMessage or a RawText object, otherwise returns a string.
textBackfaceVisible ​
textBackfaceVisible:
boolean
Defined in: @minecraft/server/index.d.ts:20745
Remarks ​
If set to true, the text primitive will render the back-face of the text. Defaults to true but will always be false if 'useRotation' is set to false.
timeLeft? ​
optionaltimeLeft?:number
Defined in: @minecraft/server/index.d.ts:18617
Remarks ​
The time left (in seconds) until this shape is automatically removed. Returns undefined if the shape does not have a limited life-span.
Inherited from ​
totalTimeLeft? ​
readonlyoptionaltotalTimeLeft?:number
Defined in: @minecraft/server/index.d.ts:18625
Remarks ​
The total initial time-span (in seconds) until this shape is automatically removed. Returns undefined if the shape does not have a limited life-span.
Inherited from ​
useRotation ​
useRotation:
boolean
Defined in: @minecraft/server/index.d.ts:20752
Remarks ​
If set to true, the text will not face the camera and instead will use the rotation from the shape.
visibleTo ​
visibleTo:
Player[]
Defined in: @minecraft/server/index.d.ts:18632
Remarks ​
The list of players that this shape will be visible to. If left empty, the shape will be visible to all players.
Inherited from ​
Methods ​
remove() ​
remove():
void
Defined in: @minecraft/server/index.d.ts:18639
Returns ​
void
Remarks ​
Removes this shape from the world. The shape can be re-added via the PrimitiveShapesManager's addText method.
Inherited from ​
setLocation() ​
setLocation(
location):void
Defined in: @minecraft/server/index.d.ts:18646
Parameters ​
location ​
Returns ​
void
Remarks ​
Set the location and dimension of the shape. If the dimension is undefined, it will display in all dimensions.
Inherited from ​
setText() ​
setText(
text):void
Defined in: @minecraft/server/index.d.ts:20764
Parameters ​
text ​
string | RawMessage
Returns ​
void
Remarks ​
Sets the text to display.
Throws ​
This function can throw errors.
minecraftcommon.ArgumentOutOfBoundsError