From 0558a3dcd11443733d7b69e930a96af3d8a5ca8a Mon Sep 17 00:00:00 2001 From: Integer Limit <103940576+IntegerLimit@users.noreply.github.com> Date: Sat, 6 Jul 2024 10:36:06 +1000 Subject: [PATCH] Custom Void Dimension, Replace JED's --- build.gradle | 17 ++++--- gradle.properties | 2 +- .../java/com/nomiceu/nomilabs/NomiLabs.java | 3 +- .../nomiceu/nomilabs/config/LabsConfig.java | 10 +++++ .../nomilabs/dimension/LabsDimensions.java | 16 +++++++ .../dimension/LabsVoidWorldProvider.java | 45 +++++++++++++++++++ .../nomiceu/nomilabs/event/CommonProxy.java | 4 ++ 7 files changed, 89 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/nomiceu/nomilabs/dimension/LabsDimensions.java create mode 100644 src/main/java/com/nomiceu/nomilabs/dimension/LabsVoidWorldProvider.java diff --git a/build.gradle b/build.gradle index 9708a8f7..6436692e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1719793363 +//version: 1720106721 /* * DO NOT CHANGE THIS FILE! * Also, you may replace this file at any time if there is an update available. @@ -33,9 +33,9 @@ plugins { id 'base' id 'eclipse' id 'maven-publish' - id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.7' - id 'com.gtnewhorizons.retrofuturagradle' version '1.3.33' - id 'net.darkhax.curseforgegradle' version '1.1.18' apply false + id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.8' + id 'com.gtnewhorizons.retrofuturagradle' version '1.4.0' + id 'net.darkhax.curseforgegradle' version '1.1.24' apply false id 'com.modrinth.minotaur' version '2.8.7' apply false id 'com.diffplug.spotless' version '6.13.0' apply false id 'com.palantir.git-version' version '3.0.0' apply false @@ -78,8 +78,10 @@ propertyDefaultIfUnset("gradleTokenVersion", "") propertyDefaultIfUnset("useSrcApiPath", false) propertyDefaultIfUnset("includeWellKnownRepositories", true) propertyDefaultIfUnset("includeCommonDevEnvMods", true) +propertyDefaultIfUnset("stripForgeRequirements", false) propertyDefaultIfUnset("noPublishedSources", false) propertyDefaultIfUnset("forceEnableMixins", false) +propertyDefaultIfUnset("mixinConfigRefmap", "mixins.${project.modId}.refmap.json") propertyDefaultIfUnsetWithEnvVar("enableCoreModDebug", false, "CORE_MOD_DEBUG") propertyDefaultIfUnset("generateMixinConfig", true) propertyDefaultIfUnset("usesShadowedDependencies", false) @@ -525,7 +527,7 @@ dependencies { // should use 2.8.6 but 2.8.9+ has a vulnerability fix annotationProcessor 'com.google.code.gson:gson:2.8.9' - mixinProviderSpec = modUtils.enableMixins(mixinProviderSpec, "mixins.${modId}.refmap.json") + mixinProviderSpec = modUtils.enableMixins(mixinProviderSpec, mixinConfigRefmap) api (mixinProviderSpec) { transitive = false } @@ -567,6 +569,10 @@ dependencies { transitive = false } + if ((usesMixins.toBoolean() || forceEnableMixins.toBoolean()) && stripForgeRequirements.toBoolean()) { + runtimeOnlyNonPublishable 'com.cleanroommc:strip-latest-forge-requirements:1.0' + } + if (includeCommonDevEnvMods.toBoolean()) { if (!(modId.equals('jei'))) { implementation 'mezz.jei:jei_1.12.2:4.16.1.302' @@ -700,7 +706,6 @@ tasks.register('generateAssets') { if (usesMixins.toBoolean() && generateMixinConfig.toBoolean()) { def mixinConfigFile = getFile("src/main/resources/mixins.${modId}.json") if (!mixinConfigFile.exists()) { - def mixinConfigRefmap = "mixins.${modId}.refmap.json" mixinConfigFile.text = """{ "package": "${modGroup}.${mixinsPackage}", diff --git a/gradle.properties b/gradle.properties index 5b6a3935..5e5c427e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -276,7 +276,7 @@ enable_controlling = false # Whether to enable Default World Generator Port in runtime. Fixes GUI Rescaling Issues, adds a Cancel Button. enable_default_world_gen_port = false -# Whether to enable TOP Addons in runtime. Fixes Error Messages with Architecture Craft 3.108 +# Whether to enable TOP Addons in runtime. Fixes Error Messages with Architecture Craft 3.108. enable_top_addons = false # Whether to enable Ender Storage in runtime. Enables remappers to remap items in ender storage. diff --git a/src/main/java/com/nomiceu/nomilabs/NomiLabs.java b/src/main/java/com/nomiceu/nomilabs/NomiLabs.java index f20292f2..b27817d3 100644 --- a/src/main/java/com/nomiceu/nomilabs/NomiLabs.java +++ b/src/main/java/com/nomiceu/nomilabs/NomiLabs.java @@ -23,7 +23,8 @@ name = LabsValues.LABS_MODNAME, acceptedMinecraftVersions = "[1.12.2]", dependencies = "required:forge@[14.23.5.2847,);" + "required-after:codechickenlib@[3.2.3,);" + - "required-after:groovyscript@[1.1.0,);" + "required-after:gregtech@[2.8,);" + "required-after:packmode;" + + "required-after:groovyscript@[1.1.0,);" + "required-after:gregtech@[2.8,);" + "required-after:gcym;" + + "required-after:packmode;" + "required-after:jei@[4.15.0,);" + "required-after:theoneprobe;" + "required-after:configanytime;" + "after:advancedrocketry;" + "after:libvulpes;" + "after:crafttweaker@[4.1.20,);" + "after:appliedenergistics2;" + diff --git a/src/main/java/com/nomiceu/nomilabs/config/LabsConfig.java b/src/main/java/com/nomiceu/nomilabs/config/LabsConfig.java index 6d990af4..87471fcf 100644 --- a/src/main/java/com/nomiceu/nomilabs/config/LabsConfig.java +++ b/src/main/java/com/nomiceu/nomilabs/config/LabsConfig.java @@ -81,6 +81,16 @@ public static class CustomContent { @Config.LangKey("config.nomilabs.content.custom_content.complex_recipes") @Config.RequiresMcRestart public boolean enableComplexRecipes = true; + + @Config.Comment({ + "Enable a Custom Void Dimension.", + "By default, has no blocks, and there is no way to reach it.", + "DimensionalEdibles (Nomifactory Edition) can allow transport to it, as well as provide a spawn obsidian platform.", + "[default: false]" + }) + @Config.LangKey("config.nomilabs.content.custom_content.custom_void") + @Config.RequiresMcRestart + public boolean enableVoidDimension = false; } public static class GTCustomContent { diff --git a/src/main/java/com/nomiceu/nomilabs/dimension/LabsDimensions.java b/src/main/java/com/nomiceu/nomilabs/dimension/LabsDimensions.java new file mode 100644 index 00000000..9ab132b0 --- /dev/null +++ b/src/main/java/com/nomiceu/nomilabs/dimension/LabsDimensions.java @@ -0,0 +1,16 @@ +package com.nomiceu.nomilabs.dimension; + +import net.minecraft.world.DimensionType; +import net.minecraftforge.common.DimensionManager; + +public class LabsDimensions { + + public static final int VOID_ID = 119; + + public static DimensionType VOID; + + public static void register() { + VOID = DimensionType.register("void_world", "_void", VOID_ID, LabsVoidWorldProvider.class, false); + DimensionManager.registerDimension(VOID_ID, VOID); + } +} diff --git a/src/main/java/com/nomiceu/nomilabs/dimension/LabsVoidWorldProvider.java b/src/main/java/com/nomiceu/nomilabs/dimension/LabsVoidWorldProvider.java new file mode 100644 index 00000000..23cbf6fb --- /dev/null +++ b/src/main/java/com/nomiceu/nomilabs/dimension/LabsVoidWorldProvider.java @@ -0,0 +1,45 @@ +package com.nomiceu.nomilabs.dimension; + +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.DimensionType; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.gen.ChunkGeneratorFlat; +import net.minecraft.world.gen.IChunkGenerator; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class LabsVoidWorldProvider extends WorldProvider { + + private static final BlockPos spawnPos = new BlockPos(2.5, 80, 2.5); + + @Override + @NotNull + public DimensionType getDimensionType() { + return LabsDimensions.VOID; + } + + @Override + @NotNull + public IChunkGenerator createChunkGenerator() { + return new ChunkGeneratorFlat(world, getSeed(), false, "3;minecraft:air;1;decoration"); + } + + @Override + @NotNull + public BlockPos getRandomizedSpawnPoint() { + return spawnPos; + } + + @Override + @NotNull + public BlockPos getSpawnPoint() { + return spawnPos; + } + + @Override + @Nullable + public BlockPos getSpawnCoordinate() { + return spawnPos; + } +} diff --git a/src/main/java/com/nomiceu/nomilabs/event/CommonProxy.java b/src/main/java/com/nomiceu/nomilabs/event/CommonProxy.java index 48acf140..2e8671dd 100644 --- a/src/main/java/com/nomiceu/nomilabs/event/CommonProxy.java +++ b/src/main/java/com/nomiceu/nomilabs/event/CommonProxy.java @@ -24,6 +24,7 @@ import com.nomiceu.nomilabs.block.registry.LabsBlocks; import com.nomiceu.nomilabs.config.LabsConfig; import com.nomiceu.nomilabs.creativetab.registry.LabsCreativeTabs; +import com.nomiceu.nomilabs.dimension.LabsDimensions; import com.nomiceu.nomilabs.fluid.FluidRegistryMixinHelper; import com.nomiceu.nomilabs.fluid.registry.LabsFluids; import com.nomiceu.nomilabs.gregtech.LabsSounds; @@ -93,6 +94,9 @@ public static void preInit() { FluidRegistryMixinHelper.preInit(); LabsNetworkHandler.preInit(); + + if (LabsConfig.content.customContent.enableVoidDimension) + LabsDimensions.register(); } public static void loadComplete() {