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 3a8d1c79e85386efa39de5fac085bbdee0c076c1..b2e71a78424dbe1ce87b982b073d8534de890181 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 // Tuinity 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