2018-09-18 03:50:02 +02:00
|
|
|
From e6432da62947acb92d51fdda1b4fb4993a856afc Mon Sep 17 00:00:00 2001
|
2017-12-20 04:57:46 +01: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-09-18 03:50:02 +02:00
|
|
|
index f80f075287..7cf4a9c11e 100644
|
2017-12-20 04:57:46 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
2018-09-18 03:50:02 +02:00
|
|
|
@@ -1042,7 +1042,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
2017-12-20 04:57:46 +01:00
|
|
|
if (e instanceof EntityExperienceOrb) {
|
|
|
|
EntityExperienceOrb loopItem = (EntityExperienceOrb) e;
|
2018-08-03 06:06:20 +02: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;
|
2018-08-04 02:59:35 +02:00
|
|
|
if ((int) newTotal < 0) continue; // Overflow
|
|
|
|
if (maxValue > 0 && newTotal > (long)maxValue) {
|
2017-12-20 04:57:46 +01:00
|
|
|
--
|
2018-09-18 03:50:02 +02:00
|
|
|
2.19.0
|
2017-12-20 04:57:46 +01:00
|
|
|
|