mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 12:42:05 -07:00
Configurable Dry and Wet Farmland Tick Rates (#9968)
* Configurable Dry and Wet Farm Land Nearby Water Tick Rates * Rebase and squash ---------
This commit is contained in:
@@ -1,9 +1,26 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Sun, 3 Apr 2016 16:28:17 -0400
|
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 <git@mrpowergamerbr.com>
|
||||||
|
|
||||||
|
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||||
|
@@ -0,0 +0,0 @@ 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
|
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
|
@@ -1895,6 +1895,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ public int grassSpread = 1;
|
+ public int grassSpread = 1;
|
||||||
+ public int containerUpdate = 1;
|
+ public int containerUpdate = 1;
|
||||||
+ public int mobSpawner = 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> 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));
|
+ public Table<EntityType<?>, String, Integer> behavior = Util.make(HashBasedTable.create(), table -> table.put(EntityType.VILLAGER, "validatenearbypoi", -1));
|
||||||
+ }
|
+ }
|
||||||
|
Reference in New Issue
Block a user