9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-30 20:39:21 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0284-optimize-SpreadingSnowyDirtBlock-randomTick.patch
Dreeam d36ed6c316 Remove OP lock (#486)
Current implementation of OP lock is not an appropriate solution to prevent plugins that contain backdoor or malicious code. There are many ways to bypass this check to manipulate the OP list or permissions. The best way to prevent this kind of grief is to get plugins from valid and trustworthy places.
2025-08-31 23:53:19 -04:00

20 lines
1.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: hayanesuru <hayanesuru@outlook.jp>
Date: Sat, 9 Aug 2025 15:39:09 +0900
Subject: [PATCH] optimize SpreadingSnowyDirtBlock#randomTick
diff --git a/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java b/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
index f8cc3f870d88715386bb4de0da81a74fa04fd216..07eb777ac9657318831b5bf00e4a4c9e8aca76db 100644
--- a/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
+++ b/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java
@@ -52,7 +52,7 @@ public abstract class SpreadingSnowyDirtBlock extends SnowyDirtBlock {
protected void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
if (this instanceof GrassBlock && level.paperConfig().tickRates.grassSpread != 1 && (level.paperConfig().tickRates.grassSpread < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % level.paperConfig().tickRates.grassSpread != 0)) { return; } // Paper - Configurable random tick rates for blocks
// Paper start - Perf: optimize dirt and snow spreading
- final net.minecraft.world.level.chunk.ChunkAccess cachedBlockChunk = level.getChunkIfLoaded(pos);
+ final net.minecraft.world.level.chunk.ChunkAccess cachedBlockChunk = level.getChunkAtIfLoadedUnchecked(pos.getX() >> 4, pos.getZ() >> 4); // Leaf - optimize get chunk
if (cachedBlockChunk == null) { // Is this needed?
return;
}