2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java
|
|
|
|
+++ b/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java
|
2024-02-21 10:55:34 +01:00
|
|
|
@@ -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 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
protected void onHit(MovingObjectPosition movingobjectposition) {
|
|
|
|
super.onHit(movingobjectposition);
|
2023-06-07 17:30:00 +02:00
|
|
|
if (this.level() instanceof WorldServer) {
|
2024-04-23 17:15:00 +02:00
|
|
|
- this.level().levelEvent(2002, this.blockPosition(), PotionContents.getColor(Potions.WATER));
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit - moved to after event
|
2024-04-23 17:15:00 +02:00
|
|
|
+ // this.level().levelEvent(2002, this.blockPosition(), PotionContents.getColor(Potions.WATER));
|
2023-06-07 17:30:00 +02:00
|
|
|
int i = 3 + this.level().random.nextInt(5) + this.level().random.nextInt(5);
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit start
|
2023-10-25 09:54:07 +02:00
|
|
|
+ org.bukkit.event.entity.ExpBottleEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callExpBottleEvent(this, movingobjectposition, i);
|
2014-11-25 22:32:16 +01:00
|
|
|
+ i = event.getExperience();
|
|
|
|
+ if (event.getShowEffect()) {
|
2024-04-23 17:15:00 +02:00
|
|
|
+ this.level().levelEvent(2002, this.blockPosition(), PotionContents.getColor(Potions.WATER));
|
2014-11-25 22:32:16 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2015-02-26 23:41:06 +01:00
|
|
|
+
|
2023-06-07 17:30:00 +02:00
|
|
|
EntityExperienceOrb.award((WorldServer) this.level(), this.position(), i);
|
2024-02-21 10:55:34 +01:00
|
|
|
- this.discard();
|
|
|
|
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
2021-06-11 07:00:00 +02:00
|
|
|
}
|
2024-02-21 10:55:34 +01:00
|
|
|
|
|
|
|
}
|