2015-05-25 18:37:24 +08:00
|
|
|
--- a/net/minecraft/server/ItemMonsterEgg.java
|
|
|
|
+++ b/net/minecraft/server/ItemMonsterEgg.java
|
2016-11-17 09:41:03 +08:00
|
|
|
@@ -153,6 +153,11 @@
|
2014-11-26 05:32:16 +08:00
|
|
|
|
2016-05-10 19:47:39 +08:00
|
|
|
@Nullable
|
2016-11-17 09:41:03 +08:00
|
|
|
public static Entity a(World world, @Nullable MinecraftKey minecraftkey, double d0, double d1, double d2) {
|
|
|
|
+ return spawnCreature(world, minecraftkey, d0, d1, d2, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
|
2014-11-26 05:32:16 +08:00
|
|
|
+ }
|
|
|
|
+
|
2016-11-17 09:41:03 +08:00
|
|
|
+ @Nullable
|
|
|
|
+ public static Entity spawnCreature(World world, @Nullable MinecraftKey minecraftkey, double d0, double d1, double d2, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
|
|
|
if (minecraftkey != null && EntityTypes.eggInfo.containsKey(minecraftkey)) {
|
2016-03-01 05:32:46 +08:00
|
|
|
Entity entity = null;
|
|
|
|
|
2016-11-17 09:41:03 +08:00
|
|
|
@@ -165,8 +170,13 @@
|
|
|
|
entityinsentient.aP = entityinsentient.yaw;
|
|
|
|
entityinsentient.aN = entityinsentient.yaw;
|
2016-03-01 05:32:46 +08:00
|
|
|
entityinsentient.prepare(world.D(new BlockPosition(entityinsentient)), (GroupDataEntity) null);
|
2014-12-03 18:52:18 +08:00
|
|
|
- world.addEntity(entity);
|
2016-03-01 05:32:46 +08:00
|
|
|
- entityinsentient.D();
|
2014-12-14 13:59:49 +08:00
|
|
|
+ // CraftBukkit start - don't return an entity when CreatureSpawnEvent is canceled
|
|
|
|
+ if (!world.addEntity(entity, spawnReason)) {
|
|
|
|
+ entity = null;
|
|
|
|
+ } else {
|
2016-03-01 05:32:46 +08:00
|
|
|
+ entityinsentient.D();
|
2014-12-14 13:59:49 +08:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2014-12-03 18:52:18 +08:00
|
|
|
}
|
|
|
|
}
|
2014-12-14 13:59:49 +08:00
|
|
|
|