SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, #1008: Add EntityRemoveEvent

By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
CraftBukkit/Spigot
2024-02-21 20:55:34 +11:00
parent 6dc11b5d28
commit 64cd2b148a
81 changed files with 2037 additions and 475 deletions

View File

@@ -1,17 +1,18 @@
--- a/net/minecraft/world/entity/projectile/EntityWitherSkull.java
+++ b/net/minecraft/world/entity/projectile/EntityWitherSkull.java
@@ -21,6 +21,10 @@
@@ -21,6 +21,11 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionEntity;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityRemoveEvent;
+import org.bukkit.event.entity.ExplosionPrimeEvent;
+// CraftBukkit end
+
public class EntityWitherSkull extends EntityFireball {
private static final DataWatcherObject<Boolean> DATA_DANGEROUS = DataWatcher.defineId(EntityWitherSkull.class, DataWatcherRegistry.BOOLEAN);
@@ -64,7 +68,7 @@
@@ -64,7 +69,7 @@
if (entity.isAlive()) {
this.doEnchantDamageEffects(entityliving, entity);
} else {
@@ -20,7 +21,7 @@
}
}
} else {
@@ -82,7 +86,7 @@
@@ -82,7 +87,7 @@
}
if (b0 > 0) {
@@ -29,11 +30,12 @@
}
}
@@ -93,7 +97,15 @@
@@ -93,8 +98,16 @@
protected void onHit(MovingObjectPosition movingobjectposition) {
super.onHit(movingobjectposition);
if (!this.level().isClientSide) {
- this.level().explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, World.a.MOB);
- this.discard();
+ // CraftBukkit start
+ // this.level().explode(this, this.getX(), this.getY(), this.getZ(), 1.0F, false, World.a.MOB);
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 1.0F, false);
@@ -43,6 +45,7 @@
+ this.level().explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB);
+ }
+ // CraftBukkit end
this.discard();
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
}
}