From 519ac2fc0e23587defcf4a8259979961d35d0ce2 Mon Sep 17 00:00:00 2001 From: isXander Date: Thu, 13 Jun 2024 18:18:18 +0100 Subject: 1.21 neoforge + fix testmod --- changelog.md | 1 + settings.gradle.kts | 2 +- .../dev/isxander/yacl3/platform/PlatformEntrypoint.java | 4 ++-- .../java/dev/isxander/yacl3/platform/YACLPlatform.java | 16 ++++++++-------- .../java/dev/isxander/yacl3/test/Entrypoint.java | 4 ++-- src/testmod/kotlin/dev/isxander/yacl3/test/DslTest.kt | 2 +- src/testmod/resources/META-INF/neoforge.mods.toml | 17 +++++++++++++++++ versions/1.21-neoforge/gradle.properties | 12 ++++++++++++ 8 files changed, 44 insertions(+), 14 deletions(-) create mode 100644 src/testmod/resources/META-INF/neoforge.mods.toml create mode 100644 versions/1.21-neoforge/gradle.properties diff --git a/changelog.md b/changelog.md index ab6c6d1..ff542b8 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ This build supports the following versions: - Fabric 1.20.4 - Fabric 1.20.6 (also supports 1.20.5) - Fabric 1.21 +- NeoForge 1.21 - NeoForge 1.20.6 (also supports 1.20.5) - NeoForge 1.20.4 - MinecraftForge 1.20.1 diff --git a/settings.gradle.kts b/settings.gradle.kts index c4edb3d..35b1b5b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -29,7 +29,7 @@ extensions.configure { mc("1.20.6", loaders = listOf("fabric", "neoforge")) mc("1.20.4", loaders = listOf("fabric", "neoforge")) - mc("1.21", loaders = listOf("fabric")) + mc("1.21", loaders = listOf("fabric", "neoforge")) mc("1.20.1", loaders = listOf("fabric", "forge")) } create(rootProject) diff --git a/src/main/java/dev/isxander/yacl3/platform/PlatformEntrypoint.java b/src/main/java/dev/isxander/yacl3/platform/PlatformEntrypoint.java index 79c0fdf..bbbeb79 100644 --- a/src/main/java/dev/isxander/yacl3/platform/PlatformEntrypoint.java +++ b/src/main/java/dev/isxander/yacl3/platform/PlatformEntrypoint.java @@ -14,8 +14,8 @@ public class PlatformEntrypoint implements ClientModInitializer { ResourceManagerHelper.get(PackType.CLIENT_RESOURCES).registerReloadListener(new YACLImageReloadListener()); } } -/*?} elif neoforge {*//* -import net.neoforged.bus.api.IEventBus; +/*?} elif neoforge {*/ +/*import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.client.event.RegisterClientReloadListenersEvent; diff --git a/src/main/java/dev/isxander/yacl3/platform/YACLPlatform.java b/src/main/java/dev/isxander/yacl3/platform/YACLPlatform.java index 490a5fa..044fbe2 100644 --- a/src/main/java/dev/isxander/yacl3/platform/YACLPlatform.java +++ b/src/main/java/dev/isxander/yacl3/platform/YACLPlatform.java @@ -2,8 +2,8 @@ package dev.isxander.yacl3.platform; /*? if fabric {*/ import net.fabricmc.loader.api.FabricLoader; -/*?} elif neoforge {*//* -import net.neoforged.fml.loading.FMLEnvironment; +/*?} elif neoforge {*/ +/*import net.neoforged.fml.loading.FMLEnvironment; import net.neoforged.fml.loading.FMLPaths; *//*?} elif forge {*//* import net.minecraftforge.fml.loading.FMLEnvironment; @@ -44,8 +44,8 @@ public final class YACLPlatform { case CLIENT -> Env.CLIENT; case SERVER -> Env.SERVER; }; - /*?} elif forge-like {*//* - return switch (FMLEnvironment.dist) { + /*?} elif forge-like {*/ + /*return switch (FMLEnvironment.dist) { case CLIENT -> Env.CLIENT; case DEDICATED_SERVER -> Env.SERVER; }; @@ -55,16 +55,16 @@ public final class YACLPlatform { public static Path getConfigDir() { /*? if fabric {*/ return FabricLoader.getInstance().getConfigDir(); - /*?} elif forge-like {*//* - return FMLPaths.CONFIGDIR.get(); + /*?} elif forge-like {*/ + /*return FMLPaths.CONFIGDIR.get(); *//*?}*/ } public static boolean isDevelopmentEnv() { /*? if fabric {*/ return FabricLoader.getInstance().isDevelopmentEnvironment(); - /*?} elif forge-like {*//* - return !FMLEnvironment.production; + /*?} elif forge-like {*/ + /*return !FMLEnvironment.production; *//*?}*/ } } diff --git a/src/testmod/java/dev/isxander/yacl3/test/Entrypoint.java b/src/testmod/java/dev/isxander/yacl3/test/Entrypoint.java index dca6070..78fcd62 100644 --- a/src/testmod/java/dev/isxander/yacl3/test/Entrypoint.java +++ b/src/testmod/java/dev/isxander/yacl3/test/Entrypoint.java @@ -1,5 +1,5 @@ -/*? if neoforge {*//* -package dev.isxander.yacl3.test; +/*? if neoforge {*/ +/*package dev.isxander.yacl3.test; import net.neoforged.fml.common.Mod; diff --git a/src/testmod/kotlin/dev/isxander/yacl3/test/DslTest.kt b/src/testmod/kotlin/dev/isxander/yacl3/test/DslTest.kt index 9335fb4..ac162a1 100644 --- a/src/testmod/kotlin/dev/isxander/yacl3/test/DslTest.kt +++ b/src/testmod/kotlin/dev/isxander/yacl3/test/DslTest.kt @@ -11,7 +11,7 @@ import net.minecraft.network.chat.Component import net.minecraft.network.chat.ComponentSerialization import net.minecraft.resources.ResourceLocation -object CodecConfigKt : JsonFileCodecConfig(YACLPlatform.getConfigDir().resolve("codec_config_kt.json")) { +object CodecConfigKt : JsonFileCodecConfig(YACLPlatform.getConfigDir().resolve("codec_config_kt.json")) { val myInt by register(0, Codec.INT) val myString by register("default", Codec.STRING) diff --git a/src/testmod/resources/META-INF/neoforge.mods.toml b/src/testmod/resources/META-INF/neoforge.mods.toml new file mode 100644 index 0000000..2af31d4 --- /dev/null +++ b/src/testmod/resources/META-INF/neoforge.mods.toml @@ -0,0 +1,17 @@ +modLoader = "javafml" +loaderVersion = "[1,)" +#issueTrackerURL = "" +license = "LGPL-3.0-or-later" + +[[mods]] +modId = "yacl_test" +version = "1" +displayName = "YACL Testmod" +description = ''' +Test mod for YACL +''' +authors = "isXander" + +[[mixins]] +config = "yacl-test.mixins.json" + diff --git a/versions/1.21-neoforge/gradle.properties b/versions/1.21-neoforge/gradle.properties new file mode 100644 index 0000000..cf9b7e8 --- /dev/null +++ b/versions/1.21-neoforge/gradle.properties @@ -0,0 +1,12 @@ +loom.platform=neoforge +mcVersion=1.21 + +java.version=21 + +deps.quiltMappings= +deps.neoforge=21.0.0-beta + +modstoml.mcDep=[1.21] +modstoml.loaderVersion=[1,) +modstoml.forgeId=neoforge +modstoml.forgeConstraint=[21,) -- cgit