Skip to content

Commit

Permalink
Port to 1.20.1 (#12)
Browse files Browse the repository at this point in the history
Minecraft Forge 47.2.20
  • Loading branch information
ShadowGry authored Nov 19, 2024
1 parent 5b6dad7 commit f59992b
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 78 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Emerald Tools
![Version](https://img.shields.io/badge/version-1.20--1.1.0.1-blue?style=flat-square)
![Version](https://img.shields.io/badge/version-1.20.1--1.1.0.1-blue?style=flat-square)
![GitHub](https://img.shields.io/github/license/ShadowGry/emerald-tools?style=flat-square)

A Minecraft mod that adds in emerald tools and armor using Forge.
Expand Down
107 changes: 38 additions & 69 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,9 @@ minecraft {
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: mapping_channel, version: mapping_version

// When true, this property will have all Eclipse run configurations run the "prepareX" task for the given run configuration before launching the game.
// 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

// When true, this property will have all 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.
// enableIdeaPrepareRuns = true

// This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
Expand All @@ -61,7 +58,8 @@ minecraft {
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
// applies to all the run configs below
configureEach {
workingDirectory project.file('run')

// Recommended logging data for a userdev environment
Expand All @@ -76,66 +74,36 @@ minecraft {
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug'

// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', mod_id

mods {
"${mod_id}" {
source sourceSets.main
}
}
}

server {
workingDirectory project.file('run')

property 'forge.logging.markers', 'REGISTRIES'

property 'forge.logging.console.level', 'debug'

client {
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', mod_id
}

mods {
"${mod_id}" {
source sourceSets.main
}
}
server {
property 'forge.enabledGameTestNamespaces', mod_id
args '--nogui'
}

// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
workingDirectory project.file('run')

property 'forge.logging.markers', 'REGISTRIES'

property 'forge.logging.console.level', 'debug'

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'
// example of overriding the workingDirectory set in configureEach above
workingDirectory project.file('run-data')

// 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 {
"${mod_id}" {
source sourceSets.main
}
}
}
}
}
Expand Down Expand Up @@ -182,47 +150,48 @@ dependencies {
// 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_name: mod_name, mod_license: mod_license, mod_version: mod_version,
mod_authors: mod_authors, mod_description: mod_description
]
processResources {
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
replaceProperties.put 'project', project

filesMatching(resourceTargets) {
expand replaceProperties
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
expand replaceProperties + [project: project]
}
}

// Example for how to get properties into the manifest for reading at runtime.
jar {
tasks.named('jar', Jar).configure {
manifest {
attributes([
"Specification-Title" : mod_id,
"Specification-Vendor" : mod_authors,
"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")
'Specification-Title' : mod_id,
'Specification-Vendor' : mod_authors,
'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")
])
}

// This is the preferred method to reobfuscate your jar file
finalizedBy 'reobfJar'
}

// Example configuration to allow publishing using the maven-publish plugin
// This is the preferred method to reobfuscate your jar file
jar.finalizedBy('reobfJar')
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
// publish.dependsOn('reobfJar')
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing:
// tasks.named('publish').configure {
// dependsOn 'reobfJar'
// }

// Example configuration to allow publishing using the maven-publish plugin
publishing {
publications {
mavenJava(MavenPublication) {
register('mavenJava', MavenPublication) {
artifact jar
}
}
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ org.gradle.daemon=false
## Environment Properties

# The Minecraft version must agree with the Forge version to get a valid artifact
minecraft_version=1.20
minecraft_version=1.20.1
# 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
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.20,1.21)
minecraft_version_range=[1.20.1,1.21)
# The Forge version must agree with the Minecraft version to get a valid artifact
forge_version=46.0.14
forge_version=47.2.20
# The Forge version range can use any version of Forge as bounds or match the loader version range
forge_version_range=[46,)
forge_version_range=[47,)
# The loader version range can only use the major version of Forge/FML as bounds
loader_version_range=[46,)
loader_version_range=[47,)
# The mapping channel to use for mappings.
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
Expand All @@ -35,7 +35,7 @@ loader_version_range=[46,)
mapping_channel=official
# The mapping version to query from the mapping channel.
# This must match the format required by the mapping channel.
mapping_version=1.20
mapping_version=1.20.1


## Mod Properties
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ pluginManagement {
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
}
4 changes: 3 additions & 1 deletion update.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"1.19.4-recommended": "1.19.4-1.1.0.1",
"1.19.4-latest": "1.19.4-1.1.0.1",
"1.20-recommended": "1.20-1.1.0.1",
"1.20-latest": "1.20-1.1.0.1"
"1.20-latest": "1.20-1.1.0.1",
"1.20.1-recommended": "1.20.1-1.1.0.1",
"1.20.1-latest": "1.20.1-1.1.0.1"
}
}

0 comments on commit f59992b

Please sign in to comment.