FallingBlockEntity
Link to fallingblockentity
导入类
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.type.misc.FallingBlockEntity;
Extending Entity
Link to extending-entity
FallingBlockEntity extends Entity. That means all methods available in Entity are also available in FallingBlockEntity
Static Methods
Link to static-methods
Name: fall
Spawns a new falling block entity at the given position with the given blockstate.
Returns: The entity that was spawned.
Return Type: FallingBlockEntity
ZenScript Copy// FallingBlockEntity.fall(level as Level, pos as BlockPos, state as BlockState) as FallingBlockEntity
FallingBlockEntity.fall(level, new BlockPos(1, 2, 3), <blockstate:minecraft:dirt>);
参数 | 类型 | 描述 |
---|---|---|
参数 level | 类型 Level | 描述 The level to spawn the entity in. |
参数 点 | 类型 BlockPos | 描述 The position to spawn the entity at. |
参数 state | 类型 BlockState | 描述 The blockstate of the falling block. |
使用方式
Link to 使用方式
Name: callOnBrokenAfterFall
Triggers the given Fallable's onBrokenAfterFall
method using this entity.
ZenScript Copy// 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));
参数 | 类型 | 描述 |
---|---|---|
参数 fallableBlock | 类型 Block | 描述 The fallable block. |
参数 position | 类型 BlockPos | 描述 The position that the block fell at. |
Name: getBlockState
Gets the BlockState of this falling entity.
Returns: The BlockState of this falling entity
Return Type: BlockState
ZenScript Copy// FallingBlockEntity.getBlockState() as BlockState
FallingBlockEntity.fall(level, new BlockPos(1, 2, 3), <blockstate:minecraft:dirt>).getBlockState();
Name: getStartPos
Gets the position that this entity was spawned at.
Returns: The position that the entity was spawned at.
Return Type: BlockPos
ZenScript Copy// FallingBlockEntity.getStartPos() as BlockPos
FallingBlockEntity.fall(level, new BlockPos(1, 2, 3), <blockstate:minecraft:dirt>).getStartPos();
Name: setBlockState
Sets the BlockState of this falling entity.
ZenScript CopyFallingBlockEntity.setBlockState(state as BlockState)
参数 | 类型 |
---|---|
参数 state | 类型 BlockState |
Name: setHurtsEntities
Sets that entities should be hurt by this block, as well as setting how much damage is done.
ZenScript Copy// FallingBlockEntity.setHurtsEntities(damagePerDistance as float, maxDamage as int)
FallingBlockEntity.fall(level, new BlockPos(1, 2, 3), <blockstate:minecraft:dirt>).setHurtsEntities(0.5, 5);
参数 | 类型 | 描述 |
---|---|---|
参数 damagePerDistance | 类型 float | 描述 The damage done per distance fell. |
参数 maxDamage | 类型 int | 描述 The max amount of damage that can be caused by this entity. |
Name: setStartPos
Sets the position that this entity was spawned at.
this is mainly used for the rendering of the entity
ZenScript Copy// FallingBlockEntity.setStartPos(pos as BlockPos)
FallingBlockEntity.fall(level, new BlockPos(1, 2, 3), <blockstate:minecraft:dirt>).setStartPos(new BlockPos(1, 2, 3));
参数 | 类型 | 描述 |
---|---|---|
参数 点 | 类型 BlockPos | 描述 the position that the entity was spawned at. |
名称 | 类型 | 可获得 | 可设置 | 描述 |
---|---|---|---|---|
名称 blockstate | 类型 BlockState | 可获得 true | 可设置 true | 描述 Gets the BlockState of this falling entity. |