Paper/Spigot-Server-Patches/0253-ExperienceOrbMergeEvent.patch
Aikar b922ff9886
Fix issues with getBlockState(false) not loading Tile Entity data
This only impacted people who used our useSnapshots new API in a plugin,
which obviously was no one as the data result was completely broken.

Merged the NPE check patch into mine since it has to handle it too.
2018-06-30 01:40:52 -04:00

26 lines
1.5 KiB
Diff

From 8bba43fbcd5555066af8c96d92bc5d528590b0bb Mon Sep 17 00:00:00 2001
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
index 39b90fb4c..c0816b9f8 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1153,7 +1153,7 @@ public abstract class World implements IBlockAccess {
for (Entity e : entities) {
if (e instanceof EntityExperienceOrb) {
EntityExperienceOrb loopItem = (EntityExperienceOrb) e;
- if (!loopItem.dead && !(maxValue > 0 && loopItem.value >= maxValue)) { // Paper
+ 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()) { // Paper
xp.value += loopItem.value;
// Paper start
if (!mergeUnconditionally && xp.value > maxValue) {
--
2.18.0