From c66b9b347ff74ca788a65866c84b45438fb4089a Mon Sep 17 00:00:00 2001 From: thedarkcolour <30441001+thedarkcolour@users.noreply.github.com> Date: Thu, 10 Aug 2023 18:07:20 -0700 Subject: [PATCH] Set Void world type as default (configurable) + add Azaleas to sieve --- changelog.md | 21 ++++++++++---- .../9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e | 9 +++++- .../sieve/moss_block/diamond/azalea.json | 13 +++++++++ .../sieve/moss_block/flint/azalea.json | 13 +++++++++ .../moss_block/flint/flowering_azalea.json | 13 +++++++++ .../sieve/moss_block/golden/azalea.json | 13 +++++++++ .../recipes/sieve/moss_block/iron/azalea.json | 13 +++++++++ .../sieve/moss_block/netherite/azalea.json | 13 +++++++++ .../sieve/moss_block/string/azalea.json | 13 +++++++++ .../thedarkcolour/exdeorum/asm/ASMHooks.java | 1 + .../exdeorum/client/ClientHandler.java | 16 ++++++++++ .../exdeorum/config/EConfig.java | 8 +++++ .../thedarkcolour/exdeorum/data/Recipes.java | 2 ++ .../exdeorum/registry/EWorldPresets.java | 29 +++++++++++++++++++ src/main/resources/coremods.js | 28 ++++++++++++++++++ 15 files changed, 198 insertions(+), 7 deletions(-) create mode 100644 src/generated/resources/data/exdeorum/recipes/sieve/moss_block/diamond/azalea.json create mode 100644 src/generated/resources/data/exdeorum/recipes/sieve/moss_block/flint/azalea.json create mode 100644 src/generated/resources/data/exdeorum/recipes/sieve/moss_block/flint/flowering_azalea.json create mode 100644 src/generated/resources/data/exdeorum/recipes/sieve/moss_block/golden/azalea.json create mode 100644 src/generated/resources/data/exdeorum/recipes/sieve/moss_block/iron/azalea.json create mode 100644 src/generated/resources/data/exdeorum/recipes/sieve/moss_block/netherite/azalea.json create mode 100644 src/generated/resources/data/exdeorum/recipes/sieve/moss_block/string/azalea.json create mode 100644 src/main/java/thedarkcolour/exdeorum/registry/EWorldPresets.java diff --git a/changelog.md b/changelog.md index d2ebe83f..3c236737 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,15 @@ -## Ex Nihilo Reborn - 1.0 -- Ex Nihilo Reborn is a port mixed of the original Ex Nihilo from 1.7.10 - and Ex Nihilo Adscensio for 1.10.2. I was unimpressed with Ex Nihilo Sequentia, - so I made this. -- Removed Andesite, Granite, and Diorite pebbles -- No coral seeds +## Ex Deorum 1.0 +*Ex Deorum*'s new additions are listed first, then the additions from original *Ex Nihilo*. +- Added the Watering Can, which can be used to hydrate farmland and speed up plant and tree growth. It is intended to be +an alternative to mods like Twerk or Tree Growing Simulator, as a Wooden Watering Can is given to the player at the start (configurable). +The list of blocks that Watering Cans can be used on is defined by the tag `exdeorum:watering_can_blocks`. +- Added the Sculk Core, which can be used to enable player-placed Sculk Shriekers to spawn Wardens. +- Added Witch Water, which can be used to create a variety of blocks with the barrel AND it can be used to create a Netherrack generator, +replacing where regular Water would be used. (configurable) +- Added the Sieve, which uses sieve meshes to filter items. (drops are configurable through data pack) +- Added the Porcelain, Crimson, and Warped Crucibles which melt cobblestone into lava when placed above a heat source. (configurable through data pack, supports modded fluids) +- Added Wooden Crucibles which melt plant material into water. (configurable through data pack, supports modded fluids) +- Added the Barrel, which has all of its functionality from Ex Nihilo. (Composting and Mixing recipes are configurable through data pack) +- Added the Silk Worm, which can infest a tree so that can be harvested for string. It can also be cooked and eaten... if you're desperate. +- Added the Crook, which can be used to break leaves and infested leaves for increased drop rates. +- Added the Hammer, which can be used to crush and smash blocks. (recipes are configurable through data pack) \ No newline at end of file diff --git a/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e index cdf931c5..b4910ff3 100644 --- a/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e +++ b/src/generated/resources/.cache/9fb1092f32d4fcbf9e061ffd718d4ec689c6c95e @@ -1,4 +1,4 @@ -// 1.20.1 2023-08-09T22:07:08.2490849 Recipes +// 1.20.1 2023-08-10T17:08:20.1669002 Recipes 5ad481a0c376c1a1785a5d3b992064d0ec0bf3b0 data/exdeorum/advancements/recipes/food/end_cake.json 25dd027e844a72b03c95dbe5e3c3dd8c738ceb00 data/exdeorum/advancements/recipes/misc/acacia_barrel.json 376be94a64c9ca97a9ea2346547b6e617f13a815 data/exdeorum/advancements/recipes/misc/acacia_crucible.json @@ -578,6 +578,7 @@ b298e2f51255b88beea1394e2f609768fbb36921 data/exdeorum/recipes/sieve/gravel/stri 19ddad521fcb43ea69e4aeda92f8ea841630c530 data/exdeorum/recipes/sieve/gravel/string/lapis_lazuli.json e33e4503b24e2dc1ab1821746f49ac157f2350d3 data/exdeorum/recipes/sieve/gravel/string/stone_pebble.json b774a52785ba81cf8c589b9962abce624862a6ec data/exdeorum/recipes/sieve/moss_block/diamond/acacia_sapling.json +34776767a1a3ccea93b858edb5e4259f5b5ff1bd data/exdeorum/recipes/sieve/moss_block/diamond/azalea.json 03fad0af6d1930f134908aef86761bda029472df data/exdeorum/recipes/sieve/moss_block/diamond/big_dripleaf.json 6de849670ed1d3f4d9566549ae50bad2b16447bf data/exdeorum/recipes/sieve/moss_block/diamond/birch_sapling.json bd431da682073ba56016352f1f6c9d35fa0211dd data/exdeorum/recipes/sieve/moss_block/diamond/cherry_sapling.json @@ -590,10 +591,12 @@ c3cb1b7c924b35323e3d7cb1ffdff46cff7bb849 data/exdeorum/recipes/sieve/moss_block/ ab9c7574d8d2ca3343f170e8cb9d78737873ee2f data/exdeorum/recipes/sieve/moss_block/diamond/spore_blossom.json f41a1dd1c6a62bc8b34baa677a53e18150185e5a data/exdeorum/recipes/sieve/moss_block/diamond/spruce_sapling.json f81c5c7b83ff1dd7ded1b46cb3b602ce56ae3ba7 data/exdeorum/recipes/sieve/moss_block/flint/acacia_sapling.json +4315fd16c0bd230e052d5308ee9c30b8fa6b4ed3 data/exdeorum/recipes/sieve/moss_block/flint/azalea.json c1687b96d45092b8fa43d15caf049dabaf1aa648 data/exdeorum/recipes/sieve/moss_block/flint/big_dripleaf.json 7bf07dd791534b61b15fcbbae56f80e2dbbc24c7 data/exdeorum/recipes/sieve/moss_block/flint/birch_sapling.json 521c7e763b7bb79e397e49f5066db5e644b56f25 data/exdeorum/recipes/sieve/moss_block/flint/cherry_sapling.json dba7cb3c95e17438407fd9126e6dcd8a8ac05709 data/exdeorum/recipes/sieve/moss_block/flint/dark_oak_sapling.json +9e043da9b384c7f23581ffcd9fa34a18d08d6ba3 data/exdeorum/recipes/sieve/moss_block/flint/flowering_azalea.json 3ac630dca6305e377a994b883446e8f2229be505 data/exdeorum/recipes/sieve/moss_block/flint/glow_berries.json cbd39e058b88538e00884c336289d08a45122d58 data/exdeorum/recipes/sieve/moss_block/flint/glow_lichen.json 6bd5c11cfc79ee76e42a3f6a488229f39515f0fe data/exdeorum/recipes/sieve/moss_block/flint/jungle_sapling.json @@ -605,6 +608,7 @@ c63138cd4e3095885913923bee0685064442871a data/exdeorum/recipes/sieve/moss_block/ 0f9eb10e52f5800d0543fbbff9c13559095d2e5f data/exdeorum/recipes/sieve/moss_block/flint/spruce_sapling.json 4ac5ebd110597a27940d6d6c8ca5858b5a09d153 data/exdeorum/recipes/sieve/moss_block/flint/sweet_berries.json 862a8042232a5b063cf8fdb30142100a32a04372 data/exdeorum/recipes/sieve/moss_block/golden/acacia_sapling.json +a215703df06f023c6b7f44d377c0a29c5fb2d6d6 data/exdeorum/recipes/sieve/moss_block/golden/azalea.json 3e2c070b67e51500187df91e5a910dbb786bb932 data/exdeorum/recipes/sieve/moss_block/golden/big_dripleaf.json a595eed6b517c0eaca5a37b88dd18372f8f24db5 data/exdeorum/recipes/sieve/moss_block/golden/birch_sapling.json c9aed5b2b7e641177e6cd08968d6a658de5a3779 data/exdeorum/recipes/sieve/moss_block/golden/cherry_sapling.json @@ -617,6 +621,7 @@ ab5ae026900f1d6c82f93d8beb2955695ace87fa data/exdeorum/recipes/sieve/moss_block/ 47a1c47daea852999f58845e542a7e2a7f43b04a data/exdeorum/recipes/sieve/moss_block/golden/spore_blossom.json 9ed8aaa5555765dacc2df79e05e8799cf7bc6e5b data/exdeorum/recipes/sieve/moss_block/golden/spruce_sapling.json aa77cca261f061b6c67d7b76cfbee948eb6a3e8d data/exdeorum/recipes/sieve/moss_block/iron/acacia_sapling.json +687f696562d11b5a8f3f029f31cd903cacca5314 data/exdeorum/recipes/sieve/moss_block/iron/azalea.json dab4403fa7e1cf72c062422421e609f4f27407be data/exdeorum/recipes/sieve/moss_block/iron/big_dripleaf.json 0319fa66a72967c39e5b5d2c92bb4fb34d722098 data/exdeorum/recipes/sieve/moss_block/iron/birch_sapling.json 41ac46391e6dd459c9772fc5804929da572c9d31 data/exdeorum/recipes/sieve/moss_block/iron/cherry_sapling.json @@ -629,6 +634,7 @@ e46a4beb26c5f1572354e87bfe4553e0a4122576 data/exdeorum/recipes/sieve/moss_block/ 0075db25f4650ba9dc172f15814725754d9f97e5 data/exdeorum/recipes/sieve/moss_block/iron/spore_blossom.json 93cb208475c16ebfdb286a2704a54b1594354c7f data/exdeorum/recipes/sieve/moss_block/iron/spruce_sapling.json 64ef5a4f025effef3ac4a2b90488c4b910729bec data/exdeorum/recipes/sieve/moss_block/netherite/acacia_sapling.json +c026c50780e9df816f2a1536d5bd1bd245d3a785 data/exdeorum/recipes/sieve/moss_block/netherite/azalea.json 415b6baad54d477f2182ff7c2c5f009e85ae9deb data/exdeorum/recipes/sieve/moss_block/netherite/big_dripleaf.json 3a1cf97e22c7e65b04727cb00da7946acd859b4e data/exdeorum/recipes/sieve/moss_block/netherite/birch_sapling.json a3fd022037cb8eb21330c4757b8c268369a19a10 data/exdeorum/recipes/sieve/moss_block/netherite/cherry_sapling.json @@ -641,6 +647,7 @@ e19bd9157fd5fb35ce43953b9ea27e9102945574 data/exdeorum/recipes/sieve/moss_block/ 913767318dab8eda863e2816e06164f8b2b7d049 data/exdeorum/recipes/sieve/moss_block/netherite/spore_blossom.json 7b16289fd38e015d5b5f6bfe70314d8a507ca4b0 data/exdeorum/recipes/sieve/moss_block/netherite/spruce_sapling.json 959d21cfb914761dac53844cea56de55f6260a27 data/exdeorum/recipes/sieve/moss_block/string/acacia_sapling.json +bbf31b2f84618308a60b93d2f298de682a0a69b4 data/exdeorum/recipes/sieve/moss_block/string/azalea.json 6232ad4b9611b1d7276ad22924f878b83df668c0 data/exdeorum/recipes/sieve/moss_block/string/big_dripleaf.json 3c17107151c6f0a2b65c505b26d46abfebe37c1c data/exdeorum/recipes/sieve/moss_block/string/birch_sapling.json 40bf75ee165f0e09e9b6859ed4ef2aed21f3b76d data/exdeorum/recipes/sieve/moss_block/string/cherry_sapling.json diff --git a/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/diamond/azalea.json b/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/diamond/azalea.json new file mode 100644 index 00000000..f7f4bf9d --- /dev/null +++ b/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/diamond/azalea.json @@ -0,0 +1,13 @@ +{ + "type": "exdeorum:sieve", + "ingredient": { + "item": "minecraft:moss_block" + }, + "mesh": "exdeorum:diamond_mesh", + "result": "minecraft:azalea", + "result_amount": { + "type": "minecraft:binomial", + "n": 1.0, + "p": 0.12 + } +} \ No newline at end of file diff --git a/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/flint/azalea.json b/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/flint/azalea.json new file mode 100644 index 00000000..79397530 --- /dev/null +++ b/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/flint/azalea.json @@ -0,0 +1,13 @@ +{ + "type": "exdeorum:sieve", + "ingredient": { + "item": "minecraft:moss_block" + }, + "mesh": "exdeorum:flint_mesh", + "result": "minecraft:azalea", + "result_amount": { + "type": "minecraft:binomial", + "n": 1.0, + "p": 0.089999996 + } +} \ No newline at end of file diff --git a/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/flint/flowering_azalea.json b/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/flint/flowering_azalea.json new file mode 100644 index 00000000..77c08e33 --- /dev/null +++ b/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/flint/flowering_azalea.json @@ -0,0 +1,13 @@ +{ + "type": "exdeorum:sieve", + "ingredient": { + "item": "minecraft:moss_block" + }, + "mesh": "exdeorum:flint_mesh", + "result": "minecraft:flowering_azalea", + "result_amount": { + "type": "minecraft:binomial", + "n": 1.0, + "p": 0.03 + } +} \ No newline at end of file diff --git a/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/golden/azalea.json b/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/golden/azalea.json new file mode 100644 index 00000000..a12bbc94 --- /dev/null +++ b/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/golden/azalea.json @@ -0,0 +1,13 @@ +{ + "type": "exdeorum:sieve", + "ingredient": { + "item": "minecraft:moss_block" + }, + "mesh": "exdeorum:golden_mesh", + "result": "minecraft:azalea", + "result_amount": { + "type": "minecraft:binomial", + "n": 1.0, + "p": 0.11 + } +} \ No newline at end of file diff --git a/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/iron/azalea.json b/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/iron/azalea.json new file mode 100644 index 00000000..3d7fd0ea --- /dev/null +++ b/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/iron/azalea.json @@ -0,0 +1,13 @@ +{ + "type": "exdeorum:sieve", + "ingredient": { + "item": "minecraft:moss_block" + }, + "mesh": "exdeorum:iron_mesh", + "result": "minecraft:azalea", + "result_amount": { + "type": "minecraft:binomial", + "n": 1.0, + "p": 0.099999994 + } +} \ No newline at end of file diff --git a/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/netherite/azalea.json b/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/netherite/azalea.json new file mode 100644 index 00000000..0efd59b3 --- /dev/null +++ b/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/netherite/azalea.json @@ -0,0 +1,13 @@ +{ + "type": "exdeorum:sieve", + "ingredient": { + "item": "minecraft:moss_block" + }, + "mesh": "exdeorum:netherite_mesh", + "result": "minecraft:azalea", + "result_amount": { + "type": "minecraft:binomial", + "n": 1.0, + "p": 0.13 + } +} \ No newline at end of file diff --git a/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/string/azalea.json b/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/string/azalea.json new file mode 100644 index 00000000..9ab80c8b --- /dev/null +++ b/src/generated/resources/data/exdeorum/recipes/sieve/moss_block/string/azalea.json @@ -0,0 +1,13 @@ +{ + "type": "exdeorum:sieve", + "ingredient": { + "item": "minecraft:moss_block" + }, + "mesh": "exdeorum:string_mesh", + "result": "minecraft:azalea", + "result_amount": { + "type": "minecraft:binomial", + "n": 1.0, + "p": 0.08 + } +} \ No newline at end of file diff --git a/src/main/java/thedarkcolour/exdeorum/asm/ASMHooks.java b/src/main/java/thedarkcolour/exdeorum/asm/ASMHooks.java index acbd29db..d332bf35 100644 --- a/src/main/java/thedarkcolour/exdeorum/asm/ASMHooks.java +++ b/src/main/java/thedarkcolour/exdeorum/asm/ASMHooks.java @@ -22,6 +22,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.levelgen.structure.Structure; import thedarkcolour.exdeorum.voidworld.VoidChunkGenerator; +@SuppressWarnings("unused") public final class ASMHooks { /** * Called in {@link net.minecraft.world.level.levelgen.structure.structures.EndCityStructure#findGenerationPoint(Structure.GenerationContext)} diff --git a/src/main/java/thedarkcolour/exdeorum/client/ClientHandler.java b/src/main/java/thedarkcolour/exdeorum/client/ClientHandler.java index 77981c3f..206e0c7f 100644 --- a/src/main/java/thedarkcolour/exdeorum/client/ClientHandler.java +++ b/src/main/java/thedarkcolour/exdeorum/client/ClientHandler.java @@ -21,15 +21,20 @@ package thedarkcolour.exdeorum.client; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.DefaultVertexFormat; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.worldselection.CreateWorldScreen; +import net.minecraft.client.gui.screens.worldselection.WorldCreationUiState; import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.ShaderInstance; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Unit; import net.minecraftforge.client.event.ClientPlayerNetworkEvent; import net.minecraftforge.client.event.EntityRenderersEvent; import net.minecraftforge.client.event.RegisterClientReloadListenersEvent; import net.minecraftforge.client.event.RegisterShadersEvent; +import net.minecraftforge.client.event.ScreenEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.event.config.ModConfigEvent; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; @@ -43,6 +48,7 @@ import thedarkcolour.exdeorum.config.EConfig; import thedarkcolour.exdeorum.network.ClientMessageHandler; import thedarkcolour.exdeorum.registry.EBlockEntities; import thedarkcolour.exdeorum.registry.EFluids; +import thedarkcolour.exdeorum.registry.EWorldPresets; import java.io.IOException; import java.io.ObjectInputFilter; @@ -59,6 +65,7 @@ public class ClientHandler { fmlBus.addListener(ClientHandler::onPlayerRespawn); fmlBus.addListener(ClientHandler::onPlayerLogout); modBus.addListener(ClientHandler::onConfigChanged); + fmlBus.addListener(ClientHandler::onScreenOpen); } private static void addClientReloadListeners(RegisterClientReloadListenersEvent event) { @@ -108,6 +115,15 @@ public class ClientHandler { } } + private static void onScreenOpen(ScreenEvent.Opening event) { + if (EConfig.CLIENT.setVoidWorldAsDefault.get()) { + if (event.getNewScreen() instanceof CreateWorldScreen screen) { + var ctx = screen.getUiState().getSettings(); + screen.getUiState().setWorldType(new WorldCreationUiState.WorldTypeEntry(ctx.worldgenLoadContext().registryOrThrow(Registries.WORLD_PRESET).getHolder(EWorldPresets.VOID_WORLD).orElse(null))); + } + } + } + private static void setRenderLayers() { // Fluids ItemBlockRenderTypes.setRenderLayer(EFluids.WITCH_WATER.get(), RenderType.translucent()); diff --git a/src/main/java/thedarkcolour/exdeorum/config/EConfig.java b/src/main/java/thedarkcolour/exdeorum/config/EConfig.java index 9d969920..dfe65853 100644 --- a/src/main/java/thedarkcolour/exdeorum/config/EConfig.java +++ b/src/main/java/thedarkcolour/exdeorum/config/EConfig.java @@ -31,6 +31,7 @@ public class EConfig { public static class Client { public final BooleanValue useFastInfestedLeaves; + public final BooleanValue setVoidWorldAsDefault; public Client(ForgeConfigSpec.Builder builder) { builder.comment("Client configuration for Ex Deorum").push("client"); @@ -38,6 +39,9 @@ public class EConfig { this.useFastInfestedLeaves = builder .comment("Whether to use a simplified renderer for infested leaves (reduces FPS lag with lots of infested trees)") .define("use_fast_infested_leaves", false); + this.setVoidWorldAsDefault = builder + .comment("Whether the Void World type is set as the default world preset in the world creation screen.") + .define("set_void_world_as_default", true); builder.pop(); } @@ -49,6 +53,7 @@ public class EConfig { public final BooleanValue simultaneousSieveUsage; public final DoubleValue barrelProgressStep; public final BooleanValue witchWaterNetherrackGenerator; + public final BooleanValue setVoidWorldAsDefault; // todo preferred ores //public final ConfigValue preferredAluminumOre; @@ -81,6 +86,9 @@ public class EConfig { this.witchWaterNetherrackGenerator = builder .comment("Whether Witch Water forms netherrack when lava flows into it, allowing for a netherrack version of a cobblestone generator.") .define("witch_water_netherrack_generator", true); + this.setVoidWorldAsDefault = builder + .comment("Whether the Void World type is used by default in the \"server.properties\" file when creating a server.") + .define("set_void_world_as_default", true); // Preferred ore items //builder.push("preferred_tag_items"); diff --git a/src/main/java/thedarkcolour/exdeorum/data/Recipes.java b/src/main/java/thedarkcolour/exdeorum/data/Recipes.java index 9f4d2d46..7415fa0f 100644 --- a/src/main/java/thedarkcolour/exdeorum/data/Recipes.java +++ b/src/main/java/thedarkcolour/exdeorum/data/Recipes.java @@ -835,6 +835,7 @@ class Recipes { addDrop.accept(Items.JUNGLE_SAPLING, chance(0.11f)); addDrop.accept(Items.CHERRY_SAPLING, chance(0.11f)); addDrop.accept(Items.MANGROVE_PROPAGULE, chance(0.11f)); + addDrop.accept(Items.AZALEA, chance(0.08f + j * 0.01f)); addDrop.accept(Items.GLOW_BERRIES, chance(0.04f + j * 0.075f)); addDrop.accept(Items.SMALL_DRIPLEAF, chance(0.07f + j * 0.025f)); addDrop.accept(Items.BIG_DRIPLEAF, chance(0.05f + j * 0.02f)); @@ -843,6 +844,7 @@ class Recipes { } forMesh(writer, ingredient(Items.MOSS_BLOCK), EItems.FLINT_MESH, addDrop -> { addDrop.accept(Items.SWEET_BERRIES, chance(0.03f)); + addDrop.accept(Items.FLOWERING_AZALEA, chance(0.03f)); addDrop.accept(Items.GLOW_LICHEN, chance(0.04f)); addDrop.accept(Items.LILY_PAD, chance(0.04f)); }); diff --git a/src/main/java/thedarkcolour/exdeorum/registry/EWorldPresets.java b/src/main/java/thedarkcolour/exdeorum/registry/EWorldPresets.java new file mode 100644 index 00000000..648f0c6a --- /dev/null +++ b/src/main/java/thedarkcolour/exdeorum/registry/EWorldPresets.java @@ -0,0 +1,29 @@ +/* + * Ex Deorum + * Copyright (c) 2023 thedarkcolour + * + * 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 . + */ + +package thedarkcolour.exdeorum.registry; + +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.levelgen.presets.WorldPreset; +import thedarkcolour.exdeorum.ExDeorum; + +public class EWorldPresets { + public static final ResourceKey VOID_WORLD = ResourceKey.create(Registries.WORLD_PRESET, new ResourceLocation(ExDeorum.ID, "void_world")); +} diff --git a/src/main/resources/coremods.js b/src/main/resources/coremods.js index 3e463248..2e87a667 100644 --- a/src/main/resources/coremods.js +++ b/src/main/resources/coremods.js @@ -11,6 +11,7 @@ var ASMAPI = Java.type('net.minecraftforge.coremod.api.ASMAPI'); function initializeCoreMod() { return { + // inserts a hook into EndCityStructure#findGenerationPoint to fix the position of the city if it is in a void world 'EndCityPatch': { 'target': { 'type': 'METHOD', @@ -38,6 +39,33 @@ function initializeCoreMod() { ASMAPI.log('ERROR', 'Unable to patch End City generation, void worlds will have no end cities!!!'); return method; } + }, + // Redirects a field access in the constructor of DedicatedServerProperties from WorldPresets.NORMAL to EWorldPresets.VOID_WORLD + 'DedicatedServerPropertiesPatch': { + 'target': { + 'type': 'METHOD', + 'class': 'net.minecraft.server.dedicated.DedicatedServerProperties', + 'methodName': '', + 'methodDesc': '(Ljava/util/Properties;)V' + }, + 'transformer': function (method) { + var insnList = method.instructions; + + for (var i = 0; i < insnList.size(); ++i) { + var insn = insnList.get(i); + + if (insn.getOpcode() === Opcodes.GETSTATIC && (insn.name.equals('f_226437_') || insn.name.equals('NORMAL'))) { + insn.owner = 'thedarkcolour/exdeorum/registry/EWorldPresets'; + insn.name = 'VOID_WORLD'; + + ASMAPI.log('INFO', 'Successfully patched server.properties to use void world type by default'); + return method; + } + } + + ASMAPI.log('ERROR', 'Unable to patch server.properties, you will have to set "level-type" to "exdeorum:void_world" manually.'); + return method; + } } }; } \ No newline at end of file