Skip to content
This repository has been archived by the owner on Dec 28, 2024. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordyrat authored Sep 11, 2024
0 parents commit 63f0540
Show file tree
Hide file tree
Showing 26 changed files with 1,292 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .devauth/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
defaultEnabled = true
defaultAccount = "main"

[accounts.main]
type = "microsoft"

23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
indent_size = 4
indent_style = space
ij_any_block_comment_add_space = true
ij_any_line_comment_add_space = true
max_line_length = 140

[*.kt]
ij_kotlin_name_count_to_use_star_import = 2147483647
ij_kotlin_name_count_to_use_star_import_for_members = 2147483647
ij_kotlin_enum_constants_wrap = split_into_lines
ij_kotlin_allow_trailing_comma_on_call_site = true
ij_kotlin_allow_trailing_comma = true
ij_kotlin_packages_to_use_import_on_demand = unset s

[*.java]
ij_java_names_count_to_use_import_on_demand = 2147483647
ij_java_class_count_to_use_import_on_demand = 2147483647
ij_java_packages_to_use_import_on_demand = 2147483647
44 changes: 44 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build

on:
push:
branches:
- "*"
paths-ignore:
- ".gitignore"
pull_request:
branches:
- "*"
paths-ignore:
- ".gitignore"
workflow_dispatch:
permissions: write-all
jobs:
build:
runs-on: ubuntu-latest
name: "Build and test"
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: gradle
- name: Setup gradle
uses: gradle/gradle-build-action@v2
- name: Build with Gradle
run: ./gradlew build -x test --stacktrace
- uses: actions/upload-artifact@v3
name: Upload development build
with:
name: "Development Build"
path: build/libs/*.jar
- name: Test with Gradle
run: ./gradlew test
- uses: actions/upload-artifact@v3
name: "Upload test report"
if: ${{ !cancelled() }}
with:
name: "Test Results"
path: build/reports/tests/test/
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.idea/*
!.idea/icon.svg
.vscode/
run/
build/
bin/

# gradle
build
gradle.properties
.gradle

# other
.DS_STORE

.devauth/*
!.devauth/config.toml
24 changes: 24 additions & 0 deletions LICENSE
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/>
Empty file added README.md
Empty file.
237 changes: 237 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
import org.apache.commons.lang3.SystemUtils
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.ByteArrayOutputStream

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 "1.9.0"
kotlin("plugin.serialization") version "1.8.0"
id("com.bnorm.power.kotlin-power-assert") version "0.13.0"
}

val group = "com.examplemod"
val mixinGroup = "$group.mixin"

// the modid and version here are used on the compiled far
val modid = "examplemod"
val version = "0.0.1"

val skyHanniVersion = "0.27.Beta.4"

val gitHash by lazy {
val baos = ByteArrayOutputStream()
exec {
standardOutput = baos
commandLine("git", "rev-parse", "--short", "HEAD")
isIgnoreExitValue = true
}
baos.toByteArray().decodeToString().trim()
}

// Toolchains:
java {
toolchain.languageVersion.set(JavaLanguageVersion.of(8))
}

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()
mavenLocal()

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")
maven("https://jitpack.io") {
content {
includeGroupByRegex("com\\.github\\..*")
}
}
maven("https://repo.nea.moe/releases")
maven("https://maven.notenoughupdates.org/releases") // NotEnoughUpdates (dev env)
maven("https://maven.teamresourceful.com/repository/thatgravyboat/") // DiscordIPC
}

val shadowImpl: Configuration by configurations.creating {
configurations.implementation.get().extendsFrom(this)
}

val shadowModImpl: Configuration by configurations.creating {
configurations.modImplementation.get().extendsFrom(this)
}

val devenvMod: Configuration by configurations.creating {
isTransitive = false
isVisible = false
}

val headlessLwjgl by configurations.creating {
isTransitive = false
isVisible = false
}

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")

implementation(kotlin("stdlib-jdk8"))
headlessLwjgl(libs.headlessLwjgl)

// 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.4-SNAPSHOT")

implementation(kotlin("stdlib-jdk8"))

// If you don't want to log in with your real minecraft account, remove this line
runtimeOnly("me.djtheredstoner:DevAuth-forge-legacy:1.1.2")

modCompileOnly("com.github.hannibal002:notenoughupdates:4957f0b:all") {
exclude(module = "unspecified")
isTransitive = false
}
devenvMod("com.github.NotEnoughUpdates:NotEnoughUpdates:2.2.2:all") {
exclude(module = "unspecified")
isTransitive = false
}

modCompileOnly("com.github.hannibal002:SkyHanni:$skyHanniVersion:") {
exclude(group = "null", module = "unspecified")
isTransitive = false
}
devenvMod("com.github.hannibal002:SkyHanni:$skyHanniVersion:") {
exclude(group = "null", module = "unspecified")
isTransitive = false
}

shadowModImpl(libs.moulconfig)
shadowImpl("org.jetbrains.kotlin:kotlin-reflect:1.9.0")
}

kotlin {
sourceSets.all {
languageSettings {
languageVersion = "2.0"
enableLanguageFeature("BreakContinueInInlineLambdas")
}
}
}

// Minecraft configuration:
loom {
launchConfigs {
"client" {
property("mixin.debug", "true")
property("devauth.configDir", rootProject.file(".devauth").absolutePath)
arg("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker")
arg("--tweakClass", "io.github.notenoughupdates.moulconfig.tweaker.DevelopmentResourceTweaker")
arg("--mods", devenvMod.resolve().joinToString(",") { it.relativeTo(file("run")).path })
}
}
forge {
pack200Provider.set(dev.architectury.pack200.java.Pack200Adapter())
mixinConfig("mixins.$modid.json")
}
@Suppress("UnstableApiUsage")
mixin {
defaultRefmapName.set("mixins.$modid.refmap.json")
}
runConfigs {
"client" {
if (SystemUtils.IS_OS_MAC_OSX) {
vmArgs.remove("-XstartOnFirstThread")
}
vmArgs.add("-Xmx4G")
}
"server" {
isIdeConfigGenerated = false
}
}
}

tasks.processResources {
inputs.property("version", version)
filesMatching("mcmod.info") {
expand(
mapOf(
"modid" to modid,
"version" to version
)
)
}
}

tasks.compileJava {
dependsOn(tasks.processResources)
}

tasks.withType(JavaCompile::class) {
options.encoding = "UTF-8"
}


tasks.withType(Jar::class) {
destinationDirectory.set(project.layout.buildDirectory.dir("badjars"))
archiveBaseName.set("$modid")
manifest.attributes.run {
this["FMLCorePluginContainsFMLMod"] = "true"
this["ForceLoadAsMod"] = "true"

this["TweakClass"] = "org.spongepowered.asm.launch.MixinTweaker"
this["MixinConfigs"] = "mixins.$modid.json"
}
}

val remapJar by tasks.named<net.fabricmc.loom.task.RemapJarTask>("remapJar") {
archiveClassifier.set("")
from(tasks.shadowJar)
input.set(tasks.shadowJar.get().archiveFile)
}

tasks.shadowJar {
destinationDirectory.set(layout.buildDirectory.dir("badjars"))
archiveClassifier.set("all-dev")
configurations = listOf(shadowImpl, shadowModImpl)
doLast {
configurations.forEach {
println("Config: ${it.files}")
}
}
exclude("META-INF/versions/**")
mergeServiceFiles()
relocate("io.github.notenoughupdates.moulconfig", "$group.deps.moulconfig")
}

tasks.jar {
archiveClassifier.set("nodeps")
destinationDirectory.set(layout.buildDirectory.dir("badjars"))
}
tasks.assemble.get().dependsOn(tasks.remapJar)

val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
jvmTarget = "1.8"
}
val compileTestKotlin: KotlinCompile by tasks
compileTestKotlin.kotlinOptions {
jvmTarget = "1.8"
}
val sourcesJar by tasks.creating(Jar::class) {
destinationDirectory.set(layout.buildDirectory.dir("badjars"))
archiveClassifier.set("src")
from(sourceSets.main.get().allSource)
}
12 changes: 12 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[versions]
libautoupdate = "1.3.1"
moulconfig = "3.0.0-beta.7"
headlessLwjgl = "1.7.2"
jbAnnotations = "24.1.0"

[libraries]
moulconfig = { module = "org.notenoughupdates.moulconfig:legacy", version.ref = "moulconfig" }
libautoupdate = { module = "moe.nea:libautoupdate", version.ref = "libautoupdate" }
headlessLwjgl = { module = "com.github.3arthqu4ke.HeadlessMc:headlessmc-lwjgl", version.ref = "headlessLwjgl" }
jbAnnotations = { module = "org.jetbrains:annotations", version.ref = "jbAnnotations" }
hotswapagentforge = { module = "moe.nea:hotswapagent-forge", version = "1.0.1" }
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 63f0540

Please sign in to comment.