--- a/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java
+++ b/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java
@@ -8,6 +8,7 @@
 import net.minecraft.world.entity.EquipmentSlot;
 import net.minecraft.world.entity.LightningBolt;
 import net.minecraft.world.entity.MobSpawnType;
+import net.minecraft.world.entity.SpawnGroupData;
 import net.minecraft.world.entity.ai.goal.Goal;
 import net.minecraft.world.entity.monster.Skeleton;
 import net.minecraft.world.flag.FeatureFlagSet;
@@ -17,7 +18,9 @@
 import net.minecraft.world.item.enchantment.ItemEnchantments;
 
 public class SkeletonTrapGoal extends Goal {
+
     private final SkeletonHorse horse;
+    private java.util.List<org.bukkit.entity.HumanEntity> eligiblePlayers; // Paper
 
     public SkeletonTrapGoal(SkeletonHorse skeletonHorse) {
         this.horse = skeletonHorse;
@@ -25,92 +28,84 @@
 
     @Override
     public boolean canUse() {
-        return this.horse.level().hasNearbyAlivePlayer(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0);
+        return !(eligiblePlayers = this.horse.level().findNearbyBukkitPlayers(this.horse.getX(), this.horse.getY(), this.horse.getZ(), 10.0D, net.minecraft.world.entity.EntitySelector.PLAYER_AFFECTS_SPAWNING)).isEmpty(); // Paper - Affects Spawning API & SkeletonHorseTrapEvent
     }
 
     @Override
     public void tick() {
-        ServerLevel serverLevel = (ServerLevel)this.horse.level();
-        DifficultyInstance difficultyInstance = serverLevel.getCurrentDifficultyAt(this.horse.blockPosition());
+        ServerLevel worldserver = (ServerLevel) this.horse.level();
+        if (!new com.destroystokyo.paper.event.entity.SkeletonHorseTrapEvent((org.bukkit.entity.SkeletonHorse) this.horse.getBukkitEntity(), eligiblePlayers).callEvent()) return; // Paper
+        DifficultyInstance difficultydamagescaler = worldserver.getCurrentDifficultyAt(this.horse.blockPosition());
+
         this.horse.setTrap(false);
         this.horse.setTamed(true);
         this.horse.setAge(0);
-        LightningBolt lightningBolt = EntityType.LIGHTNING_BOLT.create(serverLevel);
-        if (lightningBolt != null) {
-            lightningBolt.moveTo(this.horse.getX(), this.horse.getY(), this.horse.getZ());
-            lightningBolt.setVisualOnly(true);
-            serverLevel.addFreshEntity(lightningBolt);
-            Skeleton skeleton = this.createSkeleton(difficultyInstance, this.horse);
-            if (skeleton != null) {
-                skeleton.startRiding(this.horse);
-                serverLevel.addFreshEntityWithPassengers(skeleton);
+        LightningBolt entitylightning = (LightningBolt) EntityType.LIGHTNING_BOLT.create(worldserver);
 
-                for (int i = 0; i < 3; i++) {
-                    AbstractHorse abstractHorse = this.createHorse(difficultyInstance);
-                    if (abstractHorse != null) {
-                        Skeleton skeleton2 = this.createSkeleton(difficultyInstance, abstractHorse);
-                        if (skeleton2 != null) {
-                            skeleton2.startRiding(abstractHorse);
-                            abstractHorse.push(this.horse.getRandom().triangle(0.0, 1.1485), 0.0, this.horse.getRandom().triangle(0.0, 1.1485));
-                            serverLevel.addFreshEntityWithPassengers(abstractHorse);
+        if (entitylightning != null) {
+            entitylightning.moveTo(this.horse.getX(), this.horse.getY(), this.horse.getZ());
+            entitylightning.setVisualOnly(true);
+            worldserver.strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRAP); // CraftBukkit
+            Skeleton entityskeleton = this.createSkeleton(difficultydamagescaler, this.horse);
+
+            if (entityskeleton != null) {
+                entityskeleton.startRiding(this.horse);
+                worldserver.addFreshEntityWithPassengers(entityskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.TRAP); // CraftBukkit
+
+                for (int i = 0; i < 3; ++i) {
+                    AbstractHorse entityhorseabstract = this.createHorse(difficultydamagescaler);
+
+                    if (entityhorseabstract != null) {
+                        Skeleton entityskeleton1 = this.createSkeleton(difficultydamagescaler, entityhorseabstract);
+
+                        if (entityskeleton1 != null) {
+                            entityskeleton1.startRiding(entityhorseabstract);
+                            entityhorseabstract.push(this.horse.getRandom().triangle(0.0D, 1.1485D), 0.0D, this.horse.getRandom().triangle(0.0D, 1.1485D));
+                            worldserver.addFreshEntityWithPassengers(entityhorseabstract, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.JOCKEY); // CraftBukkit
                         }
                     }
                 }
+
             }
         }
     }
 
     @Nullable
     private AbstractHorse createHorse(DifficultyInstance localDifficulty) {
-        SkeletonHorse skeletonHorse = EntityType.SKELETON_HORSE.create(this.horse.level());
-        if (skeletonHorse != null) {
-            skeletonHorse.finalizeSpawn((ServerLevel)this.horse.level(), localDifficulty, MobSpawnType.TRIGGERED, null);
-            skeletonHorse.setPos(this.horse.getX(), this.horse.getY(), this.horse.getZ());
-            skeletonHorse.invulnerableTime = 60;
-            skeletonHorse.setPersistenceRequired();
-            skeletonHorse.setTamed(true);
-            skeletonHorse.setAge(0);
+        SkeletonHorse entityhorseskeleton = (SkeletonHorse) EntityType.SKELETON_HORSE.create(this.horse.level());
+
+        if (entityhorseskeleton != null) {
+            entityhorseskeleton.finalizeSpawn((ServerLevel) this.horse.level(), localDifficulty, MobSpawnType.TRIGGERED, (SpawnGroupData) null);
+            entityhorseskeleton.setPos(this.horse.getX(), this.horse.getY(), this.horse.getZ());
+            entityhorseskeleton.invulnerableTime = 60;
+            entityhorseskeleton.setPersistenceRequired();
+            entityhorseskeleton.setTamed(true);
+            entityhorseskeleton.setAge(0);
         }
 
-        return skeletonHorse;
+        return entityhorseskeleton;
     }
 
     @Nullable
     private Skeleton createSkeleton(DifficultyInstance localDifficulty, AbstractHorse vehicle) {
-        Skeleton skeleton = EntityType.SKELETON.create(vehicle.level());
-        if (skeleton != null) {
-            skeleton.finalizeSpawn((ServerLevel)vehicle.level(), localDifficulty, MobSpawnType.TRIGGERED, null);
-            skeleton.setPos(vehicle.getX(), vehicle.getY(), vehicle.getZ());
-            skeleton.invulnerableTime = 60;
-            skeleton.setPersistenceRequired();
-            if (skeleton.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) {
-                skeleton.setItemSlot(EquipmentSlot.HEAD, new ItemStack(Items.IRON_HELMET));
+        Skeleton entityskeleton = (Skeleton) EntityType.SKELETON.create(vehicle.level());
+
+        if (entityskeleton != null) {
+            entityskeleton.finalizeSpawn((ServerLevel) vehicle.level(), localDifficulty, MobSpawnType.TRIGGERED, (SpawnGroupData) null);
+            entityskeleton.setPos(vehicle.getX(), vehicle.getY(), vehicle.getZ());
+            entityskeleton.invulnerableTime = 60;
+            entityskeleton.setPersistenceRequired();
+            if (entityskeleton.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) {
+                entityskeleton.setItemSlot(EquipmentSlot.HEAD, new ItemStack(Items.IRON_HELMET));
             }
 
-            FeatureFlagSet featureFlagSet = vehicle.level().enabledFeatures();
-            skeleton.setItemSlot(
-                EquipmentSlot.MAINHAND,
-                EnchantmentHelper.enchantItem(
-                    featureFlagSet,
-                    skeleton.getRandom(),
-                    this.disenchant(skeleton.getMainHandItem()),
-                    (int)(5.0F + localDifficulty.getSpecialMultiplier() * (float)skeleton.getRandom().nextInt(18)),
-                    false
-                )
-            );
-            skeleton.setItemSlot(
-                EquipmentSlot.HEAD,
-                EnchantmentHelper.enchantItem(
-                    featureFlagSet,
-                    skeleton.getRandom(),
-                    this.disenchant(skeleton.getItemBySlot(EquipmentSlot.HEAD)),
-                    (int)(5.0F + localDifficulty.getSpecialMultiplier() * (float)skeleton.getRandom().nextInt(18)),
-                    false
-                )
-            );
+            FeatureFlagSet featureflagset = vehicle.level().enabledFeatures();
+
+            entityskeleton.setItemSlot(EquipmentSlot.MAINHAND, EnchantmentHelper.enchantItem(featureflagset, entityskeleton.getRandom(), this.disenchant(entityskeleton.getMainHandItem()), (int) (5.0F + localDifficulty.getSpecialMultiplier() * (float) entityskeleton.getRandom().nextInt(18)), false));
+            entityskeleton.setItemSlot(EquipmentSlot.HEAD, EnchantmentHelper.enchantItem(featureflagset, entityskeleton.getRandom(), this.disenchant(entityskeleton.getItemBySlot(EquipmentSlot.HEAD)), (int) (5.0F + localDifficulty.getSpecialMultiplier() * (float) entityskeleton.getRandom().nextInt(18)), false));
         }
 
-        return skeleton;
+        return entityskeleton;
     }
 
     private ItemStack disenchant(ItemStack stack) {
