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,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityEgg.java
+++ b/net/minecraft/world/entity/projectile/EntityEgg.java
@@ -11,6 +11,15 @@
@@ -11,6 +11,16 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionEntity;
@@ -10,13 +10,14 @@
+import org.bukkit.entity.Ageable;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Player;
+import org.bukkit.event.entity.EntityRemoveEvent;
+import org.bukkit.event.player.PlayerEggThrowEvent;
+// CraftBukkit end
+
public class EntityEgg extends EntityProjectileThrowable {
public EntityEgg(EntityTypes<? extends EntityEgg> entitytypes, World world) {
@@ -47,20 +56,47 @@
@@ -47,26 +57,53 @@
protected void onHit(MovingObjectPosition movingobjectposition) {
super.onHit(movingobjectposition);
if (!this.level().isClientSide) {
@@ -69,3 +70,10 @@
}
}
}
this.level().broadcastEntityEvent(this, (byte) 3);
- this.discard();
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
}
}