2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Sun, 3 Apr 2016 16:28:17 -0400
|
2023-12-03 02:00:17 +01:00
|
|
|
Subject: [PATCH] Configurable random tick rates for blocks
|
2021-06-11 14:02:28 +02:00
|
|
|
|
2023-12-03 02:00:17 +01:00
|
|
|
A general purpose patch that includes config options for the tick rate
|
|
|
|
of a variety of blocks that are random ticked.
|
2021-06-11 14:02:28 +02:00
|
|
|
|
2023-12-03 02:00:17 +01:00
|
|
|
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
|
2024-10-22 20:04:31 +02:00
|
|
|
index 38b3c14d393137026720f42bd9f14b856b8377d0..a87f8345aa5520a867a8dd769b43526b20b8c16a 100644
|
2023-12-03 02:00:17 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
2024-04-24 03:25:14 +02:00
|
|
|
@@ -93,6 +93,8 @@ public class FarmBlock extends Block {
|
2023-12-03 02:00:17 +01:00
|
|
|
@Override
|
2024-04-24 03:25:14 +02:00
|
|
|
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
2023-12-03 02:00:17 +01:00
|
|
|
int i = (Integer) state.getValue(FarmBlock.MOISTURE);
|
2024-01-23 14:34:17 +01:00
|
|
|
+ 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 - Configurable random tick rates for blocks
|
|
|
|
+ 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 - Configurable random tick rates for blocks
|
2023-12-03 02:00:17 +01:00
|
|
|
|
|
|
|
if (!FarmBlock.isNearWater(world, pos) && !world.isRainingAt(pos.above())) {
|
|
|
|
if (i > 0) {
|
2021-06-11 14:02:28 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
|
2024-12-03 18:27:11 +01:00
|
|
|
index 63fb3b192a02af585168dda58f5a49ff2f6bc216..30047cbef0ef54ad326e71761cba64887624d493 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
|
2024-04-24 03:25:14 +02:00
|
|
|
@@ -43,6 +43,7 @@ public abstract class SpreadingSnowyDirtBlock extends SnowyDirtBlock {
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
@Override
|
2024-04-24 03:25:14 +02:00
|
|
|
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
|
|
|
+ if (this instanceof GrassBlock && world.paperConfig().tickRates.grassSpread != 1 && (world.paperConfig().tickRates.grassSpread < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.grassSpread != 0)) { return; } // Paper - Configurable random tick rates for blocks
|
2021-11-23 15:03:50 +01:00
|
|
|
if (!SpreadingSnowyDirtBlock.canBeGrass(state, world, pos)) {
|
2021-06-11 14:02:28 +02:00
|
|
|
// CraftBukkit start
|
|
|
|
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, pos, Blocks.DIRT.defaultBlockState()).isCancelled()) {
|