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

已实现的接口

Link to 已实现的接口

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

MobCategory is an enum. It has 8 enum constants. They are accessible using the code below.

ZenScript
Copy
<constant:minecraft:mobcategory:monster>
<constant:minecraft:mobcategory:creature>
<constant:minecraft:mobcategory:ambient>
<constant:minecraft:mobcategory:axolotls>
<constant:minecraft:mobcategory:underground_water_creature>
<constant:minecraft:mobcategory:water_creature>
<constant:minecraft:mobcategory:water_ambient>
<constant:minecraft:mobcategory:misc>

Link to getDespawnDistance

Name: getDespawnDistance

Return Type: int

ZenScript
Copy
// MobCategory.getDespawnDistance() as int

myMobCategory.getDespawnDistance();

Link to getMaxInstancesPerChunk

Name: getMaxInstancesPerChunk

Return Type: int

ZenScript
Copy
// MobCategory.getMaxInstancesPerChunk() as int

myMobCategory.getMaxInstancesPerChunk();

Name: getName

Return Type: string

ZenScript
Copy
// MobCategory.getName() as string

myMobCategory.getName();

Link to getNoDespawnDistance

Name: getNoDespawnDistance

Return Type: int

ZenScript
Copy
// MobCategory.getNoDespawnDistance() as int

myMobCategory.getNoDespawnDistance();

Name: isFriendly

Return Type: boolean

ZenScript
Copy
// MobCategory.isFriendly() as boolean

myMobCategory.isFriendly();

Name: isPersistent

Return Type: boolean

ZenScript
Copy
// MobCategory.isPersistent() as boolean

myMobCategory.isPersistent();
名称类型可获得可设置
名称
despawnDistance
类型
int
可获得
true
可设置
false
名称
friendly
类型
布尔值
可获得
true
可设置
false
名称
maxInstancesPerChunk
类型
int
可获得
true
可设置
false
名称
noDespawnDistance
类型
int
可获得
true
可设置
false
名称
persistent
类型
布尔值
可获得
true
可设置
false