Skip to content
This repository was archived by the owner on Jul 29, 2026. It is now read-only.

Commit 1996934

Browse files
authored
Initial commit
0 parents  commit 1996934

20 files changed

Lines changed: 955 additions & 0 deletions

.editorconfig

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
tab_width = 4
8+
trim_trailing_whitespace = true
9+
10+
[*.md]
11+
trim_trailing_whitespace = false
12+
13+
[*.gradle.kts]
14+
indent_style = tab
15+
16+
[*.java]
17+
indent_style = tab
18+
19+
[*.json]
20+
indent_style = space
21+
indent_size = 2
22+
23+
[fabric.mod.json]
24+
indent_style = tab
25+
tab_width = 2
26+
27+
[*.properties]
28+
indent_style = space
29+
indent_size = 2

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* text=auto eol=lf
2+
gradlew text eol=lf
3+
*.bat text eol=crlf
4+
*.cmd text eol=crlf
5+
gradle-wrapper.jar -text -diff -merge -filter

.github/workflows/build.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Automatically build the project and run any configured tests for every push
2+
# and submitted pull request. This can help catch issues that only occur on
3+
# certain platforms or Java versions, and provides a first line of defence
4+
# against bad commits.
5+
6+
name: build
7+
on: [pull_request, push]
8+
9+
jobs:
10+
build:
11+
strategy:
12+
matrix:
13+
# Use these Java versions
14+
java: [
15+
21, # Current Java LTS & minimum supported by Minecraft
16+
]
17+
# and run on both Linux and Windows
18+
os: [ubuntu-latest, windows-latest]
19+
runs-on: ${{ matrix.os }}
20+
steps:
21+
- name: checkout repository
22+
uses: actions/checkout@v6
23+
- name: validate gradle wrapper
24+
uses: gradle/actions/wrapper-validation@v5
25+
- name: setup jdk ${{ matrix.java }}
26+
uses: actions/setup-java@v5
27+
with:
28+
java-version: ${{ matrix.java }}
29+
distribution: 'temurin'
30+
cache: gradle
31+
- name: make gradle wrapper executable
32+
if: ${{ runner.os != 'Windows' }}
33+
run: chmod +x ./gradlew
34+
- name: build
35+
run: ./gradlew build
36+
- name: capture build artifacts
37+
if: ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only upload artifacts built from latest java on one OS
38+
uses: actions/upload-artifact@v6
39+
with:
40+
name: Artifacts
41+
path: build/libs/

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.gradle/
2+
.idea/
3+
.vscode/
4+
bin/
5+
build/
6+
out/
7+
run/
8+
run-server/

LICENSE

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
Creative Commons Legal Code
2+
3+
CC0 1.0 Universal
4+
5+
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6+
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7+
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8+
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9+
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10+
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11+
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12+
HEREUNDER.
13+
14+
Statement of Purpose
15+
16+
The laws of most jurisdictions throughout the world automatically confer
17+
exclusive Copyright and Related Rights (defined below) upon the creator
18+
and subsequent owner(s) (each and all, an "owner") of an original work of
19+
authorship and/or a database (each, a "Work").
20+
21+
Certain owners wish to permanently relinquish those rights to a Work for
22+
the purpose of contributing to a commons of creative, cultural and
23+
scientific works ("Commons") that the public can reliably and without fear
24+
of later claims of infringement build upon, modify, incorporate in other
25+
works, reuse and redistribute as freely as possible in any form whatsoever
26+
and for any purposes, including without limitation commercial purposes.
27+
These owners may contribute to the Commons to promote the ideal of a free
28+
culture and the further production of creative, cultural and scientific
29+
works, or to gain reputation or greater distribution for their Work in
30+
part through the use and efforts of others.
31+
32+
For these and/or other purposes and motivations, and without any
33+
expectation of additional consideration or compensation, the person
34+
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35+
is an owner of Copyright and Related Rights in the Work, voluntarily
36+
elects to apply CC0 to the Work and publicly distribute the Work under its
37+
terms, with knowledge of his or her Copyright and Related Rights in the
38+
Work and the meaning and intended legal effect of CC0 on those rights.
39+
40+
1. Copyright and Related Rights. A Work made available under CC0 may be
41+
protected by copyright and related or neighboring rights ("Copyright and
42+
Related Rights"). Copyright and Related Rights include, but are not
43+
limited to, the following:
44+
45+
i. the right to reproduce, adapt, distribute, perform, display,
46+
communicate, and translate a Work;
47+
ii. moral rights retained by the original author(s) and/or performer(s);
48+
iii. publicity and privacy rights pertaining to a person's image or
49+
likeness depicted in a Work;
50+
iv. rights protecting against unfair competition in regards to a Work,
51+
subject to the limitations in paragraph 4(a), below;
52+
v. rights protecting the extraction, dissemination, use and reuse of data
53+
in a Work;
54+
vi. database rights (such as those arising under Directive 96/9/EC of the
55+
European Parliament and of the Council of 11 March 1996 on the legal
56+
protection of databases, and under any national implementation
57+
thereof, including any amended or successor version of such
58+
directive); and
59+
vii. other similar, equivalent or corresponding rights throughout the
60+
world based on applicable law or treaty, and any national
61+
implementations thereof.
62+
63+
2. Waiver. To the greatest extent permitted by, but not in contravention
64+
of, applicable law, Affirmer hereby overtly, fully, permanently,
65+
irrevocably and unconditionally waives, abandons, and surrenders all of
66+
Affirmer's Copyright and Related Rights and associated claims and causes
67+
of action, whether now known or unknown (including existing as well as
68+
future claims and causes of action), in the Work (i) in all territories
69+
worldwide, (ii) for the maximum duration provided by applicable law or
70+
treaty (including future time extensions), (iii) in any current or future
71+
medium and for any number of copies, and (iv) for any purpose whatsoever,
72+
including without limitation commercial, advertising or promotional
73+
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74+
member of the public at large and to the detriment of Affirmer's heirs and
75+
successors, fully intending that such Waiver shall not be subject to
76+
revocation, rescission, cancellation, termination, or any other legal or
77+
equitable action to disrupt the quiet enjoyment of the Work by the public
78+
as contemplated by Affirmer's express Statement of Purpose.
79+
80+
3. Public License Fallback. Should any part of the Waiver for any reason
81+
be judged legally invalid or ineffective under applicable law, then the
82+
Waiver shall be preserved to the maximum extent permitted taking into
83+
account Affirmer's express Statement of Purpose. In addition, to the
84+
extent the Waiver is so judged Affirmer hereby grants to each affected
85+
person a royalty-free, non transferable, non sublicensable, non exclusive,
86+
irrevocable and unconditional license to exercise Affirmer's Copyright and
87+
Related Rights in the Work (i) in all territories worldwide, (ii) for the
88+
maximum duration provided by applicable law or treaty (including future
89+
time extensions), (iii) in any current or future medium and for any number
90+
of copies, and (iv) for any purpose whatsoever, including without
91+
limitation commercial, advertising or promotional purposes (the
92+
"License"). The License shall be deemed effective as of the date CC0 was
93+
applied by Affirmer to the Work. Should any part of the License for any
94+
reason be judged legally invalid or ineffective under applicable law, such
95+
partial invalidity or ineffectiveness shall not invalidate the remainder
96+
of the License, and in such case Affirmer hereby affirms that he or she
97+
will not (i) exercise any of his or her remaining Copyright and Related
98+
Rights in the Work or (ii) assert any associated claims and causes of
99+
action with respect to the Work, in either case contrary to Affirmer's
100+
express Statement of Purpose.
101+
102+
4. Limitations and Disclaimers.
103+
104+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
105+
surrendered, licensed or otherwise affected by this document.
106+
b. Affirmer offers the Work as-is and makes no representations or
107+
warranties of any kind concerning the Work, express, implied,
108+
statutory or otherwise, including without limitation warranties of
109+
title, merchantability, fitness for a particular purpose, non
110+
infringement, or the absence of latent or other defects, accuracy, or
111+
the present or absence of errors, whether or not discoverable, all to
112+
the greatest extent permissible under applicable law.
113+
c. Affirmer disclaims responsibility for clearing rights of other persons
114+
that may apply to the Work or any use thereof, including without
115+
limitation any person's Copyright and Related Rights in the Work.
116+
Further, Affirmer disclaims responsibility for obtaining any necessary
117+
consents, permissions or other rights required for any use of the
118+
Work.
119+
d. Affirmer understands and acknowledges that Creative Commons is not a
120+
party to this document and has no duty or obligation with respect to
121+
this CC0 or use of the Work.

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Example Mod
2+
3+
Template for making Babric mods for BTA!
4+
5+
**Note: *DO NOT fork this repository unless you want to contribute!***
6+
7+
## Prerequisites
8+
- JDK for Java 21 ([Eclipse Temurin](https://adoptium.net/temurin/releases/) recommended)
9+
- [Intellij IDEA](https://www.jetbrains.com/idea/download/) (Scroll down for the free community edition, if using linux **DO NOT** use the flatpak distribution)
10+
- Minecraft Development plugin (Optional, but highly recommended)
11+
12+
## Setup instructions
13+
14+
15+
1. Click the `Use this template` button on this repo's page above (Will only appear if logged in). Choose `Create a new repository`, you will be redirected to a new page. Enter your repo's name and description, and hit `Create repository`.
16+
To get your project, open IntelliJ IDEA and click `Clone Repository` (`Get from VCS` on older versions). Select `Repository URL` and enter your repo's url
17+
18+
2. After the project has finished importing, close it and open it again.
19+
If that does not work, open the right sidebar with `Gradle` on it, open `Tasks` > `fabric` and run `ideaSyncTask`.
20+
21+
3. Create a new run configuration by going in `Run > Edit Configurations`.
22+
Then click on the plus icon and select Gradle. In the `Tasks and Arguments` field enter `build`.
23+
Running it will build your finished jar files and put them in `build/libs/`.
24+
25+
4. Lastly, open `File` > `Settings` and head to `Build, Execution, Development` > `Build Tools` > `Gradle`.
26+
Make sure `Build and run using` and `Run tests using` is set to `Gradle`.
27+
28+
5. Done! Now, all that's left is to change every mention of `examplemod` and `turniplabs` to your own mod id and mod group, respectively. Happy modding!
29+
30+
## Tips
31+
32+
1. If you haven't already you should join the BTA modding discord! https://discord.gg/FTUNJhswBT
33+
2. You can set your username when launching the client run configuration by setting `--username <username>` in your program arguments.
34+
3. When launching the server run configuration you may want to remove the `nogui` program argument in order to see the regular server GUI.
35+
4. In Intellij you can double press shift or press ctrl+N to search class files, change the search from the default `Project Files` to `All Places` you can easily explore the classes for your dependencies and even BTA itself.
36+
5. In Intellij if ctrl+left-click on a field or method you can quickly get information on when and where that field or method is assign or used.
37+
6. Ensure IntelliJ is updated to the latest version. This is important because this template uses the latest Gradle version and if your IntelliJ installation is outdated, it may not support the latest version.
38+
7. In the `examplemod.mixins.json` you'll see `"compatibilityLevel": "JAVA_${java}",` along with an error message from the `Minecraft Development` plugin stating `Cannot resolve compatibility level 'JAVA_${java}'`. You can safely ignore this. The Gradle build system has been set up to grab the Java version from your `gradle.properties` and replace `${java}` with it. So the compiled binary will properly have it as `JAVA_8`.
39+

build.gradle.kts

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
import com.smushytaco.lwjgl_gradle.Preset
2+
plugins {
3+
alias(libs.plugins.loom)
4+
alias(libs.plugins.lwjgl)
5+
java
6+
}
7+
val modVersion: Provider<String> = providers.gradleProperty("mod_version")
8+
val modGroup: Provider<String> = providers.gradleProperty("mod_group")
9+
val modName: Provider<String> = providers.gradleProperty("mod_name")
10+
11+
val javaVersion: Provider<Int> = libs.versions.java.map { it.toInt() }
12+
13+
base.archivesName = modName
14+
group = modGroup.get()
15+
version = modVersion.get()
16+
loom {
17+
customMinecraftMetadata.set("https://downloads.betterthanadventure.net/bta-client/${libs.versions.btaChannel.get()}/v${libs.versions.bta.get()}/manifest.json")
18+
}
19+
repositories {
20+
mavenCentral()
21+
maven("https://jitpack.io")
22+
maven("https://maven.fabricmc.net/") { name = "Fabric" }
23+
maven("https://maven.thesignalumproject.net/infrastructure") { name = "SignalumMavenInfrastructure" }
24+
maven("https://maven.thesignalumproject.net/releases") { name = "SignalumMavenReleases" }
25+
ivy("https://github.com/Better-than-Adventure") {
26+
patternLayout { artifact("[organisation]/releases/download/v[revision]/[module].jar") }
27+
metadataSources { artifact() }
28+
}
29+
ivy("https://downloads.betterthanadventure.net/bta-client/${libs.versions.btaChannel.get()}/") {
30+
patternLayout { artifact("/v[revision]/client.jar") }
31+
metadataSources { artifact() }
32+
}
33+
ivy("https://downloads.betterthanadventure.net/bta-server/${libs.versions.btaChannel.get()}/") {
34+
patternLayout { artifact("/v[revision]/server.jar") }
35+
metadataSources { artifact() }
36+
}
37+
ivy("https://piston-data.mojang.com") {
38+
patternLayout { artifact("v1/[organisation]/[revision]/[module].jar") }
39+
metadataSources { artifact() }
40+
}
41+
}
42+
lwjgl {
43+
version = libs.versions.lwjgl
44+
implementation(Preset.MINIMAL_OPENGL)
45+
}
46+
dependencies {
47+
minecraft("::${libs.versions.bta.get()}")
48+
49+
runtimeOnly(libs.clientJar)
50+
implementation(libs.loader)
51+
// If you do not need Halplibe you can comment out or delete this line.
52+
implementation(libs.halplibe)
53+
implementation(libs.modMenu)
54+
implementation(libs.legacyLwjgl)
55+
56+
implementation(libs.slf4jApi)
57+
implementation(libs.guava)
58+
implementation(libs.log4j.slf4j2.impl)
59+
implementation(libs.log4j.core)
60+
implementation(libs.log4j.api)
61+
implementation(libs.log4j.api12)
62+
implementation(libs.gson)
63+
64+
implementation(libs.commonsLang3)
65+
include(libs.commonsLang3)
66+
}
67+
java {
68+
toolchain {
69+
languageVersion = javaVersion.map { JavaLanguageVersion.of(it) }
70+
vendor = JvmVendorSpec.ADOPTIUM
71+
}
72+
sourceCompatibility = JavaVersion.toVersion(javaVersion.get())
73+
targetCompatibility = JavaVersion.toVersion(javaVersion.get())
74+
withSourcesJar()
75+
}
76+
val licenseFile = run {
77+
val rootLicense = layout.projectDirectory.file("LICENSE")
78+
val parentLicense = layout.projectDirectory.file("../LICENSE")
79+
when {
80+
rootLicense.asFile.exists() -> {
81+
logger.lifecycle("Using LICENSE from project root: {}", rootLicense.asFile)
82+
rootLicense
83+
}
84+
parentLicense.asFile.exists() -> {
85+
logger.lifecycle("Using LICENSE from parent directory: {}", parentLicense.asFile)
86+
parentLicense
87+
}
88+
else -> {
89+
logger.warn("No LICENSE file found in project or parent directory.")
90+
null
91+
}
92+
}
93+
}
94+
tasks {
95+
withType<JavaCompile>().configureEach {
96+
options.encoding = "UTF-8"
97+
sourceCompatibility = javaVersion.get().toString()
98+
targetCompatibility = javaVersion.get().toString()
99+
if (javaVersion.get() > 8) options.release = javaVersion
100+
}
101+
named<UpdateDaemonJvm>("updateDaemonJvm") {
102+
languageVersion = libs.versions.gradleJava.map { JavaLanguageVersion.of(it.toInt()) }
103+
vendor = JvmVendorSpec.ADOPTIUM
104+
}
105+
withType<JavaExec>().configureEach { defaultCharacterEncoding = "UTF-8" }
106+
withType<Javadoc>().configureEach { options.encoding = "UTF-8" }
107+
withType<Test>().configureEach { defaultCharacterEncoding = "UTF-8" }
108+
withType<Jar>().configureEach {
109+
licenseFile?.let {
110+
from(it) {
111+
rename { original -> "${original}_${archiveBaseName.get()}" }
112+
}
113+
}
114+
}
115+
processResources {
116+
val resourceMap = mapOf(
117+
"version" to modVersion.get(),
118+
"fabricloader" to libs.versions.loader.get(),
119+
"halplibe" to libs.versions.halplibe.get(),
120+
"java" to libs.versions.java.get(),
121+
"modmenu" to libs.versions.modMenu.get()
122+
)
123+
inputs.properties(resourceMap)
124+
filesMatching("fabric.mod.json") { expand(resourceMap) }
125+
filesMatching("**/*.mixins.json") { expand(resourceMap.filterKeys { it == "java" }) }
126+
}
127+
}
128+
// Removes LWJGL2 dependencies
129+
configurations.configureEach { exclude(group = "org.lwjgl.lwjgl") }

gradle.properties

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
##########################################################################
2+
# Standard Properties
3+
org.gradle.jvmargs = -Xmx2G
4+
org.gradle.warning.mode = all
5+
# This currently has to be set to false because the "Minecraft Client" and "Minecraft Server" configurations generated
6+
# by IntelliJ aren't currently compatible with the configuration cache. If you use the runClient and runServer Gradle
7+
# tasks instead, then this can (and should) be set to true.
8+
org.gradle.configuration-cache = false
9+
##########################################################################
10+
# Mod Properties
11+
mod_version = 1.0.0
12+
mod_group = turniplabs
13+
mod_name = examplemod
14+
##########################################################################
15+
# Plugin Dependency
16+
# Check this on https://plugins.gradle.org/plugin/org.gradle.toolchains.foojay-resolver-convention/
17+
foojay_resolver_version = 1.0.0
18+
##########################################################################

0 commit comments

Comments
 (0)