2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2017-12-19 22:46:27 +01:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Tue, 19 Dec 2017 16:31:46 -0500
|
|
|
|
Subject: [PATCH] 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.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
|
2020-08-25 04:22:08 +02:00
|
|
|
index d847326b0099a0c05a085d5d62de630491c9ac56..b537385d12463adc82751e40b479b047b32fa5bd 100644
|
2017-12-19 22:46:27 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/Block.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Block.java
|
2020-08-25 04:22:08 +02:00
|
|
|
@@ -228,13 +228,13 @@ public class Block extends BlockBase implements IMaterial {
|
2017-12-19 22:46:27 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-25 04:22:08 +02:00
|
|
|
- protected void dropExperience(WorldServer worldserver, BlockPosition blockposition, int i) {
|
|
|
|
+ protected void dropExperience(WorldServer worldserver, BlockPosition blockposition, int i, EntityPlayer player) { // Paper
|
|
|
|
if (worldserver.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)) {
|
2017-12-19 22:46:27 +01:00
|
|
|
while (i > 0) {
|
|
|
|
int j = EntityExperienceOrb.getOrbValue(i);
|
|
|
|
|
|
|
|
i -= j;
|
2020-08-25 04:22:08 +02:00
|
|
|
- worldserver.addEntity(new EntityExperienceOrb(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, j));
|
|
|
|
+ worldserver.addEntity(new EntityExperienceOrb(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, j, org.bukkit.entity.ExperienceOrb.SpawnReason.BLOCK_BREAK, player)); // Paper
|
2017-12-19 22:46:27 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 08:26:04 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/ContainerGrindstone.java b/src/main/java/net/minecraft/server/ContainerGrindstone.java
|
2020-06-25 14:04:34 +02:00
|
|
|
index 5bdb0c3a7a04a55cd5ddff8e375497e402408811..fe9a083b724a8657cac8462b3f44d3cc12a4db58 100644
|
2019-04-27 08:26:04 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/ContainerGrindstone.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ContainerGrindstone.java
|
|
|
|
@@ -81,7 +81,7 @@ public class ContainerGrindstone extends Container {
|
|
|
|
int k = EntityExperienceOrb.getOrbValue(j);
|
|
|
|
|
|
|
|
j -= k;
|
|
|
|
- world.addEntity(new EntityExperienceOrb(world, (double) blockposition.getX(), (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, k));
|
|
|
|
+ world.addEntity(new EntityExperienceOrb(world, (double) blockposition.getX(), (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, k, org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, entityhuman)); // Paper
|
|
|
|
}
|
|
|
|
|
|
|
|
world.triggerEffect(1042, blockposition, 0);
|
2020-06-25 14:04:34 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityAnimal.java b/src/main/java/net/minecraft/server/EntityAnimal.java
|
2020-08-25 04:22:08 +02:00
|
|
|
index 783cd9dbf423986d2e5cd52b05d7046e019c0b7a..2a68591c1d56f39551d0b37187b51320298787b4 100644
|
2020-06-25 14:04:34 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityAnimal.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityAnimal.java
|
2020-06-26 03:58:00 +02:00
|
|
|
@@ -237,7 +237,7 @@ public abstract class EntityAnimal extends EntityAgeable {
|
2020-08-25 04:22:08 +02:00
|
|
|
if (worldserver.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
|
2020-06-25 14:04:34 +02:00
|
|
|
// CraftBukkit start - use event experience
|
|
|
|
if (experience > 0) {
|
2020-08-25 04:22:08 +02:00
|
|
|
- worldserver.addEntity(new EntityExperienceOrb(worldserver, this.locX(), this.locY(), this.locZ(), experience));
|
|
|
|
+ worldserver.addEntity(new EntityExperienceOrb(worldserver, this.locX(), this.locY(), this.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityageable)); // Paper
|
2020-06-25 14:04:34 +02:00
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
}
|
2017-12-19 22:46:27 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
2020-08-25 04:22:08 +02:00
|
|
|
index 1627fdb2ef8551e1c63034b496a2c9bfb12d0e38..6ad63e5bb4b7bec976d1aef74547ff96f64204c6 100644
|
2017-12-19 22:46:27 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
2020-06-25 14:04:34 +02:00
|
|
|
@@ -612,7 +612,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
2017-12-19 22:46:27 +01:00
|
|
|
int j = EntityExperienceOrb.getOrbValue(i);
|
|
|
|
|
|
|
|
i -= j;
|
2019-12-12 00:43:22 +01:00
|
|
|
- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j));
|
|
|
|
+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j, org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, this.killer, this)); // Paper
|
2017-12-19 22:46:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
2020-08-25 04:22:08 +02:00
|
|
|
index 604bdc5ab98071db88ac3e93ebf11869cc60a308..deebd63e0297b245b82a620bc380c9f1a502027b 100644
|
2017-12-19 22:46:27 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
2019-04-27 08:26:04 +02:00
|
|
|
@@ -16,9 +16,59 @@ public class EntityExperienceOrb extends Entity {
|
2017-12-19 22:46:27 +01:00
|
|
|
public int value;
|
|
|
|
private EntityHuman targetPlayer;
|
|
|
|
private int targetTime;
|
|
|
|
+ // Paper start
|
|
|
|
+ public java.util.UUID sourceEntityId;
|
|
|
|
+ public java.util.UUID triggerEntityId;
|
|
|
|
+ public org.bukkit.entity.ExperienceOrb.SpawnReason spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN;
|
|
|
|
+
|
|
|
|
+ private void loadPaperNBT(NBTTagCompound nbttagcompound) {
|
|
|
|
+ if (!nbttagcompound.hasKeyOfType("Paper.ExpData", 10)) { // 10 = compound
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ NBTTagCompound comp = nbttagcompound.getCompound("Paper.ExpData");
|
|
|
|
+ if (comp.hasUUID("source")) {
|
|
|
|
+ this.sourceEntityId = comp.getUUID("source");
|
|
|
|
+ }
|
|
|
|
+ if (comp.hasUUID("trigger")) {
|
|
|
|
+ this.triggerEntityId = comp.getUUID("trigger");
|
|
|
|
+ }
|
|
|
|
+ if (comp.hasKey("reason")) {
|
|
|
|
+ String reason = comp.getString("reason");
|
|
|
|
+ try {
|
2019-04-27 08:26:04 +02:00
|
|
|
+ this.spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.valueOf(reason);
|
2017-12-19 22:46:27 +01:00
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ this.world.getServer().getLogger().warning("Invalid spawnReason set for experience orb: " + e.getMessage() + " - " + reason);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ private void savePaperNBT(NBTTagCompound nbttagcompound) {
|
|
|
|
+ NBTTagCompound comp = new NBTTagCompound();
|
2019-04-27 08:26:04 +02:00
|
|
|
+ if (this.sourceEntityId != null) {
|
|
|
|
+ comp.setUUID("source", this.sourceEntityId);
|
2017-12-19 22:46:27 +01:00
|
|
|
+ }
|
2019-04-27 08:26:04 +02:00
|
|
|
+ if (this.triggerEntityId != null) {
|
2017-12-19 22:46:27 +01:00
|
|
|
+ comp.setUUID("trigger", triggerEntityId);
|
|
|
|
+ }
|
2019-04-27 08:26:04 +02:00
|
|
|
+ if (this.spawnReason != null && this.spawnReason != org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN) {
|
|
|
|
+ comp.setString("reason", this.spawnReason.name());
|
2017-12-19 22:46:27 +01:00
|
|
|
+ }
|
|
|
|
+ nbttagcompound.set("Paper.ExpData", comp);
|
|
|
|
+ }
|
2018-07-17 22:32:05 +02:00
|
|
|
|
|
|
|
public EntityExperienceOrb(World world, double d0, double d1, double d2, int i) {
|
|
|
|
+ this(world, d0, d1, d2, i, null, null);
|
|
|
|
+ }
|
|
|
|
+
|
2017-12-19 22:46:27 +01:00
|
|
|
+ public EntityExperienceOrb(World world, double d0, double d1, double d2, int i, org.bukkit.entity.ExperienceOrb.SpawnReason reason, Entity triggerId) {
|
|
|
|
+ this(world, d0, d1, d2, i, reason, triggerId, null);
|
|
|
|
+ }
|
2018-07-17 22:32:05 +02:00
|
|
|
+
|
2017-12-19 22:46:27 +01:00
|
|
|
+ public EntityExperienceOrb(World world, double d0, double d1, double d2, int i, org.bukkit.entity.ExperienceOrb.SpawnReason reason, Entity triggerId, Entity sourceId) {
|
2019-04-27 08:26:04 +02:00
|
|
|
this(EntityTypes.EXPERIENCE_ORB, world);
|
2017-12-19 22:46:27 +01:00
|
|
|
+ this.sourceEntityId = sourceId != null ? sourceId.getUniqueID() : null;
|
|
|
|
+ this.triggerEntityId = triggerId != null ? triggerId.getUniqueID() : null;
|
|
|
|
+ this.spawnReason = reason != null ? reason : org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN;
|
|
|
|
+ // Paper end
|
|
|
|
this.setPosition(d0, d1, d2);
|
2019-04-27 08:26:04 +02:00
|
|
|
this.yaw = (float) (this.random.nextDouble() * 360.0D);
|
|
|
|
this.setMot((this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D, this.random.nextDouble() * 0.2D * 2.0D, (this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D);
|
2020-06-25 14:04:34 +02:00
|
|
|
@@ -153,6 +203,7 @@ public class EntityExperienceOrb extends Entity {
|
2019-04-27 08:26:04 +02:00
|
|
|
nbttagcompound.setShort("Health", (short) this.e);
|
|
|
|
nbttagcompound.setShort("Age", (short) this.c);
|
2017-12-19 22:46:27 +01:00
|
|
|
nbttagcompound.setShort("Value", (short) this.value);
|
2019-04-27 08:26:04 +02:00
|
|
|
+ this.savePaperNBT(nbttagcompound); // Paper
|
2017-12-19 22:46:27 +01:00
|
|
|
}
|
|
|
|
|
2019-04-27 08:26:04 +02:00
|
|
|
@Override
|
2020-06-25 14:04:34 +02:00
|
|
|
@@ -160,6 +211,7 @@ public class EntityExperienceOrb extends Entity {
|
2019-04-27 08:26:04 +02:00
|
|
|
this.e = nbttagcompound.getShort("Health");
|
|
|
|
this.c = nbttagcompound.getShort("Age");
|
2017-12-19 22:46:27 +01:00
|
|
|
this.value = nbttagcompound.getShort("Value");
|
2019-04-27 08:26:04 +02:00
|
|
|
+ this.loadPaperNBT(nbttagcompound); // Paper
|
2017-12-19 22:46:27 +01:00
|
|
|
}
|
|
|
|
|
2019-04-27 08:26:04 +02:00
|
|
|
@Override
|
2017-12-19 22:46:27 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
2020-09-11 01:47:58 +02:00
|
|
|
index 7dde9774106b7bc1dac46ad591279343b863a9cc..b6cace72ab2f3389408a5e528981fcff3b511180 100644
|
2017-12-19 22:46:27 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
2020-08-25 04:22:08 +02:00
|
|
|
@@ -452,7 +452,7 @@ public class EntityFishingHook extends IProjectile {
|
2017-12-19 22:46:27 +01:00
|
|
|
this.world.addEntity(entityitem);
|
|
|
|
// CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop()
|
|
|
|
if (playerFishEvent.getExpToDrop() > 0) {
|
2020-06-25 14:04:34 +02:00
|
|
|
- entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, playerFishEvent.getExpToDrop()));
|
|
|
|
+ entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, playerFishEvent.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.FISHING, this.getOwner(), this)); // Paper
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
if (itemstack1.getItem().a((Tag) TagsItem.FISHES)) {
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityFox.java b/src/main/java/net/minecraft/server/EntityFox.java
|
2020-08-25 04:22:08 +02:00
|
|
|
index 13dad7a2db788bf900a48bab0a4ef0c4f4b5ddc3..83fa99b1cf784eb7f30b14f9f0743cbab7136563 100644
|
2020-06-25 14:04:34 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityFox.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityFox.java
|
2020-08-25 04:22:08 +02:00
|
|
|
@@ -1236,7 +1236,7 @@ public class EntityFox extends EntityAnimal {
|
2020-06-25 14:04:34 +02:00
|
|
|
if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
|
|
|
|
// CraftBukkit start - use event experience
|
|
|
|
if (experience > 0) {
|
|
|
|
- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience));
|
|
|
|
+ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityfox)); // Paper
|
2017-12-19 22:46:27 +01:00
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2020-06-25 14:04:34 +02:00
|
|
|
}
|
2017-12-19 22:46:27 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
2020-09-11 01:47:58 +02:00
|
|
|
index e6b1c3fc643599bf838c9616845d1eedd21c7725..f62653d5507a1f62e0521dc901283c2735b14e91 100644
|
2017-12-19 22:46:27 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
2020-09-02 11:12:25 +02:00
|
|
|
@@ -1488,7 +1488,8 @@ public abstract class EntityLiving extends Entity {
|
2017-12-19 22:46:27 +01:00
|
|
|
int j = EntityExperienceOrb.getOrbValue(i);
|
|
|
|
|
|
|
|
i -= j;
|
2019-12-12 00:43:22 +01:00
|
|
|
- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j));
|
2017-12-19 22:46:27 +01:00
|
|
|
+ EntityLiving attacker = killer != null ? killer : lastDamager; // Paper
|
2019-12-12 00:43:22 +01:00
|
|
|
+ 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
|
2017-12-19 22:46:27 +01:00
|
|
|
}
|
|
|
|
this.expToDrop = 0;
|
2019-12-12 00:43:22 +01:00
|
|
|
}
|
2017-12-19 22:46:27 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
|
2020-06-25 14:04:34 +02:00
|
|
|
index 7a80b341ee7734cc289abdff8755834447cbef75..2d3ca8c424f2088027d51066d634c48723e96214 100644
|
2017-12-19 22:46:27 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
|
2020-06-25 14:04:34 +02:00
|
|
|
@@ -44,7 +44,7 @@ public class EntityThrownExpBottle extends EntityProjectileThrowable {
|
2017-12-19 22:46:27 +01:00
|
|
|
int j = EntityExperienceOrb.getOrbValue(i);
|
|
|
|
|
|
|
|
i -= j;
|
2019-12-12 00:43:22 +01:00
|
|
|
- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j));
|
|
|
|
+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j, org.bukkit.entity.ExperienceOrb.SpawnReason.EXP_BOTTLE, getShooter(), this)); // Paper
|
2017-12-19 22:46:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
this.die();
|
2019-04-27 08:26:04 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java
|
2020-09-11 01:47:58 +02:00
|
|
|
index 736db44db5420a6676af797ab3b6b06aad7dde44..a3dcb72c600034886137c24b22e64c54980c33f3 100644
|
2019-04-27 08:26:04 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityTurtle.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityTurtle.java
|
2020-06-25 14:04:34 +02:00
|
|
|
@@ -499,7 +499,7 @@ public class EntityTurtle extends EntityAnimal {
|
2019-04-27 08:26:04 +02:00
|
|
|
Random random = this.animal.getRandom();
|
|
|
|
|
2019-06-25 03:47:58 +02:00
|
|
|
if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
|
2019-12-12 00:43:22 +01:00
|
|
|
- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), random.nextInt(7) + 1));
|
|
|
|
+ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), random.nextInt(7) + 1, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer)); // Paper;
|
2019-04-27 08:26:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2017-12-19 22:46:27 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
|
2020-08-25 04:22:08 +02:00
|
|
|
index 17ae6530bda22144866e94e8449220d108084fe5..ea7fff8ff9922e038f71e887072c567cded10973 100644
|
2017-12-19 22:46:27 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityVillager.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
|
2020-06-25 14:04:34 +02:00
|
|
|
@@ -532,7 +532,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
2017-12-19 22:46:27 +01:00
|
|
|
}
|
|
|
|
|
2019-05-14 04:20:58 +02:00
|
|
|
if (merchantrecipe.isRewardExp()) {
|
2019-12-12 00:43:22 +01:00
|
|
|
- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY() + 0.5D, this.locZ(), i));
|
|
|
|
+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY() + 0.5D, this.locZ(), i, org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, this.getTrader(), this)); // Paper
|
2017-12-19 22:46:27 +01:00
|
|
|
}
|
|
|
|
|
2019-04-27 08:26:04 +02:00
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityVillagerTrader.java b/src/main/java/net/minecraft/server/EntityVillagerTrader.java
|
2020-08-25 04:22:08 +02:00
|
|
|
index c830b3c2145effc16314c6216be8af935416cb58..f1a509063c09e603140c74255a3fb901693d2cc5 100644
|
2019-04-27 08:26:04 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityVillagerTrader.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityVillagerTrader.java
|
2020-06-25 14:04:34 +02:00
|
|
|
@@ -144,7 +144,7 @@ public class EntityVillagerTrader extends EntityVillagerAbstract {
|
2019-05-14 04:20:58 +02:00
|
|
|
if (merchantrecipe.isRewardExp()) {
|
2019-04-27 08:26:04 +02:00
|
|
|
int i = 3 + this.random.nextInt(4);
|
|
|
|
|
2019-12-12 00:43:22 +01:00
|
|
|
- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY() + 0.5D, this.locZ(), i));
|
|
|
|
+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY() + 0.5D, this.locZ(), i, org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, this.getTrader(), this)); // Paper
|
2019-04-27 08:26:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2017-12-19 22:46:27 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
2020-09-12 21:57:21 +02:00
|
|
|
index 1ebc0fcca6d22e0d6f4d8dac0b305a00437c82b2..d9ee5f7fd6a405547da0b162f11886d7b96dd622 100644
|
2017-12-19 22:46:27 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
2020-06-25 14:04:34 +02:00
|
|
|
@@ -377,7 +377,7 @@ public class PlayerInteractManager {
|
2017-12-19 22:46:27 +01:00
|
|
|
|
2019-07-20 06:01:24 +02:00
|
|
|
// Drop event experience
|
2017-12-19 22:46:27 +01:00
|
|
|
if (flag && event != null) {
|
|
|
|
- iblockdata.getBlock().dropExperience(this.world, blockposition, event.getExpToDrop());
|
|
|
|
+ iblockdata.getBlock().dropExperience(this.world, blockposition, event.getExpToDrop(), this.player); // Paper
|
|
|
|
}
|
|
|
|
|
2019-07-20 06:01:24 +02:00
|
|
|
return true;
|
2017-12-19 22:46:27 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/SlotFurnaceResult.java b/src/main/java/net/minecraft/server/SlotFurnaceResult.java
|
2020-05-06 11:48:49 +02:00
|
|
|
index d2698e847cfcbc4d2f91b4f5d66b38b47f86c10e..edc4a5c34e8064d900668d132b3496e354408eaf 100644
|
2017-12-19 22:46:27 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/SlotFurnaceResult.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/SlotFurnaceResult.java
|
2019-04-27 08:26:04 +02:00
|
|
|
@@ -2,7 +2,7 @@ package net.minecraft.server;
|
2017-12-19 22:46:27 +01:00
|
|
|
|
|
|
|
public class SlotFurnaceResult extends Slot {
|
|
|
|
|
|
|
|
- private final EntityHuman a;
|
2019-04-27 08:26:04 +02:00
|
|
|
+ private final EntityHuman a; public final EntityHuman getPlayer() { return this.a; } // Paper OBFHELPER
|
2017-12-19 22:46:27 +01:00
|
|
|
private int b;
|
|
|
|
|
|
|
|
public SlotFurnaceResult(EntityHuman entityhuman, IInventory iinventory, int i, int j, int k) {
|
2019-04-27 08:26:04 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
2020-08-25 04:22:08 +02:00
|
|
|
index a3ddf7be4c7ea588098381b8f05b2bad5b388853..99b20fa5feff0f766124d4ec9474852e33e329f2 100644
|
2019-04-27 08:26:04 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
2020-06-25 14:04:34 +02:00
|
|
|
@@ -573,7 +573,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
|
|
|
|
int k = EntityExperienceOrb.getOrbValue(j);
|
|
|
|
|
|
|
|
j -= k;
|
|
|
|
- world.addEntity(new EntityExperienceOrb(world, vec3d.x, vec3d.y, vec3d.z, k));
|
|
|
|
+ world.addEntity(new EntityExperienceOrb(world, vec3d.x, vec3d.y, vec3d.z, k, org.bukkit.entity.ExperienceOrb.SpawnReason.FURNACE, entityhuman)); // Paper
|
2019-04-27 08:26:04 +02:00
|
|
|
}
|
2017-12-19 22:46:27 +01:00
|
|
|
|
2019-04-27 08:26:04 +02:00
|
|
|
}
|
2017-12-19 22:46:27 +01:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
2020-08-25 04:22:08 +02:00
|
|
|
index 948639d629d0126c914b1b4d20f7dfaa6137e63e..be55c6c63607f14d457b24b381fcf213d36f6f33 100644
|
2017-12-19 22:46:27 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
2020-08-25 04:22:08 +02:00
|
|
|
@@ -1805,7 +1805,7 @@ public class CraftWorld implements World {
|
2017-12-19 22:46:27 +01:00
|
|
|
} else if (TNTPrimed.class.isAssignableFrom(clazz)) {
|
|
|
|
entity = new EntityTNTPrimed(world, x, y, z, null);
|
|
|
|
} else if (ExperienceOrb.class.isAssignableFrom(clazz)) {
|
|
|
|
- entity = new EntityExperienceOrb(world, x, y, z, 0);
|
|
|
|
+ entity = new EntityExperienceOrb(world, x, y, z, 0, org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM, null, null); // Paper
|
2019-04-27 08:26:04 +02:00
|
|
|
} else if (LightningStrike.class.isAssignableFrom(clazz)) {
|
2020-06-25 14:04:34 +02:00
|
|
|
entity = EntityTypes.LIGHTNING_BOLT.a(world);
|
2020-06-25 16:09:55 +02:00
|
|
|
} else if (AreaEffectCloud.class.isAssignableFrom(clazz)) {
|
2017-12-19 22:46:27 +01:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
2020-05-06 11:48:49 +02:00
|
|
|
index 1b512cc45c7a185b8a7950ff9882e1f2af171cc8..fbad0456757cadea4d7f50c63dbb07bad7e8baa9 100644
|
2017-12-19 22:46:27 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
2019-05-06 04:58:04 +02:00
|
|
|
@@ -20,6 +20,18 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb {
|
2017-12-19 22:46:27 +01:00
|
|
|
getHandle().value = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ public java.util.UUID getTriggerEntityId() {
|
|
|
|
+ return getHandle().triggerEntityId;
|
|
|
|
+ }
|
|
|
|
+ public java.util.UUID getSourceEntityId() {
|
|
|
|
+ return getHandle().sourceEntityId;
|
|
|
|
+ }
|
|
|
|
+ public SpawnReason getSpawnReason() {
|
|
|
|
+ return getHandle().spawnReason;
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
@Override
|
|
|
|
public EntityExperienceOrb getHandle() {
|
|
|
|
return (EntityExperienceOrb) entity;
|