Configurable mob spawner tick rate

This commit is contained in:
Byteflux 2015-07-14 10:01:28 -07:00
parent 4cd1afddde
commit 4d0466c559

View file

@ -0,0 +1,69 @@
From 7d96e720cf8437a329fb14e8eb3a6bacb5dfef1d Mon Sep 17 00:00:00 2001
From: Sudzzy <originmc@outlook.com>
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