diff --git a/src/main/java/net/minecraft/server/BlockPortal.java b/src/main/java/net/minecraft/server/BlockPortal.java index 75b833af45..bec5aa8a50 100644 --- a/src/main/java/net/minecraft/server/BlockPortal.java +++ b/src/main/java/net/minecraft/server/BlockPortal.java @@ -23,7 +23,8 @@ public class BlockPortal extends BlockHalfTransparent { } if (l > 0 && !world.getType(i, l + 1, k).r()) { - Entity entity = ItemMonsterEgg.a(world, 57, (double) i + 0.5D, (double) l + 1.1D, (double) k + 0.5D); + // CraftBukkit - set spawn reason to NETHER_PORTAL + Entity entity = ItemMonsterEgg.spawnCreature(world, 57, (double) i + 0.5D, (double) l + 1.1D, (double) k + 0.5D, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL); if (entity != null) { entity.portalCooldown = entity.ai(); diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java b/src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java index a854f7ae63..2c14ab03e9 100644 --- a/src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java +++ b/src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java @@ -44,7 +44,7 @@ final class DispenseBehaviorMonsterEgg extends DispenseBehaviorItem { itemstack1 = CraftItemStack.asNMSCopy(event.getItem()); - Entity entity = ItemMonsterEgg.a(isourceblock.k(), itemstack.getData(), event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ()); + Entity entity = ItemMonsterEgg.spawnCreature(isourceblock.k(), itemstack.getData(), event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DISPENSE_EGG); if (entity instanceof EntityLiving && itemstack.hasName()) { ((EntityInsentient) entity).setCustomName(itemstack.getName()); diff --git a/src/main/java/net/minecraft/server/ItemMonsterEgg.java b/src/main/java/net/minecraft/server/ItemMonsterEgg.java index 34c21efc5e..a41184ea6a 100644 --- a/src/main/java/net/minecraft/server/ItemMonsterEgg.java +++ b/src/main/java/net/minecraft/server/ItemMonsterEgg.java @@ -92,6 +92,12 @@ public class ItemMonsterEgg extends Item { } 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.a.containsKey(Integer.valueOf(i))) { return null; } else { @@ -106,7 +112,7 @@ public class ItemMonsterEgg extends Item { entityinsentient.aP = entityinsentient.yaw; entityinsentient.aN = entityinsentient.yaw; entityinsentient.a((GroupDataEntity) null); - world.addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit + world.addEntity(entity, spawnReason); // CraftBukkit entityinsentient.r(); } }