Skip to content

Commit 3d5a4d0

Browse files
committed
Setup
1 parent bc1a774 commit 3d5a4d0

29 files changed

+128
-487
lines changed

.editorconfig

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,10 @@ trim_trailing_whitespace = true
99
charset = utf-8
1010

1111
[*.md]
12-
indent_style = space
13-
indent_size = 2
1412
trim_trailing_whitespace = false
1513

16-
[*.json]
17-
indent_style = space
18-
indent_size = 2
19-
20-
[*.properties]
21-
indent_style = space
22-
indent_size = 2
23-
24-
[.editorconfig]
25-
indent_style = space
26-
2714
[*.java]
2815
ij_java_use_single_class_imports = true
2916
ij_continuation_indent_size = 8
3017
ij_java_class_count_to_use_import_on_demand = 999
31-
ij_java_names_count_to_use_import_on_demand = 999
32-
33-
[*.{yml,yaml}]
34-
indent_style = space
35-
indent_size = 2
18+
ij_java_names_count_to_use_import_on_demand = 999

.sc_active_version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.21.7-fabric
1+
1.21.11-fabric

README.md

Lines changed: 0 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -1,187 +0,0 @@
1-
# Stonecutter Mod Template
2-
3-
A multi-platform Minecraft mod template for **Fabric** and **NeoForge**,
4-
using [Stonecutter](https://stonecutter.kikugie.dev/) for
5-
multiversion and multiloader code.
6-
This is the Java-only version adapted from KikuGie's Elytra Trims
7-
rewrite following major Stonecutter feature updates.
8-
9-
This template is as "batteries included" as possible.
10-
If you don't like this, it's not the right template for
11-
you ([Alternative Templates](https://stonecutter.kikugie.dev/wiki/tips/multiloader)).
12-
13-
## Features
14-
15-
* Single codebase for both Fabric and NeoForge
16-
* Single codebase for multiple Minecraft versions
17-
* CI/CD with GitHub Actions for automated builds and releases
18-
* Separate build scripts for each platform
19-
20-
## Getting Started
21-
22-
### Prerequisites
23-
24-
* Knowledge of Fabric and NeoForge
25-
* Suitable IDE
26-
* Java 21 or higher
27-
* Git
28-
29-
### Initial Setup
30-
31-
#### 1. **Clone or use this template**
32-
33-
```bash
34-
git clone https://github.com/rotgruengelb/stonecutter-mod-template.git
35-
cd stonecutter-mod-template
36-
```
37-
38-
#### 2. **Open in your IDE**
39-
40-
Import the project as a Gradle project
41-
in your preferred IDE (e.g., IntelliJ IDEA, Eclipse).
42-
43-
#### 3. **Stonecutter IntelliJ plugin**
44-
45-
The IntelliJ plugin adds comment syntax highlighting and completion,
46-
a button to switch the active version, alongside other utilities.
47-
48-
#### 4. **Configure your mod**
49-
50-
Edit `gradle.properties` to set your mod's metadata:
51-
52-
| Property | Description | Example |
53-
|--------------------|----------------------------------------------|-------------------------------------------------------------------|
54-
| `mod.id` | Your mod’s identifier (lowercase, no spaces) | `modtemplate` |
55-
| `mod.name` | Display name of your mod | `Mod Template` |
56-
| `mod.group` | Java package group | `com.example` |
57-
| `mod.version` | Mod version number | `0.1.0` |
58-
| `mod.channel_tag` | Optional release channel tag | `-alpha.0` |
59-
| `mod.authors` | Name of the author(s), comma-separated | `AuthorName` |
60-
| `mod.contributors` | Contributor names, comma-separated | `ContributorName, AnotherContributorName` |
61-
| `mod.license` | License type | `MIT` |
62-
| `mod.description` | Short mod description | `Example Description` |
63-
| `mod.sources_url` | Link to your source code repository | `https://github.com/rotgruengelb/stonecutter-mod-template` |
64-
| `mod.homepage_url` | Mod homepage or info page | `https://github.com/rotgruengelb/stonecutter-mod-template` |
65-
| `mod.issues_url` | Link to issue tracker | `https://github.com/rotgruengelb/stonecutter-mod-template/issues` |
66-
| `mod.discord_url` | Link to a Discord invite | `https://discord.gg/aunYJB4wz9` |
67-
68-
Dependencies/Properties that are specific to a version/loader
69-
are defined in `gradle.properties` as `[VERSIONED]` then set in `versions/{version}-{loader}/gradle.properties`.
70-
71-
#### 5. **Rename package structure**
72-
73-
Rename the `com.example.modtemplate` package in
74-
`src/main/java/` to match your `mod.group` and `mod.id`.
75-
76-
#### 6. **Update resource files**
77-
78-
Rename these files to match your `mod.id`:
79-
80-
* `src/main/resources/modtemplate.accesswidener`
81-
* `src/main/resources/modtemplate.mixins.json`
82-
83-
Replace and `src/main/resources/assets/icon.png` and `.idea/icon.png` with the mods icon.
84-
85-
## Development
86-
87-
### Stonecutter
88-
89-
[Stonecutter](https://stonecutter.kikugie.dev/) allows multiple Minecraft versions and loaders in a single codebase.
90-
Configure Stonecutter in `stonecutter.gradle.kts` and `settings.gradle.kts`.
91-
92-
Example of platform-specific code using Stonecutter comments:
93-
94-
```java
95-
//? if fabric {
96-
/*fabricOnlyCode();*/
97-
//?} else {
98-
neoforgeOnlyCode();
99-
//?}
100-
```
101-
Verson-specific code works similarly:
102-
103-
```java
104-
//? if 1.21.7 {
105-
LOGGER.info("hello 1.21.7!");
106-
//?} else {
107-
/*LOGGER.info("hello from any other version!");
108-
*///?}
109-
```
110-
111-
For more details, read the [Stonecutter documentation](https://stonecutter.kikugie.dev/wiki/).
112-
113-
### Running in Development
114-
115-
The Gradle plugins of the respective platform should provide run configurations.
116-
If not, you can run the server and client with the respective Gradle tasks.
117-
Be careful to run the correct task for the selected Stonecutter platform and Minecraft version.
118-
119-
### Platform Abstraction
120-
121-
The template uses a platform abstraction pattern to keep shared code loader-agnostic:
122-
123-
* **Shared code** goes in `com.example.modtemplate` (no platform dependencies)
124-
* **Platform-specific code** goes in `com.example.modtemplate.platform.{fabric|neoforge}`
125-
* The `Platform` interface provides loader-specific functionality to shared code
126-
127-
### Adding Dependencies
128-
129-
To add dependencies for a specific platform, modify the `platform` block in the respective `build.gradle.kts` file.
130-
The declared dependencies are automatically added to the metadata file for the loader and when publishing the mod to
131-
mod hosting platforms.
132-
**Important:** This does not replace the `dependencies` block!
133-
134-
```kotlin
135-
platform {
136-
loader = "fabric" // or "neoforge"
137-
dependencies {
138-
required("my-lib") {
139-
slug("my-lib") // Mod hosting platform slug (here the slug is the same on both Modrinth and CurseForge)
140-
versionRange = ">=${prop("deps.my-lib")}" // version range (for fabric.mod.json)
141-
forgeVersionRange =
142-
"[${prop("deps.my-lib")},)" // version range (for neoforge mods.toml), uses Maven version range syntax
143-
}
144-
}
145-
}
146-
```
147-
148-
### Data Generation
149-
150-
Run Fabric data generation to create recipes, tags, and other data:
151-
152-
```bash
153-
./gradlew :1.21.7-fabric:runDatagen
154-
```
155-
156-
Generated files appear in `src/main/generated/`.
157-
The current setup uses Fabric data generation for both platforms.
158-
159-
## Resouerces and Links
160-
- [Stonecutter Documentation](https://stonecutter.kikugie.dev/wiki/)
161-
- [NeoForge Documentation](https://docs.neoforged.net/docs/gettingstarted/)
162-
- [Fabric Documentation](https://docs.fabricmc.net/develop/)
163-
- [Pre-commit](https://pre-commit.com/)
164-
- [Git Source Control](https://git-scm.com/doc)
165-
- [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
166-
- [Semantic Versioning](https://semver.org/)
167-
- [How to denote a pre-release version](https://semver.org/#spec-item-9)
168-
- [Your Modrinth PAT](https://modrinth.com/settings/pats)
169-
- [Your CurseForge API Tokens](https://legacy.curseforge.com/account/api-tokens)
170-
- [GitHub Actions Documentation](https://docs.github.com/en/actions)
171-
- [Gradle Documentation](https://docs.gradle.org/current/userguide/userguide.html)
172-
173-
### Help and Support
174-
For help and support, consider the following places:
175-
- ["Kiku's Realm" Discord Server](https://discord.kikugie.dev/) for Stonecutter-related questions.
176-
- ["Cascading Colors" (My) Discord Server](https://discord.gg/aunYJB4wz9) for questions about this template and its setup.
177-
- ["The NeoForge Project" Discord Server](https://github.com/neoforged) for NeoForge-related questions.
178-
- ["The Fabric Project" Discord Server](https://discord.gg/v6v4pMv) for Fabric-related questions.
179-
180-
## License/Credits
181-
182-
This template is provided under the MIT License.
183-
Check `LICENSE` for details.
184-
185-
* Based on [murderspagurder/mod-template-java](https://github.com/murderspagurder/mod-template-java)
186-
* Adapted from [KikuGie's Elytra Trims](https://github.com/kikugie/elytra-trims) setup
187-
* Uses [Stonecutter](https://stonecutter.kikugie.dev/) by KikuGie

build-logic/src/main/kotlin/ModPlatformPlugin.kt

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ abstract class ModPlatformPlugin @Inject constructor() : Plugin<Project> {
8080
dependsOn(tasks.named("stonecutterGenerate"))
8181
var contributors = prop("mod.contributors")
8282
var authors = prop("mod.authors")
83-
var issuesUrl = prop("mod.issues_url")
84-
if (issuesUrl == "") issuesUrl = prop("mod.sources_url") + "/issues"
83+
var issuesUrl = prop("mod.url.issues")
84+
if (issuesUrl == "") issuesUrl = prop("mod.url.sources") + "/issues"
8585

8686
if (isFabric) {
8787
contributors = contributors.replace(", ", "\", \"")
@@ -92,19 +92,24 @@ abstract class ModPlatformPlugin @Inject constructor() : Plugin<Project> {
9292

9393
val props = mapOf(
9494
"version" to modVersion,
95-
"minecraft" to mcVersion,
95+
96+
"group" to prop("mod.group"),
9697
"id" to modId,
9798
"name" to prop("mod.name"),
98-
"group" to prop("mod.group"),
99+
"description" to prop("mod.description"),
100+
"license" to prop("mod.license"),
101+
99102
"authors" to authors,
100103
"contributors" to contributors,
101-
"license" to prop("mod.license"),
102-
"description" to prop("mod.description"),
103-
"issues_url" to issuesUrl,
104-
"homepage_url" to prop("mod.homepage_url"),
105-
"sources_url" to prop("mod.sources_url"),
106-
"discord_url" to prop("mod.discord_url"),
107-
"dependencies" to dependencies
104+
105+
"url_sources" to prop("mod.url.sources"),
106+
"url_github_releases" to prop("mod.url.github_releases"),
107+
"url_homepage" to prop("mod.url.homepage"),
108+
"url_issues" to issuesUrl,
109+
"url_discord" to prop("mod.url.discord"),
110+
111+
"dependencies" to dependencies,
112+
"minecraft" to mcVersion
108113
)
109114

110115
when {

build.fabric.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ platform {
2121
}
2222

2323
loom {
24-
accessWidenerPath = rootProject.file("src/main/resources/${prop("mod.id")}.accesswidener")
2524
runs.named("client") {
2625
client()
2726
ideConfigGenerated(true)

gradle.properties

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,34 @@
1-
org.gradle.jvmargs=-Xmx2G
1+
# Gradle
2+
org.gradle.jvmargs=-Xmx4G
23
org.gradle.parallel=true
34
org.gradle.configuration-cache=false
45

5-
mod.id=modtemplate
6-
mod.name=Mod Template
7-
mod.group=com.example
6+
# Mod
87
mod.version=0.1.0
98
mod.channel_tag=-alpha.0
10-
mod.authors=AuthorName
11-
mod.contributors=ContributorName, AnotherContributorName
9+
10+
mod.group=dev.trigam
11+
mod.id=banner_tooltips
12+
mod.name=Improved Banner Tooltips
13+
mod.description=Improves the tooltips of banners.
1214
mod.license=MIT
13-
mod.description=Example Description
14-
mod.sources_url=https://github.com/rotgruengelb/stonecutter-mod-template
15-
mod.homepage_url=https://github.com/rotgruengelb/stonecutter-mod-template
16-
mod.issues_url=https://github.com/rotgruengelb/stonecutter-mod-template/issues
17-
mod.discord_url=https://discord.gg/aunYJB4wz9
1815

16+
mod.authors=Trigam, Spook Lass
17+
mod.contributors=
18+
19+
mod.url.sources=https://github.com/Team-Collections/improved_banner_tooltips
20+
mod.url.github_releases=https://github.com/Team-Collections/improved_banner_tooltips/releases
21+
mod.url.homepage=https://collections.trigam.dev/improved-banner-tooltips
22+
mod.url.issues=https://github.com/Team-Collections/improved_banner_tooltips/issues
23+
mod.url.discord=https://discord.com/invite/fHFzrpkQSq
24+
25+
# Dependencies
1926
deps.minecraft=[VERSIONED]
2027
deps.fabric-api=[VERSIONED]
2128
deps.neoforge=[VERSIONED]
2229
deps.modmenu=[VERSIONED]
2330

24-
publish.modrinth=EOBBpcat
31+
# Publishing
32+
publish.modrinth=
2533
publish.curseforge=
2634
publish.github=true

renovate.json.example

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"extends": [
4-
"config:recommended"
5-
]
6-
}
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"config:recommended"
5+
]
6+
}

settings.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ pluginManagement {
33
mavenLocal()
44
mavenCentral()
55
gradlePluginPortal()
6+
7+
// Loaders
68
maven("https://maven.fabricmc.net/") { name = "Fabric" }
79
maven("https://maven.neoforged.net/releases/") { name = "NeoForged" }
10+
11+
// Dependencies
812
maven("https://maven.kikugie.dev/snapshots") { name = "KikuGie Snapshots" }
913
maven("https://maven.kikugie.dev/releases") { name = "KikuGie Releases" }
1014
maven("https://maven.parchmentmc.org") { name = "ParchmentMC" }
@@ -22,6 +26,7 @@ stonecutter {
2226
fun match(version: String, vararg loaders: String) =
2327
loaders.forEach { version("$version-$it", version).buildscript = "build.$it.gradle.kts" }
2428

29+
match("1.21.11", "fabric")
2530
match("1.21.7", "fabric", "neoforge")
2631
match("1.21.1", "fabric", "neoforge")
2732

src/main/java/com/example/modtemplate/event/ExampleEventHandler.java

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/main/java/com/example/modtemplate/platform/fabric/FabricClientEntrypoint.java

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)