Skip to content

Commit 21b0a74

Browse files
authored
Initial commit
0 parents  commit 21b0a74

File tree

16 files changed

+793
-0
lines changed

16 files changed

+793
-0
lines changed

.github/workflows/build.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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 Java versions, and provides a first line of defence against bad commits.
4+
5+
name: Build
6+
7+
on: [push, pull_request]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Repository
14+
uses: actions/checkout@v4
15+
with:
16+
persist-credentials: false
17+
18+
- name: Set up Gradle
19+
uses: gradle/actions/setup-gradle@v4
20+
21+
- name: Setup Java
22+
uses: actions/setup-java@v4
23+
with:
24+
distribution: "temurin"
25+
java-version: 21
26+
27+
- name: Build with Gradle
28+
run: ./gradlew build
29+
30+
- name: Upload a Build Artifact
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: template-mod
34+
path: build/libs/*.jar

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# gradle
2+
.gradle/
3+
build/
4+
out/
5+
classes/
6+
7+
# eclipse
8+
*.launch
9+
10+
# idea
11+
.idea/
12+
*.iml
13+
*.ipr
14+
*.iws
15+
16+
# vscode
17+
.settings/
18+
.vscode/
19+
bin/
20+
.classpath
21+
.project
22+
23+
# fabric
24+
run/
25+
26+
# macos
27+
*.DS_Store

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: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Legacy Fabric Template Mod
2+
3+
- [Quick start guide](#quick-start-guide)
4+
- [Introduction to the folder structure](#introduction-to-the-folder-structure)
5+
- [Creating your mod](#creating-your-mod)
6+
- [Useful gradle commands](#useful-gradle-commands)
7+
- [More info](#more-info)
8+
- [License](#license)
9+
10+
## Quick start guide
11+
12+
### Introduction to the folder structure
13+
14+
**Build files:**
15+
16+
| File | Description |
17+
|-----------------------| -------------------------------------------------------- |
18+
| `build.gradle.kts` | Configures the compilation process. |
19+
| `gradle.properties` | Contains properties for Minecraft, fabric, and your mod. |
20+
| `settings.gradle.kts` | Configures the plugin repositories. |
21+
22+
**Fabric files:**
23+
24+
These files are located at `src/main/resources`.
25+
26+
| File | Description | Additional information |
27+
|----------------------------| ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
28+
| `fabric.mod.json` | Contains metadata about your mod. | [wiki:fabric_mod_json_spec](https://fabricmc.net/wiki/documentation:fabric_mod_json_spec) |
29+
| `template-mod.mixins.json` | Contains a list of all your mixin files. | [wiki:mixin_registration](https://fabricmc.net/wiki/tutorial:mixin_registration) |
30+
| `assets/template/icon.png` | The icon of your mod. | [wiki:fabric_mod_json_spec#icon](https://fabricmc.net/wiki/documentation:fabric_mod_json_spec?s[]=icon#custom_fields) |
31+
32+
33+
### Creating your mod
34+
35+
First of you must replace all occurrences of `template-mod` with the id of your mod.
36+
37+
If your mod doesn't use mixins you can safely remove the mixin entry in your `fabric.mod.json` as well as delete any `*.mixin.json` files.
38+
39+
This template has the legacy fabric api included in its build script, more info about the api can be found at it's [github repo](https://github.com/Legacy-Fabric/fabric).
40+
If you know what you are doing you can also safely remove the api from the build script as it isn't required.
41+
42+
### Useful gradle commands
43+
44+
```sh
45+
# Compile your mod
46+
./gradlew build
47+
48+
# Remove old build files
49+
./gradlew clean
50+
51+
# Generate Minecraft sources
52+
./gradlew genSourcesWithVineflower
53+
54+
# Launch a modded Minecraft client
55+
./gradlew runClient
56+
57+
# Kill gradle if it's doing stupid things
58+
./gradlew --stop
59+
```
60+
61+
## More info
62+
63+
Additional tutorials and tips can be found in the [wiki](https://github.com/Legacy-Fabric/fabric-example-mod/wiki).
64+
65+
For more detailed setup instructions please see the [fabric wiki](https://fabricmc.net/wiki/tutorial:setup).
66+
67+
If you are new to fabric or Minecraft modding in general then [this wiki page](https://fabricmc.net/wiki/tutorial:primer) may help you.
68+
69+
## License
70+
71+
This template is available under the CC0 license. Feel free to learn from it and incorporate it in your own projects.

build.gradle.kts

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
plugins {
2+
id("fabric-loom") version "1.9-SNAPSHOT"
3+
id("legacy-looming") version "1.9-SNAPSHOT" // Version must be the same as fabric-loom's
4+
}
5+
6+
base {
7+
archivesName = properties["archives_base_name"] as String
8+
version = properties["mod_version"] as String
9+
group = properties["maven_group"] as String
10+
}
11+
12+
repositories {
13+
// Add repositories to retrieve artifacts from in here.
14+
// You should only use this when depending on other mods because
15+
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
16+
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
17+
// for more information about repositories.
18+
}
19+
20+
legacyLooming {
21+
// The generation of intermediary to use, default is 1.
22+
// legacy.yarn() will automatically point at the variant for the set intermediary generation.
23+
// However do not forget to set the right build number of legacy yarn as they are different per variant.
24+
// intermediaryVersion = 2
25+
26+
// Wether to use Legacy Fabric intermediaries or Upstream/Official FabricMC ones.
27+
// Default to true: use Legacy Fabric intermediaries.
28+
// If setting to false, don't forget to also set intermediaryVersion to generation 2.
29+
// useLFIntermediary.set(false)
30+
}
31+
32+
dependencies {
33+
minecraft("com.mojang:minecraft:${properties["minecraft_version"] as String}")
34+
mappings(legacy.yarn(properties["minecraft_version"] as String, properties["yarn_build"] as String))
35+
modImplementation("net.fabricmc:fabric-loader:${properties["loader_version"] as String}")
36+
37+
// Legacy Fabric API provides hooks for events, item registration, and more. As most mods will need this, it's included by default.
38+
// If you know for a fact you don't, it's not required and can be safely removed.
39+
// As of September 2024, available for MC 1.6.4, 1.7.10, 1.8, 1.8.9, 1.9.4, 1.10.2, 1.11.2 and 1.12.2.
40+
// As of September 2024, available only for intermediary generation 1.
41+
modImplementation("net.legacyfabric.legacy-fabric-api:legacy-fabric-api:${properties["fabric_version"] as String}")
42+
43+
// You can retrieve a specific api module using this notation.
44+
// modImplementation(legacy.apiModule("legacy-fabric-item-groups-v1", properties["fabric_version"] as String))
45+
}
46+
47+
tasks {
48+
processResources {
49+
val properties = mapOf(
50+
"version" to project.version
51+
)
52+
53+
filteringCharset = "UTF-8"
54+
55+
inputs.properties(properties)
56+
57+
filesMatching("fabric.mod.json") {
58+
expand(properties)
59+
}
60+
}
61+
62+
withType<JavaCompile> {
63+
// Ensure that the encoding is set to UTF-8, no matter what the system default is
64+
// this fixes some edge cases with special characters not displaying correctly
65+
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
66+
options.encoding = "UTF-8"
67+
options.release = 8
68+
}
69+
70+
java {
71+
sourceCompatibility = JavaVersion.VERSION_1_8
72+
targetCompatibility = JavaVersion.VERSION_1_8
73+
74+
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
75+
// if it is present.
76+
// If you remove this line, sources will not be generated.
77+
withSourcesJar()
78+
}
79+
80+
jar {
81+
val projectIdentifier = project.base.archivesName.get()
82+
from("LICENSE") {
83+
rename { "${it}_${projectIdentifier}" }
84+
}
85+
}
86+
}

gradle.properties

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Done to increase the memory available to gradle.
2+
org.gradle.jvmargs=-Xmx2G
3+
org.gradle.configuration-cache=true
4+
5+
# Fabric Properties
6+
# More versions available at: https://grayray75.github.io/LegacyFabric-Versions/
7+
minecraft_version = 1.8.9
8+
yarn_build = 551
9+
loader_version = 0.16.10
10+
11+
# Legacy Fabric API
12+
# Also available for mc 1.6.4, 1.7.10, 1.8, 1.9.4, 1.10.2, 1.11.2 and 1.12.2
13+
fabric_version = 1.10.2+1.8.9
14+
15+
# Mod Properties
16+
mod_version = 0.1.0
17+
maven_group = com.example
18+
archives_base_name = template-mod

gradle/wrapper/gradle-wrapper.jar

42.6 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)