2021-06-11 12:02:28 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: AlphaBlend <whizkid3000@hotmail.com>
|
|
|
|
Date: Thu, 8 Sep 2016 08:48:33 -0700
|
|
|
|
Subject: [PATCH] Add source to PlayerExpChangeEvent
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
2021-06-12 07:24:28 +00:00
|
|
|
index 7df6946dcb2a7fbc625681dfbae1e15be625875b..1953739fd2ead7680273ef63d8506e546758dc9b 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
2021-06-12 07:24:28 +00:00
|
|
|
@@ -249,7 +249,7 @@ public class ExperienceOrb extends Entity {
|
|
|
|
int i = this.repairPlayerItems(player, this.value);
|
2021-06-11 12:02:28 +00:00
|
|
|
|
2021-06-12 07:24:28 +00:00
|
|
|
if (i > 0) {
|
|
|
|
- player.giveExperiencePoints(CraftEventFactory.callPlayerExpChangeEvent(player, i).getAmount()); // CraftBukkit - this.value -> event.getAmount()
|
2021-06-11 12:02:28 +00:00
|
|
|
+ player.giveExperiencePoints(CraftEventFactory.callPlayerExpChangeEvent(player, this).getAmount()); // CraftBukkit - this.value -> event.getAmount() // Paper - supply experience orb object
|
|
|
|
}
|
|
|
|
|
2021-06-12 07:24:28 +00:00
|
|
|
--this.count;
|
2021-06-11 12:02:28 +00:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
2021-06-12 07:24:28 +00:00
|
|
|
index cb3f1f71cc5c5a18c0af818679b72583a7edec7c..c981bb0e1e7c4c8b7603e2ac8e483ad5b4a2c742 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
2021-06-12 07:24:28 +00:00
|
|
|
@@ -1041,6 +1041,17 @@ public class CraftEventFactory {
|
2021-06-11 12:02:28 +00:00
|
|
|
return event;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start - Add orb
|
|
|
|
+ public static PlayerExpChangeEvent callPlayerExpChangeEvent(net.minecraft.world.entity.player.Player entity, net.minecraft.world.entity.ExperienceOrb entityOrb) {
|
|
|
|
+ Player player = (Player) entity.getBukkitEntity();
|
|
|
|
+ ExperienceOrb source = (ExperienceOrb) entityOrb.getBukkitEntity();
|
|
|
|
+ int expAmount = source.getExperience();
|
|
|
|
+ PlayerExpChangeEvent event = new PlayerExpChangeEvent(player, source, expAmount);
|
|
|
|
+ Bukkit.getPluginManager().callEvent(event);
|
|
|
|
+ return event;
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
public static boolean handleBlockGrowEvent(Level world, BlockPos pos, net.minecraft.world.level.block.state.BlockState block) {
|
2021-06-12 07:24:28 +00:00
|
|
|
return CraftEventFactory.handleBlockGrowEvent(world, pos, block, 3);
|
2021-06-11 12:02:28 +00:00
|
|
|
}
|