9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-20 23:49:31 +00:00
Files
Leaf/patches/server/0148-Better-inline-world-height.patch
Dreeam 27134f699a Added some optimizations (#164)
* uwu

* reorder

* Change author

* Sync upstream

* Lithium: equipment tracking

* Faster CraftServer#getworlds list creation

Co-Authored-By: Kobe ⑧ <102713261+HaHaWTH@users.noreply.github.com>
2024-11-14 06:50:59 -05:00

49 lines
3.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Taiyou06 <kaandindar21@gmail.com>
Date: Fri, 8 Nov 2024 04:07:25 +0100
Subject: [PATCH] Better inline world height
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index a34ae9bfda0df2834565dc3ea1fb48f7f2efc099..704631730cf7679446a98cea6faeb70eb89c9849 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -733,11 +733,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
// 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; }
+ @Override public final int getMaxBuildHeight() { return maxBuildHeight; }
+ @Override public final int getMinSection() { return levelHeightAccessorMinSection; }
+ @Override public final int getMaxSection() { return levelHeightAccessorMaxSection; }
+ @Override public final int getMinBuildHeight() { return minBuildHeight; }
+ @Override public final int getHeight() { return height; }
// Gale end - Airplane - inline level height
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> 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<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.function.Function<org.spigotmc.SpigotWorldConfig, org.galemc.gale.configuration.GaleWorldConfiguration> 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
@@ -760,13 +760,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
+ // Gale start - Airplane - Pluto - inline level height
+ this.minBuildHeight = dimensionmanager.minY();
+ this.levelHeightAccessorMinSection = SectionPos.blockToSectionCoord(dimensionmanager.minY());
+ this.height = dimensionmanager.height();
+ this.maxBuildHeight = dimensionmanager.minY() + dimensionmanager.height();
+ this.levelHeightAccessorMaxSection = SectionPos.blockToSectionCoord((dimensionmanager.minY() + dimensionmanager.height()) - 1) + 1;
+ // Gale end - Airplane - Pluto - inline level height
this.dimension = resourcekey;
this.isClientSide = flag;
if (dimensionmanager.coordinateScale() != 1.0D) {