--- a/net/minecraft/server/PathfinderGoalHorseTrap.java
+++ b/net/minecraft/server/PathfinderGoalHorseTrap.java
@@ -25,19 +25,20 @@
 
         entitylightning.teleportAndSync(this.a.locX(), this.a.locY(), this.a.locZ());
         entitylightning.setEffect(true);
-        worldserver.addEntity(entitylightning);
+        worldserver.strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRAP); // CraftBukkit
         EntitySkeleton entityskeleton = this.a(difficultydamagescaler, this.a);
 
-        entityskeleton.startRiding(this.a);
-        worldserver.addAllEntities(entityskeleton);
+        if (entityskeleton != null) entityskeleton.startRiding(this.a); // CraftBukkit
+        worldserver.addAllEntities(entityskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.TRAP); // CraftBukkit
 
         for (int i = 0; i < 3; ++i) {
             EntityHorseAbstract entityhorseabstract = this.a(difficultydamagescaler);
+            if (entityhorseabstract == null) continue; // CraftBukkit
             EntitySkeleton entityskeleton1 = this.a(difficultydamagescaler, entityhorseabstract);
 
-            entityskeleton1.startRiding(entityhorseabstract);
+            if (entityskeleton1 != null) entityskeleton1.startRiding(entityhorseabstract); // CraftBukkit
             entityhorseabstract.i(this.a.getRandom().nextGaussian() * 0.5D, 0.0D, this.a.getRandom().nextGaussian() * 0.5D);
-            worldserver.addAllEntities(entityhorseabstract);
+            worldserver.addAllEntities(entityhorseabstract, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.JOCKEY); // CraftBukkit
         }
 
     }