-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
43 changed files
with
815 additions
and
99 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
changes: | ||
- fix auto gui scaling looking broken with weird window sizes | ||
- fix auto gui scaling looking broken with weird window sizes | ||
- **add support for forge & neoforge!!!!** |
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
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
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,8 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
kotlin("jvm") version "2.0.20" | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} |
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,32 @@ | ||
import org.gradle.api.Project | ||
import org.gradle.api.artifacts.dsl.RepositoryHandler | ||
import org.gradle.kotlin.dsl.maven | ||
import org.gradle.language.jvm.tasks.ProcessResources | ||
|
||
val Project.mod: ModData get() = ModData(this) | ||
fun Project.prop(key: String): String? = findProperty(key)?.toString() | ||
fun String.upperCaseFirst() = replaceFirstChar { if (it.isLowerCase()) it.uppercaseChar() else it } | ||
|
||
fun RepositoryHandler.strictMaven(url: String, alias: String, vararg groups: String) = exclusiveContent { | ||
forRepository { maven(url) { name = alias } } | ||
filter { groups.forEach(::includeGroup) } | ||
} | ||
|
||
fun ProcessResources.properties(files: Iterable<String>, vararg properties: Pair<String, Any>) { | ||
for ((name, value) in properties) inputs.property(name, value) | ||
filesMatching(files) { | ||
expand(properties.toMap()) | ||
} | ||
} | ||
|
||
@JvmInline | ||
value class ModData(private val project: Project) { | ||
val id: String get() = requireNotNull(project.prop("mod.id")) { "Missing 'mod.id'" } | ||
val name: String get() = requireNotNull(project.prop("mod.name")) { "Missing 'mod.name'" } | ||
val version: String get() = requireNotNull(project.prop("mod.version")) { "Missing 'mod.version'" } | ||
val version_name: String get() = requireNotNull(project.prop("mod.version_name")) { "Missing 'mod.version_name'" } | ||
val maven_group: String get() = requireNotNull(project.prop("mod.maven_group")) { "Missing 'mod.maven_group'" } | ||
|
||
fun prop(key: String) = requireNotNull(project.prop("mod.$key")) { "Missing 'mod.$key'" } | ||
fun dep(key: String) = requireNotNull(project.prop("deps.$key")) { "Missing 'deps.$key'" } | ||
} |
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,128 @@ | ||
@file:Suppress("UnstableApiUsage") | ||
|
||
plugins { | ||
id("dev.architectury.loom") | ||
id("architectury-plugin") | ||
id("com.github.johnrengelman.shadow") | ||
} | ||
|
||
val loader = prop("loom.platform")!! | ||
val minecraft = stonecutter.current.version | ||
val common: Project = requireNotNull(stonecutter.node.sibling("")) { | ||
"No common project for $project" | ||
} | ||
|
||
version = "${common.mod.version}+${common.mod.version_name}-${loader}" | ||
group = "${common.mod.maven_group}.$loader" | ||
|
||
base { | ||
archivesName.set(common.mod.name) | ||
} | ||
|
||
repositories { | ||
maven("https://maven.shedaniel.me/") | ||
maven("https://maven.terraformersmc.com/releases/") | ||
} | ||
|
||
architectury { | ||
platformSetupLoomIde() | ||
fabric() | ||
} | ||
|
||
val commonBundle: Configuration by configurations.creating { | ||
isCanBeConsumed = false | ||
isCanBeResolved = true | ||
} | ||
|
||
val shadowBundle: Configuration by configurations.creating { | ||
isCanBeConsumed = false | ||
isCanBeResolved = true | ||
} | ||
|
||
configurations { | ||
compileClasspath.get().extendsFrom(commonBundle) | ||
runtimeClasspath.get().extendsFrom(commonBundle) | ||
get("developmentFabric").extendsFrom(commonBundle) | ||
} | ||
|
||
dependencies { | ||
minecraft("com.mojang:minecraft:$minecraft") | ||
mappings("net.fabricmc:yarn:${common.mod.dep("yarn_mappings")}:v2") | ||
modImplementation("net.fabricmc:fabric-loader:${common.mod.dep("fabric_loader")}") | ||
|
||
modImplementation("me.shedaniel.cloth:cloth-config-fabric:${common.mod.dep("cloth_config_version")}") | ||
modImplementation("com.terraformersmc:modmenu:${common.mod.dep("mod_menu_version")}") | ||
|
||
implementation("org.lwjgl:lwjgl-glfw:3.3.2") | ||
|
||
commonBundle(project(common.path, "namedElements")) { isTransitive = false } | ||
shadowBundle(project(common.path, "transformProductionFabric")) { isTransitive = false } | ||
} | ||
|
||
loom { | ||
decompilers { | ||
get("vineflower").apply { // Adds names to lambdas - useful for mixins | ||
options.put("mark-corresponding-synthetics", "1") | ||
} | ||
} | ||
|
||
runConfigs.all { | ||
isIdeConfigGenerated = true | ||
runDir = "../../../run" | ||
vmArgs("-Dmixin.debug.export=true") | ||
} | ||
} | ||
|
||
val target = ">=${common.property("mod.min_target")}- <=${common.property("mod.max_target")}" | ||
|
||
tasks.processResources { | ||
val expandProps = mapOf( | ||
"version" to version, | ||
"minecraftVersion" to target, | ||
"javaVersion" to common.mod.dep("java") | ||
) | ||
|
||
filesMatching("fabric.mod.json") { | ||
expand(expandProps) | ||
} | ||
|
||
inputs.properties(expandProps) | ||
} | ||
|
||
tasks.shadowJar { | ||
configurations = listOf(shadowBundle) | ||
archiveClassifier = "dev-shadow" | ||
} | ||
|
||
tasks.remapJar { | ||
injectAccessWidener = true | ||
input = tasks.shadowJar.get().archiveFile | ||
archiveClassifier = null | ||
dependsOn(tasks.shadowJar) | ||
} | ||
|
||
tasks.jar { | ||
archiveClassifier = "dev" | ||
} | ||
|
||
java { | ||
withSourcesJar() | ||
|
||
val javaVersion = if (common.property("deps.java") == "9") JavaVersion.VERSION_1_9 else JavaVersion.VERSION_17 | ||
|
||
sourceCompatibility = javaVersion | ||
targetCompatibility = javaVersion | ||
} | ||
|
||
tasks.build { | ||
group = "versioned" | ||
description = "Must run through 'chiseledBuild'" | ||
} | ||
|
||
tasks.register<Copy>("buildAndCollect") { | ||
group = "versioned" | ||
description = "Must run through 'chiseledBuild'" | ||
from(tasks.remapJar.get().archiveFile, tasks.remapSourcesJar.get().archiveFile) | ||
into(rootProject.layout.buildDirectory.file("libs/${mod.version}/$loader")) | ||
dependsOn("build") | ||
} |
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 @@ | ||
loom.platform=fabric |
11 changes: 11 additions & 0 deletions
11
fabric/src/main/java/net/notcoded/wayfix/fabric/WayFixFabric.java
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,11 @@ | ||
package net.notcoded.wayfix.fabric; | ||
|
||
import net.fabricmc.api.ClientModInitializer; | ||
import net.notcoded.wayfix.common.WayFix; | ||
|
||
public class WayFixFabric implements ClientModInitializer { | ||
@Override | ||
public void onInitializeClient() { | ||
WayFix.init(); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
fabric/src/main/java/net/notcoded/wayfix/fabric/config/ModMenuIntegration.java
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,13 @@ | ||
package net.notcoded.wayfix.fabric.config; | ||
|
||
import com.terraformersmc.modmenu.api.ConfigScreenFactory; | ||
import com.terraformersmc.modmenu.api.ModMenuApi; | ||
import net.notcoded.wayfix.common.config.ModConfig; | ||
import me.shedaniel.autoconfig.AutoConfig; | ||
|
||
public class ModMenuIntegration implements ModMenuApi { | ||
@Override | ||
public ConfigScreenFactory<?> getModConfigScreenFactory() { | ||
return parent -> AutoConfig.getConfigScreen(ModConfig.class, parent).get(); | ||
} | ||
} |
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
Oops, something went wrong.