2015-05-25 18:37:24 +08:00
|
|
|
--- a/net/minecraft/server/ItemMonsterEgg.java
|
|
|
|
+++ b/net/minecraft/server/ItemMonsterEgg.java
|
2015-05-31 09:40:23 +08:00
|
|
|
@@ -109,6 +109,12 @@
|
2014-11-26 05:32:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public static Entity a(World world, int i, double d0, double d1, double d2) {
|
|
|
|
+ // CraftBukkit start - delegate to spawnCreature
|
|
|
|
+ return spawnCreature(world, i, d0, d1, d2, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static Entity spawnCreature(World world, int i, double d0, double d1, double d2, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
|
|
|
+ // CraftBukkit end
|
|
|
|
if (!EntityTypes.eggInfo.containsKey(Integer.valueOf(i))) {
|
|
|
|
return null;
|
|
|
|
} else {
|
2015-05-31 09:40:23 +08:00
|
|
|
@@ -123,8 +129,13 @@
|
2015-02-27 06:41:06 +08:00
|
|
|
entityinsentient.aK = entityinsentient.yaw;
|
2014-12-03 18:52:18 +08:00
|
|
|
entityinsentient.aI = entityinsentient.yaw;
|
|
|
|
entityinsentient.prepare(world.E(new BlockPosition(entityinsentient)), (GroupDataEntity) null);
|
|
|
|
- world.addEntity(entity);
|
2014-12-14 13:59:49 +08:00
|
|
|
- entityinsentient.x();
|
|
|
|
+ // CraftBukkit start - don't return an entity when CreatureSpawnEvent is canceled
|
|
|
|
+ if (!world.addEntity(entity, spawnReason)) {
|
|
|
|
+ entity = null;
|
|
|
|
+ } else {
|
|
|
|
+ entityinsentient.x();
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2014-12-03 18:52:18 +08:00
|
|
|
}
|
|
|
|
}
|
2014-12-14 13:59:49 +08:00
|
|
|
|