Home Commands Examples Getting Started With Scripts Global Keywords 1.21 Migration Guide
BracketDumpers BracketHandlers BracketValidators ResourceLocationBracketHandler

EntityType

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

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

Implements

Undocumented Interfaces

FeatureElement,EntityTypeTest<Entity, Entity>

Operators

|(other as CTEntityIngredient) as CTEntityIngredient
Combines two entity ingredients.
script.zs
// (EntityType<T : Entity> | (other as EntityIngredient)) as EntityIngredient
myEntityType | myCTEntityIngredient

Parameters:

other Type: EntityIngredient - The second entity ingredient.

Return Type: EntityIngredient

Members

implicit as CTEntityIngredient
Casts the entity type to an entity ingredient.
script.zs
// EntityType<T : Entity> as EntityIngredient
myEntityType as CTEntityIngredient

Return Type: EntityIngredient

Getter
Checks if the entity can spawn far from the player.
script.zs
// EntityType<T : Entity>.canSpawnFarFromPlayer as bool
myEntityType.canSpawnFarFromPlayer

Return Type: bool

canSpawnFarFromPlayer() as bool
Checks if the entity can spawn far from the player.

Returns: True if the entity can spawn far from the player.

script.zs
// EntityType<T : Entity>.canSpawnFarFromPlayer() as bool;
myEntityType.canSpawnFarFromPlayer();

Return Type: bool

Getter
Checks if the entity can be summoned.
script.zs
// EntityType<T : Entity>.canSummon as bool
myEntityType.canSummon

Return Type: bool

canSummon() as bool
Checks if the entity can be summoned.

Returns: True if the entity can be summoned.

script.zs
// EntityType<T : Entity>.canSummon() as bool;
myEntityType.canSummon();

Return Type: bool

Getter
Gets the category of the entity.
script.zs
// EntityType<T : Entity>.category as MobCategory
myEntityType.category

Return Type: MobCategory

category() as MobCategory
Gets the category of the entity.

Returns: The category of the entity.

script.zs
// EntityType<T : Entity>.category() as MobCategory;
myEntityType.category();

Return Type: MobCategory

Getter
Gets the command string of the entity.
script.zs
// EntityType<T : Entity>.commandString as string
myEntityType.commandString

Return Type: string

create(level as Level) as Entity
Creates an entity.

Returns: The created entity.

script.zs
// EntityType<T : Entity>.create(level as Level) as Entity;
myEntityType.create(myLevel);

Parameters:

level Type: Level - The level to create the entity in.

Return Type: Entity

Getter
Gets the default loot table of the entity.
script.zs
// EntityType<T : Entity>.defaultLootTable as ResourceLocation
myEntityType.defaultLootTable

Return Type: ResourceLocation

Getter
Gets the description of the entity.
script.zs
// EntityType<T : Entity>.description as Component
myEntityType.description

Return Type: Component

description() as Component
Gets the description of the entity.

Returns: The description of the entity.

script.zs
// EntityType<T : Entity>.description() as Component;
myEntityType.description();

Return Type: Component

Getter
Gets the description ID of the entity.
script.zs
// EntityType<T : Entity>.descriptionId as string
myEntityType.descriptionId

Return Type: string

descriptionId() as string
Gets the description ID of the entity.

Returns: The description ID of the entity.

script.zs
// EntityType<T : Entity>.descriptionId() as string;
myEntityType.descriptionId();

Return Type: string

Getter
Gets the dimensions of the entity.
script.zs
// EntityType<T : Entity>.dimensions as EntityDimensions
myEntityType.dimensions

Return Type: EntityDimensions

dimensions() as EntityDimensions
Gets the dimensions of the entity.

Returns: The dimensions of the entity.

script.zs
// EntityType<T : Entity>.dimensions() as EntityDimensions;
myEntityType.dimensions();

Return Type: EntityDimensions

Getter
Checks if the entity is fire immune.
script.zs
// EntityType<T : Entity>.fireImmune as bool
myEntityType.fireImmune

Return Type: bool

fireImmune() as bool
Checks if the entity is fire immune.

Returns: True if the entity is fire immune.

script.zs
// EntityType<T : Entity>.fireImmune() as bool;
myEntityType.fireImmune();

Return Type: bool

Getter
Gets the height of the entity.
script.zs
// EntityType<T : Entity>.height as float
myEntityType.height

Return Type: float

height() as float
Gets the height of the entity.

Returns: The height of the entity.

script.zs
// EntityType<T : Entity>.height() as float;
myEntityType.height();

Return Type: float

isBlockDangerous(state as BlockState) as bool
Checks if the entity is dangerous to blocks.

Returns: True if the entity is dangerous to blocks.

script.zs
// EntityType<T : Entity>.isBlockDangerous(state as BlockState) as bool;
myEntityType.isBlockDangerous(myBlockState);

Parameters:

state Type: BlockState - The state of the block to check.

Return Type: bool

isIn(tag as KnownTag<EntityType<Entity>>) as bool
Checks if the entity is in a tag.

Returns: True if the entity is in the tag.

script.zs
// EntityType<T : Entity>.isIn(tag as KnownTag<EntityType<Entity>>) as bool;
myEntityType.isIn(myKnownTag);

Parameters:

tag Type: KnownTag<EntityType<Entity>> - The tag to check.

Return Type: bool

Getter
Gets the registry name of the entity.
script.zs
// EntityType<T : Entity>.registryName as ResourceLocation
myEntityType.registryName

Return Type: ResourceLocation

registryName() as ResourceLocation
Gets the registry name of the entity.

Returns: The registry name of the entity.

script.zs
// EntityType<T : Entity>.registryName() as ResourceLocation;
myEntityType.registryName();

Return Type: ResourceLocation

spawn(level as ServerLevel, spawnStack as IItemStack, spawningPlayer as Player, position as BlockPos, spawnType as MobSpawnType, alignPosition as bool, invertY as bool) as Entity
Spawns an entity.

Returns: The spawned entity.

script.zs
// EntityType<T : Entity>.spawn(level as ServerLevel, spawnStack as IItemStack, spawningPlayer as Player, position as BlockPos, spawnType as MobSpawnType, alignPosition as bool, invertY as bool) as Entity;
myEntityType.spawn(myServerLevel, myIItemStack, myPlayer, myBlockPos, myMobSpawnType, myBool, myBool);

Parameters:

level Type: ServerLevel - The level to spawn the entity in.
spawnStack Type: IItemStack - The stack to spawn the entity with.
spawningPlayer Type: Player - The player that is spawning the entity.
position Type: BlockPos - The position to spawn the entity at.
spawnType Type: MobSpawnType - The type of spawn to use.
alignPosition Type: bool - Whether to align the position of the entity.
invertY Type: bool - Whether to offset the y position of the entity.

Return Type: Entity

spawn(level as ServerLevel, position as BlockPos, spawnType as MobSpawnType) as Entity
Spawns an entity.

Returns: The spawned entity.

script.zs
// EntityType<T : Entity>.spawn(level as ServerLevel, position as BlockPos, spawnType as MobSpawnType) as Entity;
myEntityType.spawn(myServerLevel, myBlockPos, myMobSpawnType);

Parameters:

level Type: ServerLevel - The level to spawn the entity in.
position Type: BlockPos - The position to spawn the entity at.
spawnType Type: MobSpawnType - The type of spawn to use.

Return Type: Entity

spawn(level as ServerLevel, onSpawn as function(t as Entity) as void, position as BlockPos, spawnType as MobSpawnType, alignPosition as bool, invertY as bool) as Entity
Spawns an entity.

Returns: The spawned entity.

script.zs
// EntityType<T : Entity>.spawn(level as ServerLevel, onSpawn as function(t as Entity) as void, position as BlockPos, spawnType as MobSpawnType, alignPosition as bool, invertY as bool) as Entity;
myEntityType.spawn(myServerLevel, myConsumer, myBlockPos, myMobSpawnType, myBool, myBool);

Parameters:

level Type: ServerLevel - The level to spawn the entity in.
onSpawn Type: function(t as Entity) as void - The consumer to call when the entity is spawned.
position Type: BlockPos - The position to spawn the entity at.
spawnType Type: MobSpawnType - The type of spawn to use.
alignPosition Type: bool - Whether to align the position of the entity.
invertY Type: bool - Whether to offset the y position of the entity.

Return Type: Entity

Getter
Gets the short string representation of the entity.
script.zs
// EntityType<T : Entity>.toShortString as string
myEntityType.toShortString

Return Type: string

toShortString() as string
Gets the short string representation of the entity.

Returns: The short string representation of the entity.

script.zs
// EntityType<T : Entity>.toShortString() as string;
myEntityType.toShortString();

Return Type: string

Getter
Gets the width of the entity.
script.zs
// EntityType<T : Entity>.width as float
myEntityType.width

Return Type: float

width() as float
Gets the width of the entity.

Returns: The width of the entity.

script.zs
// EntityType<T : Entity>.width() as float;
myEntityType.width();

Return Type: float