Skip to content

Commit

Permalink
1.20 port gradle cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Lothrazar committed Jun 11, 2023
1 parent 1e397f9 commit 6a427e0
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 25 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
52 changes: 38 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,35 @@ group = 'com.lothrazar.cyclic'
archivesBaseName = 'Cyclic'

base {
archivesName = mod_id
archivesName = 'Cyclic'
}

minecraft {
mappings channel: 'official', version: "${mc_version}"

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 {
client {
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}" {
Expand All @@ -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
}
}
Expand All @@ -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}")
Expand Down Expand Up @@ -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

]
Expand All @@ -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")
])
}
}
Expand Down
11 changes: 6 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/release.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

./gradlew cleanJar build signJar
./gradlew cleanJar build signJar
9 changes: 8 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -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'
}
4 changes: 2 additions & 2 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -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."
}
}

0 comments on commit 6a427e0

Please sign in to comment.