9
0
mirror of https://github.com/SparklyPower/SparklyPaper.git synced 2025-12-19 15:09:27 +00:00
Files
SparklyPaperMC/patches/server/0026-Cache-world-height-in-the-chunk-as-it-s-final.patch
MrPowerGamerBR 3bb1a88218 Moar patches
2021-08-31 20:14:55 -03:00

47 lines
2.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Paul Sauve <paul@technove.co>
Date: Tue, 22 Jun 2021 15:01:21 -0500
Subject: [PATCH] Cache world height in the chunk, as it's final
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index ff0fab668801d0b32abffbfedc7eb24abf71fed0..e265980f07d95a7912bf8873819033e51ef04c98 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -184,11 +184,13 @@ public class LevelChunk implements ChunkAccess {
}
// Airplane end
+ private final int levelHeight; private final int minBuildHeight; // Airplane
public LevelChunk(Level world, ChunkPos pos, ChunkBiomeContainer biomes) {
this(world, pos, biomes, UpgradeData.EMPTY, EmptyTickList.empty(), EmptyTickList.empty(), 0L, (LevelChunkSection[]) null, (Consumer) null);
}
public LevelChunk(Level world, ChunkPos pos, ChunkBiomeContainer biomes, UpgradeData upgradeData, TickList<Block> blockTickScheduler, TickList<Fluid> fluidTickScheduler, long inhabitedTime, @Nullable LevelChunkSection[] sections, @Nullable Consumer<LevelChunk> loadToWorldConsumer) {
+ this.levelHeight = world.getHeight(); this.minBuildHeight = world.getMinBuildHeight(); // Airplane
// Paper start
this.blockNibbles = StarLightEngine.getFilledEmptyLight(world);
this.skyNibbles = StarLightEngine.getFilledEmptyLight(world);
@@ -1309,13 +1311,17 @@ public class LevelChunk implements ChunkAccess {
}
@Override
- public int getMinBuildHeight() {
- return this.level.getMinBuildHeight();
+ // Airplane start
+ public final int getMinBuildHeight() {
+ return this.minBuildHeight;
+ // Airplane end
}
@Override
- public int getHeight() {
- return this.level.getHeight();
+ // Airplane start
+ public final int getHeight() {
+ return this.levelHeight;
+ // Airplane end
}
@Override