mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 12:02:36 +01:00
65bc2541a3
By: md_5 <git@md-5.net>
36 lines
1.7 KiB
Diff
36 lines
1.7 KiB
Diff
--- a/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java
|
|
+++ b/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java
|
|
@@ -11,6 +11,10 @@
|
|
import net.minecraft.world.level.World;
|
|
import net.minecraft.world.phys.MovingObjectPosition;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.event.entity.EntityRemoveEvent;
|
|
+// CraftBukkit end
|
|
+
|
|
public class EntityThrownExpBottle extends EntityProjectileThrowable {
|
|
|
|
public EntityThrownExpBottle(EntityTypes<? extends EntityThrownExpBottle> entitytypes, World world) {
|
|
@@ -39,11 +43,20 @@
|
|
protected void onHit(MovingObjectPosition movingobjectposition) {
|
|
super.onHit(movingobjectposition);
|
|
if (this.level() instanceof WorldServer) {
|
|
- this.level().levelEvent(2002, this.blockPosition(), PotionContents.getColor(Potions.WATER));
|
|
+ // CraftBukkit - moved to after event
|
|
+ // this.level().levelEvent(2002, this.blockPosition(), PotionContents.getColor(Potions.WATER));
|
|
int i = 3 + this.level().random.nextInt(5) + this.level().random.nextInt(5);
|
|
|
|
+ // CraftBukkit start
|
|
+ org.bukkit.event.entity.ExpBottleEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callExpBottleEvent(this, movingobjectposition, i);
|
|
+ i = event.getExperience();
|
|
+ if (event.getShowEffect()) {
|
|
+ this.level().levelEvent(2002, this.blockPosition(), PotionContents.getColor(Potions.WATER));
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
EntityExperienceOrb.award((WorldServer) this.level(), this.position(), i);
|
|
- this.discard();
|
|
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
|
}
|
|
|
|
}
|