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.
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.neoforged.neoforge.event.level.ExplosionEvent

    ExplosionEvent.Detonate, ExplosionEvent.Start
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final List<net.minecraft.core.BlockPos>
     
    private final net.minecraft.world.entity.Entity
     
    private net.minecraft.world.phys.Vec3
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ExplosionKnockbackEvent(net.minecraft.world.level.Level level, net.minecraft.world.level.ServerExplosion explosion, net.minecraft.world.entity.Entity entity, net.minecraft.world.phys.Vec3 knockbackVelocity, List<net.minecraft.core.BlockPos> blockList)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    List<net.minecraft.core.BlockPos>
    return the list of blocks affected by the explosion.
    net.minecraft.world.entity.Entity
    return the entity affected by the explosion knockback.
    net.minecraft.world.phys.Vec3
    return the explosion knockback velocity to apply to entity.
    void
    setKnockbackVelocity(net.minecraft.world.phys.Vec3 newKnockbackVelocity)
    Sets the explosion knockback velocity to add to the entity's existing velocity.

    Methods inherited from class net.neoforged.neoforge.event.level.ExplosionEvent

    getExplosion, getLevel

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • entity

      private final net.minecraft.world.entity.Entity entity
    • blockList

      private final List<net.minecraft.core.BlockPos> blockList
    • knockbackVelocity

      private net.minecraft.world.phys.Vec3 knockbackVelocity
  • Constructor Details

    • ExplosionKnockbackEvent

      public ExplosionKnockbackEvent(net.minecraft.world.level.Level level, net.minecraft.world.level.ServerExplosion explosion, net.minecraft.world.entity.Entity entity, net.minecraft.world.phys.Vec3 knockbackVelocity, List<net.minecraft.core.BlockPos> blockList)
  • Method Details

    • getAffectedBlocks

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

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

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

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