mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 20:46:59 +01:00
90fe0d58a5
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 897a0a23 SPIGOT-5753: Back PotionType by a minecraft registry 255b2aa1 SPIGOT-7080: Add World#locateNearestBiome ff984826 Remove javadoc.io doc links CraftBukkit Changes: 71b0135cc SPIGOT-5753: Back PotionType by a minecraft registry a6bcb8489 SPIGOT-7080: Add World#locateNearestBiome ad0e57434 SPIGOT-7502: CraftMetaItem - cannot deserialize BlockStateTag b3efca57a SPIGOT-6400: Use Mockito instead of InvocationHandler 38c599f9d PR-1272: Only allow one entity in CraftItem instead of two f065271ac SPIGOT-7498: ChunkSnapshot.getBlockEmittedLight() gets 64 blocks upper in Overworld Spigot Changes: e0e223fe Remove javadoc.io doc links
38 lines
1.9 KiB
Diff
38 lines
1.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Mon, 15 May 2023 20:25:26 -0700
|
|
Subject: [PATCH] Optimise recalcBlockCounts() for empty sections
|
|
|
|
In 1.18, every chunk section is initialised to a non-null value
|
|
and recalcBlockCounts() is invoked for each section.
|
|
However, in a standard world, most sections are empty. In such cases,
|
|
recalcBlockCounts() would iterate over ever position - even though
|
|
the block data would all be air. To avoid this, we skip
|
|
searching the section unless the palette indicates there _could_ be
|
|
a non-air block state or non-empty fluid state.
|
|
|
|
Chunk loading initially showed that recalcBlockCounts() over
|
|
sections with a ZeroBitStorage data to to take ~20% of the process,
|
|
now it takes <1%.
|
|
|
|
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 b39fea80fcb83873b7e7085eaaf935e712f0ede7..f0de72afad4bb571153436399386a6a8a70582a6 100644
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
|
@@ -144,6 +144,7 @@ public class LevelChunkSection {
|
|
this.nonEmptyBlockCount = 0;
|
|
this.tickingBlockCount = 0;
|
|
this.tickingFluidCount = 0;
|
|
+ if (this.maybeHas((BlockState state) -> !state.isAir() || !state.getFluidState().isEmpty())) { // Paper - do not run forEachLocation on clearly empty sections
|
|
this.states.forEachLocation((BlockState iblockdata, int i) -> {
|
|
FluidState fluid = iblockdata.getFluidState();
|
|
|
|
@@ -169,6 +170,7 @@ public class LevelChunkSection {
|
|
// Paper end - optimise collisions
|
|
|
|
});
|
|
+ } // Paper - do not run forEachLocation on clearly empty sections
|
|
// Paper end
|
|
}
|
|
|