diff --git a/README.md b/README.md index ab0b74e1..5a9da30e 100644 --- a/README.md +++ b/README.md @@ -149,6 +149,7 @@ All changes are toggleable via the config file. * **Remove Realms Button:** Removes the redundant Minecraft Realms button from the main menu * **Remove Recipe Book:** Removes the recipe book button from GUIs * **Remove Snooper:** Forcefully turns off the snooper and hides the snooper settings button from the options menu +* **Sea Level:** Sets the default height of the overworld's sea level * **Shield Parry:** Allows parrying of projectiles with shields * **Skip Credits:** Skips the credits screen after the player goes through the end podium portal * **Skip Missing Registry Entries Screen:** Automatically confirms the 'Missing Registry Entries' screen on world load diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfig.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfig.java index 34316604..39c6d62b 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfig.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfig.java @@ -1693,6 +1693,15 @@ public static class TweaksWorldCategory @Config.Name("Dimension Unload") public final DimensionUnloadCategory DIMENSION_UNLOAD = new DimensionUnloadCategory(); + @Config.RequiresMcRestart + @Config.Name("Sea Level") + @Config.Comment + ({ + "Sets the default height of the overworld's sea level", + "Vanilla default is 63" + }) + public int utSeaLevel = 63; + @Config.RequiresMcRestart @Config.Name("Stronghold Replacement") @Config.Comment("Replaces stronghold generation with a safer variant") diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index 90f60e28..603f92b8 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -191,7 +191,8 @@ public List getMixinConfigs() "mixins.tweaks.performance.resourcemanager.json", "mixins.tweaks.world.chunks.gen.json", "mixins.tweaks.world.loading.client.json", - "mixins.tweaks.world.loading.server.json") : + "mixins.tweaks.world.loading.server.json", + "mixins.tweaks.world.sealevel.json") : Arrays.asList( "mixins.bugfixes.blocks.comparatortiming.json", "mixins.bugfixes.blocks.fallingblockdamage.json", @@ -265,7 +266,8 @@ public List getMixinConfigs() "mixins.tweaks.performance.prefixcheck.json", "mixins.tweaks.performance.redstone.json", "mixins.tweaks.world.chunks.gen.json", - "mixins.tweaks.world.loading.server.json" + "mixins.tweaks.world.loading.server.json", + "mixins.tweaks.world.sealevel.json" ); } @@ -478,6 +480,8 @@ public boolean shouldMixinConfigQueue(String mixinConfig) return UTConfig.TWEAKS_WORLD.CHUNK_GEN_LIMIT.utChunkGenLimitToggle; case "mixins.tweaks.world.loading.server.json": return UTConfig.TWEAKS_PERFORMANCE.utWorldLoadingToggle; + case "mixins.tweaks.world.sealevel.json": + return UTConfig.TWEAKS_WORLD.utSeaLevel != 63; } return true; } diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/world/sealevel/mixin/UTSeaLevelChunkGeneratorMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/world/sealevel/mixin/UTSeaLevelChunkGeneratorMixin.java new file mode 100644 index 00000000..2950cfc2 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/world/sealevel/mixin/UTSeaLevelChunkGeneratorMixin.java @@ -0,0 +1,21 @@ +package mod.acgaming.universaltweaks.tweaks.world.sealevel.mixin; + +import mod.acgaming.universaltweaks.config.UTConfig; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(targets = "net.minecraft.world.gen.ChunkGeneratorSettings$Factory") +public class UTSeaLevelChunkGeneratorMixin +{ + @Shadow + public int seaLevel; + + @Inject(method = "setDefaults", at = @At(value = "TAIL")) + public void utSeaLevel(CallbackInfo ci) + { + seaLevel = UTConfig.TWEAKS_WORLD.utSeaLevel; + } +} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/world/sealevel/mixin/UTSeaLevelWorldMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/world/sealevel/mixin/UTSeaLevelWorldMixin.java new file mode 100644 index 00000000..6ef4f54c --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/world/sealevel/mixin/UTSeaLevelWorldMixin.java @@ -0,0 +1,27 @@ +package mod.acgaming.universaltweaks.tweaks.world.sealevel.mixin; + +import net.minecraft.profiler.Profiler; +import net.minecraft.world.World; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.storage.ISaveHandler; +import net.minecraft.world.storage.WorldInfo; + +import mod.acgaming.universaltweaks.config.UTConfig; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(World.class) +public abstract class UTSeaLevelWorldMixin +{ + @Shadow + private int seaLevel; + + @Inject(method = "", at = @At(value = "TAIL")) + public void utSeaLevel(ISaveHandler saveHandlerIn, WorldInfo info, WorldProvider providerIn, Profiler profilerIn, boolean client, CallbackInfo ci) + { + seaLevel = UTConfig.TWEAKS_WORLD.utSeaLevel; + } +} \ No newline at end of file diff --git a/src/main/resources/mixins.tweaks.world.sealevel.json b/src/main/resources/mixins.tweaks.world.sealevel.json new file mode 100644 index 00000000..297c3eba --- /dev/null +++ b/src/main/resources/mixins.tweaks.world.sealevel.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.tweaks.world.sealevel.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": ["UTSeaLevelChunkGeneratorMixin", "UTSeaLevelWorldMixin"] +} \ No newline at end of file