3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/Spigot-Server-Patches/0059-Configurable-mob-spawner-tick-rate.patch

70 Zeilen
2.7 KiB
Diff

From ef6d2eb2901e52146ebbb4c0c8d7ac6aa0ec94b4 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 8e5de323..12697ff 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 );
+ }
}
--
2.5.2