LevelWriter

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.

script.zs
import crafttweaker.api.world.LevelWriter;

Methods

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

Return Type: boolean

script.zs
LevelWriter.addFreshEntity(entity as Entity) as boolean
ParameterType
Parameter
entity
Type
Entity

Destroys a block within the world.

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

script.zs
// 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.

Destroys a block within the world.

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

script.zs
// 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.