Interface ExperienceOrb

All Superinterfaces:
Entity, HoverEventSource<HoverEvent.ShowEntity>, SchedulerSource, Sound.Emitter, Sound.Source.Provider

public interface ExperienceOrb extends Entity
An orb of experience on the ground (minecraft:experience_orb), left by a mob a player killed, by two animals that bred or by a player who died.

It falls, flies to the closest player within 8 blocks, merges with orbs of the same value nearby and despawns after 6000 ticks. A player who touches it takes its value once every other tick, as many times as its count.

Like every entity, change it from the region thread owning its chunk.

Since:
0.1.0
See Also:
  • Field Details

    • DEFAULT_LIFETIME

      static final int DEFAULT_LIFETIME
      How many ticks an orb stays on the ground before it despawns: five minutes.
      Since:
      0.1.0
      See Also:
    • FOLLOW_RANGE

      static final int FOLLOW_RANGE
      How far an orb notices a player to fly to, in blocks.
      Since:
      0.1.0
      See Also:
  • Method Details

    • value

      int value()
      Returns how many experience points a player gets each time they take this orb.
      Returns:
      how many experience points a player gets each time they take this orb
      Since:
      0.1.0
    • count

      int count()
      Returns how many times this orb gives its value.: orbs of the same value merge into one
      Returns:
      how many times this orb gives its value
      Since:
      0.1.0
    • age

      int age()
      Returns for how many ticks this orb has been on the ground.
      Returns:
      for how many ticks this orb has been on the ground
      Since:
      0.1.0
    • setAge

      void setAge(int ticks)
      Changes for how long this orb has been on the ground; it despawns at 6000 ticks.
      Parameters:
      ticks - the new age, in ticks
      Since:
      0.1.0
    • biggestOrbValue

      static int biggestOrbValue(int amount)
      Returns the value of the biggest orb that fits in an amount of experience.

      As in Vanilla, an amount is split into orbs of 2477, 1237, 617, 307, 149, 73, 37, 17, 7, 3 and 1 points, the biggest first.

      Parameters:
      amount - the experience left to give out, positive
      Returns:
      the value of the biggest orb that fits in an amount of experience
      Since:
      0.1.0