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.world.LevelWriter;

Name: addFreshEntity

add an entity to the world, return if the entity is added successfully.

Return Type: boolean

ZenScript
Copy
LevelWriter.addFreshEntity(entity as Entity) as boolean
ParameterType
Parameter
entity
Type
Entity

Name: destroyBlock

Destroys a block within the world.

Returns: Whether the block was changed.
Return Type: boolean

ZenScript
Copy
// LevelWriter.destroyBlock(pos as BlockPos, doDrops as boolean) as boolean

myLevelWriter.destroyBlock(new BlockPos(0, 1, 2), true);
ParameterTypeDescription
Parameter
pos
Type
BlockPos
Description
The position of the block.
Parameter
doDrops
Type
boolean
Description
Whether the block drops itself and it's loot.

Name: destroyBlock

Destroys a block within the world.

Returns: Whether the block was changed.
Return Type: boolean

ZenScript
Copy
// LevelWriter.destroyBlock(pos as BlockPos, doDrops as boolean, breaker as Entity?) as boolean

myLevelWriter.destroyBlock(new BlockPos(0, 1, 2), true, player);
ParameterTypeDescription
Parameter
pos
Type
BlockPos
Description
The position of the block.
Parameter
doDrops
Type
boolean
Description
Whether the block drops itself and it's loot.
Parameter
breaker
Type
Entity?
Description
The entity to break the block.