mirror of
https://github.com/PaperMC/Paper.git
synced 2025-09-03 05:43:52 -07: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:
@@ -48,7 +48,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -52,30 +58,58 @@
|
@@ -52,30 +58,65 @@
|
||||||
protected void onHit(HitResult hitResult) {
|
protected void onHit(HitResult hitResult) {
|
||||||
super.onHit(hitResult);
|
super.onHit(hitResult);
|
||||||
if (!this.level().isClientSide) {
|
if (!this.level().isClientSide) {
|
||||||
@@ -83,6 +83,13 @@
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // 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) {
|
for (int i = 0; i < b0; ++i) {
|
||||||
- Chicken entitychicken = (Chicken) EntityType.CHICKEN.create(this.level(), EntitySpawnReason.TRIGGERED);
|
- Chicken entitychicken = (Chicken) EntityType.CHICKEN.create(this.level(), EntitySpawnReason.TRIGGERED);
|
||||||
|
Reference in New Issue
Block a user