Home Migration Guide Getting Started With Scripts Commands Examples
BracketHandlers

MCEntityType

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.MCEntityType;

Implemented Interfaces

MCEntityType implements the following interfaces. That means all methods defined in these interfaces are also available in MCEntityType

Static Methods

Sets the global nameplate handler for all EntityTypes.

Return Type: void

script.zs
// MCEntityType.setNameplateHandler(function as INameplateFunction) as void
MCEntityType.setNameplateHandler((entity, result) => {
result.setAllow();
result.content = "Custom name! Position: " + entity.position;
}));
ParameterTypeDescription
Parameter
function
Type
INameplateFunction
Description
The function that controls how all EntityType’s nameplate are rendered.

Casters

Result typeIs Implicit
Result type
EntityIngredient
Is Implicit
true

Methods

Creates a new entity in the world.

Returns: The newly created Entity
Return Type: MCEntity

script.zs
MCEntityType.create(world as MCWorld) as MCEntity
ParameterTypeDescription
Parameter
world
Type
MCWorld
Description
World for the entity to be created in

Gets the registry name of this EntityType

Returns: The registry name of this EntityType as a ResourceLocation
Return Type: MCResourceLocation

script.zs
// MCEntityType.getRegistryName() as MCResourceLocation
myMCEntityType.getRegistryName();

Sets the nameplate handler for this EntityType.

Return Type: void

script.zs
// MCEntityType.setNameplate(function as INameplateFunction) as void
myMCEntityType.setNameplate((entity, result) => {
result.setAllow();
result.content = "Custom name! Position: " + entity.position;
}));
ParameterTypeDescription
Parameter
function
Type
INameplateFunction
Description
The function that controls how this EntityType’s nameplate is rendered.

Operators

script.zs
myMCEntityType | other as EntityIngredient

Properties

NameTypeHas GetterHas SetterDescription
Name
classification
Type
MCEntityClassification
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
commandString
Type
string
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
height
Type
float
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
immuneToFire
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
lootTable
Type
string
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
name
Type
string
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
registryName
Type
MCResourceLocation
Has Getter
true
Has Setter
false
Description
Gets the registry name of this EntityType
Name
serializable
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
summonable
Type
boolean
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
translationKey
Type
string
Has Getter
true
Has Setter
false
Description
No Description Provided
Name
width
Type
float
Has Getter
true
Has Setter
false
Description
No Description Provided