2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/ItemMonsterEgg.java
|
|
|
|
+++ b/net/minecraft/server/ItemMonsterEgg.java
|
2016-02-29 22:32:46 +01:00
|
|
|
@@ -131,6 +131,11 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
2016-02-29 22:32:46 +01:00
|
|
|
public static Entity a(World world, String s, double d0, double d1, double d2) {
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // 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);
|
2014-11-25 22:32:16 +01:00
|
|
|
+ }
|
|
|
|
+
|
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;
|
|
|
|
|
|
|
|
@@ -143,8 +148,13 @@
|
|
|
|
entityinsentient.aO = entityinsentient.yaw;
|
|
|
|
entityinsentient.aM = entityinsentient.yaw;
|
|
|
|
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();
|
2014-12-14 06:59:49 +01:00
|
|
|
+ // 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();
|
2014-12-14 06:59:49 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2014-12-03 11:52:18 +01:00
|
|
|
}
|
|
|
|
}
|
2014-12-14 06:59:49 +01:00
|
|
|
|