Paper/patches/server/0960-ExperienceOrb-should-call-EntitySpawnEvent.patch
Jake Potrebic 1e7dd72f15
Remove 'fix Vanilla Minecart speed' patch (#10068)
The game uses 0.95d now
2023-12-22 17:44:36 -08:00

23 lines
1.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Golfing8 <atroo@me.com>
Date: Mon, 8 May 2023 09:18:17 -0400
Subject: [PATCH] ExperienceOrb should call EntitySpawnEvent
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index c62396041c1546f3136ab6de3b174983f49287b3..68bc859fe8615fd59ef98f69f0190bea8261c15a 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -734,7 +734,10 @@ public class CraftEventFactory {
// Spigot start - SPIGOT-7523: Merge after spawn event and only merge if the event was not cancelled (gets checked above)
if (entity instanceof net.minecraft.world.entity.ExperienceOrb xp) {
double radius = world.spigotConfig.expMerge;
- if (radius > 0) {
+ // Paper start - Call EntitySpawnEvent for ExperienceOrb entities.
+ event = CraftEventFactory.callEntitySpawnEvent(entity);
+ if (radius > 0 && !event.isCancelled() && !entity.isRemoved()) {
+ // Paper end
// Paper start - Maximum exp value when merging - Whole section has been tweaked, see comments for specifics
final int maxValue = world.paperConfig().entities.behavior.experienceMergeMaxValue;
final boolean mergeUnconditionally = world.paperConfig().entities.behavior.experienceMergeMaxValue <= 0;