From 4d0466c559a5fdb43f61066cc80834f93e24eb0b Mon Sep 17 00:00:00 2001 From: Byteflux Date: Tue, 14 Jul 2015 10:01:28 -0700 Subject: [PATCH] Configurable mob spawner tick rate --- ...3-Configurable-mob-spawner-tick-rate.patch | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Spigot-Server-Patches/0063-Configurable-mob-spawner-tick-rate.patch diff --git a/Spigot-Server-Patches/0063-Configurable-mob-spawner-tick-rate.patch b/Spigot-Server-Patches/0063-Configurable-mob-spawner-tick-rate.patch new file mode 100644 index 0000000000..55aca0c7a9 --- /dev/null +++ b/Spigot-Server-Patches/0063-Configurable-mob-spawner-tick-rate.patch @@ -0,0 +1,69 @@ +From 7d96e720cf8437a329fb14e8eb3a6bacb5dfef1d Mon Sep 17 00:00:00 2001 +From: Sudzzy +Date: Tue, 14 Jul 2015 09:58:15 -0700 +Subject: [PATCH] Configurable mob spawner tick rate + + +diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +index ebd1e36..d4674dc 100644 +--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +@@ -25,6 +25,7 @@ public abstract class MobSpawnerAbstract { + private int maxNearbyEntities = 6; + private int requiredPlayerRange = 16; + private int spawnRange = 4; ++ private int tickDelay = 0; // PaperSpigot + + public MobSpawnerAbstract() {} + +@@ -56,6 +57,10 @@ public abstract class MobSpawnerAbstract { + } + + public void c() { ++ // PaperSpigot start - Configurable mob spawner tick rate ++ if (spawnDelay > 0 && --tickDelay > 0) return; ++ tickDelay = this.a().paperSpigotConfig.mobSpawnerTickRate; ++ // PaperSpigot end + if (this.g()) { + BlockPosition blockposition = this.b(); + double d0; +@@ -68,18 +73,18 @@ public abstract class MobSpawnerAbstract { + this.a().addParticle(EnumParticle.SMOKE_NORMAL, d1, d2, d0, 0.0D, 0.0D, 0.0D, new int[0]); + this.a().addParticle(EnumParticle.FLAME, d1, d2, d0, 0.0D, 0.0D, 0.0D, new int[0]); + if (this.spawnDelay > 0) { +- --this.spawnDelay; ++ this.spawnDelay -= tickDelay; // PaperSpigot + } + + this.f = this.e; + this.e = (this.e + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D; + } else { +- if (this.spawnDelay == -1) { ++ if (this.spawnDelay < -tickDelay) { // PaperSpigot + this.h(); + } + + if (this.spawnDelay > 0) { +- --this.spawnDelay; ++ this.spawnDelay -= tickDelay; // PaperSpigot + return; + } + +diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +index 2371123..9c8a01b 100644 +--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java ++++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java +@@ -384,4 +384,10 @@ public class PaperSpigotWorldConfig + { + disableMoodSounds = getBoolean( "disable-mood-sounds", false ); + } ++ ++ public int mobSpawnerTickRate; ++ private void mobSpawnerTickRate() ++ { ++ mobSpawnerTickRate = getInt( "mob-spawner-tick-rate", 1 ); ++ } + } +-- +1.9.5.msysgit.1 +