Explosion
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.
Static Methods
Return Type: Explosion
Parameter | Type | Optional |
---|---|---|
Parameter world | Type Level | Optional false |
Parameter x | Type double | Optional false |
Parameter y | Type double | Optional false |
Parameter z | Type double | Optional false |
Parameter size | Type float | Optional false |
Parameter causesFire | Type boolean | Optional false |
Parameter mode | Type ExplosionBlockInteraction | Optional false |
Parameter exploder | Type Entity | Optional true |
Parameter source | Type DamageSource | Optional true |
Methods
Clears the affected block positions of this Explosion.
Performs the first part of the explosion which is destroying the blocks.
Performs the second part of the explosion which is the sound, drops and if enabled the particles.
Parameter | Type | Description |
---|---|---|
Parameter spawnParticles | Type boolean | Description Should particles be spawned. |
Gets the damage source of this Explosion.
Returns: The damage source of this Explosion.
Return Type: DamageSource
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]
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?
Return Type: stdlib.List<BlockPos>
Properties
Name | Type | Has Getter | Has Setter | Description |
---|---|---|---|---|
Name damageSource | Type DamageSource | Has Getter true | Has Setter false | Description Gets the damage source of this Explosion. |
Name playerKnockbackMap | Type Vec3[Player] | Has Getter true | Has Setter false | Description 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. |
Name sourceMob | Type LivingEntity? | Has Getter true | Has Setter false | Description 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. |
Name toBlow | Type stdlib.List<BlockPos> | Has Getter true | Has Setter false | Description |