mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Add ThrownEggHatchEvent
Adds a new event similar to PlayerEggThrowEvent, but without the Player requirement (dispensers can throw eggs to hatch them, too).
This commit is contained in:
parent
a92909cfd7
commit
4e20691d59
1 changed files with 8 additions and 1 deletions
|
@ -48,7 +48,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -52,30 +58,58 @@
|
||||
@@ -52,30 +58,65 @@
|
||||
protected void onHit(HitResult hitResult) {
|
||||
super.onHit(hitResult);
|
||||
if (!this.level().isClientSide) {
|
||||
|
@ -83,6 +83,13 @@
|
|||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // Paper start - Add ThrownEggHatchEvent
|
||||
+ com.destroystokyo.paper.event.entity.ThrownEggHatchEvent event = new com.destroystokyo.paper.event.entity.ThrownEggHatchEvent((org.bukkit.entity.Egg) getBukkitEntity(), hatching, b0, hatchingType);
|
||||
+ event.callEvent();
|
||||
+ hatching = event.isHatching();
|
||||
+ b0 = hatching ? event.getNumHatches() : 0; // If hatching is set to false, ensure child count is 0
|
||||
+ hatchingType = event.getHatchingType();
|
||||
+ // Paper end - Add ThrownEggHatchEvent
|
||||
+
|
||||
for (int i = 0; i < b0; ++i) {
|
||||
- Chicken entitychicken = (Chicken) EntityType.CHICKEN.create(this.level(), EntitySpawnReason.TRIGGERED);
|
||||
|
|
Loading…
Reference in a new issue