User: rednesto Date: 21 Dec 23 15:49 Revision: d704b7b41f5a573771d84c24d252c2058b2e446c Summary: Update Forge, Fabric & Sponge templates Fixes #2147 TeamCity URL: http://ci.mcdev.io:80/viewModification.html?tab=vcsModificationFiles&modId=8925&personal=false Index: src/main/kotlin/creator/buildsystem/gradle-steps.kt =================================================================== --- src/main/kotlin/creator/buildsystem/gradle-steps.kt (revision 9352a1323687d5322c0d4f18ec4c543651f9aa61) +++ src/main/kotlin/creator/buildsystem/gradle-steps.kt (revision d704b7b41f5a573771d84c24d252c2058b2e446c) @@ -61,7 +61,7 @@ import org.jetbrains.plugins.gradle.service.project.open.canLinkAndRefreshGradleProject import org.jetbrains.plugins.gradle.service.project.open.linkAndRefreshGradleProject -val DEFAULT_GRADLE_VERSION = SemanticVersion.release(8, 1, 1) +val DEFAULT_GRADLE_VERSION = SemanticVersion.release(8, 5) val GRADLE_VERSION_KEY = Key.create("mcdev.gradleVersion") fun FixedAssetsNewProjectWizardStep.addGradleWrapperProperties(project: Project) { Index: src/main/kotlin/platform/fabric/creator/gradle-steps.kt =================================================================== --- src/main/kotlin/platform/fabric/creator/gradle-steps.kt (revision 9352a1323687d5322c0d4f18ec4c543651f9aa61) +++ src/main/kotlin/platform/fabric/creator/gradle-steps.kt (revision d704b7b41f5a573771d84c24d252c2058b2e446c) @@ -57,7 +57,7 @@ val mcVersion = data.getUserData(FabricVersionChainStep.MC_VERSION_KEY) ?: return val yarnVersion = data.getUserData(FabricVersionChainStep.YARN_VERSION_KEY) ?: return val loaderVersion = data.getUserData(FabricVersionChainStep.LOADER_VERSION_KEY) ?: return - val loomVersion = "1.2-SNAPSHOT" + val loomVersion = "1.4-SNAPSHOT" val javaVersion = findStep().preferredJdk.ordinal val apiVersion = data.getUserData(FabricVersionChainStep.API_VERSION_KEY) val officialMappings = data.getUserData(FabricVersionChainStep.OFFICIAL_MAPPINGS_KEY) ?: false Index: src/main/kotlin/platform/forge/creator/asset-steps.kt =================================================================== --- src/main/kotlin/platform/forge/creator/asset-steps.kt (revision 9352a1323687d5322c0d4f18ec4c543651f9aa61) +++ src/main/kotlin/platform/forge/creator/asset-steps.kt (revision d704b7b41f5a573771d84c24d252c2058b2e446c) @@ -83,6 +83,7 @@ "MOD_ID" to modId, "MOD_NAME" to modName, "MOD_VERSION" to buildSystemProps.version, + "SUPPORTS_CLIENT_SIDE_ONLY" to (forgeVersion >= ForgeConstants.CLIENT_ONLY_MANIFEST_VERSION), "DISPLAY_TEST" to (forgeVersion >= ForgeConstants.DISPLAY_TEST_MANIFEST_VERSION), "FORGE_SPEC_VERSION" to forgeVersion.parts[0].versionString, "MC_VERSION" to mcVersion, Index: src/main/kotlin/platform/forge/creator/gradle-steps.kt =================================================================== --- src/main/kotlin/platform/forge/creator/gradle-steps.kt (revision 9352a1323687d5322c0d4f18ec4c543651f9aa61) +++ src/main/kotlin/platform/forge/creator/gradle-steps.kt (revision d704b7b41f5a573771d84c24d252c2058b2e446c) @@ -49,7 +49,7 @@ import com.intellij.openapi.vfs.VfsUtil import com.intellij.util.lang.JavaVersion -private val fg6WrapperVersion = SemanticVersion.release(8, 1, 1) +private val fg6WrapperVersion = SemanticVersion.release(8, 4) const val MAGIC_RUN_CONFIGS_FILE = ".hello_from_mcdev" Index: src/main/kotlin/platform/forge/util/ForgeConstants.kt =================================================================== --- src/main/kotlin/platform/forge/util/ForgeConstants.kt (revision 9352a1323687d5322c0d4f18ec4c543651f9aa61) +++ src/main/kotlin/platform/forge/util/ForgeConstants.kt (revision d704b7b41f5a573771d84c24d252c2058b2e446c) @@ -52,4 +52,5 @@ val MOD_ID_REGEX = "^[a-z][a-z0-9_-]{1,63}$".toRegex() val DISPLAY_TEST_MANIFEST_VERSION = SemanticVersion.release(41, 0, 15) + val CLIENT_ONLY_MANIFEST_VERSION = SemanticVersion.release(49, 0, 6) } Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) build.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) build.gradle.ft (revision 9352a1323687d5322c0d4f18ec4c543651f9aa61) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) build.gradle.ft (revision d704b7b41f5a573771d84c24d252c2058b2e446c) @@ -14,7 +14,7 @@ plugins { id 'eclipse' id 'idea' - id 'net.minecraftforge.gradle' version '[6.0,6.2)' + id 'net.minecraftforge.gradle' version '[6.0.16,6.2)' } #if (${MIXINS}) @@ -49,6 +49,7 @@ mappings channel: mapping_channel, version: mapping_version // When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game. + // In most cases, it is not necessary to enable. // enableEclipsePrepareRuns = true // enableIdeaPrepareRuns = true @@ -89,13 +90,7 @@ // You can set various levels here. // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels property 'forge.logging.console.level', 'debug' - - mods { - "${mod_id}" { - source sourceSets.main - } + } - } - } #if (${GAME_TEST_FRAMEWORK}) client { @@ -222,3 +217,13 @@ tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation } + +// Merge the resources and classes into the same directory. +// This is done because java expects modules to be in a single directory. +// And if we have it in multiple we have to do performance intensive hacks like having the UnionFileSystem +// This will eventually be migrated to ForgeGradle so modders don't need to manually do it. But that is later. +sourceSets.each { + def dir = layout.buildDirectory.dir("sourcesSets/$it.name") + it.output.resourcesDir = dir + it.java.destinationDirectory = dir +} Index: src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) settings.gradle.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) settings.gradle.ft (revision 9352a1323687d5322c0d4f18ec4c543651f9aa61) +++ src/main/resources/fileTemplates/j2ee/forge/Forge (1.13+) settings.gradle.ft (revision d704b7b41f5a573771d84c24d252c2058b2e446c) @@ -9,7 +9,7 @@ } plugins { - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' } rootProject.name = '${ARTIFACT_ID}' Index: src/main/resources/fileTemplates/j2ee/forge/mods.toml.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/forge/mods.toml.ft (revision 9352a1323687d5322c0d4f18ec4c543651f9aa61) +++ src/main/resources/fileTemplates/j2ee/forge/mods.toml.ft (revision d704b7b41f5a573771d84c24d252c2058b2e446c) @@ -12,6 +12,11 @@ license="${mod_license}" # A URL to refer people to when problems occur with this mod #issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional +#if (${SUPPORTS_CLIENT_SIDE_ONLY}) +# If your mod is purely client-side and has no multiplayer functionality (be it dedicated servers or Open to LAN), +# set this to true, and Forge will set the correct displayTest for you and skip loading your mod on dedicated servers. +#clientSideOnly=true #optional - defaults to false if absent +#end # A list of mods - how many allowed here is determined by the individual mod loader [[mods]] #mandatory # The modid of the mod @@ -45,7 +50,11 @@ # IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component. # NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value. # IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself. +#if (${SUPPORTS_CLIENT_SIDE_ONLY}) +#displayTest="MATCH_VERSION" # if nothing is specified, MATCH_VERSION is the default when clientSideOnly=false, otherwise IGNORE_ALL_VERSION when clientSideOnly=true (#optional) +#else #displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional) +#end #end # The description text for the mod (multi line!) (#mandatory) Index: src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ build.gradle.kts.ft =================================================================== --- src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ build.gradle.kts.ft (revision 9352a1323687d5322c0d4f18ec4c543651f9aa61) +++ src/main/resources/fileTemplates/j2ee/sponge/Sponge 8+ build.gradle.kts.ft (revision d704b7b41f5a573771d84c24d252c2058b2e446c) @@ -3,7 +3,7 @@ plugins { `java-library` - id("org.spongepowered.gradle.plugin") version "2.1.1" + id("org.spongepowered.gradle.plugin") version "2.2.0" } group = "${GROUP_ID}" @@ -30,12 +30,12 @@ #end links { #if (${WEBSITE}) - homepage("${WEBSITE}") + homepageLink("${WEBSITE}") #else - // homepage("https://spongepowered.org") + // homepageLink("https://spongepowered.org") #end - // source("https://spongepowered.org/source") - // issues("https://spongepowered.org/issues") + // sourceLink("https://spongepowered.org/source") + // issuesLink("https://spongepowered.org/issues") } #foreach (${AUTHOR} in ${AUTHORS}) contributor("${AUTHOR}") {