Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-16 04:50:05 +01:00
30 Zeilen
1.3 KiB
Diff
30 Zeilen
1.3 KiB
Diff
--- a/net/minecraft/server/ItemMonsterEgg.java
|
|
+++ b/net/minecraft/server/ItemMonsterEgg.java
|
|
@@ -131,6 +131,10 @@
|
|
|
|
@Nullable
|
|
public static Entity a(World world, @Nullable String s, double d0, double d1, double d2) {
|
|
+ return spawnCreature(world, s, d0, d1, d2, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
|
|
+ }
|
|
+
|
|
+ public static Entity spawnCreature(World world, String s, double d0, double d1, double d2, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
|
if (s != null && EntityTypes.eggInfo.containsKey(s)) {
|
|
Entity entity = null;
|
|
|
|
@@ -143,8 +147,13 @@
|
|
entityinsentient.aQ = entityinsentient.yaw;
|
|
entityinsentient.aO = entityinsentient.yaw;
|
|
entityinsentient.prepare(world.D(new BlockPosition(entityinsentient)), (GroupDataEntity) null);
|
|
- world.addEntity(entity);
|
|
- entityinsentient.D();
|
|
+ // CraftBukkit start - don't return an entity when CreatureSpawnEvent is canceled
|
|
+ if (!world.addEntity(entity, spawnReason)) {
|
|
+ entity = null;
|
|
+ } else {
|
|
+ entityinsentient.D();
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|
|
|