From de04a62cd24e505ffdadc9c82b6fae3a0e5ed662 Mon Sep 17 00:00:00 2001 From: Matyrobbrt Date: Sun, 25 Feb 2024 14:08:17 +0200 Subject: [PATCH] Improve neoforge example --- mdg/neoforge/example.mdx | 2 +- mdgexamples/build.gradle | 11 --- mdgexamples/neoforge/build.gradle | 17 +++-- .../neoforge/src/main/resources/mods.groovy | 68 +++++++++++++++++++ 4 files changed, 81 insertions(+), 17 deletions(-) diff --git a/mdg/neoforge/example.mdx b/mdg/neoforge/example.mdx index 6a93372..a71f3de 100644 --- a/mdg/neoforge/example.mdx +++ b/mdg/neoforge/example.mdx @@ -3,4 +3,4 @@ import MyComponentSource from '!!raw-loader!../../mdgexamples/neoforge/src/main/ # Example file -{MyComponentSource} +{MyComponentSource} diff --git a/mdgexamples/build.gradle b/mdgexamples/build.gradle index ef5af3f..fe19081 100644 --- a/mdgexamples/build.gradle +++ b/mdgexamples/build.gradle @@ -1,14 +1,3 @@ plugins { id 'org.groovymc.modsdotgroovy' version '2.0.0-beta.10' apply false } - -subprojects { - apply plugin: 'java' - apply plugin: 'org.groovymc.modsdotgroovy' - - java { - toolchain { - languageVersion = JavaLanguageVersion.of(17) - } - } -} diff --git a/mdgexamples/neoforge/build.gradle b/mdgexamples/neoforge/build.gradle index 2b07e84..8a0be59 100644 --- a/mdgexamples/neoforge/build.gradle +++ b/mdgexamples/neoforge/build.gradle @@ -1,13 +1,15 @@ import org.groovymc.modsdotgroovy.core.Platform +import org.groovymc.modsdotgroovy.gradle.tasks.AbstractGatherPlatformDetailsTask plugins { id 'java' - id 'groovy' - id 'net.neoforged.gradle.userdev' version '7.0.80' + id 'org.groovymc.modsdotgroovy' } -tasks.configureEach { - if (it.name.startsWith('neoForm')) it.enabled = false +java { + toolchain { + languageVersion = JavaLanguageVersion.of(17) + } } modsDotGroovy { @@ -17,5 +19,10 @@ modsDotGroovy { } dependencies { - implementation 'net.neoforged:neoforge:20.4.167' + mdgFrontendNeoForge 'org.groovymc.modsdotgroovy:core' +} + +tasks.named('gatherNeoForgePlatformDetails', AbstractGatherPlatformDetailsTask).configure { + minecraftVersion = '1.20.4' + platformVersion = '20.4.55-beta' } diff --git a/mdgexamples/neoforge/src/main/resources/mods.groovy b/mdgexamples/neoforge/src/main/resources/mods.groovy index 472fb6b..9af77b6 100644 --- a/mdgexamples/neoforge/src/main/resources/mods.groovy +++ b/mdgexamples/neoforge/src/main/resources/mods.groovy @@ -1,3 +1,71 @@ NeoForgeModsDotGroovy.make { + // The mod is loaded by the javafml language (i.e. @Mod) + modLoader = 'javafml' + + // Depend on any version greater than 1 of FML, equivalent to [1,) using Maven version ranges + // You can also use rawVersionRange('') if we do not support parsing a specific range you want + // See the dedicated page on version ranges for more information + loaderVersion = v('>=1') + + // The license if the mod is under license = 'MIT' + + // A link to the issue tracker of the mod + issueTrackerUrl = 'https://github.com/example/mod/issues' + + // Configure a mod + mod { + // The ID of the mod + modId = 'mymod' + // The display name of the mod + displayName = 'My mod' + + // The description of the mod. Supports multi-line strings + description = ''' + My awesome mod + '''.trim() + + // The path to your mod logo, relative to the jar root + logoFile = 'mymod.png' + + // The version of the mod. You can hardcode this or use '${file.jarVersion}' to substitute it with the + // Implementation-Version of the mod jar + // Alternatively you can pull the version of your Gradle Project through the syntax specified below + version = buildProperties.version + + // The authors of the mod + authors = ['Myself', 'I'] + + // Optional property that indicates who to credit for the mod too + // credits = '' + + // A link to the homepage of your mod + // This is usually a GitHub link, CurseForge link or Modrinth link + displayUrl = 'https://www.curseforge.com/minecraft/mc-mods/example-mod' + + // Declare mod dependencies + dependencies { + // Depend on any 20.4 NeoForge version + neoforge = '[20.4,)' + // Depend on any Minecraft version greater than 1.20.4 but lower than 1.21 + minecraft = '[1.20.4, 1.21)' + + // Declare an optional JEI dependency + mod('jei') { + // This dependency is against any version of JEI with the major component 17 + versionRange = v('17.*') + type = DependencyType.OPTIONAL + } + } + } + + // Declare your mixin configs + mixins { + mixin 'mymod.mixins.json' + } + + // Declare the paths to your AT files + accessTransformers { + accessTransformer 'META-INF/accesstransformer.cfg' + } }