Skip to content

Commit

Permalink
Improve neoforge example
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed Feb 25, 2024
1 parent 239b4b2 commit de04a62
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 17 deletions.
2 changes: 1 addition & 1 deletion mdg/neoforge/example.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import MyComponentSource from '!!raw-loader!../../mdgexamples/neoforge/src/main/

# Example file

<CodeBlock language="groovy" title="Example NeoForge mods.groovy">{MyComponentSource}</CodeBlock>
<CodeBlock language="gradle" title="Example NeoForge mods.groovy">{MyComponentSource}</CodeBlock>
11 changes: 0 additions & 11 deletions mdgexamples/build.gradle
Original file line number Diff line number Diff line change
@@ -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)
}
}
}
17 changes: 12 additions & 5 deletions mdgexamples/neoforge/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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'
}
68 changes: 68 additions & 0 deletions mdgexamples/neoforge/src/main/resources/mods.groovy
Original file line number Diff line number Diff line change
@@ -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('<mavenRange>') 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'
}
}

0 comments on commit de04a62

Please sign in to comment.