Home Commands Examples Getting Started With Scripts Global Keywords

NameTagResult

Importing the class

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

script.zs
import crafttweaker.api.entity.NameTagResult;

Methods

Forces the name tag to be visible even when it would otherwise not be.

script.zs
// NameTagResult.alwaysRender()
myNameTagResult.alwaysRender();

Gets the current content of the name tag. This can be changed by mods.

Returns: The current name tag content.
Return Type: Component

script.zs
// NameTagResult.getContent() as Component
myNameTagResult.getContent();

Gets the original content of the name tag. This can not be changed by mods.

Returns: The original name tag content.
Return Type: Component

script.zs
// NameTagResult.getOriginalContent() as Component
myNameTagResult.getOriginalContent();

Forces the display name to not render even when it should.

script.zs
// NameTagResult.noRender()
myNameTagResult.noRender();

Sets the new content of the name tag.

script.zs
NameTagResult.setContent(content as Component)
ParameterTypeDescription
Parameter
content
Type
Component
Description
The new name tag contents.

Sets the default vanilla behaviour of rendering name tags.

script.zs
// NameTagResult.setDefault()
myNameTagResult.setDefault();

Properties

NameTypeHas GetterHas SetterDescription
Name
content
Type
Component
Has Getter
true
Has Setter
true
Description
Gets the current content of the name tag.
This can be changed by mods.
Name
originalContent
Type
Component
Has Getter
true
Has Setter
false
Description
Gets the original content of the name tag.
This can not be changed by mods.