aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0113-Configurable-Grass-Spread-Tick-Rate.patch
blob: f715cb336b686561419c5e02dd257f41cf719e2a (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
From 0f3548ee8b973ee84a6ff4e82be5e62addac9a48 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 3 Apr 2016 16:28:17 -0400
Subject: [PATCH] Configurable Grass Spread Tick Rate


diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 6eb0a2d..bc3515c 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -296,4 +296,10 @@ public class PaperWorldConfig {
     private void useInhabitedTime() {
         useInhabitedTime = getBoolean("use-chunk-inhabited-timer", true);
     }
+
+    public int grassUpdateRate = 1;
+    private void grassUpdateRate() {
+        grassUpdateRate = Math.max(0, getInt("grass-spread-tick-rate", grassUpdateRate));
+        log("Grass Spread Tick Rate: " + grassUpdateRate);
+    }
 }
diff --git a/src/main/java/net/minecraft/server/BlockGrass.java b/src/main/java/net/minecraft/server/BlockGrass.java
index 21e722d..e41f2b2 100644
--- a/src/main/java/net/minecraft/server/BlockGrass.java
+++ b/src/main/java/net/minecraft/server/BlockGrass.java
@@ -29,6 +29,7 @@ public class BlockGrass extends Block implements IBlockFragilePlantElement {
     }
 
     public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
+        if (world.paperConfig.grassUpdateRate != 1 && (world.paperConfig.grassUpdateRate < 1 || (MinecraftServer.currentTick + blockposition.hashCode()) % world.paperConfig.grassUpdateRate != 0)) { return; } // Paper
         if (!world.isClientSide) {
             int lightLevel = -1; // Paper
             if (world.getType(blockposition.up()).c() > 2 && (lightLevel = world.getLightLevel(blockposition.up())) < 4) { // Paper - move light check to end to avoid unneeded light lookups
-- 
2.9.3