Class ExplosionKnockbackEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.level.ExplosionEvent
net.neoforged.neoforge.event.level.ExplosionKnockbackEvent

public class ExplosionKnockbackEvent extends ExplosionEvent
ExplosionKnockbackEvent is fired once the explosion has calculated the knockback velocity to add to the entity caught in blast.

This event is not ICancellableEvent.
This event does not use
invalid reference
HasResult
.
This event is fired on the NeoForge.EVENT_BUS.
  • Field Details

    • entity

      private final Entity entity
    • knockbackVelocity

      private Vec3 knockbackVelocity
  • Constructor Details

    • ExplosionKnockbackEvent

      public ExplosionKnockbackEvent(Level level, Explosion explosion, Entity entity, Vec3 knockbackVelocity)
  • Method Details

    • getAffectedBlocks

      public List<BlockPos> getAffectedBlocks()
      return the list of blocks affected by the explosion.
    • getAffectedEntity

      public Entity getAffectedEntity()
      return the entity affected by the explosion knockback.
    • getKnockbackVelocity

      public Vec3 getKnockbackVelocity()
      return the explosion knockback velocity to apply to entity.
    • setKnockbackVelocity

      public void setKnockbackVelocity(Vec3 newKnockbackVelocity)
      Sets the explosion knockback velocity to add to the entity's existing velocity.