mirror of
https://github.com/chylex/Better-Controls.git
synced 2025-11-02 07:53:00 +01:00
Compare commits
5 Commits
1.20
...
761fdb76da
| Author | SHA1 | Date | |
|---|---|---|---|
|
761fdb76da
|
|||
|
d721d6254d
|
|||
|
2da9a54f2f
|
|||
|
73a6571f20
|
|||
|
ffc5c00201
|
@@ -1,3 +1,5 @@
|
|||||||
|
import org.gradle.jvm.tasks.Jar
|
||||||
|
|
||||||
val modId: String by project
|
val modId: String by project
|
||||||
val minecraftVersion: String by project
|
val minecraftVersion: String by project
|
||||||
val fabricVersion: String by project
|
val fabricVersion: String by project
|
||||||
@@ -45,6 +47,11 @@ tasks.jar {
|
|||||||
exclude("com/terraformersmc/modmenu/")
|
exclude("com/terraformersmc/modmenu/")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.remapJar {
|
tasks.register<Jar>("uncompressedRemapJar") {
|
||||||
archiveVersion.set(tasks.jar.get().archiveVersion)
|
group = "fabric"
|
||||||
|
|
||||||
|
from(tasks.remapJar.map { it.outputs.files.map(::zipTree) })
|
||||||
|
|
||||||
|
archiveClassifier.set("uncompressed")
|
||||||
|
entryCompression = ZipEntryCompression.STORED // Reduces size of multiloader jar.
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB |
@@ -6,7 +6,7 @@
|
|||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
"license": "${license}",
|
"license": "${license}",
|
||||||
|
|
||||||
"icon": "assets/bettercontrols/icon.png",
|
"icon": "assets/${id}/logo.png",
|
||||||
|
|
||||||
"authors": [
|
"authors": [
|
||||||
"${author}"
|
"${author}"
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
"sources": "${sourcesURL}"
|
"sources": "${sourcesURL}"
|
||||||
},
|
},
|
||||||
|
|
||||||
"environment": "client",
|
"environment": "${sidesForFabric}",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"client": [ "chylex.bettercontrols.BetterControlsMod" ],
|
"client": [ "chylex.bettercontrols.BetterControlsMod" ],
|
||||||
"modmenu": [ "chylex.bettercontrols.compatibility.ModMenuSupport" ]
|
"modmenu": [ "chylex.bettercontrols.compatibility.ModMenuSupport" ]
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
"mixins": [{
|
"mixins": [{
|
||||||
"config": "${id}.mixins.json",
|
"config": "${id}.mixins.json",
|
||||||
"environment": "client"
|
"environment": "${sidesForFabric}"
|
||||||
}],
|
}],
|
||||||
|
|
||||||
"depends": {
|
"depends": {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ runs {
|
|||||||
jvmArguments(runJvmArgs)
|
jvmArguments(runJvmArgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
create("client")
|
removeIf { it.name != "client" }
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.processResources {
|
tasks.processResources {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ displayURL = "${sourcesURL}"
|
|||||||
description = "${description}"
|
description = "${description}"
|
||||||
authors = "${author}"
|
authors = "${author}"
|
||||||
version = "${version}"
|
version = "${version}"
|
||||||
logoFile = "icon.png"
|
logoFile = "assets/${id}/logo.png"
|
||||||
|
|
||||||
[[mixins]]
|
[[mixins]]
|
||||||
config = "${id}.mixins.json"
|
config = "${id}.mixins.json"
|
||||||
@@ -21,11 +21,11 @@ modId = "minecraft"
|
|||||||
type = "required"
|
type = "required"
|
||||||
versionRange = "[${minimumMinecraftVersion},)"
|
versionRange = "[${minimumMinecraftVersion},)"
|
||||||
ordering = "NONE"
|
ordering = "NONE"
|
||||||
side = "CLIENT"
|
side = "${sidesForNeoForge}"
|
||||||
|
|
||||||
[[dependencies.${id}]]
|
[[dependencies.${id}]]
|
||||||
modId = "neoforge"
|
modId = "neoforge"
|
||||||
type = "required"
|
type = "required"
|
||||||
versionRange = "[${minimumNeoForgeVersion},)"
|
versionRange = "[${minimumNeoForgeVersion},)"
|
||||||
ordering = "NONE"
|
ordering = "NONE"
|
||||||
side = "CLIENT"
|
side = "${sidesForNeoForge}"
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB |
148
build.gradle.kts
148
build.gradle.kts
@@ -1,6 +1,6 @@
|
|||||||
@file:Suppress("ConvertLambdaToReference")
|
@file:Suppress("ConvertLambdaToReference")
|
||||||
|
|
||||||
import org.gradle.api.file.DuplicatesStrategy.EXCLUDE
|
import org.gradle.jvm.tasks.Jar
|
||||||
|
|
||||||
val modId: String by project
|
val modId: String by project
|
||||||
val modName: String by project
|
val modName: String by project
|
||||||
@@ -10,6 +10,7 @@ val modVersion: String by project
|
|||||||
val modLicense: String by project
|
val modLicense: String by project
|
||||||
val modSourcesURL: String by project
|
val modSourcesURL: String by project
|
||||||
val modIssuesURL: String by project
|
val modIssuesURL: String by project
|
||||||
|
val modSides: String by project
|
||||||
|
|
||||||
val minecraftVersion: String by project
|
val minecraftVersion: String by project
|
||||||
val mixinVersion: String by project
|
val mixinVersion: String by project
|
||||||
@@ -19,12 +20,11 @@ val minimumNeoForgeVersion: String by project
|
|||||||
val minimumFabricVersion: String by project
|
val minimumFabricVersion: String by project
|
||||||
|
|
||||||
val modNameStripped = modName.replace(" ", "")
|
val modNameStripped = modName.replace(" ", "")
|
||||||
val jarVersion = "$minecraftVersion+v$modVersion"
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
idea
|
idea
|
||||||
`java-library`
|
`java-library`
|
||||||
id("net.neoforged.gradle.vanilla")
|
id("fabric-loom")
|
||||||
}
|
}
|
||||||
|
|
||||||
idea {
|
idea {
|
||||||
@@ -46,18 +46,26 @@ repositories {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation("net.minecraft:client:$minecraftVersion")
|
|
||||||
compileOnly("net.fabricmc:sponge-mixin:$mixinVersion")
|
|
||||||
api("com.google.code.findbugs:jsr305:3.0.2")
|
|
||||||
}
|
|
||||||
|
|
||||||
base {
|
base {
|
||||||
archivesName.set("$modNameStripped-Common")
|
archivesName.set("$modNameStripped-Common")
|
||||||
}
|
}
|
||||||
|
|
||||||
runs {
|
loom {
|
||||||
clear()
|
runs {
|
||||||
|
named("client") {
|
||||||
|
ideConfigGenerated(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
findByName("server")?.let(::remove)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
minecraft("com.mojang:minecraft:$minecraftVersion")
|
||||||
|
mappings(loom.officialMojangMappings())
|
||||||
|
|
||||||
|
compileOnly("net.fabricmc:sponge-mixin:$mixinVersion")
|
||||||
|
api("com.google.code.findbugs:jsr305:3.0.2")
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
@@ -66,10 +74,6 @@ allprojects {
|
|||||||
|
|
||||||
apply(plugin = "java-library")
|
apply(plugin = "java-library")
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation("org.jetbrains:annotations:24.1.0")
|
|
||||||
}
|
|
||||||
|
|
||||||
extensions.getByType<JavaPluginExtension>().apply {
|
extensions.getByType<JavaPluginExtension>().apply {
|
||||||
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
|
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
|
||||||
}
|
}
|
||||||
@@ -86,11 +90,47 @@ allprojects {
|
|||||||
if (project.javaToolchains.launcherFor(java.toolchain).map { it.metadata.vendor }.orNull == "JetBrains") {
|
if (project.javaToolchains.launcherFor(java.toolchain).map { it.metadata.vendor }.orNull == "JetBrains") {
|
||||||
runJvmArgs.add("-XX:+AllowEnhancedClassRedefinition")
|
runJvmArgs.add("-XX:+AllowEnhancedClassRedefinition")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation("org.jetbrains:annotations:24.1.0")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<ProcessResources> {
|
||||||
|
val (sidesForNeoForge, sidesForFabric) = when (modSides) {
|
||||||
|
"both" -> Pair("BOTH", "*")
|
||||||
|
"client" -> Pair("CLIENT", "client")
|
||||||
|
"server" -> Pair("SERVER", "server")
|
||||||
|
else -> error("Invalid modSides value: $modSides")
|
||||||
|
}
|
||||||
|
|
||||||
|
inputs.property("id", modId)
|
||||||
|
inputs.property("name", modName)
|
||||||
|
inputs.property("description", modDescription)
|
||||||
|
inputs.property("version", modVersion)
|
||||||
|
inputs.property("author", modAuthor)
|
||||||
|
inputs.property("license", modLicense)
|
||||||
|
inputs.property("sourcesURL", modSourcesURL)
|
||||||
|
inputs.property("issuesURL", modIssuesURL)
|
||||||
|
inputs.property("sidesForNeoForge", sidesForNeoForge)
|
||||||
|
inputs.property("sidesForFabric", sidesForFabric)
|
||||||
|
inputs.property("minimumMinecraftVersion", minimumMinecraftVersion)
|
||||||
|
inputs.property("minimumNeoForgeVersion", minimumNeoForgeVersion)
|
||||||
|
inputs.property("minimumFabricVersion", minimumFabricVersion)
|
||||||
|
|
||||||
|
from(rootProject.file("logo.png")) {
|
||||||
|
into("assets/$modId")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<AbstractArchiveTask>().configureEach {
|
||||||
|
isPreserveFileTimestamps = false
|
||||||
|
isReproducibleFileOrder = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(rootProject)
|
implementation(project(rootProject.path, configuration = "namedElements"))
|
||||||
}
|
}
|
||||||
|
|
||||||
base {
|
base {
|
||||||
@@ -104,37 +144,16 @@ subprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.processResources {
|
tasks.processResources {
|
||||||
inputs.property("id", modId)
|
|
||||||
inputs.property("name", modName)
|
|
||||||
inputs.property("description", modDescription)
|
|
||||||
inputs.property("version", modVersion)
|
|
||||||
inputs.property("author", modAuthor)
|
|
||||||
inputs.property("license", modLicense)
|
|
||||||
inputs.property("sourcesURL", modSourcesURL)
|
|
||||||
inputs.property("issuesURL", modIssuesURL)
|
|
||||||
inputs.property("minimumMinecraftVersion", minimumMinecraftVersion)
|
|
||||||
inputs.property("minimumNeoForgeVersion", minimumNeoForgeVersion)
|
|
||||||
inputs.property("minimumFabricVersion", minimumFabricVersion)
|
|
||||||
|
|
||||||
from(rootProject.sourceSets.main.get().resources) {
|
from(rootProject.sourceSets.main.get().resources) {
|
||||||
expand(inputs.properties)
|
expand(inputs.properties)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.jar {
|
tasks.jar {
|
||||||
archiveVersion.set(jarVersion)
|
entryCompression = ZipEntryCompression.STORED // Reduces size of multiloader jar.
|
||||||
|
|
||||||
from(rootProject.file("LICENSE"))
|
|
||||||
|
|
||||||
manifest {
|
manifest {
|
||||||
attributes(
|
packageInformation(modId, "$modNameStripped-${project.name}")
|
||||||
"Specification-Title" to modId,
|
|
||||||
"Specification-Vendor" to modAuthor,
|
|
||||||
"Specification-Version" to "1",
|
|
||||||
"Implementation-Title" to "$modNameStripped-${project.name}",
|
|
||||||
"Implementation-Vendor" to modAuthor,
|
|
||||||
"Implementation-Version" to modVersion,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,18 +162,55 @@ subprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val copyJars = tasks.register<Copy>("copyJars") {
|
fun Manifest.packageInformation(specificationTitle: String, implementationTitle: String) {
|
||||||
|
attributes(
|
||||||
|
"Specification-Title" to specificationTitle,
|
||||||
|
"Specification-Vendor" to modAuthor,
|
||||||
|
"Specification-Version" to "1",
|
||||||
|
"Implementation-Title" to implementationTitle,
|
||||||
|
"Implementation-Vendor" to modAuthor,
|
||||||
|
"Implementation-Version" to modVersion,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
val multiloaderSources = sourceSets.register("multiloader")
|
||||||
|
|
||||||
|
val multiloaderJar = tasks.register<Jar>("multiloaderJar") {
|
||||||
group = "build"
|
group = "build"
|
||||||
duplicatesStrategy = EXCLUDE
|
|
||||||
|
|
||||||
for (subproject in subprojects) {
|
archiveBaseName.set(modNameStripped)
|
||||||
dependsOn(subproject.tasks.assemble)
|
archiveVersion.set("$minecraftVersion+v$modVersion")
|
||||||
from(subproject.base.libsDirectory.file("${subproject.base.archivesName.get()}-$jarVersion.jar"))
|
|
||||||
|
destinationDirectory = layout.buildDirectory.dir("dist")
|
||||||
|
|
||||||
|
fun includeJar(project: Project, jarTaskName: String) {
|
||||||
|
from(project.tasks.named(jarTaskName).map { it.outputs }) {
|
||||||
|
into("jars")
|
||||||
|
rename { "$modNameStripped-${project.name}.jar" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
into(project.layout.buildDirectory.dir("dist"))
|
findProject(":NeoForge")?.let { includeJar(it, "jar") }
|
||||||
|
findProject(":Fabric")?.let { includeJar(it, "uncompressedRemapJar") }
|
||||||
|
|
||||||
|
from(rootProject.file("LICENSE"))
|
||||||
|
from(multiloaderSources.map { it.output })
|
||||||
|
|
||||||
|
manifest {
|
||||||
|
packageInformation("$modId-multiloader", modNameStripped)
|
||||||
|
attributes("FMLModType" to "GAMELIBRARY")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named<ProcessResources>("processMultiloaderResources").configure {
|
||||||
|
inputs.property("group", project.group)
|
||||||
|
inputs.property("jarPrefix", modNameStripped)
|
||||||
|
|
||||||
|
filesMatching(listOf("fabric.mod.json", "META-INF/jarjar/metadata.json")) {
|
||||||
|
expand(inputs.properties)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.assemble {
|
tasks.assemble {
|
||||||
finalizedBy(copyJars)
|
finalizedBy(multiloaderJar)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,18 +7,23 @@ modVersion=1.3.1
|
|||||||
modLicense=MPL-2.0
|
modLicense=MPL-2.0
|
||||||
modSourcesURL=https://github.com/chylex/Better-Controls
|
modSourcesURL=https://github.com/chylex/Better-Controls
|
||||||
modIssuesURL=https://github.com/chylex/Better-Controls/issues
|
modIssuesURL=https://github.com/chylex/Better-Controls/issues
|
||||||
|
modSides=client
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
minecraftVersion=1.20.5
|
minecraftVersion=1.21
|
||||||
neoForgeVersion=20.5.0-beta
|
neoForgeVersion=21.0.0-beta
|
||||||
neoGradleVersion=7.0.120
|
neoGradleVersion=7.0.152
|
||||||
fabricVersion=0.15.11
|
fabricVersion=0.15.11
|
||||||
loomVersion=1.3
|
loomVersion=1.7
|
||||||
mixinVersion=0.12.5+mixin.0.8.5
|
mixinVersion=0.12.5+mixin.0.8.5
|
||||||
|
|
||||||
|
# https://projects.neoforged.net/neoforged/neogradle/
|
||||||
|
# https://fabricmc.net/develop/
|
||||||
|
# https://github.com/FabricMC/fabric-loom/releases
|
||||||
|
|
||||||
# Constraints
|
# Constraints
|
||||||
minimumMinecraftVersion=1.20.5
|
minimumMinecraftVersion=1.21
|
||||||
minimumNeoForgeVersion=20.5.0-beta
|
minimumNeoForgeVersion=21.0.0-beta
|
||||||
minimumFabricVersion=0.12.3
|
minimumFabricVersion=0.12.3
|
||||||
|
|
||||||
# Gradle
|
# Gradle
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
2
gradlew
vendored
2
gradlew
vendored
@@ -55,7 +55,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ pluginManagement {
|
|||||||
plugins {
|
plugins {
|
||||||
val neoGradleVersion = settings.extra.get("neoGradleVersion") as? String
|
val neoGradleVersion = settings.extra.get("neoGradleVersion") as? String
|
||||||
if (neoGradleVersion != null) {
|
if (neoGradleVersion != null) {
|
||||||
id("net.neoforged.gradle.vanilla") version neoGradleVersion
|
|
||||||
id("net.neoforged.gradle.userdev") version neoGradleVersion
|
id("net.neoforged.gradle.userdev") version neoGradleVersion
|
||||||
id("net.neoforged.gradle.mixin") version neoGradleVersion
|
id("net.neoforged.gradle.mixin") version neoGradleVersion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ import net.minecraft.client.KeyMapping;
|
|||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.components.CycleButton;
|
import net.minecraft.client.gui.components.CycleButton;
|
||||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||||
import net.minecraft.client.gui.screens.OptionsSubScreen;
|
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
|
import net.minecraft.client.gui.screens.options.OptionsSubScreen;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
@@ -211,9 +211,7 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
protected void addContents() {
|
||||||
super.init();
|
|
||||||
|
|
||||||
allKeyBindings.clear();
|
allKeyBindings.clear();
|
||||||
|
|
||||||
final List<GuiEventListener> elements = new ArrayList<>();
|
final List<GuiEventListener> elements = new ArrayList<>();
|
||||||
@@ -234,6 +232,9 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
|||||||
optionsWidget = addRenderableWidget(new OptionListWidget(width, layout.getContentHeight(), layout.getHeaderHeight(), y - TITLE_MARGIN_TOP + BOTTOM_PADDING, elements));
|
optionsWidget = addRenderableWidget(new OptionListWidget(width, layout.getContentHeight(), layout.getHeaderHeight(), y - TITLE_MARGIN_TOP + BOTTOM_PADDING, elements));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addOptions() {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void repositionElements() {
|
protected void repositionElements() {
|
||||||
super.repositionElements();
|
super.repositionElements();
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import net.minecraft.client.KeyMapping;
|
|||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.Options;
|
import net.minecraft.client.Options;
|
||||||
import net.minecraft.client.gui.components.ContainerObjectSelectionList;
|
import net.minecraft.client.gui.components.ContainerObjectSelectionList;
|
||||||
import net.minecraft.client.gui.screens.controls.KeyBindsList;
|
import net.minecraft.client.gui.screens.options.controls.KeyBindsList;
|
||||||
import net.minecraft.client.gui.screens.controls.KeyBindsList.Entry;
|
import net.minecraft.client.gui.screens.options.controls.KeyBindsList.Entry;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|||||||
@@ -4,14 +4,13 @@ import chylex.bettercontrols.gui.BetterControlsScreen;
|
|||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.Options;
|
import net.minecraft.client.Options;
|
||||||
import net.minecraft.client.gui.components.Button;
|
import net.minecraft.client.gui.components.Button;
|
||||||
import net.minecraft.client.gui.components.OptionsList;
|
|
||||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
|
||||||
import net.minecraft.client.gui.screens.OptionsSubScreen;
|
|
||||||
import net.minecraft.client.gui.screens.Screen;
|
import net.minecraft.client.gui.screens.Screen;
|
||||||
import net.minecraft.client.gui.screens.controls.ControlsScreen;
|
import net.minecraft.client.gui.screens.options.OptionsSubScreen;
|
||||||
|
import net.minecraft.client.gui.screens.options.controls.ControlsScreen;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.MutableComponent;
|
import net.minecraft.network.chat.MutableComponent;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
@@ -24,20 +23,18 @@ public abstract class HookControlsScreen extends OptionsSubScreen {
|
|||||||
super(parentScreen, options, title);
|
super(parentScreen, options, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "init", at = @At("RETURN"))
|
@Inject(method = "addOptions", at = @At("RETURN"))
|
||||||
public void afterInit(final CallbackInfo ci) {
|
public void afterAddOptions(final CallbackInfo ci) {
|
||||||
@SuppressWarnings("ConstantConditions")
|
@SuppressWarnings("ConstantConditions")
|
||||||
final ControlsScreen screen = (ControlsScreen)(Object)this;
|
final ControlsScreen screen = (ControlsScreen)(Object)this;
|
||||||
|
|
||||||
for (final GuiEventListener child : children()) {
|
if (list != null) {
|
||||||
if (child instanceof final OptionsList optionsList) {
|
final MutableComponent buttonTitle = BetterControlsScreen.TITLE.plainCopy().append("...");
|
||||||
final MutableComponent buttonTitle = BetterControlsScreen.TITLE.plainCopy().append("...");
|
list.addSmall(List.of(Button.builder(buttonTitle, btn -> showOptionsScreen(screen)).build()));
|
||||||
optionsList.addSmall(List.of(Button.builder(buttonTitle, btn -> showOptionsScreen(screen)).build()));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Unique
|
||||||
private static void showOptionsScreen(final ControlsScreen screen) {
|
private static void showOptionsScreen(final ControlsScreen screen) {
|
||||||
final Minecraft mc = Minecraft.getInstance();
|
final Minecraft mc = Minecraft.getInstance();
|
||||||
mc.setScreen(new BetterControlsScreen(mc, screen));
|
mc.setScreen(new BetterControlsScreen(mc, screen));
|
||||||
|
|||||||
@@ -10,12 +10,14 @@ import org.spongepowered.asm.mixin.Final;
|
|||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Mutable;
|
import org.spongepowered.asm.mixin.Mutable;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
@Mixin(Options.class)
|
@Mixin(Options.class)
|
||||||
public abstract class HookLoadGameOptions {
|
public abstract class HookLoadGameOptions {
|
||||||
|
@Unique
|
||||||
private boolean hasLoaded = false;
|
private boolean hasLoaded = false;
|
||||||
|
|
||||||
@Mutable
|
@Mutable
|
||||||
|
|||||||
13
src/multiloader/resources/META-INF/jarjar/metadata.json
Normal file
13
src/multiloader/resources/META-INF/jarjar/metadata.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"jars": [{
|
||||||
|
"identifier": {
|
||||||
|
"group": "${group}",
|
||||||
|
"artifact": "${id}"
|
||||||
|
},
|
||||||
|
"version": {
|
||||||
|
"artifactVersion": "${version}",
|
||||||
|
"range": "[${version}]"
|
||||||
|
},
|
||||||
|
"path": "jars/${jarPrefix}-NeoForge.jar"
|
||||||
|
}]
|
||||||
|
}
|
||||||
34
src/multiloader/resources/fabric.mod.json
Normal file
34
src/multiloader/resources/fabric.mod.json
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"schemaVersion": 1,
|
||||||
|
"id": "${id}_multiloader",
|
||||||
|
"name": "${name} (Multiloader)",
|
||||||
|
"description": "${description}",
|
||||||
|
"version": "${version}",
|
||||||
|
"license": "${license}",
|
||||||
|
|
||||||
|
"icon": "assets/${id}/logo.png",
|
||||||
|
|
||||||
|
"authors": [
|
||||||
|
"${author}"
|
||||||
|
],
|
||||||
|
|
||||||
|
"contact": {
|
||||||
|
"homepage": "https://chylex.com",
|
||||||
|
"issues": "${issuesURL}",
|
||||||
|
"sources": "${sourcesURL}"
|
||||||
|
},
|
||||||
|
|
||||||
|
"environment": "${sidesForFabric}",
|
||||||
|
|
||||||
|
"jars": [{
|
||||||
|
"file": "jars/${jarPrefix}-Fabric.jar"
|
||||||
|
}],
|
||||||
|
|
||||||
|
"custom": {
|
||||||
|
"modmenu": {
|
||||||
|
"parent": "${id}",
|
||||||
|
"badges": [ "library" ],
|
||||||
|
"update_checker": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user