--- a/net/minecraft/world/level/block/BlockPortal.java +++ b/net/minecraft/world/level/block/BlockPortal.java @@ -27,6 +27,10 @@ import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShapeCollision; +// CraftBukkit start +import org.bukkit.event.entity.EntityPortalEnterEvent; +// CraftBukkit end + public class BlockPortal extends Block { public static final BlockStateEnum AXIS = BlockProperties.HORIZONTAL_AXIS; @@ -58,7 +62,8 @@ } if (worldserver.getType(blockposition).a((IBlockAccess) worldserver, blockposition, EntityTypes.ZOMBIFIED_PIGLIN)) { - Entity entity = EntityTypes.ZOMBIFIED_PIGLIN.spawnCreature(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false); + // CraftBukkit - set spawn reason to NETHER_PORTAL + Entity entity = EntityTypes.ZOMBIFIED_PIGLIN.spawnCreature(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL); if (entity != null) { entity.resetPortalCooldown(); @@ -80,6 +85,10 @@ @Override public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) { if (!entity.isPassenger() && !entity.isVehicle() && entity.canPortal()) { + // CraftBukkit start - Entity in portal + EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ())); + world.getCraftServer().getPluginManager().callEvent(event); + // CraftBukkit end entity.d(blockposition); }