forked from hpfxd/PandaSpigot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0018-Configurable-time-update-frequency.patch
37 lines (34 loc) · 2.35 KB
/
0018-Configurable-time-update-frequency.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: hpfxd <[email protected]>
Date: Sat, 30 Oct 2021 14:42:18 -0400
Subject: [PATCH] Configurable time update frequency.
diff --git a/src/main/java/com/hpfxd/pandaspigot/config/PandaSpigotWorldConfig.java b/src/main/java/com/hpfxd/pandaspigot/config/PandaSpigotWorldConfig.java
index 3dd3d0702c17541083d0d365ca46e93602105bce..b5f16e8cab9e43ad7597b2ea5bc921399b37872b 100644
--- a/src/main/java/com/hpfxd/pandaspigot/config/PandaSpigotWorldConfig.java
+++ b/src/main/java/com/hpfxd/pandaspigot/config/PandaSpigotWorldConfig.java
@@ -6,6 +6,13 @@ import org.spongepowered.configurate.objectmapping.meta.Comment;
@ConfigSerializable
@SuppressWarnings({"FieldCanBeLocal", "FieldMayBeFinal"})
public class PandaSpigotWorldConfig {
+ @Comment("How many ticks in between sending time updates to players?\n" +
+ "\n" +
+ "The vanilla option is 20 (every second), but PandaSpigot sets the default\n" +
+ "to 100 (every 5 seconds). You would probably be fine setting this even\n" +
+ "higher, unless you're constantly changing the time, or the server is lagging.")
+ public int timeUpdateFrequency = 100;
+
@Comment("These options control velocity players receive when damaged.")
public KnockbackConfig knockback;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8f394d5fe6f0f0640a942f15ae69582bfd70b4c8..b7decb879f530345b82722aeb1294864feecd2c2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -906,7 +906,7 @@ public abstract class MinecraftServer extends com.hpfxd.pandaspigot.tickloop.Ree
long worldTime = world.getTime();
final PacketPlayOutUpdateTime worldPacket = new PacketPlayOutUpdateTime(worldTime, dayTime, doDaylight);
for (EntityHuman entityhuman : world.players) {
- if (!(entityhuman instanceof EntityPlayer) || (this.ticks + entityhuman.getId()) % 20 != 0) {
+ if (!(entityhuman instanceof EntityPlayer) || (this.ticks + entityhuman.getId()) % world.pandaSpigotConfig.timeUpdateFrequency != 0) {
continue;
}
EntityPlayer entityplayer = (EntityPlayer) entityhuman;