aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0084-Configurable-Chunk-Inhabited-Time.patch
blob: bdf4c4ca4a2fdaeb0253e88a24514ae0c459c132 (plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From 77d354aa2dbabcd0cdbeb77d8063789978bdf230 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 20:46:14 -0400
Subject: [PATCH] Configurable Chunk Inhabited Time

Vanilla stores how long a chunk has been active on a server, and dynamically scales some
aspects of vanilla gameplay to this factor.

For people who want all chunks to be treated equally, you can chose a fixed value.

This allows to fine-tune vanilla gameplay.

diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index be380ac75..69ac43d9a 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -237,4 +237,19 @@ public class PaperWorldConfig {
             skeleHorseSpawnChance = 0.01D; // Vanilla value
         }
     }
+
+    public boolean firePhysicsEventForRedstone = false;
+    private void firePhysicsEventForRedstone() {
+        firePhysicsEventForRedstone = getBoolean("fire-physics-event-for-redstone", firePhysicsEventForRedstone);
+    }
+
+    public int fixedInhabitedTime;
+    private void fixedInhabitedTime() {
+        if (PaperConfig.version < 16) {
+            if (!config.getBoolean("world-settings.default.use-chunk-inhabited-timer", true)) config.set("world-settings.default.fixed-chunk-inhabited-time", 0);
+            if (!config.getBoolean("world-settings." + worldName + ".use-chunk-inhabited-timer", true)) config.set("world-settings." + worldName + ".fixed-chunk-inhabited-time", 0);
+            set("use-chunk-inhabited-timer", null);
+        }
+        fixedInhabitedTime = getInt("fixed-chunk-inhabited-time", -1);
+    }
 }
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 182a637ad..0421f8f95 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -1289,7 +1289,7 @@ public class Chunk implements IChunkAccess {
     }
 
     public long m() {
-        return this.z;
+        return world.paperConfig.fixedInhabitedTime < 0 ? this.z : world.paperConfig.fixedInhabitedTime; // Paper
     }
 
     public void b(long i) {
-- 
2.21.0