From 01a862db30a69d2bf2c8f945867172bbfd9d01ff Mon Sep 17 00:00:00 2001 From: tterrag Date: Mon, 23 Sep 2019 13:08:26 -0400 Subject: [PATCH] Fix sea level not being available on client, move hook to Dimension --- .../minecraft/net/minecraft/world/World.java.patch | 4 ++-- .../net/minecraft/world/gen/ChunkGenerator.java.patch | 11 +++++++++++ .../common/extensions/IForgeDimension.java | 8 +++++--- 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 patches/minecraft/net/minecraft/world/gen/ChunkGenerator.java.patch diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index 0c06ff28d..f8e56c031 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -453,8 +453,8 @@ public int func_181545_F() { - return 63; -+ // FORGE: Allow modded dimensions to customize this value via ChunkGenerator -+ return this.field_73020_y.func_201711_g().func_222530_f(); ++ // FORGE: Allow modded dimensions to customize this value via Dimension ++ return this.func_201675_m().getSeaLevel(); } public World func_201672_e() { diff --git a/patches/minecraft/net/minecraft/world/gen/ChunkGenerator.java.patch b/patches/minecraft/net/minecraft/world/gen/ChunkGenerator.java.patch new file mode 100644 index 000000000..1134a356d --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/ChunkGenerator.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/ChunkGenerator.java ++++ b/net/minecraft/world/gen/ChunkGenerator.java +@@ -195,7 +195,7 @@ + public abstract void func_222537_b(IWorld p_222537_1_, IChunk p_222537_2_); + + public int func_222530_f() { +- return 63; ++ return field_222540_a.func_201675_m().getSeaLevel(); + } + + public abstract int func_222529_a(int p_222529_1_, int p_222529_2_, Heightmap.Type p_222529_3_); diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeDimension.java b/src/main/java/net/minecraftforge/common/extensions/IForgeDimension.java index 870c6645f..26c8e6582 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeDimension.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeDimension.java @@ -22,11 +22,9 @@ package net.minecraftforge.common.extensions; import javax.annotation.Nullable; import net.minecraft.client.audio.MusicTicker; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; @@ -34,7 +32,6 @@ import net.minecraft.world.chunk.Chunk; import net.minecraft.world.dimension.Dimension; import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.dimension.NetherDimension; -import net.minecraft.world.dimension.OverworldDimension; import net.minecraft.world.storage.WorldInfo; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -278,6 +275,11 @@ public interface IForgeDimension { return getWorld().getWorldInfo().getGenerator().getHorizon(getWorld()); } + + default int getSeaLevel() + { + return 63; + } /** * Determine if the cursor on the map should 'spin' when rendered, like it does for the player in the nether.