Update to neoforge

This commit is contained in:
Zontreck 2024-02-14 02:50:56 -07:00
parent 9c4d5ff6db
commit e5ef571346
4 changed files with 46 additions and 47 deletions

View file

@ -3,7 +3,8 @@ plugins {
id 'idea' id 'idea'
id 'maven-publish' id 'maven-publish'
id 'java-library' id 'java-library'
id 'net.minecraftforge.gradle' version '[6.0,6.2)' id 'net.neoforged.gradle' version '[6.0.18,6.2)'
id 'org.spongepowered.mixin' version '0.7.+'
id 'org.parchmentmc.librarian.forgegradle' version '1.+' id 'org.parchmentmc.librarian.forgegradle' version '1.+'
} }
@ -23,6 +24,9 @@ java {
configurations { configurations {
provided provided
compile.extendsFrom(provided) compile.extendsFrom(provided)
implementation.extendsFrom(provided)
runtime.extendsFrom(provided)
minecraftLibrary.extendsFrom(provided)
} }
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
@ -73,7 +77,7 @@ minecraft {
runs { runs {
// applies to all the run configs below // applies to all the run configs below
configureEach { configureEach {
workingDirectory project.file('run') workingDirectory project.file("run/${it.name}")
// Recommended logging data for a userdev environment // Recommended logging data for a userdev environment
// The markers can be added/remove as needed separated by commas. // The markers can be added/remove as needed separated by commas.
@ -112,8 +116,8 @@ minecraft {
} }
data { data {
// example of overriding the workingDirectory set in configureEach above // example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
workingDirectory project.file('run-data') // workingDirectory project.file('run-data')
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
@ -156,16 +160,12 @@ dependencies {
// The "userdev" classifier will be requested and setup by ForgeGradle. // The "userdev" classifier will be requested and setup by ForgeGradle.
// If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"], // If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"],
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository. // then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" minecraft "net.neoforged:forge:${minecraft_version}-${neo_version}"
provided "dev.zontreck:LibAC:${libac}" provided "dev.zontreck:LibAC:${libac}"
implementation "dev.zontreck:LibAC:${libac}"
minecraftLibrary "dev.zontreck:LibAC:${libac}"
provided "dev.zontreck:EventsBus:${eventsbus}" provided "dev.zontreck:EventsBus:${eventsbus}"
implementation "dev.zontreck:EventsBus:${eventsbus}"
minecraftLibrary "dev.zontreck:EventsBus:${eventsbus}"
// Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings // Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
@ -187,13 +187,13 @@ dependencies {
// A missing property will result in an error. Properties are expanded using ${} Groovy notation. // A missing property will result in an error. Properties are expanded using ${} Groovy notation.
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments. // When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html // See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
tasks.named('processResources', ProcessResources).configure { tasks.withType(ProcessResources).configureEach {
var replaceProperties = [ var replaceProperties = [
minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range, minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range,
forge_version : forge_version, forge_version_range: forge_version_range, neo_version : neo_version, neo_version_range: neo_version_range,
loader_version_range: loader_version_range, loader_version_range: loader_version_range,
mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
mod_authors : mod_authors, mod_description: mod_description, mod_authors : mod_authors, mod_description: mod_description, pack_format_number: pack_format_number,
] ]
inputs.properties replaceProperties inputs.properties replaceProperties
@ -204,11 +204,6 @@ tasks.named('processResources', ProcessResources).configure {
// Example for how to get properties into the manifest for reading at runtime. // Example for how to get properties into the manifest for reading at runtime.
tasks.named('jar', Jar).configure { tasks.named('jar', Jar).configure {
from {
configurations.provided.asFileTree.collect{zipTree(it)}
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest { manifest {
attributes([ attributes([
'Specification-Title' : mod_id, 'Specification-Title' : mod_id,

View file

@ -16,12 +16,13 @@ minecraft_version=1.20.1
# The Minecraft version range can use any release version of Minecraft as bounds. # The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly # Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions. # as they do not follow standard versioning conventions.
minecraft_version_range=[1.20.1,1.21)
# The Forge version must agree with the Minecraft version to get a valid artifact minecraft_version_range=[1.20,1.21)
forge_version=47.2.0 # The Neo version must agree with the Minecraft version to get a valid artifact
# The Forge version range can use any version of Forge as bounds or match the loader version range neo_version=47.1.65
forge_version_range=[47,) # The Neo version range can use any version of Neo as bounds or match the loader version range
# The loader version range can only use the major version of Forge/FML as bounds neo_version_range=[47.1,)
# The loader version range can only use the major version of Neo/FML as bounds
loader_version_range=[47,) loader_version_range=[47,)
# The mapping channel to use for mappings. # The mapping channel to use for mappings.
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"]. # The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
@ -62,3 +63,6 @@ mod_group_id=dev.zontreck
mod_authors=zontreck mod_authors=zontreck
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list. # The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=LibZontreck\nLibrary Mod! mod_description=LibZontreck\nLibrary Mod!
# Pack version - this changes each minecraft release, in general.
pack_format_number=15

View file

@ -5,13 +5,13 @@
# Find more information on toml format here: https://github.com/toml-lang/toml # Find more information on toml format here: https://github.com/toml-lang/toml
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version # A version range to match for said mod loader - for regular FML @Mod it will be the the FML version. This is currently 47.
loaderVersion="${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. loaderVersion="${loader_version_range}" #mandatory
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. # The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. # Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
license="${mod_license}" license="${mod_license}"
# A URL to refer people to when problems occur with this mod # A URL to refer people to when problems occur with this mod
issueTrackerURL="https://github.com/zontreck/LibZontreckMod/issues" #optional #issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
# A list of mods - how many allowed here is determined by the individual mod loader # A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory [[mods]] #mandatory
# The modid of the mod # The modid of the mod
@ -20,7 +20,7 @@ modId="${mod_id}" #mandatory
version="${mod_version}" #mandatory version="${mod_version}" #mandatory
# A display name for the mod # A display name for the mod
displayName="${mod_name}" #mandatory displayName="${mod_name}" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/ # A URL to query for updates for this mod. See the JSON update specification https://docs.neoforged.net/docs/misc/updatechecker/
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional #updateJSONURL="https://change.me.example.invalid/updates.json" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI # A URL for the "homepage" for this mod, displayed in the mod UI
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional #displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
@ -47,7 +47,7 @@ description='''${mod_description}'''
# Does this dependency have to exist - if not, ordering below must be specified # Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory mandatory=true #mandatory
# The version range of the dependency # The version range of the dependency
versionRange="${forge_version_range}" #mandatory versionRange="${neo_version_range}" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory # An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory
# BEFORE - This mod is loaded BEFORE the dependency # BEFORE - This mod is loaded BEFORE the dependency
# AFTER - This mod is loaded AFTER the dependency # AFTER - This mod is loaded AFTER the dependency

View file

@ -3,6 +3,6 @@
"description": { "description": {
"text": "${mod_id} resources" "text": "${mod_id} resources"
}, },
"pack_format": 15 "pack_format": ${pack_format_number}
} }
} }