Interface ExperienceOrb
- All Superinterfaces:
Entity, HoverEventSource<HoverEvent.ShowEntity>, SchedulerSource, Sound.Emitter, Sound.Source.Provider
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final intHow many ticks an orb stays on the ground before it despawns: five minutes.static final intHow far an orb notices a player to fly to, in blocks. -
Method Summary
Modifier and TypeMethodDescriptionintage()Returns for how many ticks this orb has been on the ground.static intbiggestOrbValue(int amount) Returns the value of the biggest orb that fits in an amount of experience.intcount()Returns how many times this orb gives its value.voidsetAge(int ticks) Changes for how long this orb has been on the ground; it despawns at 6000 ticks.intvalue()Returns how many experience points a player gets each time they take this orb.Methods inherited from interface Entity
chunk, displayName, entityId, isRemoved, location, remove, server, teleport, teleport, teleport, type, uuid, worldMethods inherited from interface HoverEventSource
asHoverEvent, asHoverEventMethods inherited from interface SchedulerSource
execute, execute, executeDelayed, executeDelayed, isOwnedByCurrentThreadMethods inherited from interface Sound.Source.Provider
soundSource
-
Field Details
-
DEFAULT_LIFETIME
static final int DEFAULT_LIFETIMEHow 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_RANGEHow 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
-