aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle.kts4
-rw-r--r--lwjgl/1.12.2-forge/api/1.12.2-forge.api0
-rw-r--r--lwjgl/1.16.2-forge/api/1.16.2-forge.api0
-rw-r--r--lwjgl/1.8.9-forge/api/1.8.9-forge.api0
-rw-r--r--lwjgl/build.gradle.kts69
-rw-r--r--lwjgl/mainProject1
-rw-r--r--lwjgl/root.gradle.kts16
-rw-r--r--settings.gradle.kts9
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/renderer/RenderManager.java6
-rw-r--r--versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ClientModLoaderMixin.java2
-rw-r--r--versions/build.gradle.kts67
-rw-r--r--versions/root.gradle.kts3
-rw-r--r--versions/src/main/resources/META-INF/mods.toml54
13 files changed, 166 insertions, 65 deletions
diff --git a/build.gradle.kts b/build.gradle.kts
index 3d48b72..dd28e33 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -113,7 +113,7 @@ dependencies {
shade("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
isTransitive = false
}
- shade("cc.polyfrost:lwjgl:1.0.0-alpha1")
+ shade("cc.polyfrost:lwjgl-1.8.9-forge:1.0.0-alpha5")
shadeNoPom(prebundle(shadeRelocated))
configurations.named(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME) { extendsFrom(shadeNoPom) }
@@ -138,7 +138,7 @@ tasks {
}
apiValidation {
- ignoredProjects.add("lwjgl")
+ ignoredPackages.add("org.lwjgl")
ignoredPackages.add("cc.polyfrost.oneconfig.libs")
ignoredPackages.add("cc.polyfrost.oneconfig.internal")
ignoredPackages.add("cc.polyfrost.oneconfig.test")
diff --git a/lwjgl/1.12.2-forge/api/1.12.2-forge.api b/lwjgl/1.12.2-forge/api/1.12.2-forge.api
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lwjgl/1.12.2-forge/api/1.12.2-forge.api
diff --git a/lwjgl/1.16.2-forge/api/1.16.2-forge.api b/lwjgl/1.16.2-forge/api/1.16.2-forge.api
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lwjgl/1.16.2-forge/api/1.16.2-forge.api
diff --git a/lwjgl/1.8.9-forge/api/1.8.9-forge.api b/lwjgl/1.8.9-forge/api/1.8.9-forge.api
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/lwjgl/1.8.9-forge/api/1.8.9-forge.api
diff --git a/lwjgl/build.gradle.kts b/lwjgl/build.gradle.kts
index df8d72c..fcc5511 100644
--- a/lwjgl/build.gradle.kts
+++ b/lwjgl/build.gradle.kts
@@ -1,7 +1,11 @@
+@file:Suppress("GradlePackageUpdate")
+
plugins {
kotlin("jvm")
+ id("gg.essential.multi-version")
id("gg.essential.defaults.repo")
id("gg.essential.defaults.java")
+ id("gg.essential.defaults.loom")
id("com.github.johnrengelman.shadow")
id("maven-publish")
id("signing")
@@ -12,7 +16,7 @@ val mod_name: String by project
val mod_version: String by project
val mod_id: String by project
-version = "1.0.0-alpha1"
+version = "1.0.0-alpha5"
repositories {
maven("https://repo.polyfrost.cc/releases")
@@ -27,23 +31,39 @@ sourceSets {
}
dependencies {
- shadeCompileOnly("org.lwjgl:lwjgl:3.3.1")
- shadeCompileOnly("org.lwjgl:lwjgl-stb:3.3.1")
- shadeCompileOnly("org.lwjgl:lwjgl-tinyfd:3.3.1")
- shadeCompileOnly("org.lwjgl:lwjgl-nanovg:3.3.1")
+ val lwjgl = if (platform.mcVersion >= 11600) {
+ "3.2.1"
+ } else {
+ "3.3.1"
+ }
+ if (platform.isLegacyForge) {
+ shadeCompileOnly("org.lwjgl:lwjgl:$lwjgl")
+ shadeCompileOnly("org.lwjgl:lwjgl-stb:$lwjgl")
+ shadeCompileOnly("org.lwjgl:lwjgl-tinyfd:$lwjgl")
+
+ shadeRuntimeOnly("org.lwjgl:lwjgl:$lwjgl:natives-windows")
+ shadeRuntimeOnly("org.lwjgl:lwjgl-stb:$lwjgl:natives-windows")
+ shadeRuntimeOnly("org.lwjgl:lwjgl-tinyfd:$lwjgl:natives-windows")
+ shadeRuntimeOnly("org.lwjgl:lwjgl:$lwjgl:natives-linux")
+ shadeRuntimeOnly("org.lwjgl:lwjgl-stb:$lwjgl:natives-linux")
+ shadeRuntimeOnly("org.lwjgl:lwjgl-tinyfd:$lwjgl:natives-linux")
+ shadeRuntimeOnly("org.lwjgl:lwjgl:$lwjgl:natives-macos")
+ shadeRuntimeOnly("org.lwjgl:lwjgl-stb:$lwjgl:natives-macos")
+ shadeRuntimeOnly("org.lwjgl:lwjgl-tinyfd:$lwjgl:natives-macos")
+ }
- shadeRuntimeOnly("org.lwjgl:lwjgl:3.3.1:natives-windows")
- shadeRuntimeOnly("org.lwjgl:lwjgl-stb:3.3.1:natives-windows")
- shadeRuntimeOnly("org.lwjgl:lwjgl-tinyfd:3.3.1:natives-windows")
- shadeRuntimeOnly("org.lwjgl:lwjgl-nanovg:3.3.1:natives-windows")
- shadeRuntimeOnly("org.lwjgl:lwjgl:3.3.1:natives-linux")
- shadeRuntimeOnly("org.lwjgl:lwjgl-stb:3.3.1:natives-linux")
- shadeRuntimeOnly("org.lwjgl:lwjgl-tinyfd:3.3.1:natives-linux")
- shadeRuntimeOnly("org.lwjgl:lwjgl-nanovg:3.3.1:natives-linux")
- shadeRuntimeOnly("org.lwjgl:lwjgl:3.3.1:natives-macos")
- shadeRuntimeOnly("org.lwjgl:lwjgl-stb:3.3.1:natives-macos")
- shadeRuntimeOnly("org.lwjgl:lwjgl-tinyfd:3.3.1:natives-macos")
- shadeRuntimeOnly("org.lwjgl:lwjgl-nanovg:3.3.1:natives-macos")
+ shadeCompileOnly("org.lwjgl:lwjgl-nanovg:$lwjgl") {
+ isTransitive = platform.isLegacyForge
+ }
+ shadeRuntimeOnly("org.lwjgl:lwjgl-nanovg:$lwjgl:natives-windows") {
+ isTransitive = platform.isLegacyForge
+ }
+ shadeRuntimeOnly("org.lwjgl:lwjgl-nanovg:$lwjgl:natives-linux") {
+ isTransitive = platform.isLegacyForge
+ }
+ shadeRuntimeOnly("org.lwjgl:lwjgl-nanovg:$lwjgl:natives-macos") {
+ isTransitive = platform.isLegacyForge
+ }
}
tasks {
@@ -53,9 +73,11 @@ tasks {
exclude("META-INF/versions/**")
exclude("**/module-info.class")
exclude("**/package-info.class")
- relocate("org.lwjgl", "org.lwjgl3") {
- include("org.lwjgl.PointerBuffer")
- include("org.lwjgl.BufferUtils")
+ if (platform.isLegacyForge) {
+ relocate("org.lwjgl", "org.lwjgl3") {
+ include("org.lwjgl.PointerBuffer")
+ include("org.lwjgl.BufferUtils")
+ }
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
dependsOn(jar)
@@ -63,13 +85,16 @@ tasks {
jar {
enabled = false
}
+ remapJar {
+ enabled = false
+ }
}
publishing {
publications {
- register<MavenPublication>("lwjgl") {
+ register<MavenPublication>("lwjgl-$platform") {
groupId = "cc.polyfrost"
- artifactId = "lwjgl"
+ artifactId = "lwjgl-$platform"
artifact(tasks["shadowJar"])
}
}
diff --git a/lwjgl/mainProject b/lwjgl/mainProject
new file mode 100644
index 0000000..dd1433e
--- /dev/null
+++ b/lwjgl/mainProject
@@ -0,0 +1 @@
+1.8.9-forge \ No newline at end of file
diff --git a/lwjgl/root.gradle.kts b/lwjgl/root.gradle.kts
new file mode 100644
index 0000000..d2dc0c7
--- /dev/null
+++ b/lwjgl/root.gradle.kts
@@ -0,0 +1,16 @@
+/**
+ * WHATEVER HAPPENS HERE MUST ALSO BE APPLIED IN `versions/root.gradle.kts`
+ */
+plugins {
+ kotlin("jvm") version "1.6.21" apply false
+ id("gg.essential.multi-version.root")
+ id("io.github.juuxel.loom-quiltflower-mini") version "171a6e2e49" apply false
+}
+
+preprocess {
+ "1.8.9-forge"(10809, "srg") {
+ "1.12.2-forge"(11202, "srg") {
+ "1.16.2-forge"(11602, "srg")
+ }
+ }
+} \ No newline at end of file
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 84d4c0d..1ac4f26 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -26,6 +26,10 @@ val mod_name: String by settings
rootProject.name = mod_name
include(":lwjgl")
+project(":lwjgl").apply {
+ projectDir = file("lwjgl/")
+ buildFileName = "root.gradle.kts"
+}
include(":platform")
project(":platform").apply {
@@ -39,8 +43,13 @@ listOf(
"1.16.2-forge"
).forEach { version ->
include(":platform:$version")
+ include(":lwjgl:$version")
project(":platform:$version").apply {
projectDir = file("versions/$version")
buildFileName = "../build.gradle.kts"
}
+ project(":lwjgl:$version").apply {
+ projectDir = file("lwjgl/$version")
+ buildFileName = "../build.gradle.kts"
+ }
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/renderer/RenderManager.java b/src/main/java/cc/polyfrost/oneconfig/renderer/RenderManager.java
index b747088..93c3c94 100644
--- a/src/main/java/cc/polyfrost/oneconfig/renderer/RenderManager.java
+++ b/src/main/java/cc/polyfrost/oneconfig/renderer/RenderManager.java
@@ -10,19 +10,17 @@ import cc.polyfrost.oneconfig.libs.universal.UResolution;
import cc.polyfrost.oneconfig.platform.Platform;
import cc.polyfrost.oneconfig.renderer.font.Font;
import cc.polyfrost.oneconfig.renderer.font.FontManager;
-import cc.polyfrost.oneconfig.renderer.font.Fonts;
import cc.polyfrost.oneconfig.utils.InputUtils;
import cc.polyfrost.oneconfig.utils.NetworkUtils;
import org.lwjgl.nanovg.NVGColor;
import org.lwjgl.nanovg.NVGPaint;
+import org.lwjgl.nanovg.NanoVGGL2;
import org.lwjgl.opengl.GL11;
import java.util.function.LongConsumer;
import java.util.regex.Pattern;
import static org.lwjgl.nanovg.NanoVG.*;
-import static org.lwjgl.nanovg.NanoVGGL2.NVG_ANTIALIAS;
-import static org.lwjgl.nanovg.NanoVGGL2.nvgCreate;
/**
* Handles NanoVG rendering and wraps it in a more convenient interface.
@@ -54,7 +52,7 @@ public final class RenderManager {
*/
public static void setupAndDraw(boolean mcScaling, LongConsumer consumer) {
if (vg == -1) {
- vg = nvgCreate(NVG_ANTIALIAS);
+ vg = NanoVGGL2.nvgCreate(NanoVGGL2.NVG_ANTIALIAS);
if (vg == -1) {
throw new RuntimeException("Failed to create nvg context");
}
diff --git a/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ClientModLoaderMixin.java b/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ClientModLoaderMixin.java
index b0caed6..a3832d0 100644
--- a/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ClientModLoaderMixin.java
+++ b/versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ClientModLoaderMixin.java
@@ -16,7 +16,7 @@ public class ClientModLoaderMixin {
OneConfig.preLaunch();
}
- @Inject(method = "lambda$finishModLoading$9", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/GameSettings;loadOptions()V"))
+ @Inject(method = "lambda$finishModLoading$9", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/GameSettings;loadOptions()V", remap = true), remap = false)
private static void onFinishModLoading(CallbackInfo ci) {
EventManager.INSTANCE.post(new InitializationEvent());
OneConfig.init();
diff --git a/versions/build.gradle.kts b/versions/build.gradle.kts
index b140fbd..069c8ef 100644
--- a/versions/build.gradle.kts
+++ b/versions/build.gradle.kts
@@ -64,9 +64,6 @@ loom {
mixinConfig("mixins.${mod_id}.json")
}
}
- log4jConfigs.asFileTree.files.forEach {
- it.writeText(it.readText().replace("warn", "debug"))
- }
mixin.defaultRefmapName.set("mixins.${mod_id}.refmap.json")
}
@@ -74,6 +71,12 @@ repositories {
maven("https://repo.polyfrost.cc/releases")
}
+val relocatedCommonProject = registerRelocationAttribute("common-lwjgl") {
+ if (platform.isModLauncher || platform.isFabric) {
+ relocate("org.lwjgl3", "org.lwjgl")
+ }
+}
+
val relocated = registerRelocationAttribute("relocate") {
relocate("gg.essential", "cc.polyfrost.oneconfig.libs")
relocate("me.kbrewster", "cc.polyfrost.oneconfig.libs")
@@ -84,6 +87,10 @@ val relocated = registerRelocationAttribute("relocate") {
remapStringsIn("com.github.benmanes.caffeine.cache.NodeFactory")
}
+val shadeProject: Configuration by configurations.creating {
+ attributes { attribute(relocatedCommonProject, false) }
+}
+
val shadeRelocated: Configuration by configurations.creating {
attributes { attribute(relocated, true) }
}
@@ -141,10 +148,11 @@ dependencies {
isTransitive = false
}
}
- shadeNoPom(project(":")) {
+ shadeProject(project(":")) {
isTransitive = false
}
- shade("cc.polyfrost:lwjgl:1.0.0-alpha1")
+
+ shade("cc.polyfrost:lwjgl-$platform:1.0.0-alpha5")
val prebundled = prebundle(shadeRelocated)
modCompileOnly(prebundled)
modRuntimeOnly(prebundled)
@@ -152,8 +160,8 @@ dependencies {
dokkaHtmlPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.6.21")
- configurations.named(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME) { extendsFrom(shadeNoPom) }
- configurations.named(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME) { extendsFrom(shadeNoPom) }
+ configurations.named(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME) { extendsFrom(shadeNoPom); extendsFrom(shadeProject) }
+ configurations.named(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME) { extendsFrom(shadeNoPom); extendsFrom(shadeProject) }
}
tasks {
@@ -219,7 +227,7 @@ tasks {
val shadowJar = named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
archiveClassifier.set("full-dev")
- configurations = listOf(shade, shadeNoPom, shadeNoPom2)
+ configurations = listOf(shade, shadeNoPom, shadeNoPom2, shadeProject)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
dependsOn(jar)
}
@@ -234,26 +242,35 @@ tasks {
}
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
- dependsOn(shadeNoPom, shadeNoPom2)
- from(ArrayList<File>().run { addAll(shadeNoPom); addAll(shadeNoPom2); this }
+ dependsOn(shadeNoPom, shadeNoPom2, shadeProject)
+ from(ArrayList<File>().run { addAll(shadeNoPom); addAll(shadeNoPom2); addAll(shadeProject); this }
.map { if (it.isDirectory) it else zipTree(it) })
manifest {
attributes(
- mapOf(
- "ModSide" to "CLIENT",
- "ForceLoadAsMod" to true,
- "TweakOrder" to "0",
- "MixinConfigs" to "mixins.oneconfig.json",
- "TweakClass" to "cc.polyfrost.oneconfig.internal.plugin.asm.OneConfigTweaker",
- "FMLModType" to "LIBRARY",
- "Specification-Title" to mod_id,
- "Specification-Vendor" to mod_id,
- "Specification-Version" to "1", // We are version 1 of ourselves, whatever the hell that means
- "Implementation-Title" to mod_name,
- "Implementation-Version" to mod_version,
- "Implementation-Vendor" to mod_id,
- "Implementation-Timestamp" to SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(`java.util`.Date())
- )
+ if (platform.isForge) {
+ if (platform.isLegacyForge) {
+ mapOf(
+ "ModSide" to "CLIENT",
+ "ForceLoadAsMod" to true,
+ "TweakOrder" to "0",
+ "MixinConfigs" to "mixins.oneconfig.json",
+ "TweakClass" to "cc.polyfrost.oneconfig.internal.plugin.asm.OneConfigTweaker"
+ )
+ } else {
+ mapOf(
+ "MixinConfigs" to "mixins.oneconfig.json",
+ "Specification-Title" to mod_id,
+ "Specification-Vendor" to mod_id,
+ "Specification-Version" to "1", // We are version 1 of ourselves, whatever the hell that means
+ "Implementation-Title" to mod_name,
+ "Implementation-Version" to mod_version,
+ "Implementation-Vendor" to mod_id,
+ "Implementation-Timestamp" to SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(`java.util`.Date())
+ )
+ }
+ } else {
+ mapOf()
+ }
)
}
/*/
diff --git a/versions/root.gradle.kts b/versions/root.gradle.kts
index baf8637..6a09be5 100644
--- a/versions/root.gradle.kts
+++ b/versions/root.gradle.kts
@@ -1,3 +1,6 @@
+/**
+ * WHATEVER HAPPENS HERE MUST ALSO BE APPLIED IN `lwjgl/root.gradle.kts`
+ */
plugins {
kotlin("jvm") version "1.6.21" apply false
id("gg.essential.multi-version.root")
diff --git a/versions/src/main/resources/META-INF/mods.toml b/versions/src/main/resources/META-INF/mods.toml
index 8050cf5..410073e 100644
--- a/versions/src/main/resources/META-INF/mods.toml
+++ b/versions/src/main/resources/META-INF/mods.toml
@@ -1,13 +1,45 @@
-modLoader="javafml"
-loaderVersion="[32,)"
-license="https://www.gnu.org/licenses/lgpl-3.0.en.html"
-[[mods]]
-modId="${id}"
-version="${version}"
-displayName="${name}"
-authors="Polyfrost"
-description="OneConfig"
+# This is an example mods.toml file. It contains the data relating to the loading mods.
+# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
+# The overall format is standard TOML format, v0.5.0.
+# Note that there are a couple of TOML lists in this file.
+# Find more information on toml format here: https://github.com/toml-lang/toml
+# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
+modLoader="javafml" #mandatory
+# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
+loaderVersion="[33,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
+# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
+# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
+license="LGPL 3.0"
+# A URL to refer people to when problems occur with this mod
+#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
+# A list of mods - how many allowed here is determined by the individual mod loader
+[[mods]] #mandatory
+# The modid of the mod
+modId="${id}" #mandatory
+# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
+# will substitute the value of the Implementation-Version as read from the mod's JAR file metadata
+# see the associated build.gradle script for how to populate this completely automatically during a build
+version="${version}" #mandatory
+# A display name for the mod
+displayName="${name}" #mandatory
+# A URL to query for updates for this mod. See the JSON update specification https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/
+#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
+# A URL for the "homepage" for this mod, displayed in the mod UI
+#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
+# A file name (in the root of the mod JAR) containing a logo for display
+# logoFile="examplemod.png" #optional
+# A text field displayed in the mod UI
+# credits="Thanks for this example mod goes to Java" #optional
+# A text field displayed in the mod UI
+authors="Polyfrost" #optional
+# The description text for the mod (multi line!) (#mandatory)
+description='''
+This is a long form description of the mod. You can write whatever you want here
+Have some lorem ipsum.
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed sagittis luctus odio eu tempus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque volutpat ligula eget lacus auctor sagittis. In hac habitasse platea dictumst. Nunc gravida elit vitae sem vehicula efficitur. Donec mattis ipsum et arcu lobortis, eleifend sagittis sem rutrum. Cras pharetra quam eget posuere fermentum. Sed id tincidunt justo. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+'''
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.oneconfig]] #optional
# the modid of the dependency
@@ -15,7 +47,7 @@ modId="forge" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
-versionRange="[32,)" #mandatory
+versionRange="[33,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
@@ -27,4 +59,4 @@ mandatory=true
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="[1.16,)"
ordering="NONE"
-side="BOTH" \ No newline at end of file
+side="BOTH"