From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MartijnMuijsers 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) 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 3e4f2b6a5c269df2bb64f879dd75731c2af227e7..66b2cde3be8109a881095ee5758542b70af10c1a 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -272,6 +272,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public abstract ResourceKey getTypeKey(); + // Gale start - Airplane - inline level height + private final int minBuildHeight, minSection, height, maxBuildHeight, maxSection; + @Override public final int getMaxBuildHeight() { return this.maxBuildHeight; } + @Override public final int getMinSection() { return this.minSection; } + @Override public final int getMaxSection() { return this.maxSection; } + @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, Holder holder, Supplier supplier, 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 - Async-Anti-Xray - Pass executor // Gale - Gale configuration this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper @@ -295,6 +304,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { }); final DimensionType dimensionmanager = (DimensionType) holder.value(); + // Gale start - Airplane - inline level height + this.minBuildHeight = dimensionmanager.minY(); + this.minSection = SectionPos.blockToSectionCoord(this.minBuildHeight); + this.height = dimensionmanager.height(); + this.maxBuildHeight = this.minBuildHeight + this.height; + this.maxSection = SectionPos.blockToSectionCoord(this.maxBuildHeight - 1) + 1; + // Gale end - Airplane - inline level height this.dimension = resourcekey; this.isClientSide = flag; if (dimensionmanager.coordinateScale() != 1.0D) {