-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9aa3aea
Showing
23 changed files
with
999 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
gradlew* linguist-vendored | ||
gradle/wrapper/* linguist-vendored | ||
*.bat text eol=crlf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Run Gradle Build | ||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
gradle: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source | ||
uses: actions/[email protected] | ||
|
||
- name: Setup Java | ||
uses: actions/[email protected] | ||
with: | ||
distribution: temurin | ||
java-version: 17 | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v3 | ||
|
||
- name: Execute Gradle build | ||
run: ./gradlew build | ||
|
||
- name: Upload built mod JAR | ||
uses: actions/[email protected] | ||
with: | ||
name: mod-jar | ||
path: build/libs/*.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: "Validate Gradle Wrapper" | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
validation: | ||
name: "Validation" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
- uses: gradle/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Initialize Template Repo | ||
on: | ||
- push | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
cleanup: | ||
name: "Initialize Repo" | ||
runs-on: ubuntu-latest | ||
if: github.event.repository.name != 'Forge1.8.9Template' | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/[email protected] | ||
- name: Initialize Repo | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
owner=$(echo $GITHUB_REPOSITORY | cut -d/ -f1 | tr '[:upper:]' '[:lower:]') | ||
name=$(echo $GITHUB_REPOSITORY | cut -d/ -f2 | tr '[:upper:]' '[:lower:]' | tr -d "-" | tr -d ".") | ||
pack_name="com.github.${owner,,}.${name,,}" | ||
proj_name="$(echo $GITHUB_REPOSITORY | cut -d/ -f2)" | ||
modid="$(echo $name | sed 's/[^a-z]//g')" | ||
./make-my-own.sh "$pack_name" "$proj_name" "$modid" | ||
git add . | ||
git commit -F- <<EOF | ||
Initialize template repository proper | ||
Set package name to $pack_name | ||
Set project name to $proj_name | ||
Set modid to $modid | ||
EOF | ||
- name: Push changes | ||
uses: ad-m/[email protected] | ||
with: | ||
branch: ${{ github.ref }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.idea/ | ||
.vscode/ | ||
run/ | ||
build/ | ||
.gradle/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
This is free and unencumbered software released into the public domain. | ||
|
||
Anyone is free to copy, modify, publish, use, compile, sell, or | ||
distribute this software, either in source code form or as a compiled | ||
binary, for any purpose, commercial or non-commercial, and by any | ||
means. | ||
|
||
In jurisdictions that recognize copyright laws, the author or authors | ||
of this software dedicate any and all copyright interest in the | ||
software to the public domain. We make this dedication for the benefit | ||
of the public at large and to the detriment of our heirs and | ||
successors. We intend this dedication to be an overt act of | ||
relinquishment in perpetuity of all present and future rights to this | ||
software under copyright law. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
For more information, please refer to <http://unlicense.org/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
Architectury Loom based template for 1.8.9 kotlin forge mods | ||
|
||
**For other templates, do check out the [other branches of this repository](https://github.com/romangraef/Forge1.8.9Template/branches/all)** | ||
|
||
## Usage | ||
|
||
Check out https://moddev.nea.moe/ for a full tutorial on legacy modding. | ||
|
||
Alternatively, read here for a basic overview on how to use this repository. | ||
|
||
To get started, [Use this template](https://github.com/new?template_name=Forge1.8.9Template&template_owner=nea89o). | ||
|
||
> [!WARNING] | ||
> 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 | ||
Please note that Mixins should be kept in their own package, and should exclusively be written in Java, since older versions | ||
of Mixin don't play well with Kotlin. | ||
|
||
This project uses [DevAuth](https://github.com/DJtheRedstoner/DevAuth) per default, so you can log in using your real | ||
minecraft account. If you don't need that, you can remove it from the buildscript. | ||
|
||
To run the mod you will need two JDKs, one Java 17 jdk and one Java 1.8 jdk. You can download those | ||
from [here](https://adoptium.net/temurin/releases) (or use your own downloads). | ||
|
||
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 | ||
Project SDK to the Java 1.8 JDK. Then click on the sync button in IntelliJ, and it should create a run task | ||
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. | ||
|
||
To export your project, run the `gradle build` task, and give other people the | ||
file `build/libs/<modid>-<version>.jar`. Ignore the jars in the `build/badjars` folder. Those are intermediary jars that | ||
are used by the build system but *do not work* in a normal forge installation. | ||
|
||
If you don't want mixins (which allow for modifying vanilla code), then you can remove the references to mixins from | ||
the `build.gradle.kts` at the lines specified with comments and the `com.example.mixin` package. | ||
|
||
If you don't want access transformers (which allow for making methods public/non-final) you can delete the | ||
`accesstransformer.cfg` file. If you make a change to the `accesstransformers.cfg` you might need to rebuild your | ||
project using `./gradlew build --refresh-dependencies`. | ||
|
||
### For those who have not an attention span | ||
|
||
[](https://www.youtube.com/watch?v=nWzHlomdCgc) | ||
|
||
## Licensing | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
import org.apache.commons.lang3.SystemUtils | ||
|
||
plugins { | ||
idea | ||
java | ||
id("gg.essential.loom") version "0.10.0.+" | ||
id("dev.architectury.architectury-pack200") version "0.1.3" | ||
id("com.github.johnrengelman.shadow") version "8.1.1" | ||
kotlin("jvm") version "2.0.0" | ||
} | ||
|
||
//Constants: | ||
|
||
val baseGroup: String by project | ||
val mcVersion: String by project | ||
val version: String by project | ||
val mixinGroup = "$baseGroup.mixin" | ||
val modid: String by project | ||
val transformerFile = file("src/main/resources/accesstransformer.cfg") | ||
|
||
// Toolchains: | ||
java { | ||
toolchain.languageVersion.set(JavaLanguageVersion.of(8)) | ||
} | ||
|
||
// Minecraft configuration: | ||
loom { | ||
log4jConfigs.from(file("log4j2.xml")) | ||
launchConfigs { | ||
"client" { | ||
// If you don't want mixins, remove these lines | ||
property("mixin.debug", "true") | ||
arg("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker") | ||
} | ||
} | ||
runConfigs { | ||
"client" { | ||
if (SystemUtils.IS_OS_MAC_OSX) { | ||
// This argument causes a crash on macOS | ||
vmArgs.remove("-XstartOnFirstThread") | ||
} | ||
} | ||
remove(getByName("server")) | ||
} | ||
forge { | ||
pack200Provider.set(dev.architectury.pack200.java.Pack200Adapter()) | ||
// If you don't want mixins, remove this lines | ||
mixinConfig("mixins.$modid.json") | ||
if (transformerFile.exists()) { | ||
println("Installing access transformer") | ||
accessTransformer(transformerFile) | ||
} | ||
} | ||
// If you don't want mixins, remove these lines | ||
mixin { | ||
defaultRefmapName.set("mixins.$modid.refmap.json") | ||
} | ||
} | ||
|
||
tasks.compileJava { | ||
dependsOn(tasks.processResources) | ||
} | ||
|
||
sourceSets.main { | ||
output.setResourcesDir(sourceSets.main.flatMap { it.java.classesDirectory }) | ||
java.srcDir(layout.projectDirectory.dir("src/main/kotlin")) | ||
kotlin.destinationDirectory.set(java.destinationDirectory) | ||
} | ||
|
||
// Dependencies: | ||
|
||
repositories { | ||
mavenCentral() | ||
maven("https://repo.spongepowered.org/maven/") | ||
// If you don't want to log in with your real minecraft account, remove this line | ||
maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1") | ||
} | ||
|
||
val shadowImpl: Configuration by configurations.creating { | ||
configurations.implementation.get().extendsFrom(this) | ||
} | ||
|
||
dependencies { | ||
minecraft("com.mojang:minecraft:1.8.9") | ||
mappings("de.oceanlabs.mcp:mcp_stable:22-1.8.9") | ||
forge("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9") | ||
|
||
shadowImpl(kotlin("stdlib-jdk8")) | ||
|
||
// If you don't want mixins, remove these lines | ||
shadowImpl("org.spongepowered:mixin:0.7.11-SNAPSHOT") { | ||
isTransitive = false | ||
} | ||
annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT") | ||
|
||
// If you don't want to log in with your real minecraft account, remove this line | ||
runtimeOnly("me.djtheredstoner:DevAuth-forge-legacy:1.2.1") | ||
|
||
} | ||
|
||
// Tasks: | ||
|
||
tasks.withType(JavaCompile::class) { | ||
options.encoding = "UTF-8" | ||
} | ||
|
||
tasks.withType(org.gradle.jvm.tasks.Jar::class) { | ||
archiveBaseName.set(modid) | ||
manifest.attributes.run { | ||
this["FMLCorePluginContainsFMLMod"] = "true" | ||
this["ForceLoadAsMod"] = "true" | ||
|
||
// If you don't want mixins, remove these lines | ||
this["TweakClass"] = "org.spongepowered.asm.launch.MixinTweaker" | ||
this["MixinConfigs"] = "mixins.$modid.json" | ||
if (transformerFile.exists()) | ||
this["FMLAT"] = "${modid}_at.cfg" | ||
} | ||
} | ||
|
||
tasks.processResources { | ||
inputs.property("version", project.version) | ||
inputs.property("mcversion", mcVersion) | ||
inputs.property("modid", modid) | ||
inputs.property("basePackage", baseGroup) | ||
|
||
filesMatching(listOf("mcmod.info", "mixins.$modid.json")) { | ||
expand(inputs.properties) | ||
} | ||
|
||
rename("accesstransformer.cfg", "META-INF/${modid}_at.cfg") | ||
} | ||
|
||
|
||
val remapJar by tasks.named<net.fabricmc.loom.task.RemapJarTask>("remapJar") { | ||
archiveClassifier.set("") | ||
from(tasks.shadowJar) | ||
input.set(tasks.shadowJar.get().archiveFile) | ||
} | ||
|
||
tasks.jar { | ||
archiveClassifier.set("without-deps") | ||
destinationDirectory.set(layout.buildDirectory.dir("intermediates")) | ||
} | ||
|
||
tasks.shadowJar { | ||
destinationDirectory.set(layout.buildDirectory.dir("intermediates")) | ||
archiveClassifier.set("non-obfuscated-with-deps") | ||
configurations = listOf(shadowImpl) | ||
doLast { | ||
configurations.forEach { | ||
println("Copying dependencies into mod: ${it.files}") | ||
} | ||
} | ||
|
||
// If you want to include other dependencies and shadow them, you can relocate them in here | ||
fun relocate(name: String) = relocate(name, "$baseGroup.deps.$name") | ||
} | ||
|
||
tasks.assemble.get().dependsOn(tasks.remapJar) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
loom.platform=forge | ||
org.gradle.jvmargs=-Xmx2g | ||
baseGroup = com.example | ||
mcVersion = 1.8.9 | ||
modid = examplemod | ||
version = 1.0.0 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.