diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..f811f6ae6 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# Disable autocrlf on generated files, they always generate with LF +# Add any extra files or paths here to make git stop saying they +# are changed when only line endings change. +src/generated/**/.cache/cache text eol=lf +src/generated/**/*.json text eol=lf diff --git a/build.gradle b/build.gradle index 3a23a49ec..919aba5a5 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ group = 'com.lothrazar.cyclic' archivesBaseName = 'Cyclic' base { - archivesName = mod_id + archivesName = 'Cyclic' } minecraft { @@ -21,7 +21,7 @@ minecraft { accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') copyIdeResources = true - + enableEclipsePrepareRuns = true // Default run configurations. // These can be tweaked, removed, or duplicated as needed. runs { @@ -29,13 +29,19 @@ minecraft { workingDirectory project.file('run') // Recommended logging data for a userdev environment - property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + // The markers can be added/remove as needed separated by commas. + // "SCAN": For mods scan. + // "REGISTRIES": For firing of registry events. + // "REGISTRYDUMP": For getting the contents of all registries. + property 'forge.logging.markers', 'REGISTRIES' // Recommended logging level for the console property 'forge.logging.console.level', 'debug' // probably for patchouli property 'mixin.env.disableRefMap', 'true' + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. + property 'forge.enabledGameTestNamespaces', mod_id mods { "${mod_id}" { @@ -53,9 +59,27 @@ minecraft { // Recommended logging level for the console property 'forge.logging.console.level', 'debug' property 'mixin.env.disableRefMap', 'true' + property 'forge.enabledGameTestNamespaces', mod_id + + mods { + "${mod_id}" { + source sourceSets.main + } + } + } + + data { + workingDirectory project.file('run') + + property 'forge.logging.markers', 'REGISTRIES' + + property 'forge.logging.console.level', 'debug' + + // 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/') mods { - cyclic { + "${mod_id}" { source sourceSets.main } } @@ -67,7 +91,7 @@ dependencies { // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. // The userdev artifact is a special name and will get all sorts of transformations applied to it. - minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}" + minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" // https://github.com/mezz/JustEnoughItems/wiki/Getting-Started-%5BJEI-10-or-higher-for-Forge-or-Fabric%5D#repositories compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}") compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}") @@ -114,12 +138,12 @@ repositories { } - +// This block of code expands all declared replace properties in the specified resource targets. +// 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. +// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html def resourceTargets = ['META-INF/mods.toml', 'pack.mcmeta'] def 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_version: mod_version ] @@ -138,11 +162,11 @@ jar { attributes([ "Specification-Title": "cyclic", "Specification-Vendor": "cyclicsareus", - "Specification-Version": "1", // We are version 1 of ourselves - "Implementation-Title": project.name, - "Implementation-Version": "${version}", - "Implementation-Vendor" :"cyclicsareus", - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") + "Specification-Version" : "1", // We are version 1 of ourselves + "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") ]) } } diff --git a/gradle.properties b/gradle.properties index 955a02d5f..fd3e12ad8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,24 +7,25 @@ org.gradle.daemon=false dist_folder=c:/temp mod_id=cyclic -mod_name=cyclic -id=cyclic +mod_name=Cyclic mod_license=All Rights Reserved mod_authors=Lothrazar -mod_description=stuff +mod_description=cyclic mod_group_id=com.lothrazar.cyclic curse_id=239286 mod_version=1.11.0 minecraft_version=1.20 mc_version=1.20 -minecraft_version_range=[1.20,1.21) + # The Forge version must agree with the Minecraft version to get a valid artifact -forge_version=46.0.13 +forge_version=46.0.14 # The Forge version range can use any version of Forge as bounds or match the loader version range forge_version_range=[46,) # The loader version range can only use the major version of Forge/FML as bounds loader_version_range=[46,) +minecraft_version_range=[1.20,1.21) + # optional dependencies jei_version=14.0.0.5 curios_version=5.2.0-beta.1+1.20 diff --git a/scripts/release.sh b/scripts/release.sh index 749ff102d..6ce083db8 100644 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,3 +1,3 @@ #!/bin/bash -./gradlew cleanJar build signJar +./gradlew cleanJar build signJar diff --git a/settings.gradle b/settings.gradle index 3703f364a..291d399db 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,13 @@ pluginManagement { repositories { gradlePluginPortal() - maven { url = 'https://maven.minecraftforge.net/' } + maven { + name = 'MinecraftForge' + url = 'https://maven.minecraftforge.net/' + } } +} + +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' } \ No newline at end of file diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 814b0f7d4..c1dbbff52 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -9,7 +9,7 @@ modLoader="javafml" #mandatory license="MIT" # A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="[26,)" #mandatory (26 is current forge version) +loaderVersion="[46,)" #mandatory (26 is current forge version) # A URL to refer people to when problems occur with this mod issueTrackerURL="https://github.com/Lothrazar/cyclic/issues" #optional # A list of mods - how many allowed here is determined by the individual mod loader @@ -33,7 +33,7 @@ credits="Thanks for this example mod goes to Java" #optional authors="Lothrazar" #optional # The description text for the mod (multi line!) (#mandatory) description=''' -A small mod by Lothrazar +#{mod_id} A small mod by Lothrazar ''' # A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. [[dependencies.cyclic]] #optional diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 17cef1f94..88da7f140 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,7 +1,7 @@ { "pack": { - "description": "examplemod resources", - "pack_format": 9, + "description": "${mod_id} resources", + "pack_format": 15, "_comment": "A pack_format of 4 requires json lang files. Note: we require v4 pack meta for all mods." } }