ExperienceOrb merging/stacking API and fixes

Adds an option for maximum exp value when merging orbs

Adds ExperienceOrbMergeEvent
Fired when the server is about to merge 2 experience orbs
as entities. Plugins can cancel it if they want to ensure experience orbs do not lose important
metadata such as spawn reason, or conditionally move data from source to target.

Fixes an issue where the stacked count was not taking into account
for mending repairs and when merging with spigot's merge-on-spawn
logic

== AT ==
public net.minecraft.world.entity.ExperienceOrb count

Co-authored-by: Aikar <aikar@aikar.co>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
BillyGalbreath
2017-11-10 23:03:12 -05:00
parent e5e4cc7020
commit e91df097e9
3 changed files with 48 additions and 8 deletions

View File

@@ -18,6 +18,18 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb {
this.getHandle().value = value;
}
// Paper start - expose count
@Override
public int getCount() {
return this.getHandle().count;
}
@Override
public void setCount(final int count) {
this.getHandle().count = count;
}
// Paper end
// Paper start
public java.util.UUID getTriggerEntityId() {
return getHandle().triggerEntityId;