ExperienceOrbs API for Reason/Source/Triggering player

Adds lots of information about why this orb exists.

Replaces isFromBottle() with logic that persists entity reloads too.
This commit is contained in:
Aikar
2017-12-19 16:31:46 -05:00
parent aa6fe30766
commit 110bcadcdf
16 changed files with 207 additions and 40 deletions

View File

@@ -205,8 +205,9 @@
if (world instanceof ServerLevel worldserver) {
- if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
- ExperienceOrb.award(worldserver, this.position(), Mth.floor((float) short0 * 0.08F));
+ if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && true) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp
ExperienceOrb.award(worldserver, this.position(), Mth.floor((float) short0 * 0.08F));
+ ExperienceOrb.award(worldserver, this.position(), Mth.floor((float) short0 * 0.08F), org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, this.lastHurtByPlayer, this); // Paper
}
if (this.dragonDeathTime == 1 && !this.isSilent()) {
@@ -233,16 +234,17 @@
}
}
@@ -592,7 +704,7 @@
@@ -592,15 +704,15 @@
if (world1 instanceof ServerLevel) {
ServerLevel worldserver1 = (ServerLevel) world1;
- if (worldserver1.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
- ExperienceOrb.award(worldserver1, this.position(), Mth.floor((float) short0 * 0.2F));
+ if (true) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp
ExperienceOrb.award(worldserver1, this.position(), Mth.floor((float) short0 * 0.2F));
+ ExperienceOrb.award(worldserver1, this.position(), Mth.floor((float) short0 * 0.2F), org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, this.lastHurtByPlayer, this); // Paper
}
@@ -600,7 +712,7 @@
if (this.dragonFight != null) {
this.dragonFight.setDragonKilled(this);
}