Interface ExperienceOrb

All Superinterfaces:
Audience, CommandSender, Entity, HoverEventSource<HoverEvent.ShowEntity>, Metadatable, Nameable, Permissible, PersistentDataHolder, ServerOperator

public interface ExperienceOrb extends Entity
Represents an Experience Orb.
  • Method Details

    • getExperience

      int getExperience()
      Gets how much experience is contained within this orb
      Returns:
      Amount of experience
    • setExperience

      void setExperience(int value)
      Sets how much experience is contained within this orb
      Parameters:
      value - Amount of experience
    • isFromBottle

      @Deprecated default boolean isFromBottle()
      Deprecated.
      Use getSpawnReason() == EXP_BOTTLE
      Check if this orb was spawned from a ThrownExpBottle
      Returns:
      if orb was spawned from a bottle
    • getTriggerEntityId

      @Nullable UUID getTriggerEntityId()
      If this experience orb was triggered to be spawned by an entity such as a player, due to events such as killing entity, breaking blocks, smelting in a furnace, etc, this will return the UUID of the entity that triggered this orb to drop. In the case of an entity being killed, this will be the killers UUID.
      Returns:
      UUID of the player that triggered this orb to drop, or null if unknown/no triggering entity
    • getSourceEntityId

      @Nullable UUID getSourceEntityId()
      If this experience orb was spawned in relation to another entity, such as a player or other living entity death, or breeding, return the source entity UUID. In the case of breeding, this will be the new baby entities UUID. In the case of an entity being killed, this will be the dead entities UUID.
      Returns:
      The UUID of the entity that sourced this experience orb
    • getSpawnReason

      Gets the reason that this experience orb was spawned. For any case that we do not know, such as orbs spawned before this API was added, UNKNOWN is returned.
      Returns:
      The reason for this orb being spawned.