Compare commits
6 Commits
a875ae2255
...
edf97c834a
Author | SHA1 | Date |
---|---|---|
chylex | edf97c834a | |
chylex | cbe3fa6a71 | |
chylex | 0d1dfdee87 | |
chylex | d7d0bf072a | |
chylex | 4e12f8b43c | |
chylex | 6c2bf71472 |
|
@ -0,0 +1,46 @@
|
|||
plugins {
|
||||
idea
|
||||
id("fabric-loom") version "0.9-SNAPSHOT"
|
||||
}
|
||||
|
||||
val modId: String by project
|
||||
val minecraftVersion: String by project
|
||||
val fabricVersion: String by project
|
||||
|
||||
dependencies {
|
||||
minecraft("com.mojang:minecraft:$minecraftVersion")
|
||||
modImplementation("net.fabricmc:fabric-loader:$fabricVersion")
|
||||
mappings(loom.officialMojangMappings())
|
||||
}
|
||||
|
||||
loom {
|
||||
runs {
|
||||
named("client") {
|
||||
configName = "Fabric Client"
|
||||
client()
|
||||
runDir("run")
|
||||
ideConfigGenerated(true)
|
||||
}
|
||||
|
||||
named("server") {
|
||||
configName = "Fabric Server"
|
||||
server()
|
||||
runDir("run")
|
||||
ideConfigGenerated(true)
|
||||
}
|
||||
}
|
||||
|
||||
mixin {
|
||||
add(sourceSets.main.get(), "$modId.refmap.json")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand(inputs.properties)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
exclude("io/github/prospector/")
|
||||
}
|
|
@ -4,8 +4,8 @@ import net.fabricmc.api.ClientModInitializer;
|
|||
import net.fabricmc.loader.api.FabricLoader;
|
||||
|
||||
public final class BetterControlsMod implements ClientModInitializer {
|
||||
public static final BetterControlsConfig config = BetterControlsConfig.load(FabricLoader.getInstance().getConfigDir().resolve("BetterControls.json"));
|
||||
|
||||
@Override
|
||||
public void onInitializeClient() {}
|
||||
public void onInitializeClient() {
|
||||
BetterControlsCommon.setConfig(BetterControlsConfig.load(FabricLoader.getInstance().getConfigDir().resolve("BetterControls.json")));
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
@ -3,7 +3,7 @@
|
|||
"id": "bettercontrols",
|
||||
"version": "${version}",
|
||||
|
||||
"name": "Better Controls",
|
||||
"name": "${name}",
|
||||
"description": "Adds many powerful key bindings and options to control your movement.\nThe features complement vanilla mechanics without giving unfair advantages, so server use should be fine.",
|
||||
"icon": "assets/bettercontrols/icon.png",
|
||||
"license": "MPL-2.0",
|
|
@ -0,0 +1,95 @@
|
|||
import net.minecraftforge.gradle.userdev.UserDevExtension
|
||||
import org.gradle.api.file.DuplicatesStrategy.INCLUDE
|
||||
import org.spongepowered.asm.gradle.plugins.MixinExtension
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven("https://maven.minecraftforge.net")
|
||||
maven("https://repo.spongepowered.org/maven")
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath(group = "net.minecraftforge.gradle", name = "ForgeGradle", version = "5.1.+") { isChanging = true }
|
||||
classpath(group = "org.spongepowered", name = "mixingradle", version = "0.7-SNAPSHOT")
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
java
|
||||
eclipse
|
||||
}
|
||||
|
||||
apply {
|
||||
plugin("net.minecraftforge.gradle")
|
||||
plugin("org.spongepowered.mixin")
|
||||
}
|
||||
|
||||
val modId: String by project
|
||||
val minecraftVersion: String by project
|
||||
val forgeVersion: String by project
|
||||
val mixinVersion: String by project
|
||||
|
||||
dependencies {
|
||||
"minecraft"("net.minecraftforge:forge:$minecraftVersion-$forgeVersion")
|
||||
|
||||
if (System.getProperty("idea.sync.active") != "true") {
|
||||
annotationProcessor("org.spongepowered:mixin:$mixinVersion:processor")
|
||||
}
|
||||
}
|
||||
|
||||
configure<UserDevExtension> {
|
||||
mappings("official", minecraftVersion)
|
||||
|
||||
runs {
|
||||
create("client") {
|
||||
taskName = "Client"
|
||||
workingDirectory(rootProject.file("run"))
|
||||
ideaModule("${rootProject.name}.${project.name}.main")
|
||||
|
||||
property("mixin.env.remapRefMap", "true")
|
||||
property("mixin.env.refMapRemappingFile", "$projectDir/build/createSrgToMcp/output.srg")
|
||||
arg("-mixin.config=$modId.mixins.json")
|
||||
|
||||
mods {
|
||||
create(modId) {
|
||||
source(sourceSets.main.get())
|
||||
source(rootProject.sourceSets.main.get())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
create("server") {
|
||||
taskName = "Server"
|
||||
workingDirectory(rootProject.file("run"))
|
||||
ideaModule("${rootProject.name}.${project.name}.main")
|
||||
|
||||
property("mixin.env.remapRefMap", "true")
|
||||
property("mixin.env.refMapRemappingFile", "$projectDir/build/createSrgToMcp/output.srg")
|
||||
arg("-mixin.config=$modId.mixins.json")
|
||||
|
||||
mods {
|
||||
create(modId) {
|
||||
source(sourceSets.main.get())
|
||||
source(rootProject.sourceSets.main.get())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
configure<MixinExtension> {
|
||||
add(sourceSets.main.get(), "$modId.refmap.json")
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
from(sourceSets.main.get().resources.srcDirs) {
|
||||
include("META-INF/mods.toml")
|
||||
expand(inputs.properties)
|
||||
duplicatesStrategy = INCLUDE
|
||||
}
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
finalizedBy("reobfJar")
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package chylex.bettercontrols;
|
||||
import chylex.bettercontrols.config.BetterControlsConfig;
|
||||
import chylex.bettercontrols.gui.BetterControlsScreen;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.IExtensionPoint.DisplayTest;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.loading.FMLPaths;
|
||||
import net.minecraftforge.fmlclient.ConfigGuiHandler.ConfigGuiFactory;
|
||||
import net.minecraftforge.fmllegacy.network.FMLNetworkConstants;
|
||||
|
||||
@Mod("bettercontrols")
|
||||
public final class BetterControlsMod {
|
||||
public BetterControlsMod() {
|
||||
BetterControlsCommon.setConfig(DistExecutor.safeCallWhenOn(Dist.CLIENT, () -> ClientLoader::loadConfig));
|
||||
ModLoadingContext.get().registerExtensionPoint(ConfigGuiFactory.class, () -> new ConfigGuiFactory(ClientLoader::createScreen));
|
||||
ModLoadingContext.get().registerExtensionPoint(DisplayTest.class, () -> new DisplayTest(() -> FMLNetworkConstants.IGNORESERVERONLY, (a, b) -> true));
|
||||
}
|
||||
|
||||
private static final class ClientLoader {
|
||||
public static BetterControlsConfig loadConfig() {
|
||||
return BetterControlsConfig.load(FMLPaths.CONFIGDIR.get().resolve("BetterControls.json"));
|
||||
}
|
||||
|
||||
public static BetterControlsScreen createScreen(final Minecraft mc, final Screen parentScreen) {
|
||||
return new BetterControlsScreen(parentScreen);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
modLoader = "javafml"
|
||||
loaderVersion = "[37,)"
|
||||
|
||||
authors = "chylex"
|
||||
license = "MPL-2.0"
|
||||
issueTrackerURL = "https://github.com/chylex/Better-Controls/issues"
|
||||
|
||||
[[mods]]
|
||||
modId = "bettercontrols"
|
||||
version = "${version}"
|
||||
displayName = "${name}"
|
||||
logoFile = "icon.png"
|
||||
description = '''
|
||||
Adds many powerful key bindings and options to control your movement.
|
||||
The features complement vanilla mechanics without giving unfair advantages, so server use should be fine.
|
||||
'''
|
||||
|
||||
[[dependencies.bettercontrols]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
versionRange = "[1.17.1,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
|
||||
[[dependencies.bettercontrols]]
|
||||
modId = "forge"
|
||||
mandatory = true
|
||||
versionRange = "[37,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
14
README.md
14
README.md
|
@ -3,9 +3,9 @@ Better Controls
|
|||
|
||||
![Logo](https://raw.githubusercontent.com/chylex/Better-Controls/master/logo.png "Depiction of Zero Regrets")
|
||||
|
||||
Better Controls is a reimagining of [Better Sprinting](https://www.curseforge.com/minecraft/mc-mods/better-sprinting) with even more customizability. It features several new keybindings and many configurable options for how sprinting, sneaking, and flying should behave.
|
||||
[Better Controls](https://www.curseforge.com/minecraft/mc-mods/better-controls) is a reimagining of [Better Sprinting](https://www.curseforge.com/minecraft/mc-mods/better-sprinting) with even more customizability. It features several new keybindings and many configurable options for how sprinting, sneaking, and flying should behave.
|
||||
|
||||
Better Controls only focuses on complementing vanilla mechanics rather than adding new mechanics (such as [Better Sprinting](https://www.curseforge.com/minecraft/mc-mods/better-sprinting)'s option to allow sprinting in all directions) that only work on client side and server owners must explicitly opt in to enable them. By not having such features in Better Controls, it significantly reduces complexity by not having a server side version of the mod, and not needing a way to completely disable the mod while the game is running.
|
||||
Better Controls only focuses on complementing vanilla mechanics, rather than adding new mechanics (such as [Better Sprinting](https://www.curseforge.com/minecraft/mc-mods/better-sprinting)'s option to allow sprinting in all directions) that only work on client side and server owners must explicitly opt in to enable them. By not having such features in Better Controls, it significantly reduces complexity by not having a server side version of the mod, and not needing a way to completely disable the mod while the game is running.
|
||||
|
||||
Another major difference is the amount and granularity of options. Better Controls could be considered an *advanced controls mod* - by default, none of the keybinds are bound, and all options are set to match vanilla behavior. To take full advantage, go into *Options - Controls - Better Controls*, check out all of the available options, and figure out the best configuration for you.
|
||||
|
||||
|
@ -54,7 +54,7 @@ While this is convenient, there is potential for bugs which can affect server pl
|
|||
### Compatibility
|
||||
|
||||
* Better Controls is a client-side mod, it will do nothing when installed on a server.
|
||||
* If you run into a conflict with another mod that modifies the *Controls* screen, hold Alt while opening *Controls* to prevent Better Controls from adding its button. If another mod prevents the button from appearing, you can install [Mod Menu](https://www.curseforge.com/minecraft/mc-mods/modmenu) which adds a mod list with configuration buttons for mods.
|
||||
* If you run into a conflict with another mod that modifies the *Controls* screen, hold Alt while opening *Controls* to prevent Better Controls from adding its button. If another mod prevents the button from appearing, a button to open the mod's configuration is available in the Mods menu (for Fabric, install [Mod Menu](https://www.curseforge.com/minecraft/mc-mods/modmenu)).
|
||||
|
||||
## Screenshot
|
||||
|
||||
|
@ -63,11 +63,15 @@ While this is convenient, there is potential for bugs which can affect server pl
|
|||
Source Code
|
||||
===========
|
||||
|
||||
The `main` branch includes the latest version for Fabric. Older versions and their Forge equivalents are in branches named `fabric/<version>` and `forge/<version>`.
|
||||
The `main` branch includes both the Fabric and Forge version in a single project. The project uses Mojang mappings. The root project contains common source code and resource files, and the `Fabric` and `Forge` folders are subprojects with loader-specific files.
|
||||
|
||||
The `main` branch always has the latest development version. Before updating to a new Minecraft version, a new branch is created from the `main` branch (for example, before the mod is updated to `1.18`, a branch named `1.17` will be created). Further development of older versions may continue in these branches in case backports or version-specific fixes are needed.
|
||||
|
||||
Older versions from before the merge of the Fabric and Forge versions can be found in branches named `fabric/<version>` and `forge/<version>`.
|
||||
|
||||
## Contributing
|
||||
|
||||
All contributions should target the `main` branch, unless the contribution is specifically made for older versions. Every feature must be portable to Forge to ensure parity, unless the feature adds integration with another mod that is only compatible with one mod loader. Integrations for Forge-only mods should target the most recent `forge/<version>` branch.
|
||||
All contributions should target the `main` branch and work in both Fabric and Forge, unless the contribution is specifically targeting older versions or a specific mod loader.
|
||||
|
||||
For any larger contributions, please [open an issue](https://github.com/chylex/Better-Controls/issues/new) first before you make a PR.
|
||||
|
||||
|
|
36
build.gradle
36
build.gradle
|
@ -1,36 +0,0 @@
|
|||
plugins {
|
||||
id 'fabric-loom' version '0.9-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_16
|
||||
targetCompatibility = JavaVersion.VERSION_16
|
||||
|
||||
archivesBaseName = project.archives_base_name
|
||||
version = 'v' + project.mod_version
|
||||
group = project.maven_group
|
||||
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
mappings minecraft.officialMojangMappings()
|
||||
compileOnly "com.google.code.findbugs:jsr305:3.0.2"
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.mod_version
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand "version": project.mod_version
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
options.release = 16
|
||||
}
|
||||
|
||||
jar {
|
||||
from "LICENSE"
|
||||
exclude "io/github/prospector/"
|
||||
}
|
|
@ -0,0 +1,124 @@
|
|||
import org.gradle.api.file.DuplicatesStrategy.EXCLUDE
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
maven("https://repo.spongepowered.org/maven")
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
idea
|
||||
id("org.spongepowered.gradle.vanilla") version "0.2.1-SNAPSHOT"
|
||||
}
|
||||
|
||||
idea {
|
||||
module {
|
||||
excludeDirs.add(project.file("run"))
|
||||
}
|
||||
}
|
||||
|
||||
val modId: String by project
|
||||
val modName: String by project
|
||||
val modAuthor: String by project
|
||||
val modVersion: String by project
|
||||
val minecraftVersion: String by project
|
||||
val mixinVersion: String by project
|
||||
|
||||
repositories {
|
||||
maven("https://repo.spongepowered.org/maven")
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.spongepowered:mixin:$mixinVersion")
|
||||
api("com.google.code.findbugs:jsr305:3.0.2")
|
||||
}
|
||||
|
||||
base {
|
||||
archivesName.set("${modName.replace(" ", "")}-Common-$minecraftVersion")
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version(minecraftVersion)
|
||||
runs.clear()
|
||||
}
|
||||
|
||||
allprojects {
|
||||
group = "com.$modAuthor.$modId"
|
||||
version = modVersion
|
||||
|
||||
apply(plugin = "java")
|
||||
|
||||
dependencies {
|
||||
implementation("org.jetbrains:annotations:22.0.0")
|
||||
}
|
||||
|
||||
extensions.getByType<JavaPluginExtension>().apply {
|
||||
toolchain.languageVersion.set(JavaLanguageVersion.of(16))
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
options.encoding = "UTF-8"
|
||||
options.release.set(16)
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
repositories {
|
||||
maven("https://repo.spongepowered.org/maven")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(rootProject)
|
||||
}
|
||||
|
||||
base {
|
||||
archivesName.set("${modName.replace(" ", "")}-${project.name}-$minecraftVersion")
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
source({ rootProject.sourceSets.main.get().allSource })
|
||||
}
|
||||
|
||||
tasks.processResources {
|
||||
from(rootProject.sourceSets.main.get().resources)
|
||||
|
||||
inputs.property("name", modName)
|
||||
inputs.property("version", modVersion)
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
from(rootProject.file("LICENSE"))
|
||||
|
||||
manifest {
|
||||
attributes(
|
||||
"Specification-Title" to modId,
|
||||
"Specification-Vendor" to modAuthor,
|
||||
"Specification-Version" to "1",
|
||||
"Implementation-Title" to "${modName.replace(" ", "")}-${project.name}",
|
||||
"Implementation-Vendor" to modAuthor,
|
||||
"Implementation-Version" to modVersion,
|
||||
"Implementation-Timestamp" to SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()),
|
||||
"MixinConfigs" to "$modId.mixins.json"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val copyJars = tasks.register<Copy>("copyJars") {
|
||||
duplicatesStrategy = EXCLUDE
|
||||
|
||||
for (subproject in subprojects) {
|
||||
dependsOn(subproject.tasks.build)
|
||||
from(subproject.base.libsDirectory.file("${subproject.base.archivesName.get()}-$modVersion.jar"))
|
||||
}
|
||||
|
||||
into(file("${project.buildDir}/dist"))
|
||||
}
|
||||
|
||||
tasks.build {
|
||||
finalizedBy(copyJars)
|
||||
}
|
|
@ -1,13 +1,15 @@
|
|||
# Done to increase the memory available to gradle.
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
# Mod
|
||||
modId=bettercontrols
|
||||
modName=Better Controls
|
||||
modAuthor=chylex
|
||||
modVersion=1.2.0a
|
||||
|
||||
# Fabric Properties
|
||||
minecraft_version=1.17
|
||||
loader_version=0.11.3
|
||||
# Dependencies
|
||||
minecraftVersion=1.17.1
|
||||
forgeVersion=37.0.75
|
||||
fabricVersion=0.11.7
|
||||
mixinVersion=0.8.4
|
||||
|
||||
# Mod Properties
|
||||
mod_version=1.2.0
|
||||
maven_group=chylex.bettercontrols
|
||||
archives_base_name=BetterControls-1.17+
|
||||
|
||||
# https://modmuss50.me/fabric.html
|
||||
# Gradle
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
|
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
|
@ -72,7 +72,7 @@ case "`uname`" in
|
|||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
MSYS* | MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
|
@ -172,14 +172,12 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
ARGV=("$@")
|
||||
eval set -- $DEFAULT_JVM_OPTS
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
IFS=$'
|
||||
' read -rd '' -a JAVA_OPTS_ARR <<< "$(echo $JAVA_OPTS | xargs -n1)"
|
||||
IFS=$'
|
||||
' read -rd '' -a GRADLE_OPTS_ARR <<< "$(echo $GRADLE_OPTS | xargs -n1)"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
exec "$JAVACMD" "$@" "${JAVA_OPTS_ARR[@]}" "${GRADLE_OPTS_ARR[@]}" "-Dorg.gradle.appname=$APP_BASE_NAME" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "${ARGV[@]}"
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
maven {
|
||||
name = 'Fabric'
|
||||
url = 'https://maven.fabricmc.net/'
|
||||
}
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
rootProject.name = "Better-Controls"
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven(url = "https://maven.fabricmc.net/") { name = "Fabric" }
|
||||
maven(url = "https://repo.spongepowered.org/repository/maven-public/") { name = "Sponge Snapshots" }
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.extra.has("forgeVersion")) {
|
||||
include("Forge")
|
||||
}
|
||||
|
||||
if (settings.extra.has("fabricVersion")) {
|
||||
include("Fabric")
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package chylex.bettercontrols;
|
||||
|
||||
import chylex.bettercontrols.config.BetterControlsConfig;
|
||||
|
||||
public final class BetterControlsCommon {
|
||||
private static BetterControlsConfig config;
|
||||
|
||||
public static BetterControlsConfig getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
static void setConfig(final BetterControlsConfig config) {
|
||||
BetterControlsCommon.config = config;
|
||||
}
|
||||
|
||||
private BetterControlsCommon() {}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
package chylex.bettercontrols.gui;
|
||||
import chylex.bettercontrols.BetterControlsMod;
|
||||
import chylex.bettercontrols.BetterControlsCommon;
|
||||
import chylex.bettercontrols.config.BetterControlsConfig;
|
||||
import chylex.bettercontrols.gui.elements.BooleanValueWidget;
|
||||
import chylex.bettercontrols.gui.elements.CycleButtonWidget;
|
||||
|
@ -13,6 +13,7 @@ import chylex.bettercontrols.input.SprintMode;
|
|||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.screens.OptionsSubScreen;
|
||||
|
@ -20,8 +21,9 @@ import net.minecraft.client.gui.screens.Screen;
|
|||
import net.minecraft.network.chat.CommonComponents;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
@ -31,7 +33,6 @@ import static chylex.bettercontrols.gui.OptionListWidget.ROW_WIDTH;
|
|||
import static chylex.bettercontrols.gui.OptionListWidget.col2;
|
||||
import static chylex.bettercontrols.gui.OptionListWidget.col4;
|
||||
import static chylex.bettercontrols.gui.elements.TextWidget.CENTER;
|
||||
import static chylex.bettercontrols.util.Statics.OPTIONS;
|
||||
|
||||
public class BetterControlsScreen extends OptionsSubScreen {
|
||||
private static TextComponent text(final String text) {
|
||||
|
@ -54,7 +55,7 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
|||
// Options
|
||||
|
||||
private int generateSprintingOptions(int y, final List<GuiEventListener> elements) {
|
||||
final BetterControlsConfig cfg = BetterControlsMod.config;
|
||||
final BetterControlsConfig cfg = BetterControlsCommon.getConfig();
|
||||
|
||||
generateKeyBindingWithModifierOption(y, elements, text("Toggle Sprint"), cfg.keyToggleSprint);
|
||||
|
||||
|
@ -78,7 +79,7 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
|||
}
|
||||
|
||||
private int generateSneakingOptions(int y, final List<GuiEventListener> elements) {
|
||||
final BetterControlsConfig cfg = BetterControlsMod.config;
|
||||
final BetterControlsConfig cfg = BetterControlsCommon.getConfig();
|
||||
|
||||
generateKeyBindingWithModifierOption(y, elements, text("Toggle Sneak"), cfg.keyToggleSneak);
|
||||
|
||||
|
@ -93,7 +94,7 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
|||
|
||||
@SuppressWarnings({ "AutoBoxing", "AutoUnboxing" })
|
||||
private int generateFlightOptions(int y, final List<GuiEventListener> elements) {
|
||||
final BetterControlsConfig cfg = BetterControlsMod.config;
|
||||
final BetterControlsConfig cfg = BetterControlsCommon.getConfig();
|
||||
|
||||
final List<Option<Float>> flightSpeedOptions = Arrays.asList(
|
||||
new Option<>(Float.valueOf(0.25F), text("0.25x")),
|
||||
|
@ -178,7 +179,7 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
|||
}
|
||||
|
||||
private int generateMiscellaneousOptions(int y, final List<GuiEventListener> elements) {
|
||||
final BetterControlsConfig cfg = BetterControlsMod.config;
|
||||
final BetterControlsConfig cfg = BetterControlsCommon.getConfig();
|
||||
|
||||
generateKeyBindingWithModifierOption(y, elements, text("Toggle Walk Forwards"), cfg.keyToggleWalkForward);
|
||||
|
||||
|
@ -229,7 +230,7 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
|||
private final List<KeyBindingWidget> allKeyBindings = new ArrayList<>();
|
||||
|
||||
public BetterControlsScreen(@Nullable final Screen parentScreen) {
|
||||
super(parentScreen, OPTIONS, TITLE);
|
||||
super(parentScreen, Minecraft.getInstance().options, TITLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -257,11 +258,11 @@ public class BetterControlsScreen extends OptionsSubScreen {
|
|||
|
||||
@Override
|
||||
public void removed() {
|
||||
BetterControlsMod.config.save();
|
||||
BetterControlsCommon.getConfig().save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(final PoseStack matrices, final int mouseX, final int mouseY, final float delta) {
|
||||
public void render(final @NotNull PoseStack matrices, final int mouseX, final int mouseY, final float delta) {
|
||||
renderBackground(matrices);
|
||||
optionsWidget.render(matrices, mouseX, mouseY, delta);
|
||||
drawCenteredString(matrices, font, title, width / 2, 8, (255 << 16) | (255 << 8) | 255);
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
package chylex.bettercontrols.gui;
|
||||
import chylex.bettercontrols.gui.OptionListWidget.Entry;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.ContainerObjectSelectionList;
|
||||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import static chylex.bettercontrols.util.Statics.MINECRAFT;
|
||||
|
||||
public final class OptionListWidget extends ContainerObjectSelectionList<Entry> {
|
||||
public static final int ROW_WIDTH = 408;
|
||||
|
@ -30,11 +31,11 @@ public final class OptionListWidget extends ContainerObjectSelectionList<Entry>
|
|||
}
|
||||
|
||||
private static Offset getElementOffset(final GuiEventListener element) {
|
||||
if (element instanceof OptionWidget) {
|
||||
return new Offset(((OptionWidget)element).getX(), ((OptionWidget)element).getY());
|
||||
if (element instanceof final OptionWidget widget) {
|
||||
return new Offset(widget.getX(), widget.getY());
|
||||
}
|
||||
else if (element instanceof AbstractWidget) {
|
||||
return new Offset(((AbstractWidget)element).x, ((AbstractWidget)element).y);
|
||||
else if (element instanceof final AbstractWidget widget) {
|
||||
return new Offset(widget.x, widget.y);
|
||||
}
|
||||
else {
|
||||
return new Offset(0, 0);
|
||||
|
@ -48,18 +49,10 @@ public final class OptionListWidget extends ContainerObjectSelectionList<Entry>
|
|||
void setY(int y);
|
||||
}
|
||||
|
||||
private static final class Offset {
|
||||
public final int x;
|
||||
public final int y;
|
||||
|
||||
private Offset(final int x, final int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
}
|
||||
private record Offset(int x, int y) {}
|
||||
|
||||
public OptionListWidget(final int top, final int bottom, final int width, final int height, final List<GuiEventListener> widgets, final int innerHeight) {
|
||||
super(MINECRAFT, width, height, top, bottom, innerHeight);
|
||||
super(Minecraft.getInstance(), width, height, top, bottom, innerHeight);
|
||||
addEntry(new Entry(widgets));
|
||||
}
|
||||
|
||||
|
@ -90,33 +83,31 @@ public final class OptionListWidget extends ContainerObjectSelectionList<Entry>
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<? extends GuiEventListener> children() {
|
||||
public @NotNull List<? extends GuiEventListener> children() {
|
||||
return Collections.unmodifiableList(elements);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends NarratableEntry> narratables() {
|
||||
public @NotNull List<? extends NarratableEntry> narratables() {
|
||||
return Collections.unmodifiableList(narratables);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(final PoseStack matrices, final int index, final int y, final int x, final int entryWidth, final int entryHeight, final int mouseX, final int mouseY, final boolean hovered, final float tickDelta) {
|
||||
public void render(final @NotNull PoseStack matrices, final int index, final int y, final int x, final int entryWidth, final int entryHeight, final int mouseX, final int mouseY, final boolean hovered, final float tickDelta) {
|
||||
for (final GuiEventListener element : elements) {
|
||||
final Offset offset = offsets.get(element);
|
||||
|
||||
if (element instanceof AbstractWidget) {
|
||||
final AbstractWidget button = (AbstractWidget)element;
|
||||
button.x = x + offset.x;
|
||||
button.y = y + offset.y;
|
||||
if (element instanceof final AbstractWidget widget) {
|
||||
widget.x = x + offset.x;
|
||||
widget.y = y + offset.y;
|
||||
}
|
||||
else if (element instanceof OptionWidget) {
|
||||
final OptionWidget widget = (OptionWidget)element;
|
||||
else if (element instanceof final OptionWidget widget) {
|
||||
widget.setX(x + offset.x);
|
||||
widget.setY(y + offset.y);
|
||||
}
|
||||
|
||||
if (element instanceof Widget) {
|
||||
((Widget)element).render(matrices, mouseX, mouseY, tickDelta);
|
||||
if (element instanceof final Widget widget) {
|
||||
widget.render(matrices, mouseX, mouseY, tickDelta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
package chylex.bettercontrols.gui;
|
||||
import chylex.bettercontrols.mixin.AccessCycleButtonFields;
|
||||
import chylex.bettercontrols.mixin.AccessOptionFields;
|
||||
import chylex.bettercontrols.mixin.AccessScreenButtons;
|
||||
import net.minecraft.client.Option;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.components.CycleButton;
|
||||
import net.minecraft.client.gui.components.events.ContainerEventHandler;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.screens.AccessibilityOptionsScreen;
|
||||
import net.minecraft.client.gui.screens.controls.ControlsScreen;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import static chylex.bettercontrols.util.Statics.MINECRAFT;
|
||||
|
||||
public final class ScreenPatcher {
|
||||
private ScreenPatcher() {}
|
||||
|
||||
public static void onControlsScreenOpened(final ControlsScreen screen) {
|
||||
final AccessScreenButtons accessor = (AccessScreenButtons)screen;
|
||||
final List<? extends GuiEventListener> children = screen.children();
|
||||
|
||||
final CycleButton<?> autoJump = children.stream().flatMap(it -> getOptionButton(it, Option.AUTO_JUMP).stream()).findAny().orElse(null);
|
||||
|
||||
if (autoJump != null) {
|
||||
final Button widget = new Button(autoJump.x, autoJump.y, autoJump.getWidth(), autoJump.getHeight(), BetterControlsScreen.TITLE.plainCopy().append("..."), btn -> {
|
||||
MINECRAFT.setScreen(new BetterControlsScreen(screen));
|
||||
});
|
||||
|
||||
accessor.callRemoveWidget(autoJump);
|
||||
accessor.callAddRenderableWidget(widget);
|
||||
}
|
||||
}
|
||||
|
||||
public static void onAccessibilityScreenOpened(final AccessibilityOptionsScreen screen) {
|
||||
walkChildren(screen.children(), it -> {
|
||||
getOptionButton(it, Option.TOGGLE_SPRINT).ifPresent(button -> button.active = false);
|
||||
getOptionButton(it, Option.TOGGLE_CROUCH).ifPresent(button -> button.active = false);
|
||||
});
|
||||
}
|
||||
|
||||
private static void walkChildren(final List<? extends GuiEventListener> elements, final Consumer<GuiEventListener> callback) {
|
||||
for (final GuiEventListener element : elements) {
|
||||
callback.accept(element);
|
||||
|
||||
if (element instanceof ContainerEventHandler) {
|
||||
walkChildren(((ContainerEventHandler)element).children(), callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Optional<CycleButton<?>> getOptionButton(final GuiEventListener element, final Option option) {
|
||||
if (element instanceof CycleButton<?> && ((AccessOptionFields)option).getCaption().equals(((AccessCycleButtonFields)element).getName())) {
|
||||
return Optional.of((CycleButton<?>)element);
|
||||
}
|
||||
else {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ public class CycleButtonWidget<T> extends Button {
|
|||
private T selectedValue;
|
||||
|
||||
public CycleButtonWidget(final int x, final int y, final int width, final int height, final List<Option<T>> options, final T selectedValue, final Consumer<T> onChanged) {
|
||||
super(x, y, width, height, Option.find(options, selectedValue).getText(), btn -> {});
|
||||
super(x, y, width, height, Option.find(options, selectedValue).text(), btn -> {});
|
||||
this.options = options;
|
||||
this.selectedValue = selectedValue;
|
||||
this.onChanged = onChanged;
|
||||
|
@ -29,8 +29,8 @@ public class CycleButtonWidget<T> extends Button {
|
|||
|
||||
final Option<T> newSelectedOption = options.get(nextIndex);
|
||||
|
||||
selectedValue = newSelectedOption.getValue();
|
||||
selectedValue = newSelectedOption.value();
|
||||
onChanged.accept(selectedValue);
|
||||
setMessage(newSelectedOption.getText());
|
||||
setMessage(newSelectedOption.text());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ public final class DiscreteValueSliderWidget<T> extends AbstractSliderButton {
|
|||
private T selectedValue;
|
||||
|
||||
public DiscreteValueSliderWidget(final int x, final int y, final int width, final int height, final List<Option<T>> options, final T selectedValue, final Consumer<T> onChanged) {
|
||||
super(x, y, width, height, Option.find(options, selectedValue).getText(), options.indexOf(Option.find(options, selectedValue)) / (options.size() - 1.0));
|
||||
super(x, y, width, height, Option.find(options, selectedValue).text(), options.indexOf(Option.find(options, selectedValue)) / (options.size() - 1.0));
|
||||
this.options = options;
|
||||
this.selectedValue = selectedValue;
|
||||
this.onChanged = onChanged;
|
||||
|
@ -26,12 +26,12 @@ public final class DiscreteValueSliderWidget<T> extends AbstractSliderButton {
|
|||
|
||||
@Override
|
||||
protected void updateMessage() {
|
||||
setMessage(getSelectedOption().getText());
|
||||
setMessage(getSelectedOption().text());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyValue() {
|
||||
final T newSelectedValue = getSelectedOption().getValue();
|
||||
final T newSelectedValue = getSelectedOption().value();
|
||||
|
||||
if (selectedValue != newSelectedValue) {
|
||||
selectedValue = newSelectedValue;
|
||||
|
|
|
@ -2,16 +2,17 @@ package chylex.bettercontrols.gui.elements;
|
|||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.components.AbstractButton;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import static chylex.bettercontrols.util.Statics.OPTIONS;
|
||||
|
||||
public final class KeyBindingWidget extends Button {
|
||||
private final KeyMapping binding;
|
||||
|
@ -40,7 +41,7 @@ public final class KeyBindingWidget extends Button {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected MutableComponent createNarrationMessage() {
|
||||
protected @NotNull MutableComponent createNarrationMessage() {
|
||||
return binding.isUnbound() ? new TranslatableComponent("narrator.controls.unbound", bindingName) : new TranslatableComponent("narrator.controls.bound", bindingName, super.createNarrationMessage());
|
||||
}
|
||||
|
||||
|
@ -69,8 +70,8 @@ public final class KeyBindingWidget extends Button {
|
|||
boolean hasConflict = false;
|
||||
|
||||
if (!binding.isUnbound()) {
|
||||
for (final KeyMapping other : OPTIONS.keyMappings) {
|
||||
if (binding != other && binding.equals(other)) {
|
||||
for (final KeyMapping other : Minecraft.getInstance().options.keyMappings) {
|
||||
if (binding != other && binding.same(other)) {
|
||||
hasConflict = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3,23 +3,7 @@ import net.minecraft.network.chat.Component;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public final class Option<T> {
|
||||
private final T value;
|
||||
private final Component text;
|
||||
|
||||
public Option(final T value, final Component text) {
|
||||
this.value = value;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public T getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Component getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public record Option<T>(T value, Component text) {
|
||||
public static <T> Option<T> find(final List<Option<T>> options, final T value) {
|
||||
return options.stream().filter(it -> Objects.equals(it.value, value)).findFirst().orElseGet(() -> options.get(0));
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package chylex.bettercontrols.gui.elements;
|
||||
import chylex.bettercontrols.gui.OptionListWidget.OptionWidget;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.util.FormattedCharSequence;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import java.util.List;
|
||||
import static chylex.bettercontrols.util.Statics.MINECRAFT;
|
||||
|
||||
public final class TextWidget extends GuiComponent implements OptionWidget {
|
||||
public static final int LEFT = 0;
|
||||
|
@ -57,8 +58,8 @@ public final class TextWidget extends GuiComponent implements OptionWidget {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(final PoseStack matrices, final int mouseX, final int mouseY, final float delta) {
|
||||
final Font textRenderer = MINECRAFT.font;
|
||||
public void render(final @NotNull PoseStack matrices, final int mouseX, final int mouseY, final float delta) {
|
||||
final Font textRenderer = Minecraft.getInstance().font;
|
||||
final List<FormattedCharSequence> lines = textRenderer.split(text, width);
|
||||
final int lineHeight = textRenderer.lineHeight + 1;
|
||||
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
package chylex.bettercontrols.input;
|
||||
import com.mojang.blaze3d.platform.InputConstants.Type;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import javax.annotation.Nullable;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class KeyBindingWithModifier extends KeyMapping {
|
||||
public static final String CATEGORY = "key.categories.bettercontrols";
|
||||
|
||||
public static boolean checkCategoryMatches(final Component text) {
|
||||
return text instanceof TranslatableComponent && CATEGORY.equals(((TranslatableComponent)text).getKey());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private ModifierKey modifier = null;
|
||||
|
||||
|
|
|
@ -5,6 +5,6 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
|||
|
||||
@Mixin(Camera.class)
|
||||
public interface AccessCameraFields {
|
||||
@Accessor("eyeHeight")
|
||||
void setCameraY(float y);
|
||||
@Accessor
|
||||
void setEyeHeight(float y);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,6 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
|||
|
||||
@Mixin(LocalPlayer.class)
|
||||
public interface AccessClientPlayerFields {
|
||||
@Accessor("sprintTriggerTime")
|
||||
void setTicksLeftToDoubleTapSprint(int value);
|
||||
@Accessor
|
||||
void setSprintTriggerTime(int value);
|
||||
}
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
import net.minecraft.client.gui.screens.controls.ControlList.CategoryEntry;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(CategoryEntry.class)
|
||||
public interface AccessControlsListCategory {
|
||||
@Accessor("name")
|
||||
Component getText();
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.client.gui.screens.controls.ControlList.KeyEntry;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(KeyEntry.class)
|
||||
public interface AccessControlsListKeyBinding {
|
||||
@Accessor("key")
|
||||
KeyMapping getBinding();
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
|
||||
import net.minecraft.client.gui.components.CycleButton;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(CycleButton.class)
|
||||
public interface AccessCycleButtonFields {
|
||||
@Accessor("name")
|
||||
Component getName();
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
|
||||
import net.minecraft.client.Option;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(Option.class)
|
||||
public interface AccessOptionFields {
|
||||
@Accessor("caption")
|
||||
Component getCaption();
|
||||
}
|
|
@ -5,6 +5,6 @@ import org.spongepowered.asm.mixin.gen.Accessor;
|
|||
|
||||
@Mixin(Player.class)
|
||||
public interface AccessPlayerFields {
|
||||
@Accessor("jumpTriggerTime")
|
||||
void setTicksLeftToDoubleTapFlight(int value);
|
||||
@Accessor
|
||||
void setJumpTriggerTime(int value);
|
||||
}
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
@Mixin(Screen.class)
|
||||
public interface AccessScreenButtons {
|
||||
@Invoker
|
||||
<T extends GuiEventListener & Widget & NarratableEntry> T callAddRenderableWidget(T widget);
|
||||
|
||||
@Invoker
|
||||
void callRemoveWidget(GuiEventListener widget);
|
||||
}
|
|
@ -7,10 +7,10 @@ import java.util.function.BooleanSupplier;
|
|||
|
||||
@Mixin(ToggleKeyMapping.class)
|
||||
public interface AccessStickyKeyBindingStateGetter {
|
||||
@Accessor("needsToggle")
|
||||
BooleanSupplier getToggleGetter();
|
||||
@Accessor
|
||||
BooleanSupplier getNeedsToggle();
|
||||
|
||||
@Accessor("needsToggle")
|
||||
@Accessor
|
||||
@Mutable
|
||||
void setToggleGetter(final BooleanSupplier toggleGetter);
|
||||
void setNeedsToggle(final BooleanSupplier toggleGetter);
|
||||
}
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
|
||||
import chylex.bettercontrols.player.PlayerTicker;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.player.AbstractClientPlayer;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.Slice;
|
||||
import static chylex.bettercontrols.util.Statics.MINECRAFT;
|
||||
|
||||
@SuppressWarnings("MethodMayBeStatic")
|
||||
@Mixin(AbstractClientPlayer.class)
|
||||
public abstract class HookClientPlayerFOV {
|
||||
@Redirect(
|
||||
|
@ -21,7 +20,7 @@ public abstract class HookClientPlayerFOV {
|
|||
)
|
||||
)
|
||||
private boolean resetFOV(final float movementSpeed) {
|
||||
final LocalPlayer player = MINECRAFT.player;
|
||||
final LocalPlayer player = Minecraft.getInstance().player;
|
||||
return (player != null && PlayerTicker.get(player).shouldResetFOV(player)) || Float.isNaN(movementSpeed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
import chylex.bettercontrols.player.PlayerTicker;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.player.Input;
|
||||
import net.minecraft.client.player.KeyboardInput;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
|
@ -7,15 +8,15 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import static chylex.bettercontrols.util.Statics.MINECRAFT;
|
||||
import static org.spongepowered.asm.mixin.injection.At.Shift.AFTER;
|
||||
|
||||
@Mixin(KeyboardInput.class)
|
||||
public abstract class HookClientPlayerInputTick {
|
||||
@Inject(method = "tick(Z)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/player/KeyboardInput;up:Z", ordinal = 0, shift = AFTER))
|
||||
private void afterInputTick(final CallbackInfo info) {
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
final Input input = (Input)(Object)this;
|
||||
final LocalPlayer player = MINECRAFT.player;
|
||||
final LocalPlayer player = Minecraft.getInstance().player;
|
||||
|
||||
if (player != null) {
|
||||
PlayerTicker.get(player).afterInputAssignsPressingForward(input);
|
||||
|
|
|
@ -18,18 +18,21 @@ public abstract class HookClientPlayerTick extends AbstractClientPlayer {
|
|||
|
||||
@Inject(method = "aiStep()V", at = @At("HEAD"))
|
||||
private void atHead(final CallbackInfo info) {
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
final LocalPlayer player = (LocalPlayer)(Object)this;
|
||||
PlayerTicker.get(player).atHead(player);
|
||||
}
|
||||
|
||||
@Inject(method = "aiStep()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/Input;tick(Z)V", ordinal = 0, shift = AFTER))
|
||||
private void afterInputTick(final CallbackInfo info) {
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
final LocalPlayer player = (LocalPlayer)(Object)this;
|
||||
PlayerTicker.get(player).afterInputTick(player);
|
||||
}
|
||||
|
||||
@Inject(method = "aiStep()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/AbstractClientPlayer;aiStep()V", ordinal = 0, shift = AFTER))
|
||||
private void afterSuperCall(final CallbackInfo info) {
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
final LocalPlayer player = (LocalPlayer)(Object)this;
|
||||
PlayerTicker.get(player).afterSuperCall(player);
|
||||
}
|
||||
|
|
|
@ -1,18 +1,15 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
import chylex.bettercontrols.BetterControlsMod;
|
||||
import chylex.bettercontrols.input.KeyBindingWithModifier;
|
||||
import chylex.bettercontrols.BetterControlsCommon;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.Options;
|
||||
import net.minecraft.client.gui.components.ContainerObjectSelectionList;
|
||||
import net.minecraft.client.gui.screens.controls.ControlList;
|
||||
import net.minecraft.client.gui.screens.controls.ControlList.CategoryEntry;
|
||||
import net.minecraft.client.gui.screens.controls.ControlList.Entry;
|
||||
import net.minecraft.client.gui.screens.controls.ControlList.KeyEntry;
|
||||
import net.minecraft.client.gui.screens.controls.ControlsScreen;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(ControlList.class)
|
||||
public abstract class HookControlsListWidget extends ContainerObjectSelectionList<Entry> {
|
||||
|
@ -20,18 +17,8 @@ public abstract class HookControlsListWidget extends ContainerObjectSelectionLis
|
|||
super(client, width, height, top, bottom, itemHeight);
|
||||
}
|
||||
|
||||
@Inject(method = "<init>", at = @At("TAIL"))
|
||||
public void init(final ControlsScreen parent, final Minecraft client, final CallbackInfo ci) {
|
||||
children().removeIf(it -> {
|
||||
if (it instanceof CategoryEntry && KeyBindingWithModifier.checkCategoryMatches(((AccessControlsListCategory)it).getText())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (it instanceof KeyEntry && ArrayUtils.contains(BetterControlsMod.config.getAllKeyBindings(), ((AccessControlsListKeyBinding)it).getBinding())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
@Redirect(method = "<init>", at = @At(value = "FIELD", target = "Lnet/minecraft/client/Options;keyMappings:[Lnet/minecraft/client/KeyMapping;"))
|
||||
private KeyMapping[] excludeOwnKeyBindings(final Options options) {
|
||||
return ArrayUtils.removeElements(options.keyMappings, BetterControlsCommon.getConfig().getAllKeyBindings());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
|
||||
import chylex.bettercontrols.gui.BetterControlsScreen;
|
||||
import net.minecraft.client.CycleOption;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.Option;
|
||||
import net.minecraft.client.Options;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.screens.controls.ControlsScreen;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(ControlsScreen.class)
|
||||
public abstract class HookControlsScreen {
|
||||
@Redirect(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/CycleOption;createButton(Lnet/minecraft/client/Options;III)Lnet/minecraft/client/gui/components/AbstractWidget;"))
|
||||
private AbstractWidget replaceAutoJumpButton(final CycleOption<?> option, final Options options, final int x, final int y, final int width) {
|
||||
if (option == Option.AUTO_JUMP && !Screen.hasAltDown()) {
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
final ControlsScreen screen = (ControlsScreen)(Object)this;
|
||||
return new Button(x, y, width, 20, BetterControlsScreen.TITLE.plainCopy().append("..."), btn -> Minecraft.getInstance().setScreen(new BetterControlsScreen(screen)));
|
||||
}
|
||||
|
||||
return option.createButton(options, x, y, width);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
import chylex.bettercontrols.BetterControlsMod;
|
||||
import chylex.bettercontrols.BetterControlsCommon;
|
||||
import chylex.bettercontrols.config.BetterControlsConfig;
|
||||
import chylex.bettercontrols.input.KeyBindingWithModifier;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.client.Options;
|
||||
|
@ -27,8 +28,13 @@ public abstract class HookLoadGameOptions {
|
|||
return;
|
||||
}
|
||||
|
||||
final BetterControlsConfig config = BetterControlsCommon.getConfig();
|
||||
if (config == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
hasLoaded = true;
|
||||
keyMappings = ArrayUtils.addAll(keyMappings, BetterControlsMod.config.getAllKeyBindings());
|
||||
keyMappings = ArrayUtils.addAll(keyMappings, config.getAllKeyBindings());
|
||||
AccessKeyBindingFields.getCategoryOrderMap().put(KeyBindingWithModifier.CATEGORY, Integer.valueOf(Integer.MAX_VALUE));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
import chylex.bettercontrols.gui.ScreenPatcher;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.AccessibilityOptionsScreen;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.screens.controls.ControlsScreen;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import static chylex.bettercontrols.util.Statics.MINECRAFT;
|
||||
|
||||
@SuppressWarnings("MethodMayBeStatic")
|
||||
@Mixin(value = Minecraft.class, priority = 100)
|
||||
public abstract class HookOpenScreen {
|
||||
@Inject(method = "setScreen", at = @At("TAIL"))
|
||||
private void openScreen(final Screen ignore, final CallbackInfo ci) {
|
||||
final Screen screen = MINECRAFT.screen;
|
||||
|
||||
if (screen != null && !Screen.hasAltDown()) {
|
||||
if (screen.getClass() == ControlsScreen.class) {
|
||||
ScreenPatcher.onControlsScreenOpened((ControlsScreen)screen);
|
||||
}
|
||||
else if (screen.getClass() == AccessibilityOptionsScreen.class) {
|
||||
ScreenPatcher.onAccessibilityScreenOpened((AccessibilityOptionsScreen)screen);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.Slice;
|
||||
|
||||
@SuppressWarnings("MethodMayBeStatic")
|
||||
@SuppressWarnings("SameReturnValue")
|
||||
@Mixin(Player.class)
|
||||
public abstract class HookPlayerFlightSpeed extends LivingEntity {
|
||||
protected HookPlayerFlightSpeed(final EntityType<? extends LivingEntity> type, final Level world) {
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package chylex.bettercontrols.mixin;
|
||||
|
||||
import net.minecraft.client.CycleOption;
|
||||
import net.minecraft.client.Option;
|
||||
import net.minecraft.client.Options;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(CycleOption.class)
|
||||
public abstract class HookToggleOptionButtons {
|
||||
@Inject(method = "createButton", at = @At("RETURN"))
|
||||
private void disableToggleOptions(final Options options, final int x, final int y, final int width, final CallbackInfoReturnable<AbstractWidget> ci) {
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
final CycleOption<?> me = (CycleOption<?>)(Object)this;
|
||||
|
||||
if (me == Option.TOGGLE_CROUCH || me == Option.TOGGLE_SPRINT) {
|
||||
ci.getReturnValue().active = false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
package chylex.bettercontrols.player;
|
||||
import chylex.bettercontrols.BetterControlsMod;
|
||||
import chylex.bettercontrols.BetterControlsCommon;
|
||||
import chylex.bettercontrols.config.BetterControlsConfig;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
|
||||
|
@ -10,7 +10,7 @@ final class FlightHelper {
|
|||
private static final float BASE_VERTICAL_VELOCITY = 3F;
|
||||
|
||||
private static BetterControlsConfig cfg() {
|
||||
return BetterControlsMod.config;
|
||||
return BetterControlsCommon.getConfig();
|
||||
}
|
||||
|
||||
static boolean isFlyingCreativeOrSpectator(final LocalPlayer player) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package chylex.bettercontrols.player;
|
||||
import chylex.bettercontrols.BetterControlsMod;
|
||||
import chylex.bettercontrols.BetterControlsCommon;
|
||||
import chylex.bettercontrols.config.BetterControlsConfig;
|
||||
import chylex.bettercontrols.gui.BetterControlsScreen;
|
||||
import chylex.bettercontrols.input.SprintMode;
|
||||
|
@ -10,18 +10,23 @@ import chylex.bettercontrols.mixin.AccessClientPlayerFields;
|
|||
import chylex.bettercontrols.mixin.AccessPlayerFields;
|
||||
import chylex.bettercontrols.mixin.AccessStickyKeyBindingStateGetter;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.Options;
|
||||
import net.minecraft.client.player.Input;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import static chylex.bettercontrols.util.Statics.KEY_FORWARD;
|
||||
import static chylex.bettercontrols.util.Statics.KEY_JUMP;
|
||||
import static chylex.bettercontrols.util.Statics.KEY_SNEAK;
|
||||
import static chylex.bettercontrols.util.Statics.KEY_SPRINT;
|
||||
import static chylex.bettercontrols.util.Statics.MINECRAFT;
|
||||
import static chylex.bettercontrols.util.Statics.OPTIONS;
|
||||
|
||||
public final class PlayerTicker {
|
||||
private static final Minecraft MINECRAFT = Minecraft.getInstance();
|
||||
private static final Options OPTIONS = MINECRAFT.options;
|
||||
|
||||
private static final KeyMapping KEY_SPRINT = OPTIONS.keySprint;
|
||||
private static final KeyMapping KEY_SNEAK = OPTIONS.keyShift;
|
||||
private static final KeyMapping KEY_FORWARD = OPTIONS.keyUp;
|
||||
private static final KeyMapping KEY_JUMP = OPTIONS.keyJump;
|
||||
|
||||
private static PlayerTicker ticker = new PlayerTicker(null);
|
||||
|
||||
public static PlayerTicker get(final LocalPlayer player) {
|
||||
|
@ -33,7 +38,7 @@ public final class PlayerTicker {
|
|||
}
|
||||
|
||||
private static BetterControlsConfig cfg() {
|
||||
return BetterControlsMod.config;
|
||||
return BetterControlsCommon.getConfig();
|
||||
}
|
||||
|
||||
private final WeakReference<LocalPlayer> ref;
|
||||
|
@ -63,13 +68,13 @@ public final class PlayerTicker {
|
|||
|
||||
private void setup() {
|
||||
final AccessStickyKeyBindingStateGetter sprint = (AccessStickyKeyBindingStateGetter)KEY_SPRINT;
|
||||
BooleanSupplier getter = sprint.getToggleGetter();
|
||||
BooleanSupplier getter = sprint.getNeedsToggle();
|
||||
|
||||
if (getter instanceof SprintPressGetter) {
|
||||
getter = ((SprintPressGetter)getter).getWrapped();
|
||||
if (getter instanceof final SprintPressGetter g) {
|
||||
getter = g.wrapped();
|
||||
}
|
||||
|
||||
sprint.setToggleGetter(new SprintPressGetter(getter, () -> temporarySprintTimer > 0));
|
||||
sprint.setNeedsToggle(new SprintPressGetter(getter, () -> temporarySprintTimer > 0));
|
||||
}
|
||||
|
||||
public void atHead(final LocalPlayer player) {
|
||||
|
@ -78,11 +83,11 @@ public final class PlayerTicker {
|
|||
}
|
||||
|
||||
if (!cfg().doubleTapForwardToSprint) {
|
||||
((AccessClientPlayerFields)player).setTicksLeftToDoubleTapSprint(0);
|
||||
((AccessClientPlayerFields)player).setSprintTriggerTime(0);
|
||||
}
|
||||
|
||||
if (!cfg().doubleTapJumpToToggleFlight) {
|
||||
((AccessPlayerFields)player).setTicksLeftToDoubleTapFlight(0);
|
||||
((AccessPlayerFields)player).setJumpTriggerTime(0);
|
||||
}
|
||||
|
||||
final SprintMode sprintMode = cfg().sprintMode;
|
||||
|
@ -282,7 +287,7 @@ public final class PlayerTicker {
|
|||
final Camera camera = MINECRAFT.gameRenderer.getMainCamera();
|
||||
|
||||
if (camera.getEntity() == player) {
|
||||
((AccessCameraFields)camera).setCameraY(player.getEyeHeight());
|
||||
((AccessCameraFields)camera).setEyeHeight(player.getEyeHeight());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,19 +1,7 @@
|
|||
package chylex.bettercontrols.player;
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
final class SprintPressGetter implements BooleanSupplier {
|
||||
private final BooleanSupplier wrapped;
|
||||
private final BooleanSupplier or;
|
||||
|
||||
public SprintPressGetter(final BooleanSupplier wrapped, final BooleanSupplier or) {
|
||||
this.wrapped = wrapped;
|
||||
this.or = or;
|
||||
}
|
||||
|
||||
public BooleanSupplier getWrapped() {
|
||||
return wrapped;
|
||||
}
|
||||
|
||||
record SprintPressGetter(BooleanSupplier wrapped, BooleanSupplier or) implements BooleanSupplier {
|
||||
@Override
|
||||
public boolean getAsBoolean() {
|
||||
return wrapped.getAsBoolean() || or.getAsBoolean();
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
package chylex.bettercontrols.util;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.Options;
|
||||
|
||||
public final class Statics {
|
||||
private Statics() {}
|
||||
|
||||
public static final Minecraft MINECRAFT = Minecraft.getInstance();
|
||||
public static final Options OPTIONS = MINECRAFT.options;
|
||||
|
||||
public static final KeyMapping KEY_SPRINT = OPTIONS.keySprint;
|
||||
public static final KeyMapping KEY_SNEAK = OPTIONS.keyShift;
|
||||
public static final KeyMapping KEY_FORWARD = OPTIONS.keyUp;
|
||||
public static final KeyMapping KEY_JUMP = OPTIONS.keyJump;
|
||||
}
|
|
@ -2,26 +2,23 @@
|
|||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "chylex.bettercontrols.mixin",
|
||||
"refmap": "bettercontrols.refmap.json",
|
||||
"compatibilityLevel": "JAVA_16",
|
||||
"client": [
|
||||
"AccessCameraFields",
|
||||
"AccessClientPlayerFields",
|
||||
"AccessControlsListCategory",
|
||||
"AccessControlsListKeyBinding",
|
||||
"AccessCycleButtonFields",
|
||||
"AccessKeyBindingFields",
|
||||
"AccessOptionFields",
|
||||
"AccessPlayerFields",
|
||||
"AccessScreenButtons",
|
||||
"AccessStickyKeyBindingStateGetter",
|
||||
"HookClientPlayerFOV",
|
||||
"HookClientPlayerInputTick",
|
||||
"HookClientPlayerTick",
|
||||
"HookControlsListWidget",
|
||||
"HookControlsScreen",
|
||||
"HookLoadGameOptions",
|
||||
"HookOpenScreen",
|
||||
"HookPlayerFlightSpeed",
|
||||
"HookStickyKeyBindingState"
|
||||
"HookStickyKeyBindingState",
|
||||
"HookToggleOptionButtons"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"pack": {
|
||||
"description": "Better Controls",
|
||||
"pack_format": 7,
|
||||
"_comment": ""
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue