Explosion
Link to explosion
导入类
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.world.Explosion;
Static Methods
Link to static-methods
Name: create
Return Type: Explosion
ZenScript CopyExplosion.create(world as Level, x as double, y as double, z as double, size as float, causesFire as boolean, mode as ExplosionBlockInteraction, exploder as Entity, source as DamageSource) as Explosion
参数 | 类型 | 可选 |
---|---|---|
参数 world | 类型 Level | 可选 false |
参数 x | 类型 double | 可选 false |
参数 y | 类型 double | 可选 false |
参数 z | 类型 double | 可选 false |
参数 size #大小 | 类型 float | 可选 false |
参数 causesFire | 类型 布尔值 | 可选 false |
参数 mode | 类型 ExplosionBlockInteraction | 可选 false |
参数 exploder | 类型 Entity | 可选 true |
参数 来源 | 类型 DamageSource | 可选 true |
使用方式
Link to 使用方式
Name: clearToBlow
Clears the affected block positions of this Explosion.
ZenScript Copy// Explosion.clearToBlow()
myExplosion.clearToBlow();
Name: explode
Performs the first part of the explosion which is destroying the blocks.
ZenScript Copy// Explosion.explode()
myExplosion.explode();
Name: finalizeExplosion
Performs the second part of the explosion which is the sound, drops and if enabled the particles.
ZenScript Copy// Explosion.finalizeExplosion(spawnParticles as boolean)
myExplosion.finalizeExplosion(true);
参数 | 类型 | 描述 |
---|---|---|
参数 spawnParticles | 类型 布尔值 | 描述 Should particles be spawned. |
Name: getDamageSource
Gets the damage source of this Explosion.
Returns: The damage source of this Explosion.
Return Type: DamageSource
ZenScript Copy// Explosion.getDamageSource() as DamageSource
myExplosion.getDamageSource();
Name: getHitPlayers
Gets the player knockback map for this Explosion.
This map is only populated in Explosion#explode() so calling it before will return nothing.
This map is used to calculate the vectors that players around the explosion will be pushed back by.
Returns: A Map of PlayerEntity to Vector3d depicting knockback vectors.
Return Type: Vec3[Player]
ZenScript Copy// Explosion.getHitPlayers() as Vec3[Player]
myExplosion.getHitPlayers();
Name: getSourceMob
Gets the LivingEntity that caused this Explosion.
For example: If the Explosion was caused by TNT, it will return the PlayerEntity that placed it. If the Explosion was caused by a Creeper or another Entity directly, it will return that Entity. If the Explosion was caused by a Ghast fireball, it will return the Ghast.
If no Entity caused this Explosion (for example, if the Explosion was caused by TNT in a Desert Temple that generated in the world), then null
is returned.
You may need to cast the returned LivingEntity to not be nullable.
Returns: The LivingEntity that caused this Explosion. null
if no LivingEntity caused it.
Return Type: LivingEntity?
ZenScript Copy// Explosion.getSourceMob() as LivingEntity?
myExplosion.getSourceMob();
Name: getToBlow
Return Type: stdlib.List<BlockPos>
ZenScript Copy// Explosion.getToBlow() as stdlib.List<BlockPos>
myExplosion.getToBlow();
名称 | 类型 | 可获得 | 可设置 | 描述 |
---|---|---|---|---|
名称 damageSource | 类型 DamageSource | 可获得 true | 可设置 false | 描述 Gets the damage source of this Explosion. |
名称 playerKnockbackMap | 类型 Vec3[Player] | 可获得 true | 可设置 false | 描述 Gets the player knockback map for this Explosion. This map is only populated in Explosion#explode() so calling it before will return nothing. This map is used to calculate the vectors that players around the explosion will be pushed back by. |
名称 sourceMob | 类型 LivingEntity? | 可获得 true | 可设置 false | 描述 Gets the LivingEntity that caused this Explosion. For example: If the Explosion was caused by TNT, it will return the PlayerEntity that placed it. If the Explosion was caused by a Creeper or another Entity directly, it will return that Entity. If the Explosion was caused by a Ghast fireball, it will return the Ghast. If no Entity caused this Explosion (for example, if the Explosion was caused by TNT in a Desert Temple that generated in the world), then null is returned. You may need to cast the returned LivingEntity to not be nullable. |
名称 toBlow | 类型 stdlib.List<BlockPos> | 可获得 true | 可设置 false | 描述 |