Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,23 @@ A template to allow easy usage of the Meteor Addon API.
To update this template to a newer Minecraft version, follow these steps:

1. Ensure a Meteor Client snapshot is available for the new Minecraft version.
2. Update `gradle.properties`:
- Set `minecraft_version`, `yarn_mappings` and `loader_version` to the new version.
- Update any additional dependencies accordingly.
2. Update `gradle/libs.versions.toml` (the versions catalog):
- Set the version entries to the new versions. Common keys to update are:
- `versions.minecraft` - Minecraft version
- `versions.yarn-mappings` - Yarn mappings
- `versions.fabric-loader` - Fabric loader version
- `versions.meteor` - Meteor Client snapshot version
- If your addon depends on other libraries listed under the `[libraries]` section, update their versions there as
needed.
- After editing, refresh Gradle dependencies and rebuild your project in the IDE.
3. Update Loom:
- Change the `loom_version` in `build.gradle.kts` to the latest version compatible with the new Minecraft version.
- Change the `loom` version in `gradle/libs.versions.toml` (the `versions.loom` entry) to the latest version
compatible with the new Minecraft version.
4. Update the Gradle wrapper:
- You can find the latest Gradle version [here](https://gradle.org/releases/).
- Run the `./gradlew wrapper --gradle-version <version>; ./gradlew wrapper` command to update the wrapper script.
- Run the wrapper update command for your platform. Examples:
- Unix / macOS / Windows (Powershell): `./gradlew wrapper --gradle-version <version> && ./gradlew wrapper`
- Windows (cmd.exe): `gradlew.bat wrapper --gradle-version <version> && gradlew.bat wrapper`
- This updates and regenerates the Gradle Wrapper scripts (`gradlew`, `gradlew.bat`, etc.) for the specified version.
5. Update your source code:
- Adjust for Minecraft or Yarn mapping changes: method names, imports, mixins, etc.
- Check for Meteor Client API changes that may affect your addon by comparing against the
Expand All @@ -60,6 +69,7 @@ To update this template to a newer Minecraft version, follow these steps:
│ │── dev_build.yml
│ ╰── pull_request.yml
│── gradle
│ │── libs.versions.toml
│ ╰── wrapper
│ │── gradle-wrapper.jar
│ ╰── gradle-wrapper.properties
Expand Down Expand Up @@ -97,8 +107,10 @@ This is the default project structure. Each folder/file has a specific purpose.
Here is a brief explanation of the ones you might need to modify:

- `.github/workflows`: Contains the GitHub Actions configuration files.
- `gradle`: Contains the Gradle wrapper files.
Edit the `gradle.properties` file to change the version of the Gradle wrapper.
- `gradle`: Contains the Gradle wrapper files and the versions catalog.
- `libs.versions.toml`: Defines version numbers for Minecraft, Loom, Meteor, and other dependencies.
- `wrapper`: Contains the Gradle wrapper executable files.
To update the Gradle wrapper executable itself, run the wrapper update command (examples are shown above).
- `src/main/java/com/example/addon`: Contains the main class of the addon.
Here you can register your custom commands, modules, and HUDs.
Edit the `getPackage` method to reflect the package of your addon.
Expand All @@ -115,8 +127,9 @@ Here is a brief explanation of the ones you might need to modify:
- `build.gradle.kts`: Contains the Gradle build script.
You can manage the dependencies of the addon here.
Remember to keep the `fabric-loom` version up-to-date.
- `gradle.properties`: Contains the properties of the Gradle build.
These will be used by the build script.
- `gradle.properties`: Contains additional build properties used by the build script
(for example `maven_group` and `archives_base_name`).
Dependency and platform version numbers are stored in `gradle/libs.versions.toml`.
- `LICENSE`: Contains the license of the addon.
You can edit this file to change the license of your addon.
- `README.md`: Contains the documentation of the addon.
Expand Down
14 changes: 7 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
plugins {
id("fabric-loom") version "1.11-SNAPSHOT"
alias(libs.plugins.fabric.loom)
}

base {
archivesName = properties["archives_base_name"] as String
version = properties["mod_version"] as String
version = libs.versions.mod.version.get()
group = properties["maven_group"] as String
}

Expand All @@ -21,19 +21,19 @@ repositories {

dependencies {
// Fabric
minecraft("com.mojang:minecraft:${properties["minecraft_version"] as String}")
mappings("net.fabricmc:yarn:${properties["yarn_mappings"] as String}:v2")
modImplementation("net.fabricmc:fabric-loader:${properties["loader_version"] as String}")
minecraft(libs.minecraft)
mappings(variantOf(libs.yarn) { classifier("v2") })
modImplementation(libs.fabric.loader)

// Meteor
modImplementation("meteordevelopment:meteor-client:${properties["minecraft_version"] as String}-SNAPSHOT")
modImplementation(libs.meteor.client)
}

tasks {
processResources {
val propertyMap = mapOf(
"version" to project.version,
"mc_version" to project.property("minecraft_version"),
"mc_version" to libs.versions.minecraft.get()
)

inputs.properties(propertyMap)
Expand Down
8 changes: 0 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
org.gradle.jvmargs=-Xmx2G
org.gradle.configuration-cache=false

# Fabric Properties (https://fabricmc.net/develop)
minecraft_version=1.21.10
yarn_mappings=1.21.10+build.2
loader_version=0.17.3

# Mod Properties
mod_version=0.1.0
maven_group=com.example
archives_base_name=addon-template

# Dependencies
29 changes: 29 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[versions]
mod-version = "0.1.0"

# Fabric (https://fabricmc.net/develop)
minecraft = "1.21.10"
yarn-mappings = "1.21.10+build.2"
fabric-loader = "0.17.3"

# Loom (https://github.com/FabricMC/fabric-loom)
loom = "1.12-SNAPSHOT"

# Meteor (https://github.com/MeteorDevelopment/meteor-client/)
meteor = "1.21.10-SNAPSHOT"

# Mods

[libraries]
# Fabric base
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
yarn = { module = "net.fabricmc:yarn", version.ref = "yarn-mappings" }
fabric-loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric-loader" }

# Meteor client
meteor-client = { module = "meteordevelopment:meteor-client", version.ref = "meteor" }

# Mods

[plugins]
fabric-loom = { id = "fabric-loom", version.ref = "loom" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ pluginManagement {
gradlePluginPortal()
}
}

rootProject.name = "addon-template"