9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-21 07:59:26 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0105-Cache-random-tick-block-status.patch
Dreeam 387597f347 Updated Upstream (Leaves)
Upstream has released updates that appear to apply and compile correctly

Leaves Changes:
LeavesMC/Leaves@88819fe8 Add mc-old hopper suck-in behavior (#395)
LeavesMC/Leaves@7394e8dd Fix papermc repo
LeavesMC/Leaves@85c7bf11 Remove cache-world-generator-sea-level (#392)
LeavesMC/Leaves@00798036 init 1.21.4, and boom!
LeavesMC/Leaves@91fc24da build change, but weight not work
LeavesMC/Leaves@4ccdf459 just work
LeavesMC/Leaves@05ee2e36 Build changes, and delete timings
LeavesMC/Leaves@fcc859dc Fix API patches (#406)
LeavesMC/Leaves@6a1259df 0006/0129
LeavesMC/Leaves@3e3b05df 0009/0129
LeavesMC/Leaves@c3255c4f 0011/0129
LeavesMC/Leaves@6284c7b6 0018/0129
LeavesMC/Leaves@7abdc88c 0030/0129
LeavesMC/Leaves@4d119ff9 0035/0129
LeavesMC/Leaves@60baed99 0043/0129
LeavesMC/Leaves@dc319d5b 0048/0129
LeavesMC/Leaves@73a505d5 0049/0129
LeavesMC/Leaves@016b29dd 0057/0129
LeavesMC/Leaves@c9cf5af8 0065/0129
LeavesMC/Leaves@330b79ff 0086/0129 (#408)
LeavesMC/Leaves@06c1d946 0087/0129
LeavesMC/Leaves@bf4bc284 0091/0129
LeavesMC/Leaves@102a3b70 0097/0129
LeavesMC/Leaves@53b43fed 0101/0129
LeavesMC/Leaves@892f3925 102/129
LeavesMC/Leaves@08c3043a 0107/0129
LeavesMC/Leaves@48764d8e 0112/0129
LeavesMC/Leaves@8380feff 0118/0129
LeavesMC/Leaves@e51603db 0129/0129, 100% patched
LeavesMC/Leaves@ef851152 fix some
LeavesMC/Leaves@9b7c6e88 server work
LeavesMC/Leaves@272b7dcb Protocol... (#409)
LeavesMC/Leaves@7be1bc97 Make jade better
LeavesMC/Leaves@5350f6ea Make action work
LeavesMC/Leaves@f07c26c8 fix action jar
2025-02-06 23:28:14 -05:00

60 lines
3.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Sat, 23 Nov 2024 09:04:46 -0500
Subject: [PATCH] Cache random tick block status
diff --git a/net/minecraft/world/level/chunk/LevelChunkSection.java b/net/minecraft/world/level/chunk/LevelChunkSection.java
index 412e7b1cf8c24f0ddf6d174967bedad576f10aba..b8ac6a9ba7b56ccd034757f7d135d272b8e69e90 100644
--- a/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -21,6 +21,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
short nonEmptyBlockCount; // Paper - package private
private short tickingBlockCount;
private short tickingFluidCount;
+ private boolean isRandomlyTickingBlocksStatus; // Leaf - Cache random tick block status
public final PalettedContainer<BlockState> states;
private PalettedContainer<Holder<Biome>> biomes; // CraftBukkit - read/write
@@ -54,6 +55,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
this.tickingFluidCount = section.tickingFluidCount;
this.states = section.states.copy();
this.biomes = section.biomes.copy();
+ this.isRandomlyTickingBlocksStatus = this.tickingBlockCount > 0; // Leaf - Cache random tick block status
}
public LevelChunkSection(PalettedContainer<BlockState> states, PalettedContainer<Holder<Biome>> biomes) { // CraftBukkit - read/write
@@ -165,6 +167,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
}
this.updateBlockCallback(x, y, z, state, blockState); // Paper - block counting
+ this.isRandomlyTickingBlocksStatus = this.tickingBlockCount > 0; // Leaf - Cache random tick block status
return blockState;
}
@@ -178,7 +181,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
}
public boolean isRandomlyTickingBlocks() {
- return this.tickingBlockCount > 0;
+ return isRandomlyTickingBlocksStatus; // Leaf - Cache random tick block status
}
public boolean isRandomlyTickingFluids() {
@@ -193,6 +196,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
this.tickingFluidCount = (short)0;
this.specialCollidingBlocks = (short)0;
this.tickingBlocks.clear();
+ this.isRandomlyTickingBlocksStatus = false; // Leaf - Cache random tick block status
if (this.maybeHas((final BlockState state) -> !state.isAir())) {
final PalettedContainer.Data<BlockState> data = this.states.data;
@@ -226,6 +230,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
this.nonEmptyBlockCount += (short)paletteCount;
if (state.isRandomlyTicking()) {
this.tickingBlockCount += (short)paletteCount;
+ this.isRandomlyTickingBlocksStatus = this.tickingBlockCount > 0; // Leaf - Cache random tick block status
final short[] raw = coordinates.elements();
final int rawLen = raw.length;