PlacementType
Link to placementtype
导入类
Link to 导入类
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 Copyimport crafttweaker.api.entity.PlacementType;
Enum Constants
Link to enum-constants
PlacementType is an enum. It has 4 enum constants. They are accessible using the code below.
ZenScript CopyPlacementType.ON_GROUND
PlacementType.IN_WATER
PlacementType.NO_RESTRICTIONS
PlacementType.IN_LAVA
使用方式
Link to 使用方式
Name: canSpawnAt
Checks if a specific entity type can spawn in the world at the given position with this PlacementType.
Returns: True if the entity type can spawn. False otherwise.
Return Type: boolean
ZenScript Copy// PlacementType.canSpawnAt(world as MCWorld, pos as BlockPos, entityType as MCEntityType) as boolean
myPlacementType.canSpawnAt(world, new BlockPos(1,2,3), <entitytype:minecraft:pig>);
参数 | 类型 | 描述 |
---|---|---|
参数 world | 类型 MCWorld | 描述 A World object. |
参数 点 | 类型 BlockPos | 描述 The position to check at. |
参数 entityType | 类型 MCEntityType #MC实体类型 | 描述 The EntityType to check for. |