Fix Reason = Player for Experience Orb drop

Dieser Commit ist enthalten in:
Aikar 2018-05-18 19:40:33 -04:00
Ursprung 01c6454ead
Commit 340908d328
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 401ADFC9891FAAFE

Datei anzeigen

@ -1,4 +1,4 @@
From 595f30a5ba443cbbad054e480a9cd909e56c02b8 Mon Sep 17 00:00:00 2001
From 1e93cb2d271ea70f82389d69c55179ba9a2edca0 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 19 Dec 2017 16:31:46 -0500
Subject: [PATCH] ExperienceOrbs API for Reason/Source/Triggering player
@ -129,7 +129,7 @@ index 6ac89d1e3..177d8582f 100644
// CraftBukkit end
Item item = itemstack.getItem();
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 9e864864d..91e8c1d75 100644
index 9e864864d..38c043375 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -347,7 +347,8 @@ public abstract class EntityLiving extends Entity {
@ -138,7 +138,7 @@ index 9e864864d..91e8c1d75 100644
i -= j;
- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j));
+ EntityLiving attacker = killer != null ? killer : lastDamager; // Paper
+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j, this instanceof Player ? org.bukkit.entity.ExperienceOrb.SpawnReason.PLAYER_DEATH : org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, attacker, this)); // Paper
+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j, this instanceof EntityPlayer ? org.bukkit.entity.ExperienceOrb.SpawnReason.PLAYER_DEATH : org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, attacker, this)); // Paper
}
this.expToDrop = 0;
// CraftBukkit end