Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/nms-patches/ItemMonsterEgg.patch

32 Zeilen
1.5 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/ItemMonsterEgg.java
+++ b/net/minecraft/server/ItemMonsterEgg.java
2016-05-10 13:47:39 +02:00
@@ -130,7 +130,11 @@
}
2016-05-10 13:47:39 +02:00
@Nullable
- public static Entity a(World world, @Nullable String s, double d0, double d1, double d2) {
+ public static Entity a(World world, @Nullable String s, double d0, double d1, double d2) { // CraftBukkit start - delegate to spawnCreature
2016-02-29 22:32:46 +01:00
+ return spawnCreature(world, s, d0, d1, d2, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
+ }
+
2016-02-29 22:32:46 +01:00
+ 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;
2016-05-10 13:47:39 +02:00
@@ -143,8 +147,13 @@
entityinsentient.aP = entityinsentient.yaw;
entityinsentient.aN = entityinsentient.yaw;
2016-02-29 22:32:46 +01:00
entityinsentient.prepare(world.D(new BlockPosition(entityinsentient)), (GroupDataEntity) null);
2014-12-03 11:52:18 +01:00
- world.addEntity(entity);
2016-02-29 22:32:46 +01:00
- entityinsentient.D();
+ // CraftBukkit start - don't return an entity when CreatureSpawnEvent is canceled
+ if (!world.addEntity(entity, spawnReason)) {
+ entity = null;
+ } else {
2016-02-29 22:32:46 +01:00
+ entityinsentient.D();
+ }
+ // CraftBukkit end
2014-12-03 11:52:18 +01:00
}
}