diff options
author | MrPowerGamerBR <[email protected]> | 2023-12-02 22:00:17 -0300 |
---|---|---|
committer | GitHub <[email protected]> | 2023-12-02 17:00:17 -0800 |
commit | ffa41152390b121b919454b64f99097f356b25bf (patch) | |
tree | d87de40e3c1bf11b5ab18ba649637b36f5e3896c | |
parent | 40872ece07b24a02b021bf1b4dbe9b42e0116376 (diff) | |
download | Paper-ffa41152390b121b919454b64f99097f356b25bf.tar.gz Paper-ffa41152390b121b919454b64f99097f356b25bf.zip |
Configurable Dry and Wet Farmland Tick Rates (#9968)
* Configurable Dry and Wet Farm Land Nearby Water Tick Rates
* Rebase and squash
---------
-rw-r--r-- | patches/server/0005-Paper-config-files.patch | 6 | ||||
-rw-r--r-- | patches/server/0085-Configurable-random-tick-rates-for-blocks.patch (renamed from patches/server/0085-Configurable-Grass-Spread-Tick-Rate.patch) | 19 | ||||
-rw-r--r-- | patches/server/0687-Optimise-BlockSoil-nearby-water-lookup.patch | 4 |
3 files changed, 24 insertions, 5 deletions
diff --git a/patches/server/0005-Paper-config-files.patch b/patches/server/0005-Paper-config-files.patch index b72ae1ee74..f5803a04ce 100644 --- a/patches/server/0005-Paper-config-files.patch +++ b/patches/server/0005-Paper-config-files.patch @@ -1390,10 +1390,10 @@ index 0000000000000000000000000000000000000000..351fbbc577556ebbd62222615801a96b +} diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java new file mode 100644 -index 0000000000000000000000000000000000000000..84e6fc5bac43ee0499b391827726bc02f6d3e46f +index 0000000000000000000000000000000000000000..dbcab5a6095d1f318fd333e24f1aa54da7edcaf5 --- /dev/null +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java -@@ -0,0 +1,539 @@ +@@ -0,0 +1,541 @@ +package io.papermc.paper.configuration; + +import com.google.common.collect.HashBasedTable; @@ -1895,6 +1895,8 @@ index 0000000000000000000000000000000000000000..84e6fc5bac43ee0499b391827726bc02 + public int grassSpread = 1; + public int containerUpdate = 1; + public int mobSpawner = 1; ++ public int wetFarmland = 1; ++ public int dryFarmland = 1; + public Table<EntityType<?>, String, Integer> sensor = Util.make(HashBasedTable.create(), table -> table.put(EntityType.VILLAGER, "secondarypoisensor", 40)); + public Table<EntityType<?>, String, Integer> behavior = Util.make(HashBasedTable.create(), table -> table.put(EntityType.VILLAGER, "validatenearbypoi", -1)); + } diff --git a/patches/server/0085-Configurable-Grass-Spread-Tick-Rate.patch b/patches/server/0085-Configurable-random-tick-rates-for-blocks.patch index 101ec3a372..d492f4f705 100644 --- a/patches/server/0085-Configurable-Grass-Spread-Tick-Rate.patch +++ b/patches/server/0085-Configurable-random-tick-rates-for-blocks.patch @@ -1,9 +1,26 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar <[email protected]> Date: Sun, 3 Apr 2016 16:28:17 -0400 -Subject: [PATCH] Configurable Grass Spread Tick Rate +Subject: [PATCH] Configurable random tick rates for blocks +A general purpose patch that includes config options for the tick rate +of a variety of blocks that are random ticked. +Co-authored-by: MrPowerGamerBR <[email protected]> + +diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java +index 3b4d8a47e7fe08284b79fab2d147629e902db026..eb6056c5051e5e8a872a10dc993dbd5232787663 100644 +--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java +@@ -85,6 +85,8 @@ public class FarmBlock extends Block { + @Override + public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + int i = (Integer) state.getValue(FarmBlock.MOISTURE); ++ if (i > 0 && world.paperConfig().tickRates.wetFarmland != 1 && (world.paperConfig().tickRates.wetFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.wetFarmland != 0)) { return; } // Paper ++ if (i == 0 && world.paperConfig().tickRates.dryFarmland != 1 && (world.paperConfig().tickRates.dryFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.dryFarmland != 0)) { return; } // Paper + + if (!FarmBlock.isNearWater(world, pos) && !world.isRainingAt(pos.above())) { + if (i > 0) { diff --git a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java index 1df22561b2d39066b6b30f10ea43edd734e3b50a..1fe07f8f9b28faf076209f7ad235fd5dc948b294 100644 --- a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java diff --git a/patches/server/0687-Optimise-BlockSoil-nearby-water-lookup.patch b/patches/server/0687-Optimise-BlockSoil-nearby-water-lookup.patch index 08ef0f3bc8..0e1204b2ec 100644 --- a/patches/server/0687-Optimise-BlockSoil-nearby-water-lookup.patch +++ b/patches/server/0687-Optimise-BlockSoil-nearby-water-lookup.patch @@ -7,10 +7,10 @@ Apparently the abstract block iteration was taking about 75% of the method call. diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java -index 3b4d8a47e7fe08284b79fab2d147629e902db026..5946f06f63b5694034bd027984a4925b0831d439 100644 +index eb6056c5051e5e8a872a10dc993dbd5232787663..502dcba14da9d3dcefc61fdc349a4e1e1d94b478 100644 --- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java -@@ -142,19 +142,27 @@ public class FarmBlock extends Block { +@@ -144,19 +144,27 @@ public class FarmBlock extends Block { } private static boolean isNearWater(LevelReader world, BlockPos pos) { |