Skip to content

Commit 8a1d436

Browse files
authored
Initial commit
0 parents  commit 8a1d436

22 files changed

+975
-0
lines changed

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
gradlew* linguist-vendored
2+
gradle/wrapper/* linguist-vendored
3+
*.bat text eol=crlf
4+

.github/workflows/build.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Run Gradle Build
2+
on:
3+
- push
4+
- pull_request
5+
6+
jobs:
7+
gradle:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout source
11+
uses: actions/[email protected]
12+
13+
- name: Setup Java
14+
uses: actions/[email protected]
15+
with:
16+
distribution: temurin
17+
java-version: 17
18+
19+
- name: Setup Gradle
20+
uses: gradle/actions/setup-gradle@v4
21+
22+
- name: Execute Gradle build
23+
run: ./gradlew build
24+
25+
- name: Upload built mod JAR
26+
uses: actions/[email protected]
27+
with:
28+
name: mod-jar
29+
path: build/libs/*.jar
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: "Validate Gradle Wrapper"
2+
on: [push, pull_request]
3+
4+
jobs:
5+
validation:
6+
name: "Validation"
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/[email protected]
10+
- uses: gradle/actions/wrapper-validation@v4

.github/workflows/init.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Initialize Template Repo
2+
on:
3+
- push
4+
5+
permissions:
6+
contents: write
7+
8+
jobs:
9+
cleanup:
10+
name: "Initialize Repo"
11+
runs-on: ubuntu-latest
12+
if: github.event.repository.name != 'Forge1.8.9Template'
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/[email protected]
16+
- name: Initialize Repo
17+
run: |
18+
git config --local user.email "[email protected]"
19+
git config --local user.name "GitHub Action"
20+
owner=$(echo $GITHUB_REPOSITORY | cut -d/ -f1 | tr '[:upper:]' '[:lower:]')
21+
name=$(echo $GITHUB_REPOSITORY | cut -d/ -f2 | tr '[:upper:]' '[:lower:]' | tr -d "-" | tr -d ".")
22+
pack_name="com.github.${owner,,}.${name,,}"
23+
proj_name="$(echo $GITHUB_REPOSITORY | cut -d/ -f2)"
24+
modid="$(echo $name | sed 's/[^a-z]//g')"
25+
./make-my-own.sh "$pack_name" "$proj_name" "$modid"
26+
git add .
27+
git commit -F- <<EOF
28+
Initialize template repository proper
29+
30+
Set package name to $pack_name
31+
Set project name to $proj_name
32+
Set modid to $modid
33+
EOF
34+
- name: Push changes
35+
uses: ad-m/[email protected]
36+
with:
37+
branch: ${{ github.ref }}
38+
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

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

LICENSE

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
This is free and unencumbered software released into the public domain.
2+
3+
Anyone is free to copy, modify, publish, use, compile, sell, or
4+
distribute this software, either in source code form or as a compiled
5+
binary, for any purpose, commercial or non-commercial, and by any
6+
means.
7+
8+
In jurisdictions that recognize copyright laws, the author or authors
9+
of this software dedicate any and all copyright interest in the
10+
software to the public domain. We make this dedication for the benefit
11+
of the public at large and to the detriment of our heirs and
12+
successors. We intend this dedication to be an overt act of
13+
relinquishment in perpetuity of all present and future rights to this
14+
software under copyright law.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.
23+
24+
For more information, please refer to <http://unlicense.org/>

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Architectury Loom based template for 1.8.9 forge mods
2+
3+
**For other templates, do check out the [other branches of this repository](https://github.com/romangraef/Forge1.8.9Template/branches/all)**
4+
5+
## Usage
6+
7+
Check out https://moddev.nea.moe/ for a full tutorial on legacy modding.
8+
9+
Alternatively, read here for a basic overview on how to use this repository.
10+
11+
To get started, [Use this template](https://github.com/new?template_name=Forge1.8.9Template&template_owner=nea89o).
12+
13+
> [!WARNING]
14+
> Do not Fork or Clone or Download ZIP this template. If you "use" this template a custom mod id will be generated. You can do that manually using the `make-my-own` script, if you are on linux. If not, just click the use this template button. If you want to use kotlin or make a 1.12 mod check the "Include all branches" and change the default branch in https://github.com/yourname/yourreponame/branches
15+
16+
This project uses [DevAuth](https://github.com/DJtheRedstoner/DevAuth) per default, so you can log in using your real
17+
minecraft account. If you don't need that, you can remove it from the buildscript.
18+
19+
To run the mod you will need two JDKs, one Java 17 jdk and one Java 1.8 jdk. You can download those
20+
from [here](https://adoptium.net/temurin/releases) (or use your own downloads).
21+
22+
When you import your project into IntelliJ, you need to set the gradle jvm to the Java 17 JDK in the gradle tab, and the
23+
Project SDK to the Java 1.8 JDK. Then click on the sync button in IntelliJ, and it should create a run task
24+
called `Minecraft Client`. If it doesn't then try relaunching your IntelliJ. **Warning for Mac users**: You might have to remove the `-XStartOnFirstThread` vm argument from your run configuration. In the future, that should be handled by the plugin, but for now you'll probably have to do that manually.
25+
26+
To export your project, run the `gradle build` task, and give other people the
27+
file `build/libs/<modid>-<version>.jar`. Ignore the jars in the `build/badjars` folder. Those are intermediary jars that
28+
are used by the build system but *do not work* in a normal forge installation.
29+
30+
If you don't want mixins (which allow for modifying vanilla code), then you can remove the references to mixins from
31+
the `build.gradle.kts` at the lines specified with comments and the `com.example.mixin` package.
32+
33+
If you don't want access transformers (which allow for making methods public/non-final) you can delete the
34+
`accesstransformer.cfg` file. If you make a change to the `accesstransformers.cfg` you might need to rebuild your
35+
project using `./gradlew build --refresh-dependencies`.
36+
37+
### For those who have not an attention span
38+
39+
[![Youtube Tutorial](https://i.ytimg.com/vi/nWzHlomdCgc/maxresdefault.jpg)](https://www.youtube.com/watch?v=nWzHlomdCgc)
40+
41+
## Licensing
42+
43+
This template is licensed under the Unlicense (license copy present in this repository), or alternatively under [Creative Commons 1.0 Universal (CC0 1.0)](https://creativecommons.org/publicdomain/zero/1.0/), and all contributions and PR to this template are expected to follow this. This means your mod, based on this template can be licensed whatever way you want, and does not need to reference back to this template in any way.

build.gradle.kts

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
import org.apache.commons.lang3.SystemUtils
2+
3+
plugins {
4+
idea
5+
java
6+
id("gg.essential.loom") version "0.10.0.+"
7+
id("dev.architectury.architectury-pack200") version "0.1.3"
8+
id("com.github.johnrengelman.shadow") version "8.1.1"
9+
}
10+
11+
//Constants:
12+
13+
val baseGroup: String by project
14+
val mcVersion: String by project
15+
val version: String by project
16+
val mixinGroup = "$baseGroup.mixin"
17+
val modid: String by project
18+
val transformerFile = file("src/main/resources/accesstransformer.cfg")
19+
20+
// Toolchains:
21+
java {
22+
toolchain.languageVersion.set(JavaLanguageVersion.of(8))
23+
}
24+
25+
// Minecraft configuration:
26+
loom {
27+
log4jConfigs.from(file("log4j2.xml"))
28+
launchConfigs {
29+
"client" {
30+
// If you don't want mixins, remove these lines
31+
property("mixin.debug", "true")
32+
arg("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker")
33+
}
34+
}
35+
runConfigs {
36+
"client" {
37+
if (SystemUtils.IS_OS_MAC_OSX) {
38+
// This argument causes a crash on macOS
39+
vmArgs.remove("-XstartOnFirstThread")
40+
}
41+
}
42+
remove(getByName("server"))
43+
}
44+
forge {
45+
pack200Provider.set(dev.architectury.pack200.java.Pack200Adapter())
46+
// If you don't want mixins, remove this lines
47+
mixinConfig("mixins.$modid.json")
48+
if (transformerFile.exists()) {
49+
println("Installing access transformer")
50+
accessTransformer(transformerFile)
51+
}
52+
}
53+
// If you don't want mixins, remove these lines
54+
mixin {
55+
defaultRefmapName.set("mixins.$modid.refmap.json")
56+
}
57+
}
58+
59+
sourceSets.main {
60+
output.setResourcesDir(sourceSets.main.flatMap { it.java.classesDirectory })
61+
}
62+
63+
// Dependencies:
64+
65+
repositories {
66+
mavenCentral()
67+
maven("https://repo.spongepowered.org/maven/")
68+
// If you don't want to log in with your real minecraft account, remove this line
69+
maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1")
70+
}
71+
72+
val shadowImpl: Configuration by configurations.creating {
73+
configurations.implementation.get().extendsFrom(this)
74+
}
75+
76+
dependencies {
77+
minecraft("com.mojang:minecraft:1.8.9")
78+
mappings("de.oceanlabs.mcp:mcp_stable:22-1.8.9")
79+
forge("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9")
80+
81+
// If you don't want mixins, remove these lines
82+
shadowImpl("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
83+
isTransitive = false
84+
}
85+
annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT")
86+
87+
// If you don't want to log in with your real minecraft account, remove this line
88+
runtimeOnly("me.djtheredstoner:DevAuth-forge-legacy:1.2.1")
89+
90+
}
91+
92+
// Tasks:
93+
94+
tasks.withType(JavaCompile::class) {
95+
options.encoding = "UTF-8"
96+
}
97+
98+
tasks.withType(org.gradle.jvm.tasks.Jar::class) {
99+
archiveBaseName.set(modid)
100+
manifest.attributes.run {
101+
this["FMLCorePluginContainsFMLMod"] = "true"
102+
this["ForceLoadAsMod"] = "true"
103+
104+
// If you don't want mixins, remove these lines
105+
this["TweakClass"] = "org.spongepowered.asm.launch.MixinTweaker"
106+
this["MixinConfigs"] = "mixins.$modid.json"
107+
if (transformerFile.exists())
108+
this["FMLAT"] = "${modid}_at.cfg"
109+
}
110+
}
111+
112+
tasks.processResources {
113+
inputs.property("version", project.version)
114+
inputs.property("mcversion", mcVersion)
115+
inputs.property("modid", modid)
116+
inputs.property("basePackage", baseGroup)
117+
118+
filesMatching(listOf("mcmod.info", "mixins.$modid.json")) {
119+
expand(inputs.properties)
120+
}
121+
122+
rename("accesstransformer.cfg", "META-INF/${modid}_at.cfg")
123+
}
124+
125+
126+
val remapJar by tasks.named<net.fabricmc.loom.task.RemapJarTask>("remapJar") {
127+
archiveClassifier.set("")
128+
from(tasks.shadowJar)
129+
input.set(tasks.shadowJar.get().archiveFile)
130+
}
131+
132+
tasks.jar {
133+
archiveClassifier.set("without-deps")
134+
destinationDirectory.set(layout.buildDirectory.dir("intermediates"))
135+
}
136+
137+
tasks.shadowJar {
138+
destinationDirectory.set(layout.buildDirectory.dir("intermediates"))
139+
archiveClassifier.set("non-obfuscated-with-deps")
140+
configurations = listOf(shadowImpl)
141+
doLast {
142+
configurations.forEach {
143+
println("Copying dependencies into mod: ${it.files}")
144+
}
145+
}
146+
147+
// If you want to include other dependencies and shadow them, you can relocate them in here
148+
fun relocate(name: String) = relocate(name, "$baseGroup.deps.$name")
149+
}
150+
151+
tasks.assemble.get().dependsOn(tasks.remapJar)
152+

gradle.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
loom.platform=forge
2+
org.gradle.jvmargs=-Xmx2g
3+
baseGroup = com.example
4+
mcVersion = 1.8.9
5+
modid = examplemod
6+
version = 1.0.0

gradle/wrapper/gradle-wrapper.jar

42.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)