Class LivingExperienceDropEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.EntityEvent
net.neoforged.neoforge.event.entity.living.LivingEvent
net.neoforged.neoforge.event.entity.living.LivingExperienceDropEvent
All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent

public class LivingExperienceDropEvent extends LivingEvent implements net.neoforged.bus.api.ICancellableEvent
Event for when an entity drops experience on its death, can be used to change the amount of experience points dropped or completely prevent dropping of experience by canceling the event.
  • Field Details Link icon

    • attackingPlayer Link icon

      @Nullable private final @Nullable Player attackingPlayer
    • originalExperiencePoints Link icon

      private final int originalExperiencePoints
    • droppedExperiencePoints Link icon

      private int droppedExperiencePoints
  • Constructor Details Link icon

    • LivingExperienceDropEvent Link icon

      public LivingExperienceDropEvent(LivingEntity entity, @Nullable @Nullable Player attackingPlayer, int originalExperience)
  • Method Details Link icon

    • getDroppedExperience Link icon

      public int getDroppedExperience()
    • setDroppedExperience Link icon

      public void setDroppedExperience(int droppedExperience)
    • getAttackingPlayer Link icon

      @Nullable public @Nullable Player getAttackingPlayer()
      Returns:
      The player that last attacked the entity and thus caused the experience. This can be null, in case the player has since logged out.
    • getOriginalExperience Link icon

      public int getOriginalExperience()