--- a/net/minecraft/world/level/block/BlockPortal.java +++ b/net/minecraft/world/level/block/BlockPortal.java @@ -26,6 +26,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 MapCodec CODEC = simpleCodec(BlockPortal::new); @@ -63,7 +67,8 @@ } if (worldserver.getBlockState(blockposition).isValidSpawn(worldserver, blockposition, EntityTypes.ZOMBIFIED_PIGLIN)) { - Entity entity = EntityTypes.ZOMBIFIED_PIGLIN.spawn(worldserver, blockposition.above(), EnumMobSpawn.STRUCTURE); + // CraftBukkit - set spawn reason to NETHER_PORTAL + Entity entity = EntityTypes.ZOMBIFIED_PIGLIN.spawn(worldserver, blockposition.above(), EnumMobSpawn.STRUCTURE, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL); if (entity != null) { entity.setPortalCooldown(); @@ -85,6 +90,10 @@ @Override protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) { if (entity.canChangeDimensions()) { + // 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.handleInsidePortal(blockposition); }