PaperMC/nms-patches/PathfinderGoalHorseTrap.patch
2020-06-25 10:00:00 +10:00

41 lines
2.4 KiB
Diff

--- a/net/minecraft/server/PathfinderGoalHorseTrap.java
+++ b/net/minecraft/server/PathfinderGoalHorseTrap.java
@@ -24,16 +24,17 @@
entitylightning.teleportAndSync(this.a.locX(), this.a.locY(), this.a.locZ());
entitylightning.setEffect(true);
- this.a.world.addEntity(entitylightning);
+ ((WorldServer) this.a.world).strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRAP); // CraftBukkit
EntitySkeleton entityskeleton = this.a(difficultydamagescaler, this.a);
- entityskeleton.startRiding(this.a);
+ if (entityskeleton != null) entityskeleton.startRiding(this.a); // 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.h(this.a.getRandom().nextGaussian() * 0.5D, 0.0D, this.a.getRandom().nextGaussian() * 0.5D);
}
@@ -48,7 +49,7 @@
entityhorseskeleton.setPersistent();
entityhorseskeleton.setTamed(true);
entityhorseskeleton.setAgeRaw(0);
- entityhorseskeleton.world.addEntity(entityhorseskeleton);
+ if (!entityhorseskeleton.world.addEntity(entityhorseskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.TRAP)) return null; // CraftBukkit
return entityhorseskeleton;
}
@@ -65,7 +66,7 @@
entityskeleton.setSlot(EnumItemSlot.MAINHAND, EnchantmentManager.a(entityskeleton.getRandom(), entityskeleton.getItemInMainHand(), (int) (5.0F + difficultydamagescaler.d() * (float) entityskeleton.getRandom().nextInt(18)), false));
entityskeleton.setSlot(EnumItemSlot.HEAD, EnchantmentManager.a(entityskeleton.getRandom(), entityskeleton.getEquipment(EnumItemSlot.HEAD), (int) (5.0F + difficultydamagescaler.d() * (float) entityskeleton.getRandom().nextInt(18)), false));
- entityskeleton.world.addEntity(entityskeleton);
+ if (!entityskeleton.world.addEntity(entityskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.JOCKEY)) return null; // CraftBukkit
return entityskeleton;
}
}