From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Martijn Muijsers Date: Wed, 23 Nov 2022 22:41:54 +0100 Subject: [PATCH] Inline level height License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) Gale - https://galemc.org This patch is based on the following patch: "Ensure level height is inlined" By: Paul Sauve As part of: Airplane (https://github.com/TECHNOVE/Airplane) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) * Airplane copyright * Airplane Copyright (C) 2020 Technove LLC This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java index abebc41e69a41cbf940ffd10dae4815202b525dc..a48b1639ffa83ae2d1e614d32a339f08366da57c 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -685,6 +685,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl } // Paper end - optimise random ticking + // Gale start - Airplane - inline level height + private final int minBuildHeight, levelHeightAccessorMinSection, height, maxBuildHeight, levelHeightAccessorMaxSection; + @Override public final int getMaxBuildHeight() { return this.maxBuildHeight; } + @Override public final int getMinSection() { return this.levelHeightAccessorMinSection; } + @Override public final int getMaxSection() { return this.levelHeightAccessorMaxSection; } + @Override public final int getMinBuildHeight() { return this.minBuildHeight; } + @Override public final int getHeight() { return this.height; } + // Gale end - Airplane - inline level height + protected Level(WritableLevelData worlddatamutable, ResourceKey resourcekey, RegistryAccess iregistrycustom, Holder holder, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function paperWorldConfigCreator, java.util.function.Function galeWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config & Anti-Xray // Gale - Gale configuration // Gale - Purpur - remove vanilla profiler this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config @@ -704,6 +713,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl this.dimensionTypeRegistration = holder; final DimensionType dimensionmanager = (DimensionType) holder.value(); + // Gale start - Airplane - inline level height + this.minBuildHeight = LevelAccessor.super.getMinBuildHeight(); + this.levelHeightAccessorMinSection = LevelAccessor.super.getMinSection(); + this.height = LevelAccessor.super.getHeight(); + this.maxBuildHeight = LevelAccessor.super.getMaxBuildHeight(); + this.levelHeightAccessorMaxSection = LevelAccessor.super.getMaxSection(); + // Gale end - Airplane - inline level height this.dimension = resourcekey; this.isClientSide = flag; if (dimensionmanager.coordinateScale() != 1.0D) {