From fc81df77cfd0c88424b382cc508a054b688140b4 Mon Sep 17 00:00:00 2001
From: CraftBukkit/Spigot <noreply+git-craftbukkit@papermc.io>
Date: Sun, 2 Feb 2014 16:55:46 +0000
Subject: [PATCH] Add Option to Nerf Mobs from Spawners

By: md_5 <git@md-5.net>
---
 .../net/minecraft/world/level/BaseSpawner.java.patch      | 8 +++++++-
 .../src/main/java/org/spigotmc/SpigotWorldConfig.java     | 7 +++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/paper-server/patches/sources/net/minecraft/world/level/BaseSpawner.java.patch b/paper-server/patches/sources/net/minecraft/world/level/BaseSpawner.java.patch
index 22fbd3abb1..26c161d3e4 100644
--- a/paper-server/patches/sources/net/minecraft/world/level/BaseSpawner.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/level/BaseSpawner.java.patch
@@ -8,7 +8,7 @@
      }
  
      public boolean isNearPlayer(Level world, BlockPos pos) {
-@@ -157,13 +158,18 @@
+@@ -157,13 +158,24 @@
                                  ((Mob) entity).finalizeSpawn(world, world.getCurrentDifficultyAt(entity.blockPosition()), EntitySpawnReason.SPAWNER, (SpawnGroupData) null);
                              }
  
@@ -17,6 +17,12 @@
  
                              Objects.requireNonNull(entityinsentient);
                              optional1.ifPresent(entityinsentient::equip);
++                            // Spigot Start
++                            if ( entityinsentient.level().spigotConfig.nerfSpawnerMobs )
++                            {
++                                entityinsentient.aware = false;
++                            }
++                            // Spigot End
                          }
  
 -                        if (!world.tryAddFreshEntityWithPassengers(entity)) {
diff --git a/paper-server/src/main/java/org/spigotmc/SpigotWorldConfig.java b/paper-server/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 60daf36023..d1c8c21083 100644
--- a/paper-server/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/paper-server/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -262,4 +262,11 @@ public class SpigotWorldConfig
         this.zombieAggressiveTowardsVillager = this.getBoolean( "zombie-aggressive-towards-villager", true );
         this.log( "Zombie Aggressive Towards Villager: " + this.zombieAggressiveTowardsVillager );
     }
+
+    public boolean nerfSpawnerMobs;
+    private void nerfSpawnerMobs()
+    {
+        this.nerfSpawnerMobs = this.getBoolean( "nerf-spawner-mobs", false );
+        this.log( "Nerfing mobs spawned from spawners: " + this.nerfSpawnerMobs );
+    }
 }