mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-22 16:39:22 +00:00
Move to 1.21.4
This commit is contained in:
59
patches/server/0135-Cache-random-tick-block-status.patch
Normal file
59
patches/server/0135-Cache-random-tick-block-status.patch
Normal file
@@ -0,0 +1,59 @@
|
||||
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/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
index e4ae25c83ab9dd1aaa530a5456275ef63cdb8511..f19d9bba70957fc652c3222cadd247eb837c2a13 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
@@ -22,6 +22,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
|
||||
|
||||
@@ -55,6 +56,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> datapaletteblock, PalettedContainer<Holder<Biome>> palettedcontainerro) { // CraftBukkit - read/write
|
||||
@@ -165,6 +167,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
}
|
||||
|
||||
this.updateBlockCallback(x, y, z, state, iblockdata1); // Paper - block counting
|
||||
+ this.isRandomlyTickingBlocksStatus = this.tickingBlockCount > 0; // Leaf - Cache random tick block status
|
||||
|
||||
return iblockdata1;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user