2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
|
|
Date: Sun, 9 Feb 2020 00:19:05 -0600
|
|
|
|
Subject: [PATCH] Add ThrownEggHatchEvent
|
|
|
|
|
|
|
|
Adds a new event similar to PlayerEggThrowEvent, but without the Player requirement
|
|
|
|
(dispensers can throw eggs to hatch them, too).
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
|
2024-01-21 12:53:04 +01:00
|
|
|
index 98d42143e70c5be809deb6c03270987ff9db46d5..785196e6f4677074890ca965e9add85ccfd0e6e3 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
|
2023-07-05 09:46:12 +02:00
|
|
|
@@ -82,6 +82,13 @@ public class ThrownEgg extends ThrowableItemProjectile {
|
2023-07-04 10:22:56 +02:00
|
|
|
}
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
2023-07-04 10:22:56 +02:00
|
|
|
// CraftBukkit end
|
2024-01-21 12:53:04 +01:00
|
|
|
+ // Paper start - Add ThrownEggHatchEvent
|
2021-06-11 14:02:28 +02:00
|
|
|
+ com.destroystokyo.paper.event.entity.ThrownEggHatchEvent event = new com.destroystokyo.paper.event.entity.ThrownEggHatchEvent((org.bukkit.entity.Egg) getBukkitEntity(), hatching, b0, hatchingType);
|
|
|
|
+ event.callEvent();
|
2023-07-05 09:46:12 +02:00
|
|
|
+ hatching = event.isHatching();
|
|
|
|
+ b0 = hatching ? event.getNumHatches() : 0; // If hatching is set to false, ensure child count is 0
|
2021-06-11 14:02:28 +02:00
|
|
|
+ hatchingType = event.getHatchingType();
|
2024-01-21 12:53:04 +01:00
|
|
|
+ // Paper end - Add ThrownEggHatchEvent
|
2023-07-04 10:22:56 +02:00
|
|
|
|
|
|
|
for (int i = 0; i < b0; ++i) {
|
2023-12-05 23:55:31 +01:00
|
|
|
Entity entitychicken = this.level().getWorld().makeEntity(new org.bukkit.Location(this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F), hatchingType.getEntityClass()); // CraftBukkit
|