9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-30 20:39:21 +00:00

Drop "Cache random tick block status" (#450)

* drop Cache random tick block status

* rebuild patches

* [ci/skip] Update patch comment
This commit is contained in:
hayanesuru
2025-08-09 03:35:58 +09:00
committed by GitHub
parent 86c87e1ba0
commit 1ea7c5fe56
96 changed files with 10 additions and 10 deletions

View File

@@ -1,59 +0,0 @@
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 df717c545472006b99532280c38c1fbef12bcf82..36c033b0ee63dfc273d721fb4b614733e8fdef19 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;

View File

@@ -174,7 +174,7 @@ index 0376a10ee0544b13e8fd629a7b13f78811e57a30..aa6b900347635857b84460fa8435b81f
// Paper start - PlayerChunkLoadEvent
if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) {
diff --git a/net/minecraft/world/level/chunk/LevelChunkSection.java b/net/minecraft/world/level/chunk/LevelChunkSection.java
index 36c033b0ee63dfc273d721fb4b614733e8fdef19..4d06df242ab73411bdefc4770e131b27a6ea668a 100644
index df717c545472006b99532280c38c1fbef12bcf82..7689e005a7de17fa0411a346f595f40b06bb5ca4 100644
--- a/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -18,7 +18,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
@@ -185,4 +185,4 @@ index 36c033b0ee63dfc273d721fb4b614733e8fdef19..4d06df242ab73411bdefc4770e131b27
+ volatile short nonEmptyBlockCount; // Paper - package private // Leaf - Async chunk sending - volatile
private short tickingBlockCount;
private short tickingFluidCount;
private boolean isRandomlyTickingBlocksStatus; // Leaf - Cache random tick block status
public final PalettedContainer<BlockState> states;

View File

@@ -159,18 +159,18 @@ index 4ca68a903e67606fc4ef0bfa9862a73797121c8b..bed3a64388bb43e47c2ba4e67f7dde5b
public static final class SaveState {
diff --git a/net/minecraft/world/level/chunk/LevelChunkSection.java b/net/minecraft/world/level/chunk/LevelChunkSection.java
index 4d06df242ab73411bdefc4770e131b27a6ea668a..fb936344ba363490f2255682678f08e219fdec3d 100644
index 7689e005a7de17fa0411a346f595f40b06bb5ca4..5c5d51d5341dac68f89253c5181e1a099c305fac 100644
--- a/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -24,6 +24,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
private boolean isRandomlyTickingBlocksStatus; // Leaf - Cache random tick block status
@@ -23,6 +23,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
private short tickingFluidCount;
public final PalettedContainer<BlockState> states;
private PalettedContainer<Holder<Biome>> biomes; // CraftBukkit - read/write
+ private boolean modified = false; // Leaf - Optimize chunkUnload
// Paper start - block counting
private static final it.unimi.dsi.fastutil.shorts.ShortArrayList FULL_LIST = new it.unimi.dsi.fastutil.shorts.ShortArrayList(16*16*16);
@@ -135,6 +136,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
@@ -133,6 +134,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
// Paper end - block counting
public BlockState setBlockState(int x, int y, int z, BlockState state, boolean useLocks) {
@@ -178,7 +178,7 @@ index 4d06df242ab73411bdefc4770e131b27a6ea668a..fb936344ba363490f2255682678f08e2
BlockState blockState;
if (useLocks) {
blockState = this.states.getAndSet(x, y, z, state);
@@ -328,7 +330,32 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
@@ -323,7 +325,31 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
this.biomes = palettedContainer;
}
@@ -190,7 +190,6 @@ index 4d06df242ab73411bdefc4770e131b27a6ea668a..fb936344ba363490f2255682678f08e2
+ this.tickingFluidCount = tickingFluidCount;
+ this.states = states;
+ this.biomes = biomes;
+ this.isRandomlyTickingBlocksStatus = this.tickingBlockCount > 0; // Leaf - Cache random tick block status
+ }
+ // Leaf end - Optimize chunkUnload
+

View File

@@ -46,7 +46,7 @@ index 258a90b1a35c2899481c6b37f949670d4d44e2f5..29f250f78bdd3c523b859d09d5561db0
private void updatePlayerAttributes() {
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 84030c40f2f91b433b3ccd21e0367d2f8b7c97b6..03cd2af813c3cca167b07115f03f6b5eae6d4185 100644
index 6b73679351f786362daf988b02b2a226d6b43984..3e66777b784825e28b4055e9a981cb387489a188 100644
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -190,6 +190,12 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack

View File

@@ -241,7 +241,7 @@ index 90814ad07a2686c5a274860395f5aca29cc3bf13..94c7ae9535a235abb8fddf0ca6578dfa
+ }
}
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index a55b1534dc3c0745ff569f5c1e07dbeaba0fe57d..dfe39967ba858f27bf6a18d820dae2e2f737c142 100644
index a55b1534dc3c0745ff569f5c1e07dbeaba0fe57d..089cac94935865039cea04485560f42c4909689c 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -431,7 +431,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin