IExplosion
Link to iexplosion
导入类
Link to 导入类
It might be required to import the class to avoid errors.
import crafttweaker.world.IExplosion;
Creating an IExplosion object
Link to creating-an-iexplosion-object
To create an IExplosion object, you must obtain it from an IWorld and call it with any of these three methods:
world.createExplosion(IEntity, double, double, double, float, bool, bool);
world.performExplosion(IEntity, double, double, double, float, bool, bool);
world.performExplosion(IExplosion);
ZenGetters and ZenSetters
Link to zengetters-and-zensetters
ZenGetter | ZenSetter | 类型 | 描述 |
---|---|---|---|
ZenGetter world | ZenSetter | 类型 IWorld | 描述 The world of the explosion. |
ZenGetter placedBy | ZenSetter | 类型 IEntityLivingBase | 描述 The entity that initiated the explosion. If the explosion was caused by TNT, the entity is the entity that placed down the TNT, if applicable. Can be null . |
ZenGetter position | ZenSetter | 类型 Position3f | 描述 The position of the explosion. |
ZenGetter affectedBlockPositions | ZenSetter affectedBlockPositions | 类型 IBlockPos[ ] | 描述 A list of block positions that the explosion affects. May be null/empty before doExplosionA() is called. |
ZenGetter playerKnockbackMap | ZenSetter | 类型 IVector3d[IPlayer] | 描述 A map of players in the explosion area mapped to their respective knockbacks taken from the explosion. |
ZenMethods
Link to zenmethods
clearAffectedBlockPositions()
- clears the list of affected block positionsonExplosionStart(IWorld world)
- returns abool
that is the result of the ExplosionStart event in the specified world, so this should be called if you want to use logic to possibly cancel your explosion before detonating it manually.doExplosionA()
- performs the first part of the explosion; this includes entity damage, entity knockback, andaffectedBlockPositions
assignment.doExplosionB(bool spawnParticles)
- performs the second part of the explosion; this includes sounds, particles, block destruction/dropping, and fire creation.