From aa492e552e7868f6ff340677fddf326a0f375097 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 7 Sep 2019 16:35:09 +1000 Subject: [PATCH] SPIGOT-5255: Raid / patrol spawn reasons --- nms-patches/MobSpawnerPatrol.patch | 11 +++++++++++ nms-patches/Raid.patch | 9 +++++++++ 2 files changed, 20 insertions(+) create mode 100644 nms-patches/MobSpawnerPatrol.patch diff --git a/nms-patches/MobSpawnerPatrol.patch b/nms-patches/MobSpawnerPatrol.patch new file mode 100644 index 0000000000..7f6335daad --- /dev/null +++ b/nms-patches/MobSpawnerPatrol.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/server/MobSpawnerPatrol.java ++++ b/net/minecraft/server/MobSpawnerPatrol.java +@@ -96,7 +96,7 @@ + + entitymonsterpatrolling.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ()); + entitymonsterpatrolling.prepare(world, world.getDamageScaler(blockposition), EnumMobSpawn.PATROL, (GroupDataEntity) null, (NBTTagCompound) null); +- world.addEntity(entitymonsterpatrolling); ++ world.addEntity(entitymonsterpatrolling, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.PATROL); // CraftBukkit + return true; + } else { + return false; diff --git a/nms-patches/Raid.patch b/nms-patches/Raid.patch index 0e2c920d6f..40e5bf0911 100644 --- a/nms-patches/Raid.patch +++ b/nms-patches/Raid.patch @@ -140,6 +140,15 @@ } public void a(int i, EntityRaider entityraider, @Nullable BlockPosition blockposition, boolean flag) { +@@ -513,7 +536,7 @@ + entityraider.prepare(this.k, this.k.getDamageScaler(blockposition), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null); + entityraider.a(i, false); + entityraider.onGround = true; +- this.k.addEntity(entityraider); ++ this.k.addEntity(entityraider, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.RAID); // CraftBukkit + } + } + @@ -759,6 +782,12 @@ this.h.add(entity.getUniqueID()); }