Skip to content

Commit 8635722

Browse files
committed
Architectury port
1 parent 906daa9 commit 8635722

53 files changed

Lines changed: 2089 additions & 1629 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.gradle

Lines changed: 70 additions & 207 deletions
Original file line numberDiff line numberDiff line change
@@ -1,207 +1,70 @@
1-
plugins {
2-
id 'eclipse'
3-
id 'idea'
4-
id 'maven-publish'
5-
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
6-
}
7-
8-
version = mod_version
9-
group = mod_group_id
10-
11-
base {
12-
archivesName = mod_id
13-
}
14-
15-
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
16-
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
17-
18-
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
19-
minecraft {
20-
// The mappings can be changed at any time and must be in the following format.
21-
// Channel: Version:
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
24-
//
25-
// You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
26-
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
27-
//
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-
//
31-
// Use non-default mappings at your own risk. They may not always work.
32-
// Simply re-run your setup task after changing the mappings to update your workspace.
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')
57-
58-
// Default run configurations.
59-
// These can be tweaked, removed, or duplicated as needed.
60-
runs {
61-
// applies to all the run configs below
62-
configureEach {
63-
workingDirectory project.file('run')
64-
65-
// Recommended logging data for a userdev environment
66-
// The markers can be added/remove as needed separated by commas.
67-
// "SCAN": For mods scan.
68-
// "REGISTRIES": For firing of registry events.
69-
// "REGISTRYDUMP": For getting the contents of all registries.
70-
property 'forge.logging.markers', 'REGISTRIES'
71-
72-
// Recommended logging level for the console
73-
// You can set various levels here.
74-
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
75-
property 'forge.logging.console.level', 'debug'
76-
77-
mods {
78-
"${mod_id}" {
79-
source sourceSets.main
80-
}
81-
}
82-
}
83-
84-
client {
85-
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
86-
property 'forge.enabledGameTestNamespaces', mod_id
87-
}
88-
89-
server {
90-
property 'forge.enabledGameTestNamespaces', mod_id
91-
args '--nogui'
92-
}
93-
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
99-
}
100-
101-
data {
102-
// example of overriding the workingDirectory set in configureEach above
103-
workingDirectory project.file('run-data')
104-
105-
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
106-
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
107-
}
108-
}
109-
}
110-
111-
// Include resources generated by data generators.
112-
sourceSets.main.resources { srcDir 'src/generated/resources' }
113-
114-
repositories {
115-
// Put repositories for dependencies here
116-
// ForgeGradle automatically adds the Forge maven and Maven Central for you
117-
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
120-
// flatDir {
121-
// dir 'libs'
122-
// }
123-
}
124-
125-
dependencies {
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"
142-
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
143-
144-
// For more info:
145-
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
146-
// http://www.gradle.org/docs/current/userguide/dependency_management.html
147-
}
148-
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-
168-
// Example for how to get properties into the manifest for reading at runtime.
169-
tasks.named('jar', Jar).configure {
170-
manifest {
171-
attributes([
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")
179-
])
180-
}
181-
182-
// This is the preferred method to reobfuscate your jar file
183-
finalizedBy 'reobfJar'
184-
}
185-
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-
// }
190-
191-
// Example configuration to allow publishing using the maven-publish plugin
192-
publishing {
193-
publications {
194-
register('mavenJava', MavenPublication) {
195-
artifact jar
196-
}
197-
}
198-
repositories {
199-
maven {
200-
url "file://${project.projectDir}/mcmodsrepo"
201-
}
202-
}
203-
}
204-
205-
tasks.withType(JavaCompile).configureEach {
206-
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
207-
}
1+
plugins {
2+
id 'dev.architectury.loom' version '1.6-SNAPSHOT' apply false
3+
id 'architectury-plugin' version '3.4-SNAPSHOT'
4+
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
5+
}
6+
7+
architectury {
8+
minecraft = project.minecraft_version
9+
}
10+
11+
allprojects {
12+
group = rootProject.maven_group
13+
version = rootProject.mod_version
14+
}
15+
16+
subprojects {
17+
apply plugin: 'dev.architectury.loom'
18+
apply plugin: 'architectury-plugin'
19+
apply plugin: 'maven-publish'
20+
21+
base {
22+
// Set up a suffixed format for the mod jar names, e.g. `example-fabric`.
23+
archivesName = "$rootProject.archives_name-$project.name"
24+
}
25+
26+
repositories {
27+
// Add repositories to retrieve artifacts from in here.
28+
// You should only use this when depending on other mods because
29+
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
30+
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
31+
// for more information about repositories.
32+
}
33+
34+
dependencies {
35+
minecraft "net.minecraft:minecraft:$rootProject.minecraft_version"
36+
mappings loom.officialMojangMappings()
37+
}
38+
39+
java {
40+
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
41+
// if it is present.
42+
// If you remove this line, sources will not be generated.
43+
withSourcesJar()
44+
45+
sourceCompatibility = JavaVersion.VERSION_17
46+
targetCompatibility = JavaVersion.VERSION_17
47+
}
48+
49+
tasks.withType(JavaCompile).configureEach {
50+
it.options.release = 17
51+
}
52+
53+
// Configure Maven publishing.
54+
publishing {
55+
publications {
56+
mavenJava(MavenPublication) {
57+
artifactId = base.archivesName.get()
58+
from components.java
59+
}
60+
}
61+
62+
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
63+
repositories {
64+
// Add repositories to publish to here.
65+
// Notice: This block does NOT have the same function as the block in the top level.
66+
// The repositories here will be used for publishing your artifact, not for
67+
// retrieving dependencies.
68+
}
69+
}
70+
}

common/build.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
architectury {
2+
common rootProject.enabled_platforms.split(',')
3+
}
4+
5+
dependencies {
6+
// We depend on Fabric Loader here to use the Fabric @Environment annotations,
7+
// which get remapped to the correct annotations on each platform.
8+
// Do NOT use other classes from Fabric Loader.
9+
modImplementation "net.fabricmc:fabric-loader:$rootProject.fabric_loader_version"
10+
11+
// Architectury API. This is optional, and you can comment it out if you don't need it.
12+
modImplementation "dev.architectury:architectury:$rootProject.architectury_api_version"
13+
14+
api("com.electronwill.night-config:toml:$rootProject.nightconfig_version")
15+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package net.stonebound.simpleircbridge;
2+
3+
import net.stonebound.simpleircbridge.simpleircbridge.SimpleIRCBridgeCommon;
4+
5+
public final class SimpleIRCBridge {
6+
public static final String MOD_ID = "simpleircbridge";
7+
8+
public static void init() {
9+
new SimpleIRCBridgeCommon();
10+
}
11+
}

0 commit comments

Comments
 (0)