Importare la Classe

Link to importare-la-classe

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

PlacementType is an enum. It has 4 enum constants. They are accessible using the code below.

ZenScript
Copy
PlacementType.ON_GROUND
PlacementType.IN_WATER
PlacementType.NO_RESTRICTIONS
PlacementType.IN_LAVA

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>);
ParametroTipoDescrizione
Parametro
world
Tipo
MCWorld
Descrizione
A World object.
Parametro
pos
Tipo
BlockPos
Descrizione
The position to check at.
Parametro
entityType
Tipo
MCEntityType
Descrizione
The EntityType to check for.