Importing the class

Link to 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.

ZenScript
Copy
import crafttweaker.api.entity.MCEntityType;

Implemented Interfaces

Link to implemented-interfaces

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

Link to setNameplateHandler

Name: setNameplateHandler

Sets the global nameplate handler for all EntityTypes.

Return Type: void

ZenScript
Copy
// 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.
Result typeIs Implicit
Result type
EntityIngredient
Is Implicit
true

Name: create

Creates a new entity in the world.

Returns: The newly created Entity
Return Type: MCEntity

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

Name: getRegistryName

Gets the registry name of this EntityType

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

ZenScript
Copy
// MCEntityType.getRegistryName() as MCResourceLocation

myMCEntityType.getRegistryName();

Name: setNameplate

Sets the nameplate handler for this EntityType.

Return Type: void

ZenScript
Copy
// 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.

Name: OR

ZenScript
Copy
myMCEntityType | other as EntityIngredient
名称TypeHas GetterHas SetterDescription
名称
classification
Type
MCEntityClassification
Has Getter
true
Has Setter
false
Description
No Description Provided
名称
commandString
Type
string
Has Getter
true
Has Setter
false
Description
No Description Provided
名称
height
Type
float
Has Getter
true
Has Setter
false
Description
No Description Provided
名称
immuneToFire
Type
boolean型
Has Getter
true
Has Setter
false
Description
No Description Provided
名称
lootTable
Type
string
Has Getter
true
Has Setter
false
Description
No Description Provided
名称
name
Type
string
Has Getter
true
Has Setter
false
Description
No Description Provided
名称
registryName
Type
MCResourceLocation
Has Getter
true
Has Setter
false
Description
Gets the registry name of this EntityType
名称
serializable
Type
boolean型
Has Getter
true
Has Setter
false
Description
No Description Provided
名称
summonable
Type
boolean型
Has Getter
true
Has Setter
false
Description
No Description Provided
名称
translationKey
Type
string
Has Getter
true
Has Setter
false
Description
No Description Provided
名称
width
Type
float
Has Getter
true
Has Setter
false
Description
No Description Provided