mirror of
https://github.com/QuiltMC/quilt-template-mod
synced 2024-08-15 00:23:32 +00:00
Rework the template mod (#2)
This commit is contained in:
commit
d87251b7d3
16 changed files with 203 additions and 108 deletions
34
.editorconfig
Normal file
34
.editorconfig
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
tab_width = 4
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.gradle]
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
|
[*.java]
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
|
[*.json]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[quilt.mod.json]
|
||||||
|
indent_style = tab
|
||||||
|
tab_width = 2
|
||||||
|
|
||||||
|
[*.toml]
|
||||||
|
indent_style = tab
|
||||||
|
tab_width = 2
|
||||||
|
|
||||||
|
[*.properties]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[.editorconfig]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
31
.gitignore
vendored
31
.gitignore
vendored
|
@ -1,4 +1,27 @@
|
||||||
.idea
|
# Gradle
|
||||||
.gradle
|
.gradle/
|
||||||
build
|
build/
|
||||||
run
|
out/
|
||||||
|
classes/
|
||||||
|
|
||||||
|
# Quilt Loom
|
||||||
|
run/
|
||||||
|
|
||||||
|
# Eclipse
|
||||||
|
*.launch
|
||||||
|
|
||||||
|
# IntelliJ Idea
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
.settings/
|
||||||
|
.vscode/
|
||||||
|
bin/
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
|
||||||
|
# macOS
|
||||||
|
*.DS_Store
|
||||||
|
|
31
README.md
31
README.md
|
@ -1,12 +1,29 @@
|
||||||
# quilt-example-mod
|
# Quilt Example Mod
|
||||||
Official Quilt example mod.
|
|
||||||
|
|
||||||
|
The official Quilt example mod. You can use it as a template for your own mods!
|
||||||
|
|
||||||
## To use this template
|
## Usage
|
||||||
1. Click on `Use this Template`
|
|
||||||
2. Clone the resulted repo on your pc
|
In order to use this mod as a template:
|
||||||
3. Enjoy!
|
|
||||||
|
1. Create a new repository from this template with `Use this template`
|
||||||
|
2. Clone the recently-created repo on your PC
|
||||||
|
3. Make the necessary changes in order to make it yours:
|
||||||
|
- Update `gradle.properties` in order to use your Maven group and mod ID
|
||||||
|
- If you don't know which Maven group to use, and you are planning to host the mod's source code on GitHub, use `io.github.<Your_Username_Here>`
|
||||||
|
- Update `quilt.mod.json` in order to reflect your mod's metadata
|
||||||
|
- If you are planning to include (jar-in-jar) a mod, don't forget to declare its dependency on it!
|
||||||
|
- The icon provided here is a placeholder one. If you aren't able to replace it yet, you can delete it and remove the "icon" property
|
||||||
|
- Create a LICENSE file for this mod! If you don't know which license to use, check out [here](https://choosealicense.com/).
|
||||||
|
- If you use `LICENSE.md`, don't forget to update the buildscript in order to use that file name!
|
||||||
|
- On `quilt.mod.json`, don't forget to put in `"metadata"` a `"license"` property that contains the license's [SPDX identifier](https://spdx.org/licenses/).
|
||||||
|
- The GPLv3 and AGPLv3 are not valid mod licenses, so you can use almost any license except for those.
|
||||||
|
- Update the Java sub-directory structure so it reflects your Maven group
|
||||||
|
- If the dependencies on `gradle/libs.versions.toml` isn't up-to-date, feel free to update them! The linked utility should help you in this easy and quick process.
|
||||||
|
4. The mod is now ready to be worked on!
|
||||||
|
|
||||||
## License
|
## License
|
||||||
This template on the QuiltMC GitHub is licensed under the CC0 license.
|
|
||||||
|
This template on the QuiltMC GitHub is licensed under the [Creative Common Zero v1.0 license](./LICENSE-TEMPLATE.md).
|
||||||
|
|
||||||
Mods created with this template are not automatically licensed under the CC0, and are not required to give any kind of credit back to QuiltMC for this template.
|
Mods created with this template are not automatically licensed under the CC0, and are not required to give any kind of credit back to QuiltMC for this template.
|
||||||
|
|
75
build.gradle
75
build.gradle
|
@ -1,76 +1,83 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'org.quiltmc.loom' version '0.12-SNAPSHOT'
|
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
|
alias(libs.plugins.quilt.loom)
|
||||||
}
|
}
|
||||||
|
|
||||||
group = maven_group
|
archivesBaseName = project.archives_base_name
|
||||||
version = project.version
|
version = project.version
|
||||||
archivesBaseName = archives_base_name
|
group = project.maven_group
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
// Add repositories to retrieve artifacts from in here.
|
||||||
|
// You should only use this when depending on other mods because
|
||||||
|
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
||||||
|
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
||||||
|
// for more information about repositories.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// All the dependencies are declared at gradle/libs.version.toml and referenced with "libs.<id>"
|
||||||
|
// See https://docs.gradle.org/current/userguide/platforms.html for information on how version catalogs work.
|
||||||
dependencies {
|
dependencies {
|
||||||
// To change the versions see the gradle.properties file
|
minecraft libs.minecraft
|
||||||
minecraft "com.mojang:minecraft:$minecraft_version"
|
mappings loom.layered {
|
||||||
mappings( loom.layered {
|
addLayer quiltMappings.mappings("org.quiltmc:quilt-mappings:${libs.versions.quilt.mappings.get()}:v2")
|
||||||
addLayer quiltMappings.mappings( "org.quiltmc:quilt-mappings:$minecraft_version+build.$quilt_mappings:v2" )
|
// officialMojangMappings() // Uncomment if you want to use Mojang mappings as your primary mappings, falling back on QM for parameters and Javadocs
|
||||||
// addLayer loom.officialMojangMappings() // uncomment if you want mojmap too
|
}
|
||||||
})
|
modImplementation libs.quilt.loader
|
||||||
modImplementation "org.quiltmc:quilt-loader:$loader_version"
|
|
||||||
|
|
||||||
modImplementation "org.quiltmc:qsl:$qsl_version"
|
// QSL is not a complete API; You will need Quilted Fabric API to fill in the gaps.
|
||||||
|
// Quilted Fabric API will automatically pull in the correct QSL version.
|
||||||
// QSL is not a complete API; you need Quilted Fabric API to fill in the gaps.
|
modImplementation libs.quilted.fabric.api
|
||||||
modImplementation "org.quiltmc.quilted-fabric-api:quilted-fabric-api:$quilted_fapi_version-$minecraft_version"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
inputs.property 'version', version
|
inputs.property "version", version
|
||||||
inputs.property 'maven_group', maven_group
|
|
||||||
inputs.property 'loader_version', loader_version
|
|
||||||
inputs.property 'minecraft_version', minecraft_version
|
|
||||||
|
|
||||||
filesMatching('quilt.mod.json') {
|
filesMatching('quilt.mod.json') {
|
||||||
expand([
|
expand "version": version
|
||||||
'version': version,
|
|
||||||
'maven_group': maven_group,
|
|
||||||
'loader_version': loader_version,
|
|
||||||
'minecraft_version': minecraft_version,
|
|
||||||
'quilted_fabric_api_version': quilted_fapi_version
|
|
||||||
])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile).configureEach {
|
tasks.withType(JavaCompile).configureEach {
|
||||||
it.sourceCompatibility = 17 // for the IDE support
|
it.options.encoding = "UTF-8"
|
||||||
it.options.encoding = 'UTF-8'
|
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
|
||||||
it.options.release.set(17)
|
it.options.release = 17
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
// if this mod is gonna be a library, its better to generate javadocs too, uncomment this line to generate them
|
// Still required by IDEs such as Eclipse and Visual Studio Code
|
||||||
//withJavadocJar()
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
|
|
||||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task if it is present.
|
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task if it is present.
|
||||||
// If you remove this line, sources will not be generated.
|
// If you remove this line, sources will not be generated.
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
|
|
||||||
|
// If this mod is going to be a library, then it should also generate Javadocs in order to aid with developement.
|
||||||
|
// Uncomment this line to generate them.
|
||||||
|
// withJavadocJar()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If you plan to use a different file for the license, don't forget to change the file name here!
|
||||||
jar {
|
jar {
|
||||||
from('LICENSE') {
|
from("LICENSE") {
|
||||||
rename { "$it_$archivesBaseName"}
|
rename { "${it}_${archivesBaseName}" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Configure the maven publication
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
group 'com.examplemod'
|
|
||||||
from components.java
|
from components.java
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
// Add repositories to publish to here.
|
||||||
|
// Notice: This block does NOT have the same function as the block in the top level.
|
||||||
|
// The repositories here will be used for publishing your artifact, not for
|
||||||
|
// retrieving dependencies.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,10 @@
|
||||||
# gradle stuff
|
# Gradle Properties
|
||||||
org.gradle.jvmargs=-Xmx3G
|
org.gradle.jvmargs = -Xmx1G
|
||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
org.gradle.caching=true
|
|
||||||
# uncomment this is gradle doesn't want to use more workers
|
|
||||||
#org.gradle.workers.max=4
|
|
||||||
# Quilt Properties
|
|
||||||
# check these on https://lambdaurora.dev/tools/import_quilt.html
|
|
||||||
minecraft_version=1.18.2
|
|
||||||
quilt_mappings=22
|
|
||||||
loader_version=0.16.0-beta.7
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
version = 1.0.0
|
version = 1.0.0
|
||||||
maven_group = com.example
|
maven_group = com.example
|
||||||
archives_base_name=example-mod
|
archives_base_name = example_mod
|
||||||
# Dependencies
|
|
||||||
qsl_version=1.1.0-beta.2+1.18.2
|
# Dependencies are managed at gradle/libs.versions.toml
|
||||||
quilted_fapi_version=1.0.0-beta.5+0.48.0
|
|
||||||
|
|
21
gradle/libs.versions.toml
Normal file
21
gradle/libs.versions.toml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
[versions]
|
||||||
|
# The latest versions are available at https://lambdaurora.dev/tools/import_quilt.html
|
||||||
|
minecraft = "1.18.2"
|
||||||
|
quilt_mappings = "1.18.2+build.22"
|
||||||
|
quilt_loader = "0.16.0-beta.7"
|
||||||
|
|
||||||
|
quilted_fabric_api = "1.0.0-beta.6+0.51.1-1.18.2"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
|
||||||
|
quilt_mappings = { module = "org.quiltmc:quilt-mappings", version.ref = "quilt_mappings" }
|
||||||
|
quilt_loader = { module = "org.quiltmc:quilt-loader", version.ref = "quilt_loader" }
|
||||||
|
|
||||||
|
quilted_fabric_api = { module = "org.quiltmc.quilted-fabric-api:quilted-fabric-api", version.ref = "quilted_fabric_api" }
|
||||||
|
|
||||||
|
# If you have multiple similar dependencies, you can declare a dependency bundle and reference it on the build script with "libs.bundles.example".
|
||||||
|
# [bundles]
|
||||||
|
# example = ["example-a", "example-b", "example-c"]
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
quilt_loom = { id = "org.quiltmc.loom", version = "0.12.+" }
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
10
gradlew
vendored
10
gradlew
vendored
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright © 2015-2021 the original authors.
|
# Copyright © 2015-2021 the original authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -32,10 +32,10 @@
|
||||||
# Busybox and similar reduced shells will NOT work, because this script
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
# requires all of these POSIX shell features:
|
# requires all of these POSIX shell features:
|
||||||
# * functions;
|
# * functions;
|
||||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
# * compound commands having a testable exit status, especially «case»;
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
# * various built-in commands including «command», «set», and «ulimit».
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
#
|
#
|
||||||
# Important for patching:
|
# Important for patching:
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
maven { url 'https://maven.fabricmc.net' }
|
maven {
|
||||||
maven { url 'https://maven.quiltmc.org/repository/release' }
|
name = 'Quilt'
|
||||||
maven { url 'https://maven.quiltmc.org/repository/snapshot' }
|
url = 'https://maven.quiltmc.org/repository/release'
|
||||||
|
}
|
||||||
|
// Currently needed for Intermediary and other temporary dependencies
|
||||||
|
maven {
|
||||||
|
name = 'Fabric'
|
||||||
|
url = 'https://maven.fabricmc.net/'
|
||||||
|
}
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
mavenCentral()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
18
src/main/java/com/example/example_mod/ExampleMod.java
Normal file
18
src/main/java/com/example/example_mod/ExampleMod.java
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
package com.example.example_mod;
|
||||||
|
|
||||||
|
import org.quiltmc.loader.api.ModContainer;
|
||||||
|
import org.quiltmc.qsl.base.api.entrypoint.ModInitializer;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
public class ExampleMod implements ModInitializer {
|
||||||
|
// This logger is used to write text to the console and the log file.
|
||||||
|
// It is considered best practice to use your mod name as the logger's name.
|
||||||
|
// That way, it's clear which mod wrote info, warnings, and errors.
|
||||||
|
public static final Logger LOGGER = LoggerFactory.getLogger("Example Mod");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInitialize(ModContainer mod) {
|
||||||
|
LOGGER.info("Hello Quilt world from {} v{}!", mod.metadata().name(), mod.metadata().version().raw());
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
package com.examplemod.mixin;
|
package com.example.example_mod.mixin;
|
||||||
|
|
||||||
import com.examplemod.ExampleMod;
|
import com.example.example_mod.ExampleMod;
|
||||||
import net.minecraft.client.gui.screen.TitleScreen;
|
import net.minecraft.client.gui.screen.TitleScreen;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
|
@ -1,15 +0,0 @@
|
||||||
package com.examplemod;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
import org.quiltmc.loader.api.ModContainer;
|
|
||||||
import org.quiltmc.qsl.base.api.entrypoint.ModInitializer;
|
|
||||||
|
|
||||||
public class ExampleMod implements ModInitializer {
|
|
||||||
public static final Logger LOGGER = LogManager.getLogger("ExampleMod");
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onInitialize(ModContainer mod) {
|
|
||||||
LOGGER.info( "Hello Quilt world from ExampleMod v{}!", mod.metadata().version().raw() );
|
|
||||||
}
|
|
||||||
}
|
|
BIN
src/main/resources/assets/example_mod/icon.png
Normal file
BIN
src/main/resources/assets/example_mod/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"required": true,
|
"required": true,
|
||||||
"minVersion": "0.8",
|
"minVersion": "0.8",
|
||||||
"package": "com.examplemod.mixin",
|
"package": "com.example.example_mod.mixin",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"mixins": [],
|
"mixins": [],
|
||||||
"client": [
|
"client": [
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"schema_version": 1,
|
"schema_version": 1,
|
||||||
"quilt_loader": {
|
"quilt_loader": {
|
||||||
"group": "${maven_group}",
|
"group": "com.example",
|
||||||
"id": "examplemod",
|
"id": "example_mod",
|
||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "Mod Name",
|
"name": "Mod Name",
|
||||||
|
@ -10,33 +10,26 @@
|
||||||
"contributors": {
|
"contributors": {
|
||||||
"Me!": "Owner"
|
"Me!": "Owner"
|
||||||
},
|
},
|
||||||
"icon": "assets/examplemod/icon.png"
|
"icon": "assets/example_mod/icon.png"
|
||||||
},
|
},
|
||||||
"intermediate_mappings": "net.fabricmc:intermediary",
|
"intermediate_mappings": "net.fabricmc:intermediary",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"init": [
|
"init": "com.example.example_mod.ExampleMod"
|
||||||
"com.examplemod.ExampleMod"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"depends": [
|
"depends": [
|
||||||
{
|
{
|
||||||
"id": "quilt_loader",
|
"id": "quilt_loader",
|
||||||
"versions": ">=${loader_version}"
|
"versions": ">=0.16.0-"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "quilted_fabric_api",
|
"id": "quilted_fabric_api",
|
||||||
"versions": "${quilted_fabric_api_version}"
|
"versions": ">=1.0.0-"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "minecraft",
|
"id": "minecraft",
|
||||||
"versions": ">=${minecraft_version}"
|
"versions": ">=1.18.2"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixin": [
|
"mixin": "example_mod.mixins.json"
|
||||||
"examplemod.mixins.json"
|
|
||||||
],
|
|
||||||
"minecraft": {
|
|
||||||
"environment": "*"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue