mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
1. Wet the drys 2. Dry the wets 3. Wet the drys 4. Dry the wets 5. Wet the drys 6. Now dust the wets
60 lines
3.2 KiB
Diff
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;
|
|
|