diff --git a/build.gradle b/build.gradle index c0b2fab..c92575a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,112 +1,134 @@ buildscript { repositories { // These repositories are only for Gradle plugins, put any other repositories in the repository block further below - maven { url = 'https://maven.minecraftforge.net' } + maven { url = 'https://repo.spongepowered.org/repository/maven-public/' } mavenCentral() } dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true + classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' } } -apply plugin: 'net.minecraftforge.gradle' +plugins { + id 'eclipse' + id 'idea' + id 'net.minecraftforge.gradle' version '[6.0.16,6.2)' + id 'org.parchmentmc.librarian.forgegradle' version '1.+' +} -def archiveVersion = "${project.mcVersion}-${project.buildVersion}" as Object +apply plugin: 'org.spongepowered.mixin' -java.toolchain.languageVersion = JavaLanguageVersion.of(17) +group = mod_group_id +version = mod_version + +base { + archivesName = "${mod_id}-${minecraft_version}" +} + +java { + toolchain.languageVersion = JavaLanguageVersion.of(17) +} minecraft { - mappings channel: 'official', version: mcVersion + mappings channel: mapping_channel, version: "$mapping_version-$minecraft_version" - accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + copyIdeResources = true + // generateRunFolders = true + // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ runs { - client { + // applies to all the run configs below + configureEach { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' mods { - totemofreviving { + "${mod_id}" { source sourceSets.main } } } + client { + property 'forge.enabledGameTestNamespaces', mod_id + } + server { - workingDirectory project.file('run') + property 'forge.enabledGameTestNamespaces', mod_id + args '--nogui' + } - property 'forge.logging.markers', 'REGISTRIES' - property 'forge.logging.console.level', 'debug' - - mods { - totemofreviving { - source sourceSets.main - } - } + gameTestServer { + property 'forge.enabledGameTestNamespaces', mod_id } data { - workingDirectory project.file('run') - - property 'forge.logging.markers', 'REGISTRIES' - property 'forge.logging.console.level', 'debug' - - args '--mod', 'totemofreviving', '--all', - '--existing', file('src/main/resources').toString(), - '--existing', file('src/generated/resources').toString(), - '--output', file('src/generated/resources/') - - mods { - totemofreviving { - source sourceSets.main - } - } + workingDirectory project.file('run-data') + args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') } } } +//mixin { +// add sourceSets.main, "${mod_id}.refmap.json" +// +// config "${mod_id}.mixins.json" +//} + sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { - maven { - name = "Progwml6 maven" - url = "https://dvs1.progwml6.com/files/maven/" - } - maven { - name = "ModMaven" - url = "https://modmaven.dev" + exclusiveContent { + forRepository { + maven { + name = "Modrinth" + url = "https://api.modrinth.com/maven" + } + } + forRepositories(fg.repository) // Only add this if you're using ForgeGradle, otherwise remove this line + filter { + includeGroup "maven.modrinth" + } } } dependencies { - minecraft "net.minecraftforge:forge:${project.mcVersion}-${project.forgeVersion}" + minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" + annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' +} - // JEI - if (project.hasProperty('jeiVersion')) { - // compile against JEI API but do not include it at runtime - compileOnly fg.deobf("mezz.jei:jei-${project.mcVersion}-forge-api:${project.jeiVersion}") - // at runtime, use full JEI jar - runtimeOnly fg.deobf("mezz.jei:jei-${project.mcVersion}-forge:${project.jeiVersion}") +tasks.named('processResources', ProcessResources).configure { + var replaceProperties = [minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range, + forge_version : forge_version, forge_version_range: forge_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_authors : mod_authors, mod_description: mod_description] + + inputs.properties replaceProperties + + filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { + expand replaceProperties + [project: project] } } -jar { - archiveFileName = "${project.archivesBaseName}-${archiveVersion}.jar" +tasks.named('jar', Jar).configure { manifest { - attributes([ - "Specification-Title" : project.name, - "Specification-Vendor" : project.author, - "Specification-Version" : "1", - "Implementation-Title" : project.name, - "Implementation-Vendor" : project.author, - "Implementation-Version" : archiveVersion, - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") - ]) + attributes(["Specification-Title" : mod_id, + "Specification-Vendor" : mod_authors, + "Specification-Version" : "1", + "Implementation-Title" : project.name, + "Implementation-Version" : project.jar.archiveVersion, + "Implementation-Vendor" : mod_authors, + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")]) } + + finalizedBy 'reobfJar' } -jar.finalizedBy('reobfJar') \ No newline at end of file +tasks.withType(JavaCompile).configureEach { + options.encoding = 'UTF-8' +} diff --git a/gradle.properties b/gradle.properties index 9ecf99e..56a9727 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,14 +1,20 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false -group = dev.micle -archivesBaseName = micles-totem-of-reviving-forge -modID = totemofreviving -name = Micle's Totem of Reviving -author = Micle +mod_id=totem_of_reviving +mod_name=Micle's Totem of Reviving +mod_license=All Rights Reserved +mod_version=2.0.0 +mod_group_id=dev.micle +mod_authors=Micle +mod_description=Totems to revive your friends in hardcore. -buildVersion = 2.0.0 -mcVersion = 1.20.1 -forgeVersion = 47.2.20 +minecraft_version=1.20.1 +minecraft_version_range=[1.20.1,1.21) -#jeiVersion = 11.+ +forge_version=47.2.20 +forge_version_range=[47,) +loader_version_range=[47,) + +mapping_channel=parchment +mapping_version=2023.09.03 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aa991fc..0d18421 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle index 6726ec5..45fe14b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,16 @@ -rootProject.name = 'TotemOfReviving-1.20' +pluginManagement { + repositories { + gradlePluginPortal() + maven { + name = 'MinecraftForge' + url = 'https://maven.minecraftforge.net/' + } + maven { url = 'https://maven.parchmentmc.org' } + } +} + +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' +} + +rootProject.name = "${mod_id}-${minecraft_version}" diff --git a/src/main/java/dev/micle/totemofreviving/TotemOfReviving.java b/src/main/java/dev/micle/totemofreviving/TotemOfReviving.java index e60f80a..5852867 100644 --- a/src/main/java/dev/micle/totemofreviving/TotemOfReviving.java +++ b/src/main/java/dev/micle/totemofreviving/TotemOfReviving.java @@ -12,7 +12,7 @@ import java.util.Optional; @Mod(TotemOfReviving.MOD_ID) public final class TotemOfReviving { - public static final String MOD_ID = "totemofreviving"; + public static final String MOD_ID = "totem_of_reviving"; private static IProxy proxy; diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index dc42f2e..2c82ceb 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -1,58 +1,30 @@ -# This is an example mods.toml file. It contains the data relating to the loading mods. -# There are several mandatory fields (#mandatory), and many more that are optional (#optional). -# The overall format is standard TOML format, v0.5.0. -# Note that there are a couple of TOML lists in this file. -# 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 -modLoader = "javafml" #mandatory -# A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion = "[47,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. -# 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. -license = "All Rights Reserved" -# A URL to refer people to when problems occur with this mod -#issueTrackerURL="http://my.issue.tracker/" #optional -# A list of mods - how many allowed here is determined by the individual mod loader -[[mods]] #mandatory -# The modid of the mod -modId = "totemofreviving" #mandatory -# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it -# ${file.jarVersion} will substitute the value of the Implementation-Version as read from the mod's JAR file metadata -# see the associated build.gradle script for how to populate this completely automatically during a build -version = "${file.jarVersion}" #mandatory -# A display name for the mod -displayName = "Micle's Totem of Reviving" #mandatory -# A URL to query for updates for this mod. See the JSON update specification -#updateJSONURL="http://myurl.me/" #optional -# A URL for the "homepage" for this mod, displayed in the mod UI -#displayURL="http://example.com/" #optional -# A file name (in the root of the mod JAR) containing a logo for display -logoFile="logo.jpg" #optional -# A text field displayed in the mod UI -#credits="Thanks for this example mod goes to Java" #optional -# A text field displayed in the mod UI -authors="Micle" #optional -# The description text for the mod (multi line!) (#mandatory) -description = ''' -Mod for reviving players in a hardcore world. -''' -# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. -[[dependencies.totemofreviving]] #optional - # the modid of the dependency - modId = "forge" #mandatory - # Does this dependency have to exist - if not, ordering below must be specified - mandatory = true #mandatory - # The version range of the dependency - versionRange = "[47,)" #mandatory - # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory - ordering = "NONE" - # Side this dependency is applied on - BOTH, CLIENT or SERVER - side = "BOTH" -# Here's another dependency -[[dependencies.totemofreviving]] +modLoader = "javafml" +loaderVersion = "${loader_version_range}" +license = "${mod_license}" +issueTrackerURL="https://gitea.micle.dev/minecraft-mods/totem_of_reviving/issues" + +[[mods]] +modId = "${mod_id}" +version = "${mod_version}" +displayName = "${mod_name}" +#updateJSONURL="http://myurl.me/" +#displayURL="http://example.com/" +logoFile="logo.jpg" +#credits="" +authors="${mod_authors}" +displayTest="MATCH_VERSION" # MATCH_VERSION, IGNORE_SERVER_VERSION (server only), IGNORE_ALL_VERSION (client only), NONE (IExtensionPoint.DisplayTest) +description = '''${mod_description}''' + +[[dependencies."${mod_id}"]] + modId = "forge" + mandatory = true + versionRange = "${forge_version_range}" + ordering = "NONE" # BEFORE, AFTER, NONE + side = "BOTH" # BOTH, CLIENT, SERVER + +[[dependencies."${mod_id}"]] modId = "minecraft" mandatory = true - # This version range declares a minimum of the current minecraft version up to but not including the next major version - versionRange = "[1.20.1,1.20.2)" + versionRange = "${minecraft_version_range}" ordering = "NONE" side = "BOTH"