Skip to content

Commit 906daa9

Browse files
committed
1.20.1
1 parent f65a5f3 commit 906daa9

10 files changed

Lines changed: 261 additions & 141 deletions

File tree

build.gradle

Lines changed: 116 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,65 @@
1-
buildscript {
2-
repositories {
3-
// These repositories are only for Gradle plugins, put any other repositories in the repository block further below
4-
maven { url = 'https://maven.minecraftforge.net' }
5-
mavenCentral()
6-
}
7-
dependencies {
8-
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
9-
}
1+
plugins {
2+
id 'eclipse'
3+
id 'idea'
4+
id 'maven-publish'
5+
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
106
}
11-
apply plugin: 'net.minecraftforge.gradle'
12-
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
13-
apply plugin: 'eclipse'
14-
apply plugin: 'maven-publish'
157

16-
version = '1.5.1'
17-
group = 'simpleircbridge' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
18-
archivesBaseName = 'simpleircbridge'
8+
version = mod_version
9+
group = mod_group_id
10+
11+
base {
12+
archivesName = mod_id
13+
}
1914

2015
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
2116
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
2217

23-
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
18+
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
2419
minecraft {
2520
// The mappings can be changed at any time and must be in the following format.
2621
// Channel: Version:
27-
// snapshot YYYYMMDD Snapshot are built nightly.
28-
// stable # Stables are built at the discretion of the MCP team.
29-
// official MCVersion Official field/method names from Mojang mapping files
22+
// official MCVersion Official field/method names from Mojang mapping files
23+
// parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
3024
//
31-
// You must be aware of the Mojang license when using the 'official' mappings.
25+
// You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
3226
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
3327
//
28+
// Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
29+
// Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started
30+
//
3431
// Use non-default mappings at your own risk. They may not always work.
3532
// Simply re-run your setup task after changing the mappings to update your workspace.
36-
mappings channel: 'official', version: '1.19.2'
37-
38-
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default.
33+
mappings channel: mapping_channel, version: mapping_version
34+
35+
// 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.
36+
// In most cases, it is not necessary to enable.
37+
// enableEclipsePrepareRuns = true
38+
// enableIdeaPrepareRuns = true
39+
40+
// This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
41+
// It is REQUIRED to be set to true for this template to function.
42+
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
43+
copyIdeResources = true
44+
45+
// When true, this property will add the folder name of all declared run configurations to generated IDE run configurations.
46+
// The folder name can be set on a run configuration using the "folderName" property.
47+
// By default, the folder name of a run configuration is the name of the Gradle project containing it.
48+
// generateRunFolders = true
49+
50+
// This property enables access transformers for use in development.
51+
// They will be applied to the Minecraft artifact.
52+
// The access transformer file can be anywhere in the project.
53+
// However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge.
54+
// This default location is a best practice to automatically put the file in the right place in the final jar.
55+
// See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information.
56+
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
3957

4058
// Default run configurations.
4159
// These can be tweaked, removed, or duplicated as needed.
4260
runs {
43-
client {
61+
// applies to all the run configs below
62+
configureEach {
4463
workingDirectory project.file('run')
4564

4665
// Recommended logging data for a userdev environment
@@ -56,57 +75,35 @@ minecraft {
5675
property 'forge.logging.console.level', 'debug'
5776

5877
mods {
59-
simpleircbridge {
78+
"${mod_id}" {
6079
source sourceSets.main
6180
}
6281
}
6382
}
6483

65-
server {
66-
workingDirectory project.file('run')
67-
68-
// Recommended logging data for a userdev environment
69-
// The markers can be added/remove as needed separated by commas.
70-
// "SCAN": For mods scan.
71-
// "REGISTRIES": For firing of registry events.
72-
// "REGISTRYDUMP": For getting the contents of all registries.
73-
property 'forge.logging.markers', 'REGISTRIES'
84+
client {
85+
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
86+
property 'forge.enabledGameTestNamespaces', mod_id
87+
}
7488

75-
// Recommended logging level for the console
76-
// You can set various levels here.
77-
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
78-
property 'forge.logging.console.level', 'debug'
89+
server {
90+
property 'forge.enabledGameTestNamespaces', mod_id
91+
args '--nogui'
92+
}
7993

80-
mods {
81-
simpleircbridge {
82-
source sourceSets.main
83-
}
84-
}
94+
// This run config launches GameTestServer and runs all registered gametests, then exits.
95+
// By default, the server will crash when no gametests are provided.
96+
// The gametest system is also enabled by default for other run configs under the /test command.
97+
gameTestServer {
98+
property 'forge.enabledGameTestNamespaces', mod_id
8599
}
86100

87101
data {
88-
workingDirectory project.file('run')
89-
90-
// Recommended logging data for a userdev environment
91-
// The markers can be added/remove as needed separated by commas.
92-
// "SCAN": For mods scan.
93-
// "REGISTRIES": For firing of registry events.
94-
// "REGISTRYDUMP": For getting the contents of all registries.
95-
property 'forge.logging.markers', 'REGISTRIES'
96-
97-
// Recommended logging level for the console
98-
// You can set various levels here.
99-
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
100-
property 'forge.logging.console.level', 'debug'
102+
// example of overriding the workingDirectory set in configureEach above
103+
workingDirectory project.file('run-data')
101104

102105
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
103-
args '--mod', 'simpleircbridge', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
104-
105-
mods {
106-
simpleircbridge {
107-
source sourceSets.main
108-
}
109-
}
106+
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
110107
}
111108
}
112109
}
@@ -118,55 +115,83 @@ repositories {
118115
// Put repositories for dependencies here
119116
// ForgeGradle automatically adds the Forge maven and Maven Central for you
120117

121-
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
118+
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so.
119+
// See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver
122120
// flatDir {
123121
// dir 'libs'
124122
// }
125123
}
126124

127125
dependencies {
128-
// Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed
129-
// that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied.
130-
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
131-
minecraft 'net.minecraftforge:forge:1.19.2-43.1.64'
132-
133-
// Real mod deobf dependency examples - these get remapped to your current mappings
134-
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
135-
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency
136-
// implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency
137-
138-
// Examples using mod jars from ./libs
126+
// Specify the version of Minecraft to use.
127+
// Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact.
128+
// The "userdev" classifier will be requested and setup by ForgeGradle.
129+
// If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"],
130+
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
131+
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
132+
133+
// Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings
134+
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
135+
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}")
136+
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}")
137+
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}")
138+
139+
// Example mod dependency using a mod jar from ./libs with a flat dir repository
140+
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
141+
// The group id is ignored when searching -- in this case, it is "blank"
139142
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
140143

141-
// For more info...
144+
// For more info:
142145
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
143146
// http://www.gradle.org/docs/current/userguide/dependency_management.html
144147
}
145148

149+
// This block of code expands all declared replace properties in the specified resource targets.
150+
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
151+
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
152+
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
153+
tasks.named('processResources', ProcessResources).configure {
154+
var replaceProperties = [
155+
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
156+
forge_version: forge_version, forge_version_range: forge_version_range,
157+
loader_version_range: loader_version_range,
158+
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
159+
mod_authors: mod_authors, mod_description: mod_description,
160+
]
161+
inputs.properties replaceProperties
162+
163+
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
164+
expand replaceProperties + [project: project]
165+
}
166+
}
167+
146168
// Example for how to get properties into the manifest for reading at runtime.
147-
jar {
169+
tasks.named('jar', Jar).configure {
148170
manifest {
149171
attributes([
150-
"Specification-Title" : "simpleircbridge",
151-
"Specification-Vendor" : "simpleircbridge",
152-
"Specification-Version" : "1", // We are version 1 of ourselves
153-
"Implementation-Title" : project.name,
154-
"Implementation-Version" : project.jar.archiveVersion,
155-
"Implementation-Vendor" : "simpleircbridge",
156-
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
172+
'Specification-Title' : mod_id,
173+
'Specification-Vendor' : mod_authors,
174+
'Specification-Version' : '1', // We are version 1 of ourselves
175+
'Implementation-Title' : project.name,
176+
'Implementation-Version' : project.jar.archiveVersion,
177+
'Implementation-Vendor' : mod_authors,
178+
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
157179
])
158180
}
181+
182+
// This is the preferred method to reobfuscate your jar file
183+
finalizedBy 'reobfJar'
159184
}
160185

161-
// Example configuration to allow publishing using the maven-publish plugin
162-
// This is the preferred method to reobfuscate your jar file
163-
jar.finalizedBy('reobfJar')
164-
// 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
165-
// publish.dependsOn('reobfJar')
186+
// 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:
187+
// tasks.named('publish').configure {
188+
// dependsOn 'reobfJar'
189+
// }
166190

191+
// Example configuration to allow publishing using the maven-publish plugin
167192
publishing {
168193
publications {
169-
mavenJava(MavenPublication) {
194+
register('mavenJava', MavenPublication) {
170195
artifact jar
171196
}
172197
}

gradle.properties

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,59 @@
11
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
22
# This is required to provide enough memory for the Minecraft decompilation process.
33
org.gradle.jvmargs=-Xmx3G
4-
org.gradle.daemon=false
4+
org.gradle.daemon=false
5+
6+
7+
## Environment Properties
8+
9+
# The Minecraft version must agree with the Forge version to get a valid artifact
10+
minecraft_version=1.20.1
11+
# The Minecraft version range can use any release version of Minecraft as bounds.
12+
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
13+
# as they do not follow standard versioning conventions.
14+
minecraft_version_range=[1.20.1,1.21)
15+
# The Forge version must agree with the Minecraft version to get a valid artifact
16+
forge_version=47.1.3
17+
# The Forge version range can use any version of Forge as bounds or match the loader version range
18+
forge_version_range=[47,)
19+
# The loader version range can only use the major version of Forge/FML as bounds
20+
loader_version_range=[47,)
21+
# The mapping channel to use for mappings.
22+
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
23+
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
24+
#
25+
# | Channel | Version | |
26+
# |-----------|----------------------|--------------------------------------------------------------------------------|
27+
# | official | MCVersion | Official field/method names from Mojang mapping files |
28+
# | parchment | YYYY.MM.DD-MCVersion | Open community-sourced parameter names and javadocs layered on top of official |
29+
#
30+
# You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
31+
# See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
32+
#
33+
# Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge.
34+
# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started
35+
mapping_channel=official
36+
# The mapping version to query from the mapping channel.
37+
# This must match the format required by the mapping channel.
38+
mapping_version=1.20.1
39+
40+
41+
## Mod Properties
42+
43+
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
44+
# Must match the String constant located in the main mod class annotated with @Mod.
45+
mod_id=simpleircbridge
46+
# The human-readable display name for the mod.
47+
mod_name=SimpleIRCBridge
48+
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
49+
mod_license=BSD-2-Clause
50+
# The mod version. See https://semver.org/
51+
mod_version=1.6.0
52+
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
53+
# This should match the base package used for the mod sources.
54+
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
55+
mod_group_id=simpleircbridge
56+
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
57+
mod_authors=xnrand & contributors
58+
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
59+
mod_description=This server-side mod allows you to relay all chat on the server to and from an IRC channel. Its configuration is kept very simple and its functionality is basic.

gradle/wrapper/gradle-wrapper.jar

1.99 KB
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
4+
networkTimeout=10000
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)