Home Commands Examples Getting Started With Scripts Global Keywords

FallingBlockEntity

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.entity.type.misc.FallingBlockEntity;

Extending Entity

FallingBlockEntity extends Entity. That means all methods available in Entity are also available in FallingBlockEntity

Static Methods

Spawns a new falling block entity at the given position with the given blockstate.

Returns: The entity that was spawned.
Return Type: FallingBlockEntity

script.zs
// FallingBlockEntity.fall(level as Level, pos as BlockPos, state as BlockState) as FallingBlockEntity
FallingBlockEntity.fall(level, new BlockPos(1, 2, 3), <blockstate:minecraft:dirt>);
ParameterTypeDescription
Parameter
level
Type
Level
Description
The level to spawn the entity in.
Parameter
pos
Type
BlockPos
Description
The position to spawn the entity at.
Parameter
state
Type
BlockState
Description
The blockstate of the falling block.

Methods

Triggers the given Fallable’s onBrokenAfterFall method using this entity.

script.zs
// FallingBlockEntity.callOnBrokenAfterFall(fallableBlock as Block, position as BlockPos)
FallingBlockEntity.fall(level, new BlockPos(1, 2, 3), <blockstate:minecraft:dirt>).callOnBrokenAfterFall(<block:minecraft:sand>, new BlockPos(1, 2, 3));
ParameterTypeDescription
Parameter
fallableBlock
Type
Block
Description
The fallable block.
Parameter
position
Type
BlockPos
Description
The position that the block fell at.

Gets the BlockState of this falling entity.

Returns: The BlockState of this falling entity
Return Type: BlockState

script.zs
// FallingBlockEntity.getBlockState() as BlockState
FallingBlockEntity.fall(level, new BlockPos(1, 2, 3), <blockstate:minecraft:dirt>).getBlockState();

Gets the position that this entity was spawned at.

Returns: The position that the entity was spawned at.
Return Type: BlockPos

script.zs
// FallingBlockEntity.getStartPos() as BlockPos
FallingBlockEntity.fall(level, new BlockPos(1, 2, 3), <blockstate:minecraft:dirt>).getStartPos();

Sets the BlockState of this falling entity.

script.zs
FallingBlockEntity.setBlockState(state as BlockState)
ParameterType
Parameter
state
Type
BlockState

Sets that entities should be hurt by this block, as well as setting how much damage is done.

script.zs
// FallingBlockEntity.setHurtsEntities(damagePerDistance as float, maxDamage as int)
FallingBlockEntity.fall(level, new BlockPos(1, 2, 3), <blockstate:minecraft:dirt>).setHurtsEntities(0.5, 5);
ParameterTypeDescription
Parameter
damagePerDistance
Type
float
Description
The damage done per distance fell.
Parameter
maxDamage
Type
int
Description
The max amount of damage that can be caused by this entity.

Sets the position that this entity was spawned at.

this is mainly used for the rendering of the entity

script.zs
// FallingBlockEntity.setStartPos(pos as BlockPos)
FallingBlockEntity.fall(level, new BlockPos(1, 2, 3), <blockstate:minecraft:dirt>).setStartPos(new BlockPos(1, 2, 3));
ParameterTypeDescription
Parameter
pos
Type
BlockPos
Description
the position that the entity was spawned at.

Properties

NameTypeHas GetterHas SetterDescription
Name
blockstate
Type
BlockState
Has Getter
true
Has Setter
true
Description
Gets the BlockState of this falling entity.