diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-07-06 21:09:37 +0900 |
---|---|---|
committer | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-07-06 21:09:37 +0900 |
commit | bf0d2189dd881faa8f401d60c891bd8c1b7086b5 (patch) | |
tree | 333f33191dfbc6851ed1ba936b4b9675a68c042b /versions | |
parent | 52b87cb59eebff7826d8891a6fb52911be386f46 (diff) | |
download | OneConfig-bf0d2189dd881faa8f401d60c891bd8c1b7086b5.tar.gz OneConfig-bf0d2189dd881faa8f401d60c891bd8c1b7086b5.tar.bz2 OneConfig-bf0d2189dd881faa8f401d60c891bd8c1b7086b5.zip |
real
Diffstat (limited to 'versions')
-rw-r--r-- | versions/1.16.2-forge/src/main/java/cc/polyfrost/oneconfig/internal/mixin/ClientModLoaderMixin.java | 2 | ||||
-rw-r--r-- | versions/build.gradle.kts | 67 | ||||
-rw-r--r-- | versions/root.gradle.kts | 3 | ||||
-rw-r--r-- | versions/src/main/resources/META-INF/mods.toml | 54 |
4 files changed, 89 insertions, 37 deletions
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" |