Paper/Spigot-Server-Patches/0079-Configurable-Grass-Spread-Tick-Rate.patch
2021-01-03 17:23:10 +01:00

34 lines
2.0 KiB
Diff

From 0000000000000000000000000000000000000000 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 4faedee40c731920d6fc0e032df71f8118ba9dbf..244ee374dc96b715d5d97883d99f53bc7776d6a8 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -246,4 +246,10 @@ public class PaperWorldConfig {
}
fixedInhabitedTime = getInt("fixed-chunk-inhabited-time", -1);
}
+
+ 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/BlockDirtSnowSpreadable.java b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java
index 5eb62e9b9a228eaa50526e4203998246783a33d0..7b29d47dfdef7611db58068af285f76d92a9f12a 100644
--- a/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java
+++ b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java
@@ -31,6 +31,7 @@ public abstract class BlockDirtSnowSpreadable extends BlockDirtSnow {
@Override
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
+ if (this instanceof BlockGrass && worldserver.paperConfig.grassUpdateRate != 1 && (worldserver.paperConfig.grassUpdateRate < 1 || (MinecraftServer.currentTick + blockposition.hashCode()) % worldserver.paperConfig.grassUpdateRate != 0)) { return; } // Paper
if (!b(iblockdata, (IWorldReader) worldserver, blockposition)) {
// CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.DIRT.getBlockData()).isCancelled()) {