9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-19 14:59:29 +00:00
Files
Gale/patches/server/0030-Inline-level-height.patch
2022-12-13 14:28:30 +01:00

67 lines
3.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
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 <paul@technove.co>
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 <http://www.gnu.org/licenses/>.
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<LevelStem> 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<Level> resourcekey, Holder<DimensionType> holder, Supplier<ProfilerFiller> 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<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.function.Function<org.spigotmc.SpigotWorldConfig, GaleWorldConfiguration> 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) {