From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Paul Sauve 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 blockTickScheduler, TickList fluidTickScheduler, long inhabitedTime, @Nullable LevelChunkSection[] sections, @Nullable Consumer 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