2018-08-03 04:06:20 +00:00
|
|
|
From 2c072e94e1c963916f63e2ff8fb41b0f933b1ccb Mon Sep 17 00:00:00 2001
|
2017-12-20 03:57:46 +00:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Tue, 19 Dec 2017 22:57:26 -0500
|
|
|
|
Subject: [PATCH] ExperienceOrbMergeEvent
|
|
|
|
|
|
|
|
Fired when the server is about to merge 2 experience orbs
|
|
|
|
Plugins can cancel this if they want to ensure experience orbs do not lose important
|
|
|
|
metadata such as spawn reason, or conditionally move data from source to target.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
2018-08-03 04:06:20 +00:00
|
|
|
index c0e79796bd..986670f689 100644
|
2017-12-20 03:57:46 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
2018-08-03 04:06:20 +00:00
|
|
|
@@ -1154,7 +1154,7 @@ public abstract class World implements IBlockAccess {
|
2017-12-20 03:57:46 +00:00
|
|
|
if (e instanceof EntityExperienceOrb) {
|
|
|
|
EntityExperienceOrb loopItem = (EntityExperienceOrb) e;
|
2018-08-03 04:06:20 +00:00
|
|
|
// Paper start
|
|
|
|
- if (!loopItem.dead && !(maxValue > 0 && loopItem.value >= maxValue)) {
|
|
|
|
+ if (!loopItem.dead && !(maxValue > 0 && loopItem.value >= maxValue) && new com.destroystokyo.paper.event.entity.ExperienceOrbMergeEvent((org.bukkit.entity.ExperienceOrb) entity.getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) loopItem.getBukkitEntity()).callEvent()) {
|
|
|
|
long newTotal = (long)xp.value + (long)loopItem.value;
|
|
|
|
if (newTotal > (long)maxValue) {
|
|
|
|
loopItem.value = xp.value - maxValue;
|
2017-12-20 03:57:46 +00:00
|
|
|
--
|
2018-06-30 05:40:52 +00:00
|
|
|
2.18.0
|
2017-12-20 03:57:46 +00:00
|
|
|
|