├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ └── build.yml ├── .gitignore ├── HEADER ├── LICENSE ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── icon.png ├── settings.gradle └── src └── main ├── java └── me │ └── lambdaurora │ └── keystrokes │ ├── AuroraKeystrokes.java │ ├── ColorConfigPanel.java │ ├── KeystrokesConfig.java │ ├── LayoutMode.java │ ├── TextDisplayMode.java │ ├── command │ └── KeystrokesCommand.java │ ├── gui │ ├── KeystrokesColorConfigScreen.java │ ├── KeystrokesConfigScreen.java │ └── KeystrokesHud.java │ └── mixin │ └── MinecraftClientMixin.java └── resources ├── assets └── aurora_keystrokes │ ├── icon.png │ └── lang │ ├── en_us.json │ ├── fr_ca.json │ ├── fr_fr.json │ ├── tr_tr.json │ └── zh_cn.json ├── config.toml ├── keystrokes.mixins.json └── quilt.mod.json /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. Linux] 28 | - Minecraft [e.g. 1.14.4] 29 | - Fabric [e.g. fabric 0.7.2+build.174] 30 | - Mods [e.g. aurora_keystrokes v1.0.0, modmenu v1.7.15] 31 | - Version [e.g. 1.0.0] 32 | - Branch [e.g. dev] 33 | 34 | **Additional context** 35 | Add any other context about the problem here. 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: [ push, pull_request ] 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - uses: actions/checkout@v2 11 | - name: Set up JDK 17 12 | uses: actions/setup-java@v2 13 | with: 14 | distribution: 'temurin' 15 | java-version: 17 16 | - name: Grant execute permission for gradlew 17 | run: chmod +x gradlew 18 | 19 | - name: Build Artifacts 20 | uses: gradle/gradle-build-action@v2 21 | with: 22 | arguments: build --stacktrace 23 | 24 | - name: Upload build artifacts 25 | uses: actions/upload-artifact@v1 26 | with: 27 | name: build-artifacts 28 | path: build/libs -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # 2 | # LambdAurora's ignore file 3 | # 4 | # v0.15 5 | 6 | # JetBrains 7 | .idea/ 8 | *.iml 9 | *.ipr 10 | *.iws 11 | ## Intellij IDEA 12 | out/ 13 | ## CLion 14 | cmake-build-debug*/ 15 | cmake-build-release*/ 16 | ## Eclipse 17 | eclipse 18 | *.launch 19 | .settings 20 | .metadata 21 | .classpath 22 | .project 23 | ## Visual Studio 24 | .vs/ 25 | CMakeSettings.json 26 | 27 | # Build system 28 | ## Cargo 29 | Cargo.lock 30 | ## CMake 31 | CMakeCache.txt 32 | CMakeFiles/ 33 | ## Gradle 34 | .gradle/ 35 | ## Node.JS 36 | node_modules/ 37 | 38 | # Editors 39 | ## VSCode 40 | .vscode/ 41 | 42 | # Logging 43 | logs/ 44 | 45 | # Languages 46 | ## Java 47 | classes/ 48 | ## Python 49 | __pycache__/ 50 | ## Rust 51 | **/*.rs.bk 52 | 53 | # OS 54 | ## Windows 55 | desktop.ini 56 | # MacOS 57 | .DS_Store 58 | 59 | # File types 60 | *.dll 61 | *.so 62 | *.dylib 63 | *.lib 64 | lib*.a 65 | *.png~ 66 | *.tar.?z 67 | 68 | # Common 69 | bin/ 70 | build/ 71 | dist/ 72 | lib/ 73 | obj/ 74 | run/ 75 | target/ 76 | -------------------------------------------------------------------------------- /HEADER: -------------------------------------------------------------------------------- 1 | Copyright © 2021 LambdAurora 2 | 3 | This file is part of AuroraKeystrokes. 4 | 5 | Licensed under the MIT license. For more information, 6 | see the LICENSE file. 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright © 2020 LambdAurora 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AuroraKeystrokes 2 | 3 | ![Java 17](https://img.shields.io/badge/language-Java%2017-9B599A.svg?style=flat-square) 4 | [![GitHub license](https://img.shields.io/github/license/LambdAurora/AuroraKeystrokes?style=flat-square)](https://raw.githubusercontent.com/LambdAurora/AuroraKeystrokes/1.17/LICENSE) 5 | ![Environment: Client](https://img.shields.io/badge/environment-client-1976d2?style=flat-square) 6 | ![Mod loader: Fabric](https://img.shields.io/badge/modloader-Fabric-1976d2?style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAFHGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDIgNzkuMTYwOTI0LCAyMDE3LzA3LzEzLTAxOjA2OjM5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOCAoV2luZG93cykiIHhtcDpDcmVhdGVEYXRlPSIyMDE4LTEyLTE2VDE2OjU0OjE3LTA4OjAwIiB4bXA6TW9kaWZ5RGF0ZT0iMjAxOS0wNy0yOFQyMToxNzo0OC0wNzowMCIgeG1wOk1ldGFkYXRhRGF0ZT0iMjAxOS0wNy0yOFQyMToxNzo0OC0wNzowMCIgZGM6Zm9ybWF0PSJpbWFnZS9wbmciIHBob3Rvc2hvcDpDb2xvck1vZGU9IjMiIHBob3Rvc2hvcDpJQ0NQcm9maWxlPSJzUkdCIElFQzYxOTY2LTIuMSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDowZWRiMWMyYy1mZjhjLWU0NDEtOTMxZi00OTVkNGYxNGM3NjAiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MGVkYjFjMmMtZmY4Yy1lNDQxLTkzMWYtNDk1ZDRmMTRjNzYwIiB4bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ9InhtcC5kaWQ6MGVkYjFjMmMtZmY4Yy1lNDQxLTkzMWYtNDk1ZDRmMTRjNzYwIj4gPHhtcE1NOkhpc3Rvcnk+IDxyZGY6U2VxPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0iY3JlYXRlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDowZWRiMWMyYy1mZjhjLWU0NDEtOTMxZi00OTVkNGYxNGM3NjAiIHN0RXZ0OndoZW49IjIwMTgtMTItMTZUMTY6NTQ6MTctMDg6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCBDQyAyMDE4IChXaW5kb3dzKSIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4/HiGMAAAAtUlEQVRYw+XXrQqAMBQF4D2P2eBL+QIG8RnEJFaNBjEum+0+zMQLtwwv+wV3ZzhhMDgfJ0wUSinxZUQWgKos1JP/AbD4OneIDyQPwCFniA+EJ4CaXm4TxAXCC0BNHgLhAdAnx9hC8PwGSRtAFVMQjF7cNTWED8B1cgwW20yfJgAvrssAsZ1cB3g/xckAxr6FmCDU5N6f488BrpCQ4rQBJkiMYh4ACmLzwOQF0CExinkCsvw7vgGikl+OotaKRwAAAABJRU5ErkJggg==) 7 | ![Version](https://img.shields.io/github/v/tag/LambdAurora/AuroraKeystrokes?label=version&style=flat-square) 8 | [![CurseForge](http://cf.way2muchnoise.eu/title/352659.svg)](https://www.curseforge.com/minecraft/mc-mods/aurorakeystrokes) 9 | 10 | A Fabric Minecraft mod which displays the movement keys and mouse clicks on screen. 11 | 12 | ## Build 13 | 14 | Just do `./gradlew shadowRemapJar` and everything should build just fine! 15 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | //file:noinspection GroovyAssignabilityCheck 2 | plugins { 3 | id 'org.quiltmc.loom' version '0.12.+' 4 | id 'com.github.johnrengelman.shadow' version '7.1.2' 5 | id 'java-library' 6 | id 'maven-publish' 7 | } 8 | 9 | def targetJavaVersion = 17 10 | 11 | import net.fabricmc.loom.task.RemapJarTask 12 | 13 | group = project.maven_group 14 | version = "${project.mod_version}+${project.minecraft_version}" 15 | archivesBaseName = project.archives_base_name + "-fabric" 16 | 17 | repositories { 18 | mavenLocal() 19 | mavenCentral() 20 | maven { 21 | name 'Gegy' 22 | url 'https://maven.gegy.dev' 23 | } 24 | maven { 25 | url "https://jitpack.io" 26 | } 27 | } 28 | 29 | configurations { 30 | shadow 31 | api.extendsFrom shadow 32 | } 33 | 34 | dependencies { 35 | minecraft "com.mojang:minecraft:${project.minecraft_version}" 36 | 37 | mappings loom.layered { 38 | it.addLayer(quiltMappings.mappings("org.quiltmc:quilt-mappings:${minecraft_version}+build.${project.quilt_mappings}:v2")) 39 | } 40 | 41 | modImplementation "org.quiltmc:quilt-loader:${project.loader_version}" 42 | 43 | // Fabric API. This is technically optional, but you probably want it anyway. 44 | modImplementation "org.quiltmc.quilted-fabric-api:quilted-fabric-api:${project.qfapi_version}" 45 | 46 | modImplementation "dev.lambdaurora:spruceui:${project.spruceui_version}" 47 | include "dev.lambdaurora:spruceui:${project.spruceui_version}" 48 | 49 | shadow 'com.electronwill.night-config:core:3.6.5' 50 | shadow 'com.electronwill.night-config:toml:3.6.5' 51 | } 52 | 53 | java { 54 | sourceCompatibility = JavaVersion.toVersion(targetJavaVersion) 55 | targetCompatibility = JavaVersion.toVersion(targetJavaVersion) 56 | 57 | withSourcesJar() 58 | } 59 | 60 | tasks.withType(JavaCompile).configureEach { 61 | it.options.encoding = 'UTF-8' 62 | it.options.deprecation(true) 63 | it.options.incremental(true) 64 | it.options.release.set(targetJavaVersion) 65 | } 66 | 67 | processResources { 68 | inputs.property 'version', project.version 69 | 70 | filesMatching('quilt.mod.json') { 71 | expand 'version': project.version 72 | } 73 | } 74 | 75 | jar { 76 | from('LICENSE') { 77 | rename { "${it}_${project.archivesBaseName}"} 78 | } 79 | } 80 | 81 | shadowJar { 82 | dependsOn jar 83 | configurations = [project.configurations.shadow] 84 | archiveClassifier.set('dev') 85 | 86 | relocate 'com.electronwill.nightconfig', 'dev.lambdaurora.aurorakeystrokes.shadow.nightconfig' 87 | } 88 | remapJar.dependsOn(shadowJar) 89 | 90 | task shadowRemapJar(type: RemapJarTask) { 91 | dependsOn shadowJar 92 | 93 | input = file("${project.buildDir}/devlibs/$archivesBaseName-${project.version}-dev.jar") 94 | archiveName = "$archivesBaseName-${project.version}.jar" 95 | addNestedDependencies.set(true) 96 | } 97 | build.dependsOn(shadowRemapJar) 98 | 99 | publishing { 100 | publications { 101 | mavenJava(MavenPublication) { 102 | from components.java 103 | } 104 | } 105 | 106 | repositories { 107 | mavenLocal() 108 | } 109 | } 110 | 111 | quiltflower { 112 | addToRuntimeClasspath.set(true) 113 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Done to increase the memory available to gradle. 2 | org.gradle.jvmargs=-Xmx1536m 3 | org.gradle.parallel=true 4 | 5 | # Fabric Properties 6 | # check these on https://fabricmc.net/use 7 | minecraft_version=1.19 8 | quilt_mappings=1 9 | loader_version=0.16.1 10 | 11 | # Mod Properties 12 | mod_version = 1.3.0 13 | maven_group = me.lambdaurora 14 | archives_base_name = aurorakeystrokes 15 | 16 | # Dependencies 17 | # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api 18 | qfapi_version=2.0.0-alpha.2+0.55.3-1.19 19 | spruceui_version=4.0.0+1.19 20 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LambdAurora/AuroraKeystrokes/ad00fa206d54207368b5f71edc090c0ce7cb0696/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 84 | 85 | APP_NAME="Gradle" 86 | APP_BASE_NAME=${0##*/} 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | MAX_FD=$( ulimit -H -n ) || 147 | warn "Could not query maximum file descriptor limit" 148 | esac 149 | case $MAX_FD in #( 150 | '' | soft) :;; #( 151 | *) 152 | ulimit -n "$MAX_FD" || 153 | warn "Could not set maximum file descriptor limit to $MAX_FD" 154 | esac 155 | fi 156 | 157 | # Collect all arguments for the java command, stacking in reverse order: 158 | # * args from the command line 159 | # * the main class name 160 | # * -classpath 161 | # * -D...appname settings 162 | # * --module-path (only if needed) 163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 164 | 165 | # For Cygwin or MSYS, switch paths to Windows format before running java 166 | if "$cygwin" || "$msys" ; then 167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 169 | 170 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 171 | 172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 173 | for arg do 174 | if 175 | case $arg in #( 176 | -*) false ;; # don't mess with options #( 177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 178 | [ -e "$t" ] ;; #( 179 | *) false ;; 180 | esac 181 | then 182 | arg=$( cygpath --path --ignore --mixed "$arg" ) 183 | fi 184 | # Roll the args list around exactly as many times as the number of 185 | # args, so each arg winds up back in the position where it started, but 186 | # possibly modified. 187 | # 188 | # NB: a `for` loop captures its iteration list before it begins, so 189 | # changing the positional parameters here affects neither the number of 190 | # iterations, nor the values presented in `arg`. 191 | shift # remove old arg 192 | set -- "$@" "$arg" # push replacement arg 193 | done 194 | fi 195 | 196 | # Collect all arguments for the java command; 197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 198 | # shell script including quotes and variable substitutions, so put them in 199 | # double quotes to make sure that they get re-expanded; and 200 | # * put everything else in single quotes, so that it's not re-expanded. 201 | 202 | set -- \ 203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 204 | -classpath "$CLASSPATH" \ 205 | org.gradle.wrapper.GradleWrapperMain \ 206 | "$@" 207 | 208 | # Use "xargs" to parse quoted args. 209 | # 210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 211 | # 212 | # In Bash we could simply go: 213 | # 214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 215 | # set -- "${ARGS[@]}" "$@" 216 | # 217 | # but POSIX shell has neither arrays nor command substitution, so instead we 218 | # post-process each arg (as a line of input to sed) to backslash-escape any 219 | # character that might be a shell metacharacter, then use eval to reverse 220 | # that process (while maintaining the separation between arguments), and wrap 221 | # the whole thing up as a single "set" statement. 222 | # 223 | # This will of course break if any of these variables contains a newline or 224 | # an unmatched quote. 225 | # 226 | 227 | eval "set -- $( 228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 229 | xargs -n1 | 230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 231 | tr '\n' ' ' 232 | )" '"$@"' 233 | 234 | exec "$JAVACMD" "$@" 235 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LambdAurora/AuroraKeystrokes/ad00fa206d54207368b5f71edc090c0ce7cb0696/icon.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | maven { 4 | name 'Fabric' 5 | url 'https://maven.fabricmc.net/' 6 | } 7 | maven { 8 | name 'QuiltMC Releases' 9 | url 'https://maven.quiltmc.org/repository/release' 10 | } 11 | maven { 12 | name 'QuiltMC Snapshots' 13 | url 'https://maven.quiltmc.org/repository/snapshot' 14 | } 15 | gradlePluginPortal() 16 | mavenCentral() 17 | } 18 | } 19 | 20 | 21 | rootProject.name = 'aurorakeystrokes' -------------------------------------------------------------------------------- /src/main/java/me/lambdaurora/keystrokes/AuroraKeystrokes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2020 LambdAurora 3 | * 4 | * This file is part of AuroraKeystrokes. 5 | * 6 | * Licensed under the MIT license. For more information, 7 | * see the LICENSE file. 8 | */ 9 | 10 | package me.lambdaurora.keystrokes; 11 | 12 | import dev.lambdaurora.spruceui.hud.HudManager; 13 | import me.lambdaurora.keystrokes.command.KeystrokesCommand; 14 | import me.lambdaurora.keystrokes.gui.KeystrokesHud; 15 | import net.fabricmc.api.ClientModInitializer; 16 | import net.minecraft.client.font.TextRenderer; 17 | import net.minecraft.client.gui.DrawableHelper; 18 | import net.minecraft.client.util.math.MatrixStack; 19 | import net.minecraft.text.Text; 20 | import org.apache.logging.log4j.LogManager; 21 | import org.apache.logging.log4j.Logger; 22 | import org.jetbrains.annotations.NotNull; 23 | import org.quiltmc.qsl.command.api.client.ClientCommandManager; 24 | import org.quiltmc.qsl.lifecycle.api.client.event.ClientTickEvents; 25 | 26 | import java.awt.*; 27 | 28 | /** 29 | * Represents the mod instance of AuroraKeystrokes. 30 | * 31 | * @author LambdAurora 32 | * @version 1.2.4 33 | * @since 1.0.0 34 | */ 35 | public class AuroraKeystrokes implements ClientModInitializer { 36 | public static final String NAMESPACE = "aurorakeystrokes"; 37 | private static AuroraKeystrokes INSTANCE; 38 | public final Logger logger = LogManager.getLogger("AuroraKeystrokes"); 39 | public final KeystrokesConfig config = new KeystrokesConfig(this); 40 | private KeystrokesHud hud; 41 | public int cps = 0; 42 | private long lastTime = 0; 43 | 44 | @Override 45 | public void onInitializeClient() { 46 | INSTANCE = this; 47 | log("Initializing AuroraKeystrokes..."); 48 | this.config.load(); 49 | ClientTickEvents.START.register(client -> { 50 | long currentTime = System.currentTimeMillis(); 51 | if (currentTime - lastTime >= 1000) { 52 | this.cps = 0; 53 | this.lastTime = currentTime; 54 | } 55 | }); 56 | 57 | HudManager.register(this.hud = new KeystrokesHud(this)); 58 | this.hud.setVisible(this.config.doesRenderHud()); 59 | 60 | KeystrokesCommand.registerCommands(ClientCommandManager.getDispatcher()); 61 | } 62 | 63 | /** 64 | * Prints a message to the console. 65 | * 66 | * @param info The message to print. 67 | */ 68 | public void log(String info) { 69 | this.logger.info("[AuroraKeystrokes] " + info); 70 | } 71 | 72 | public static AuroraKeystrokes get() { 73 | return INSTANCE; 74 | } 75 | 76 | /** 77 | * Sets whether the HUD is enabled or not. 78 | * 79 | * @param enabled True if the HUD is enabled, else false. 80 | */ 81 | public void setHudEnabled(boolean enabled) { 82 | this.config.setRenderHud(enabled); 83 | this.hud.setVisible(enabled); 84 | } 85 | 86 | /** 87 | * Parses a color from a hexadecimal color string. 88 | * 89 | * @param hex The hexadecimal color. 90 | * @return The color instance, null if invalid. 91 | */ 92 | public static Color parseColor(String hex) { 93 | hex = hex.replace("#", ""); 94 | return switch (hex.length()) { 95 | case 6 -> new Color( 96 | Integer.valueOf(hex.substring(0, 2), 16), 97 | Integer.valueOf(hex.substring(2, 4), 16), 98 | Integer.valueOf(hex.substring(4, 6), 16)); 99 | case 8 -> new Color( 100 | Integer.valueOf(hex.substring(0, 2), 16), 101 | Integer.valueOf(hex.substring(2, 4), 16), 102 | Integer.valueOf(hex.substring(4, 6), 16), 103 | Integer.valueOf(hex.substring(6, 8), 16)); 104 | default -> null; 105 | }; 106 | } 107 | 108 | public static int getRainbowRGB(double x, double y) { 109 | float speed = 2600.0F; 110 | return Color.HSBtoRGB((float) ((System.currentTimeMillis() - x * 10.0D - y * 10.0D) % speed) / speed, 111 | (float) AuroraKeystrokes.get().config.getRainbowSaturation(), 112 | 0.9F); 113 | } 114 | 115 | public static void drawRainbowString(MatrixStack matrices, TextRenderer textRenderer, int x, int y, @NotNull String text) { 116 | for (char c : text.toCharArray()) { 117 | int rgb = getRainbowRGB(x, y); 118 | String tmp = String.valueOf(c); 119 | textRenderer.draw(matrices, tmp, x, y, rgb); 120 | x += textRenderer.getWidth(tmp); 121 | } 122 | } 123 | 124 | /** 125 | * Renders a text box with a background. 126 | * 127 | * @param textRenderer The text renderer. 128 | * @param x The x position of the text box. 129 | * @param y The y position of the text box. 130 | * @param padding The padding of the box. 131 | * @param boxHeight The box height. 132 | * @param text The text inside the box. 133 | * @param foreground The foreground color of the box. 134 | * @param background The background color of the box. 135 | * @return The width of the box. 136 | */ 137 | public static int renderTextBox(MatrixStack matrices, TextRenderer textRenderer, int x, int y, int padding, int boxHeight, @NotNull Text text, @NotNull Color foreground, @NotNull Color background) { 138 | int textLength = textRenderer.getWidth(text); 139 | int boxWidth = padding * 2 + textLength; 140 | DrawableHelper.fill(matrices, x, y, x + boxWidth, y + boxHeight, background.getRGB()); 141 | if (AuroraKeystrokes.get().config.useRainbowText()) 142 | drawRainbowString(matrices, textRenderer, x + padding, y + padding + 1, text.getString()); 143 | else 144 | DrawableHelper.drawTextWithShadow(matrices, textRenderer, text, x + padding, y + padding + 1, foreground.getRGB()); 145 | return boxWidth; 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /src/main/java/me/lambdaurora/keystrokes/ColorConfigPanel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2020 LambdAurora 3 | * 4 | * This file is part of AuroraKeystrokes. 5 | * 6 | * Licensed under the MIT license. For more information, 7 | * see the LICENSE file. 8 | */ 9 | 10 | package me.lambdaurora.keystrokes; 11 | 12 | import dev.lambdaurora.spruceui.util.Nameable; 13 | import net.minecraft.text.Text; 14 | import org.jetbrains.annotations.NotNull; 15 | 16 | import java.awt.*; 17 | 18 | /** 19 | * Represents panels for the color config screen. 20 | */ 21 | public enum ColorConfigPanel implements Nameable { 22 | NORMAL(), 23 | PRESSED() { 24 | public Color getColor(@NotNull KeystrokesConfig config) { 25 | return config.getColorPressed(); 26 | } 27 | 28 | public void setColor(@NotNull KeystrokesConfig config, @NotNull Color color) { 29 | config.setColorPressed(color); 30 | } 31 | 32 | public Color getBackgroundColor(@NotNull KeystrokesConfig config) { 33 | return config.getBackgroundPressed(); 34 | } 35 | 36 | public void setBackgroundColor(@NotNull KeystrokesConfig config, @NotNull Color color) { 37 | config.setBackgroundPressed(color); 38 | } 39 | }; 40 | 41 | public Color getColor(@NotNull KeystrokesConfig config) { 42 | return config.getColorNormal(); 43 | } 44 | 45 | public void setColor(@NotNull KeystrokesConfig config, @NotNull Color color) { 46 | config.setColorNormal(color); 47 | } 48 | 49 | public Color getBackgroundColor(@NotNull KeystrokesConfig config) { 50 | return config.getBackgroundNormal(); 51 | } 52 | 53 | public void setBackgroundColor(@NotNull KeystrokesConfig config, @NotNull Color color) { 54 | config.setBackgroundNormal(color); 55 | } 56 | 57 | /** 58 | * Returns the next color config panel available. 59 | * 60 | * @return The next available color config panel. 61 | */ 62 | public ColorConfigPanel next() { 63 | ColorConfigPanel[] v = values(); 64 | if (v.length == this.ordinal() + 1) 65 | return v[0]; 66 | return v[this.ordinal() + 1]; 67 | } 68 | 69 | /** 70 | * Gets the text of this color config panel. 71 | * 72 | * @return The text of this color config panel. 73 | */ 74 | public Text getText() { 75 | return Text.translatable("keystrokes.color_config_panel." + this.getName()); 76 | } 77 | 78 | @Override 79 | public @NotNull String getName() { 80 | return this.name().toLowerCase(); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/me/lambdaurora/keystrokes/KeystrokesConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2020 LambdAurora 3 | * 4 | * This file is part of AuroraKeystrokes. 5 | * 6 | * Licensed under the MIT license. For more information, 7 | * see the LICENSE file. 8 | */ 9 | 10 | package me.lambdaurora.keystrokes; 11 | 12 | import com.electronwill.nightconfig.core.file.FileConfig; 13 | import org.jetbrains.annotations.NotNull; 14 | 15 | import java.awt.*; 16 | 17 | /** 18 | * Represents the AuroraKeytrokes configuration. 19 | */ 20 | public class KeystrokesConfig { 21 | private final FileConfig config = FileConfig.builder("config/keystrokes.toml").concurrent().defaultResource("/config.toml").build(); 22 | private final AuroraKeystrokes mod; 23 | private TextDisplayMode textDisplayMode = TextDisplayMode.ACTION_NAME; 24 | 25 | public KeystrokesConfig(@NotNull AuroraKeystrokes mod) { 26 | this.mod = mod; 27 | } 28 | 29 | public void load() { 30 | this.config.load(); 31 | this.textDisplayMode = TextDisplayMode.byId(this.config.getOrElse("hud.text_display_mode", "action_name")).orElseGet(() -> { 32 | this.mod.log("Could not load `text_display_mode` property: invalid value."); 33 | return TextDisplayMode.ACTION_NAME; 34 | }); 35 | } 36 | 37 | public void save() { 38 | this.config.save(); 39 | } 40 | 41 | public boolean doesRenderHud() { 42 | return this.config.getOrElse("hud.enable", true); 43 | } 44 | 45 | public void setRenderHud(boolean renderHud) { 46 | this.config.set("hud.enable", renderHud); 47 | } 48 | 49 | public double getX() { 50 | return this.config.getOrElse("hud.x", 10.0); 51 | } 52 | 53 | public void setX(double x) { 54 | this.config.set("hud.x", x); 55 | } 56 | 57 | public double getY() { 58 | return this.config.getOrElse("hud.y", 10.0); 59 | } 60 | 61 | public void setY(double y) { 62 | this.config.set("hud.y", y); 63 | } 64 | 65 | public int getPadding() { 66 | return this.config.getOrElse("hud.padding", 4); 67 | } 68 | 69 | public void setPadding(int padding) { 70 | this.config.set("hud.padding", padding); 71 | } 72 | 73 | public boolean showMovementBoxes() { 74 | return this.config.getOrElse("hud.show_movement_boxes", true); 75 | } 76 | 77 | public void setMovementBoxes(boolean show) { 78 | this.config.set("hud.show_movement_boxes", show); 79 | } 80 | 81 | public boolean showAttackBox() { 82 | return this.config.getOrElse("hud.show_attack_box", true); 83 | } 84 | 85 | public void setAttackBox(boolean show) { 86 | this.config.set("hud.show_attack_box", show); 87 | } 88 | 89 | public boolean showUseBox() { 90 | return this.config.getOrElse("hud.show_use_box", true); 91 | } 92 | 93 | public void setUseBox(boolean show) { 94 | this.config.set("hud.show_use_box", show); 95 | } 96 | 97 | public boolean showSneakBox() { 98 | return this.config.getOrElse("hud.show_sneak_box", true); 99 | } 100 | 101 | public void setSneakBox(boolean show) { 102 | this.config.set("hud.show_sneak_box", show); 103 | } 104 | 105 | public boolean showJumpBox() { 106 | return this.config.getOrElse("hud.show_jump_box", true); 107 | } 108 | 109 | public void setJumpBox(boolean show) { 110 | this.config.set("hud.show_jump_box", show); 111 | } 112 | 113 | public TextDisplayMode getTextDisplayMode() { 114 | return this.textDisplayMode; 115 | } 116 | 117 | public void setTextDisplayMode(TextDisplayMode textDisplayMode) { 118 | if (textDisplayMode != this.textDisplayMode) { 119 | this.textDisplayMode = textDisplayMode; 120 | this.config.set("hud.text_display_mode", textDisplayMode.name().toLowerCase()); 121 | } 122 | } 123 | 124 | public boolean showCps() { 125 | return this.config.getOrElse("cps.show", true); 126 | } 127 | 128 | public void setShowCps(boolean show) { 129 | this.config.set("cps.show", show); 130 | } 131 | 132 | public boolean attachedCps() { 133 | return this.config.getOrElse("cps.attached", true); 134 | } 135 | 136 | public void setAttachedCps(boolean attached) { 137 | this.config.set("cps.attached", attached); 138 | } 139 | 140 | public LayoutMode getLayout() { 141 | return LayoutMode.fromName(this.config.getOrElse("hud.layout", "cross")); 142 | } 143 | 144 | public void setLayout(LayoutMode layout) { 145 | this.config.set("hud.layout", layout.getName()); 146 | } 147 | 148 | private String hex(int i) { 149 | String res = Integer.toHexString(i); 150 | if (res.length() == 1) 151 | return "0" + res; 152 | return res; 153 | } 154 | 155 | public Color getColorNormal() { 156 | return AuroraKeystrokes.parseColor(this.config.getOrElse("colors.normal", "#FFFFFFFF")); 157 | } 158 | 159 | public void setColorNormal(@NotNull Color color) { 160 | this.config.set("colors.normal", "#" + hex(color.getRed()) + hex(color.getGreen()) + hex(color.getBlue()) + hex(color.getAlpha())); 161 | } 162 | 163 | public Color getColorPressed() { 164 | return AuroraKeystrokes.parseColor(this.config.getOrElse("colors.pressed", "#FFA000FF")); 165 | } 166 | 167 | public void setColorPressed(@NotNull Color color) { 168 | this.config.set("colors.pressed", "#" + hex(color.getRed()) + hex(color.getGreen()) + hex(color.getBlue()) + hex(color.getAlpha())); 169 | } 170 | 171 | public Color getBackgroundNormal() { 172 | return AuroraKeystrokes.parseColor(this.config.getOrElse("colors.background_normal", "#000000AA")); 173 | } 174 | 175 | public void setBackgroundNormal(@NotNull Color color) { 176 | this.config.set("colors.background_normal", "#" + hex(color.getRed()) + hex(color.getGreen()) + hex(color.getBlue()) + hex(color.getAlpha())); 177 | } 178 | 179 | public Color getBackgroundPressed() { 180 | return AuroraKeystrokes.parseColor(this.config.getOrElse("colors.background_pressed", "#FFFFFFAA")); 181 | } 182 | 183 | public void setBackgroundPressed(@NotNull Color color) { 184 | this.config.set("colors.background_pressed", "#" + hex(color.getRed()) + hex(color.getGreen()) + hex(color.getBlue()) + hex(color.getAlpha())); 185 | } 186 | 187 | public boolean useRainbowText() { 188 | return this.config.getOrElse("colors.rainbow", false); 189 | } 190 | 191 | public void setRainbowText(boolean rainbow) { 192 | this.config.set("colors.rainbow", rainbow); 193 | } 194 | 195 | public double getRainbowSaturation() { 196 | return this.config.getOrElse("colors.rainbow_saturation", 0.8D); 197 | } 198 | 199 | public void setRainbowSaturation(double saturation) { 200 | this.config.set("colors.rainbow_saturation", saturation); 201 | } 202 | } 203 | -------------------------------------------------------------------------------- /src/main/java/me/lambdaurora/keystrokes/LayoutMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2020 LambdAurora 3 | * 4 | * This file is part of AuroraKeystrokes. 5 | * 6 | * Licensed under the MIT license. For more information, 7 | * see the LICENSE file. 8 | */ 9 | 10 | package me.lambdaurora.keystrokes; 11 | 12 | import dev.lambdaurora.spruceui.util.Nameable; 13 | import org.jetbrains.annotations.NotNull; 14 | 15 | public enum LayoutMode implements Nameable { 16 | CROSS("cross"), 17 | PYRAMID("pyramid"); 18 | 19 | private final String name; 20 | 21 | LayoutMode(String name) { 22 | this.name = name; 23 | } 24 | 25 | /** 26 | * Returns the layout mode from its name. 27 | * 28 | * @param name The layout name. 29 | * @return The layout. 30 | */ 31 | public static LayoutMode fromName(@NotNull String name) { 32 | for (LayoutMode layout : LayoutMode.values()) { 33 | if (layout.getName().equals(name)) 34 | return layout; 35 | } 36 | return CROSS; 37 | } 38 | 39 | /** 40 | * Returns the next layout mode available. 41 | * 42 | * @return The next layout display mode. 43 | */ 44 | public LayoutMode next() { 45 | LayoutMode[] v = values(); 46 | if (v.length == this.ordinal() + 1) 47 | return v[0]; 48 | return v[this.ordinal() + 1]; 49 | } 50 | 51 | @Override 52 | public @NotNull String getName() { 53 | return this.name; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/me/lambdaurora/keystrokes/TextDisplayMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2020 LambdAurora 3 | * 4 | * This file is part of AuroraKeystrokes. 5 | * 6 | * Licensed under the MIT license. For more information, 7 | * see the LICENSE file. 8 | */ 9 | 10 | package me.lambdaurora.keystrokes; 11 | 12 | import dev.lambdaurora.spruceui.util.Nameable; 13 | import net.minecraft.client.option.KeyBind; 14 | import net.minecraft.text.Text; 15 | import org.jetbrains.annotations.NotNull; 16 | 17 | import java.util.Arrays; 18 | import java.util.Optional; 19 | import java.util.function.Function; 20 | 21 | /** 22 | * Represents the display modes of the text inside the keystrokes boxes. 23 | */ 24 | public enum TextDisplayMode implements Nameable { 25 | ACTION_NAME(keyBinding -> Text.translatable(keyBinding.getTranslationKey())), 26 | KEY_NAME(keyBinding -> { 27 | Text text = keyBinding.getKeyName(); 28 | String str = text.getString(); 29 | if (str.length() == 1) 30 | return Text.literal(str.toUpperCase()); 31 | return text; 32 | }); 33 | 34 | private final Function nameMapper; 35 | 36 | TextDisplayMode(@NotNull Function nameMapper) { 37 | this.nameMapper = nameMapper; 38 | } 39 | 40 | /** 41 | * Returns the next display mode available. 42 | * 43 | * @return The next available display mode. 44 | */ 45 | public TextDisplayMode next() { 46 | TextDisplayMode[] v = values(); 47 | if (v.length == this.ordinal() + 1) 48 | return v[0]; 49 | return v[this.ordinal() + 1]; 50 | } 51 | 52 | /** 53 | * Gets the text of this text display mode. 54 | * 55 | * @return The text of this text display mode. 56 | */ 57 | public Text getText() { 58 | return Text.translatable("keystrokes.text_display_mode." + this.getName()); 59 | } 60 | 61 | /** 62 | * Gets the text from the specified key binding. 63 | * 64 | * @param keyBinding The specified key binding. 65 | * @return The text describing the key binding. 66 | */ 67 | public Text getText(KeyBind keyBinding) { 68 | return this.nameMapper.apply(keyBinding); 69 | } 70 | 71 | /** 72 | * Gets the text display mode from a string identifier. 73 | * 74 | * @param id The string identifier. 75 | * @return The optional text display mode. 76 | */ 77 | public static Optional byId(String id) { 78 | return Arrays.stream(values()).filter(tdm -> tdm.getName().equalsIgnoreCase(id)).findFirst(); 79 | } 80 | 81 | @Override 82 | public @NotNull String getName() { 83 | return this.name().toLowerCase(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/me/lambdaurora/keystrokes/command/KeystrokesCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2020 LambdAurora 3 | * 4 | * This file is part of AuroraKeystrokes. 5 | * 6 | * Licensed under the MIT license. For more information, 7 | * see the LICENSE file. 8 | */ 9 | 10 | package me.lambdaurora.keystrokes.command; 11 | 12 | import com.mojang.brigadier.CommandDispatcher; 13 | import me.lambdaurora.keystrokes.AuroraKeystrokes; 14 | import me.lambdaurora.keystrokes.gui.KeystrokesConfigScreen; 15 | import net.minecraft.client.MinecraftClient; 16 | import net.minecraft.text.Text; 17 | import net.minecraft.util.Formatting; 18 | import org.quiltmc.qsl.command.api.client.QuiltClientCommandSource; 19 | 20 | import java.util.Timer; 21 | import java.util.TimerTask; 22 | 23 | import static org.quiltmc.qsl.command.api.client.ClientCommandManager.literal; 24 | 25 | /** 26 | * Represents the client command of AuroraKeystrokes. 27 | */ 28 | public class KeystrokesCommand { 29 | public static void registerCommands(CommandDispatcher dispatcher) { 30 | dispatcher.register(literal("keystrokes") 31 | .then(literal("reload") 32 | .executes(ctx -> { 33 | AuroraKeystrokes.get().config.load(); 34 | ctx.getSource().sendFeedback(Text.translatable("keystrokes.reloaded").formatted(Formatting.GREEN)); 35 | return 1; 36 | })) 37 | .then(literal("save") 38 | .executes(ctx -> { 39 | AuroraKeystrokes.get().config.save(); 40 | ctx.getSource().sendFeedback(Text.translatable("keystrokes.saved").formatted(Formatting.GREEN)); 41 | return 1; 42 | })) 43 | .executes(ctx -> { 44 | new Timer().schedule(new TimerTask() { 45 | @Override 46 | public void run() { 47 | var client = MinecraftClient.getInstance(); 48 | client.execute(() -> client.setScreen(new KeystrokesConfigScreen(AuroraKeystrokes.get()))); 49 | } 50 | }, 2); 51 | return 1; 52 | })); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/me/lambdaurora/keystrokes/gui/KeystrokesColorConfigScreen.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2020 LambdAurora 3 | * 4 | * This file is part of AuroraKeystrokes. 5 | * 6 | * Licensed under the MIT license. For more information, 7 | * see the LICENSE file. 8 | */ 9 | 10 | package me.lambdaurora.keystrokes.gui; 11 | 12 | import dev.lambdaurora.spruceui.Position; 13 | import dev.lambdaurora.spruceui.SpruceTexts; 14 | import dev.lambdaurora.spruceui.option.SpruceBooleanOption; 15 | import dev.lambdaurora.spruceui.option.SpruceCyclingOption; 16 | import dev.lambdaurora.spruceui.option.SpruceDoubleOption; 17 | import dev.lambdaurora.spruceui.option.SpruceOption; 18 | import dev.lambdaurora.spruceui.screen.SpruceScreen; 19 | import dev.lambdaurora.spruceui.widget.SpruceButtonWidget; 20 | import me.lambdaurora.keystrokes.AuroraKeystrokes; 21 | import me.lambdaurora.keystrokes.ColorConfigPanel; 22 | import net.minecraft.client.gui.screen.Screen; 23 | import net.minecraft.client.util.math.MatrixStack; 24 | import net.minecraft.text.Text; 25 | 26 | import java.awt.*; 27 | import java.util.ArrayList; 28 | 29 | /** 30 | * Represents the color configuration screen. 31 | */ 32 | public class KeystrokesColorConfigScreen extends SpruceScreen { 33 | private final AuroraKeystrokes mod; 34 | private final Screen parent; 35 | private ColorConfigPanel panel; 36 | private final SpruceOption configPanelOption; 37 | private final SpruceOption frOption, fgOption, fbOption, faOption, brOption, bgOption, bbOption, baOption; 38 | private final SpruceOption rainbowText, rainbowSaturation; 39 | private int r = 0, g = 0, b = 0, a = 0; 40 | private int br = 0, bg = 0, bb = 0, ba = 0; 41 | private final java.util.List foregroundButtons = new ArrayList<>(); 42 | private SpruceButtonWidget rainbowSaturationButton; 43 | 44 | protected KeystrokesColorConfigScreen(AuroraKeystrokes mod, Screen parent) { 45 | super(Text.translatable("keystrokes.menu.title.colors")); 46 | this.mod = mod; 47 | this.parent = parent; 48 | this.panel = ColorConfigPanel.NORMAL; 49 | 50 | this.configPanelOption = new SpruceCyclingOption("keystrokes.menu.color_config_panel", 51 | amount -> { 52 | this.applyColors(); 53 | this.panel = this.panel.next(); 54 | this.children().clear(); 55 | this.init(); 56 | }, 57 | option -> option.getDisplayText(this.panel.getText()), 58 | Text.translatable("keystrokes.tooltip.color_config_panel")); 59 | this.frOption = new SpruceDoubleOption("keystrokes.menu.color_foreground_r", 0.0, 255.0, 1.0F, 60 | () -> (double) this.r, 61 | newValue -> this.r = newValue.intValue(), 62 | option -> option.getDisplayText(Text.of(String.valueOf((int) option.get()))), 63 | null); 64 | this.fgOption = new SpruceDoubleOption("keystrokes.menu.color_foreground_g", 0.0, 255.0, 1.0F, 65 | () -> (double) this.g, 66 | newValue -> this.g = newValue.intValue(), 67 | option -> option.getDisplayText(Text.of(String.valueOf((int) option.get()))), 68 | null); 69 | this.fbOption = new SpruceDoubleOption("keystrokes.menu.color_foreground_b", 0.0, 255.0, 1.0F, 70 | () -> (double) this.b, 71 | newValue -> this.b = newValue.intValue(), 72 | option -> option.getDisplayText(Text.of(String.valueOf((int) option.get()))), 73 | null); 74 | this.faOption = new SpruceDoubleOption("keystrokes.menu.color_foreground_a", 0.0, 255.0, 1.0F, 75 | () -> (double) this.a, 76 | newValue -> this.a = newValue.intValue(), 77 | option -> option.getDisplayText(Text.of(String.valueOf((int) option.get()))), 78 | null); 79 | this.brOption = new SpruceDoubleOption("keystrokes.menu.color_background_r", 0.0, 255.0, 1.0F, 80 | () -> (double) this.br, 81 | newValue -> this.br = newValue.intValue(), 82 | option -> option.getDisplayText(Text.of(String.valueOf((int) option.get()))), 83 | null); 84 | this.bgOption = new SpruceDoubleOption("keystrokes.menu.color_background_g", 0.0, 255.0, 1.0F, 85 | () -> (double) this.bg, 86 | newValue -> this.bg = newValue.intValue(), 87 | option -> option.getDisplayText(Text.of(String.valueOf((int) option.get()))), 88 | null); 89 | this.bbOption = new SpruceDoubleOption("keystrokes.menu.color_background_b", 0.0, 255.0, 1.0F, 90 | () -> (double) this.bb, 91 | newValue -> this.bb = newValue.intValue(), 92 | option -> option.getDisplayText(Text.of(String.valueOf((int) option.get()))), 93 | null); 94 | this.baOption = new SpruceDoubleOption("keystrokes.menu.color_background_a", 0.0, 255.0, 1.0F, 95 | () -> (double) this.ba, 96 | newValue -> this.ba = newValue.intValue(), 97 | option -> option.getDisplayText(Text.of(String.valueOf((int) option.get()))), 98 | null); 99 | this.rainbowText = new SpruceBooleanOption("keystrokes.menu.color.rainbow", 100 | this.mod.config::useRainbowText, 101 | this::apply_rainbow, 102 | Text.translatable("keystrokes.tooltip.rainbow")); 103 | this.rainbowSaturation = new SpruceDoubleOption("keystrokes.menu.color.rainbow_saturation", 0.0, 1.0, 0.05F, 104 | this.mod.config::getRainbowSaturation, 105 | this.mod.config::setRainbowSaturation, 106 | option -> option.getDisplayText(Text.of(option.get() == 1.0 ? "1.0" : "0." + (int) (option.get() * 100))), 107 | Text.translatable("keystrokes.tooltip.rainbow_saturation")); 108 | } 109 | 110 | public void apply_rainbow(boolean newValue) { 111 | this.mod.config.setRainbowText(newValue); 112 | 113 | this.foregroundButtons.forEach(button -> button.setActive(newValue)); 114 | if (this.rainbowSaturationButton != null) 115 | this.rainbowSaturationButton.setActive(newValue); 116 | } 117 | 118 | @Override 119 | public void closeScreen() { 120 | super.closeScreen(); 121 | this.mod.config.save(); 122 | } 123 | 124 | @Override 125 | protected void init() { 126 | super.init(); 127 | this.mod.config.load(); 128 | int widgetWidth = 204; 129 | int widgetHeight = 20; 130 | int margin = 4; 131 | int y = this.height / 4 - 8; 132 | this.initColors(); 133 | this.initLeftWidgets(y, widgetWidth, widgetHeight, margin); 134 | this.initRightWidgets(y, widgetWidth, widgetHeight, margin); 135 | 136 | this.apply_rainbow(this.mod.config.useRainbowText()); 137 | } 138 | 139 | private void initLeftWidgets(int y, int widgetWidth, int widgetHeight, int margin) { 140 | int x = (this.width / 4) - widgetWidth / 2; 141 | this.addDrawableChild(this.frOption.createWidget(Position.of(x, (y += widgetHeight + margin)), widgetWidth)); 142 | this.addDrawableChild(this.fgOption.createWidget(Position.of(x, (y += widgetHeight + margin)), widgetWidth)); 143 | this.addDrawableChild(this.fbOption.createWidget(Position.of(x, (y += widgetHeight + margin)), widgetWidth)); 144 | this.addDrawableChild(this.faOption.createWidget(Position.of(x, (y += widgetHeight + margin)), widgetWidth)); 145 | this.addSelectableChild(this.configPanelOption.createWidget(Position.of(x, (y += widgetHeight + margin)), widgetWidth)); 146 | this.addSelectableChild(this.rainbowText.createWidget(Position.of(x, (y + widgetHeight + margin)), widgetWidth)); 147 | 148 | } 149 | 150 | private void initRightWidgets(int y, int widgetWidth, int widgetHeight, int margin) { 151 | int x = (this.width / 4) * 3 - widgetWidth / 2; 152 | this.addDrawableChild(this.brOption.createWidget(Position.of(x, (y += widgetHeight + margin)), widgetWidth)); 153 | this.addDrawableChild(this.bgOption.createWidget(Position.of(x, (y += widgetHeight + margin)), widgetWidth)); 154 | this.addDrawableChild(this.bbOption.createWidget(Position.of(x, (y += widgetHeight + margin)), widgetWidth)); 155 | this.addDrawableChild(this.baOption.createWidget(Position.of(x, (y += widgetHeight + margin)), widgetWidth)); 156 | this.addDrawableChild(this.rainbowSaturation.createWidget(Position.of(x, (y += widgetHeight + margin)), widgetWidth)); 157 | this.addSelectableChild(new SpruceButtonWidget(Position.of(x, (y + widgetHeight + margin)), widgetWidth, widgetHeight, SpruceTexts.GUI_DONE, (button) -> { 158 | this.applyColors(); 159 | this.mod.config.save(); 160 | if (this.client != null) { 161 | this.client.setScreen(this.parent); 162 | } 163 | })); 164 | } 165 | 166 | private void initColors() { 167 | Color foreground = this.panel.getColor(this.mod.config); 168 | this.r = foreground.getRed(); 169 | this.g = foreground.getGreen(); 170 | this.b = foreground.getBlue(); 171 | this.a = foreground.getAlpha(); 172 | Color background = this.panel.getBackgroundColor(this.mod.config); 173 | this.br = background.getRed(); 174 | this.bg = background.getGreen(); 175 | this.bb = background.getBlue(); 176 | this.ba = background.getAlpha(); 177 | } 178 | 179 | private void applyColors() { 180 | this.panel.setColor(this.mod.config, new Color(r, g, b, a)); 181 | this.panel.setBackgroundColor(this.mod.config, new Color(br, bg, bb, ba)); 182 | } 183 | 184 | @Override 185 | public void renderTitle(MatrixStack matrices, int mouseX, int mouseY, float delta) { 186 | drawCenteredText(matrices, this.textRenderer, this.title, this.width / 2, 10, 16777215); 187 | var example = Text.translatable("keystrokes.menu.example_text"); 188 | int y = this.height / 4 + 24 - 16; 189 | int padding = (20 - this.textRenderer.fontHeight) / 2; 190 | AuroraKeystrokes.renderTextBox(matrices, this.textRenderer, (this.width / 2 - this.textRenderer.getWidth(example) 191 | / 2), y / 2, padding, 20, example, new Color(r, g, b, a), new Color(br, bg, bb, ba)); 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /src/main/java/me/lambdaurora/keystrokes/gui/KeystrokesConfigScreen.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2020 LambdAurora 3 | * 4 | * This file is part of AuroraKeystrokes. 5 | * 6 | * Licensed under the MIT license. For more information, 7 | * see the LICENSE file. 8 | */ 9 | 10 | package me.lambdaurora.keystrokes.gui; 11 | 12 | import dev.lambdaurora.spruceui.Position; 13 | import dev.lambdaurora.spruceui.SpruceTexts; 14 | import dev.lambdaurora.spruceui.option.*; 15 | import dev.lambdaurora.spruceui.screen.SpruceScreen; 16 | import dev.lambdaurora.spruceui.widget.SpruceButtonWidget; 17 | import me.lambdaurora.keystrokes.AuroraKeystrokes; 18 | import net.minecraft.client.gui.screen.ConfirmScreen; 19 | import net.minecraft.client.gui.screen.FatalErrorScreen; 20 | import net.minecraft.client.gui.widget.ButtonWidget; 21 | import net.minecraft.client.util.math.MatrixStack; 22 | import net.minecraft.text.Text; 23 | import org.jetbrains.annotations.NotNull; 24 | 25 | import java.io.File; 26 | import java.util.ArrayList; 27 | import java.util.List; 28 | 29 | /** 30 | * Represents the config screen of AuroraKeystrokes. 31 | */ 32 | public class KeystrokesConfigScreen extends SpruceScreen { 33 | private final AuroraKeystrokes mod; 34 | 35 | private final SpruceOption resetOption; 36 | private final List leftOptions; 37 | private final List rightOptions; 38 | 39 | public KeystrokesConfigScreen(@NotNull AuroraKeystrokes mod) { 40 | super(Text.translatable("keystrokes.menu.title.main")); 41 | this.mod = mod; 42 | 43 | this.leftOptions = new ArrayList<>(); 44 | 45 | this.leftOptions.add(new SpruceDoubleOption("keystrokes.menu.x", 0.0, 100.0, 0.5F, 46 | this.mod.config::getX, 47 | this.mod.config::setX, 48 | option -> Text.literal("X: " + option.get()), 49 | Text.translatable("keystrokes.tooltip.x"))); 50 | this.leftOptions.add(new SpruceDoubleOption("keystrokes.menu.y", 0.0, 100.0, 0.5F, 51 | this.mod.config::getY, 52 | this.mod.config::setY, 53 | (option) -> Text.literal("Y: " + option.get()), 54 | Text.translatable("keystrokes.tooltip.y"))); 55 | this.leftOptions.add(new SpruceDoubleOption("keystrokes.menu.padding", 0.0, 20.0, 1.0F, 56 | () -> (double) this.mod.config.getPadding(), 57 | newValue -> this.mod.config.setPadding(newValue.intValue()), 58 | (option) -> option.getDisplayText(Text.of(String.valueOf(option.get()))), 59 | Text.translatable("keystrokes.tooltip.padding"))); 60 | 61 | /* Boxes */ 62 | this.leftOptions.add(new SpruceCheckboxBooleanOption("keystrokes.menu.show_movement_boxes", 63 | this.mod.config::showMovementBoxes, this.mod.config::setMovementBoxes, null)); 64 | this.leftOptions.add(new SpruceCheckboxBooleanOption("keystrokes.menu.show_attack_box", 65 | this.mod.config::showAttackBox, this.mod.config::setAttackBox, null)); 66 | this.leftOptions.add(new SpruceCheckboxBooleanOption("keystrokes.menu.show_use_box", 67 | this.mod.config::showUseBox, this.mod.config::setUseBox, null)); 68 | this.leftOptions.add(new SpruceCheckboxBooleanOption("keystrokes.menu.show_sneak_box", 69 | this.mod.config::showSneakBox, this.mod.config::setSneakBox, null)); 70 | this.leftOptions.add(new SpruceCheckboxBooleanOption("keystrokes.menu.show_jump_box", 71 | this.mod.config::showJumpBox, this.mod.config::setJumpBox, null)); 72 | 73 | this.rightOptions = new ArrayList<>(); 74 | 75 | this.rightOptions.add(new SpruceCyclingOption("keystrokes.menu.text_display_mode", 76 | amount -> this.mod.config.setTextDisplayMode(this.mod.config.getTextDisplayMode().next()), 77 | option -> option.getDisplayText(this.mod.config.getTextDisplayMode().getText()), 78 | Text.translatable("keystrokes.tooltip.text_display_mode"))); 79 | 80 | /* CPS */ 81 | this.rightOptions.add(new SpruceCheckboxBooleanOption("keystrokes.menu.show_cps", 82 | this.mod.config::showCps, this.mod.config::setShowCps, null)); 83 | this.rightOptions.add(new SpruceCheckboxBooleanOption("keystrokes.menu.attach_cps", 84 | this.mod.config::attachedCps, this.mod.config::setAttachedCps, null)); 85 | 86 | this.rightOptions.add(new SpruceCyclingOption("keystrokes.menu.layout", 87 | amount -> this.mod.config.setLayout(this.mod.config.getLayout().next()), 88 | option -> option.getDisplayText(Text.translatable("keystrokes.layout." + this.mod.config.getLayout().getName())), 89 | null)); 90 | 91 | SpruceOption showHudOption = new SpruceCheckboxBooleanOption("keystrokes.menu.show_hud", this.mod.config::doesRenderHud, this.mod::setHudEnabled, null); 92 | 93 | this.resetOption = SpruceSimpleActionOption.reset(btn -> { 94 | if (this.client != null) { 95 | this.client.setScreen(new ConfirmScreen(confirm -> { 96 | if (confirm) { 97 | if (new File("config/keystrokes.toml").delete()) { 98 | this.mod.config.load(); 99 | this.client.setScreen(new KeystrokesConfigScreen(this.mod)); 100 | } else { 101 | this.client.setScreen(new FatalErrorScreen(SpruceTexts.RESET_TEXT, Text.translatable("keystrokes.error.cannot_reset"))); 102 | } 103 | } else this.client.setScreen(this); 104 | }, SpruceTexts.RESET_TEXT, Text.translatable("keystrokes.menu.confirm_reset"))); 105 | } 106 | }); 107 | } 108 | 109 | @Override 110 | public void closeScreen() { 111 | super.closeScreen(); 112 | this.mod.config.save(); 113 | } 114 | 115 | @Override 116 | protected void init() { 117 | super.init(); 118 | this.mod.config.load(); 119 | int widgetWidth = 204; 120 | int widgetHeight = 20; 121 | int margin = 4; 122 | int y = this.height / 4 - 8; 123 | this.initLeftWidgets(y, widgetWidth, widgetHeight, margin); 124 | this.initRightWidgets(y, widgetWidth, widgetHeight, margin); 125 | } 126 | 127 | private void initLeftWidgets(int y, int widgetWidth, int widgetHeight, int margin) { 128 | int x = this.width / 4 - widgetWidth / 2; 129 | for (SpruceOption option : this.leftOptions) { 130 | this.addDrawableChild(option.createWidget(Position.of(x, y), widgetWidth)); 131 | y += widgetHeight + margin; 132 | } 133 | } 134 | 135 | private void initRightWidgets(int y, int widgetWidth, int widgetHeight, int margin) { 136 | int x = (this.width / 4) * 3 - widgetWidth / 2; 137 | this.addDrawableChild(new ButtonWidget(x, y, widgetWidth, widgetHeight, Text.translatable("keystrokes.menu.open_color_config"), (button) -> { 138 | this.mod.config.save(); 139 | if (this.client != null) { 140 | this.client.setScreen(new KeystrokesColorConfigScreen(this.mod, this)); 141 | } 142 | })); 143 | 144 | y += widgetHeight + margin; 145 | for (SpruceOption option : this.rightOptions) { 146 | if (option != null) 147 | this.addDrawableChild(option.createWidget(Position.of(x, y), widgetWidth)); 148 | y += widgetHeight + margin; 149 | } 150 | 151 | this.addDrawableChild(new SpruceButtonWidget(Position.of(x, y), widgetWidth, widgetHeight, SpruceTexts.GUI_DONE, (button) -> { 152 | this.mod.config.save(); 153 | if (this.client != null) { 154 | this.client.setScreen(null); 155 | } 156 | })); 157 | this.addDrawableChild(this.resetOption.createWidget(Position.of(x, y + (widgetHeight + margin) * 2), widgetWidth)); 158 | } 159 | 160 | @Override 161 | public void renderTitle(MatrixStack matrices, int mouseX, int mouseY, float delta) { 162 | drawCenteredText(matrices, this.textRenderer, this.title, this.width / 2, 10, 16777215); 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /src/main/java/me/lambdaurora/keystrokes/gui/KeystrokesHud.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2020 LambdAurora 3 | * 4 | * This file is part of AuroraKeystrokes. 5 | * 6 | * Licensed under the MIT license. For more information, 7 | * see the LICENSE file. 8 | */ 9 | 10 | package me.lambdaurora.keystrokes.gui; 11 | 12 | import dev.lambdaurora.spruceui.hud.Hud; 13 | import me.lambdaurora.keystrokes.AuroraKeystrokes; 14 | import me.lambdaurora.keystrokes.LayoutMode; 15 | import net.minecraft.client.MinecraftClient; 16 | import net.minecraft.client.option.KeyBind; 17 | import net.minecraft.client.util.math.MatrixStack; 18 | import net.minecraft.text.Text; 19 | import net.minecraft.util.Identifier; 20 | import org.jetbrains.annotations.NotNull; 21 | 22 | /** 23 | * Represents the keystrokes hud. 24 | */ 25 | public class KeystrokesHud extends Hud { 26 | private final AuroraKeystrokes mod; 27 | private MinecraftClient client; 28 | 29 | public KeystrokesHud(AuroraKeystrokes mod) { 30 | super(new Identifier(AuroraKeystrokes.NAMESPACE, "hud/keystrokes")); 31 | this.mod = mod; 32 | } 33 | 34 | @Override 35 | public void init(@NotNull MinecraftClient client, int screenWidth, int screenHeight) { 36 | super.init(client, screenWidth, screenHeight); 37 | this.client = client; 38 | } 39 | 40 | @Override 41 | public void render(MatrixStack matrices, float tickDelta) { 42 | int padding = this.mod.config.getPadding(); 43 | String cpsText = "CPS: " + this.mod.cps; 44 | 45 | // Sizes. 46 | int boxHeight = this.client.textRenderer.fontHeight + padding * 2; 47 | int leftWidth = this.getBoxWidth(this.client.options.leftKey); 48 | int backWidth = this.getBoxWidth(this.client.options.backKey); 49 | int rightWidth = this.getBoxWidth(this.client.options.rightKey); 50 | int attackWidth = this.getBoxWidth(this.client.options.attackKey); 51 | int useWidth = this.getBoxWidth(this.client.options.useKey); 52 | int sneakWidth = this.getBoxWidth(this.client.options.sneakKey); 53 | int jumpWidth = this.getBoxWidth(this.client.options.jumpKey); 54 | int rightLeftWidth = leftWidth + padding + rightWidth; 55 | if (this.mod.config.getLayout() == LayoutMode.PYRAMID) { 56 | rightLeftWidth += padding + backWidth; 57 | } 58 | int mouseWidth = attackWidth + padding + useWidth; 59 | int jumpSneakWidth = sneakWidth + padding + jumpWidth; 60 | if (!this.mod.config.showMovementBoxes()) 61 | rightLeftWidth = 0; 62 | if (!this.mod.config.showAttackBox() && !this.mod.config.showUseBox()) 63 | mouseWidth = 0; 64 | else if (!this.mod.config.showAttackBox() || !this.mod.config.showUseBox()) { 65 | if (this.mod.config.showAttackBox()) 66 | mouseWidth = attackWidth; 67 | else 68 | mouseWidth = useWidth; 69 | } 70 | if (!this.mod.config.showSneakBox() && !this.mod.config.showJumpBox()) 71 | jumpSneakWidth = 0; 72 | else if (!this.mod.config.showSneakBox() || !this.mod.config.showJumpBox()) { 73 | if (this.mod.config.showSneakBox()) 74 | jumpSneakWidth = sneakWidth; 75 | else 76 | jumpSneakWidth = jumpWidth; 77 | } 78 | int totalWidth = this.getTotalWidth(rightLeftWidth, mouseWidth, jumpSneakWidth); 79 | int totalHeight = this.getTotalHeight(boxHeight, padding); 80 | 81 | int x = (int) (this.mod.config.getX() / 100.0 * (this.client.getWindow().getScaledWidth() - totalWidth)), 82 | y = (int) (this.mod.config.getY() / 100.0 * (this.client.getWindow().getScaledHeight() - totalHeight)); 83 | 84 | int boxWidth = this.getBoxWidth(this.client.options.forwardKey); 85 | 86 | y -= (boxHeight + padding); 87 | 88 | // Movements keys. 89 | if (this.mod.config.showMovementBoxes()) { 90 | switch (this.mod.config.getLayout()) { 91 | case PYRAMID: 92 | this.renderKeyBox(matrices, x + (totalWidth / 2 - boxWidth / 2), (y += (padding + boxHeight)), padding, boxHeight, this.client.options.forwardKey); 93 | this.renderSection(matrices, x, (y += (padding + boxHeight)), padding, boxHeight, this.client.options.leftKey, this.client.options.backKey, this.client.options.rightKey, totalWidth, leftWidth, backWidth, rightWidth); 94 | break; 95 | case CROSS: 96 | default: 97 | this.renderKeyBox(matrices, x + (totalWidth / 2 - boxWidth / 2), (y += (padding + boxHeight)), padding, boxHeight, this.client.options.forwardKey); 98 | this.renderSection(matrices, x, (y += (padding + boxHeight)), padding, boxHeight, this.client.options.leftKey, this.client.options.rightKey, totalWidth, leftWidth, rightWidth); 99 | this.renderKeyBox(matrices, x + (totalWidth / 2 - backWidth / 2), (y += (padding + boxHeight)), padding, boxHeight, this.client.options.backKey); 100 | break; 101 | } 102 | } 103 | 104 | // Interaction keys. 105 | if (this.mod.config.showAttackBox() && this.mod.config.showUseBox()) 106 | this.renderSection(matrices, x, (y += (padding + boxHeight)), padding, boxHeight, this.client.options.attackKey, this.client.options.useKey, totalWidth, attackWidth, useWidth); 107 | else if (this.mod.config.showAttackBox()) 108 | this.renderKeyBox(matrices, x + (totalWidth / 2 - attackWidth / 2), (y += (padding + boxHeight)), padding, boxHeight, this.client.options.attackKey); 109 | else if (this.mod.config.showUseBox()) 110 | this.renderKeyBox(matrices, x + (totalWidth / 2 - useWidth / 2), (y += (padding + boxHeight)), padding, boxHeight, this.client.options.useKey); 111 | 112 | // More movements keys. 113 | if (this.mod.config.showSneakBox() && this.mod.config.showJumpBox()) 114 | this.renderSection(matrices, x, (y += (padding + boxHeight)), padding, boxHeight, this.client.options.sneakKey, this.client.options.jumpKey, totalWidth, sneakWidth, jumpWidth); 115 | else if (this.mod.config.showSneakBox()) 116 | this.renderKeyBox(matrices, x + (totalWidth / 2 - sneakWidth / 2), (y += (padding + boxHeight)), padding, boxHeight, this.client.options.sneakKey); 117 | else if (this.mod.config.showJumpBox()) 118 | this.renderKeyBox(matrices, x + (totalWidth / 2 - jumpWidth / 2), (y += (padding + boxHeight)), padding, boxHeight, this.client.options.jumpKey); 119 | 120 | // CPS counter. 121 | if (this.mod.config.showCps()) { 122 | boxWidth = this.getBoxWidth(cpsText); 123 | int cpsX, cpsY; 124 | if (this.mod.config.attachedCps()) { 125 | cpsX = x + (totalWidth / 2 - boxWidth / 2); 126 | cpsY = y + (padding + boxHeight); 127 | } else { 128 | cpsX = this.client.getWindow().getScaledWidth() - padding - boxWidth; 129 | cpsY = this.client.getWindow().getScaledHeight() - padding - boxHeight; 130 | } 131 | AuroraKeystrokes.renderTextBox(matrices, this.client.textRenderer, cpsX, cpsY, padding, boxHeight, Text.literal(cpsText), this.mod.config.getColorPressed(), this.mod.config.getBackgroundNormal()); 132 | } 133 | } 134 | 135 | public int getTotalHeight(int boxHeight, int padding) { 136 | int i = 0; 137 | if (this.mod.config.showMovementBoxes()) 138 | i += (boxHeight + padding) * 3; 139 | if (this.mod.config.showAttackBox() || this.mod.config.showUseBox()) 140 | i += boxHeight + padding; 141 | if (this.mod.config.showSneakBox() || this.mod.config.showJumpBox()) 142 | i += boxHeight + padding; 143 | if (this.mod.config.showCps() && this.mod.config.attachedCps()) 144 | i += boxHeight + padding; 145 | return i - padding; 146 | } 147 | 148 | public int getTotalWidth(int rightLeftWidth, int mouseWidth, int jumpSneakWidth) { 149 | return Math.max(rightLeftWidth, Math.max(mouseWidth, jumpSneakWidth)); 150 | } 151 | 152 | public int getBoxWidth(@NotNull KeyBind keyBinding) { 153 | return this.getBoxWidth(this.mod.config.getTextDisplayMode().getText(keyBinding)); 154 | } 155 | 156 | public int getBoxWidth(@NotNull Text text) { 157 | return this.client.textRenderer.getWidth(text) + this.mod.config.getPadding() * 2; 158 | } 159 | 160 | public int getBoxWidth(@NotNull String text) { 161 | return this.client.textRenderer.getWidth(text) + this.mod.config.getPadding() * 2; 162 | } 163 | 164 | public void renderSection(MatrixStack matrices, int x, int y, int padding, int boxHeight, @NotNull KeyBind left, @NotNull KeyBind right, int totalWidth, int leftWidth, int rightWidth) { 165 | if (totalWidth == leftWidth + padding + rightWidth) { 166 | leftWidth = this.renderKeyBox(matrices, x, y, padding, boxHeight, left); 167 | this.renderKeyBox(matrices, x + leftWidth + padding, y, padding, boxHeight, right); 168 | } else { 169 | int maxWidth = (totalWidth - padding) / 2; 170 | this.renderKeyBox(matrices, x + (maxWidth / 2 - leftWidth / 2), y, padding, boxHeight, left); 171 | this.renderKeyBox(matrices, x + padding + maxWidth + (maxWidth / 2 - rightWidth / 2), y, padding, boxHeight, right); 172 | } 173 | } 174 | 175 | public void renderSection(MatrixStack matrices, int x, int y, int padding, int boxHeight, @NotNull KeyBind left, @NotNull KeyBind center, @NotNull KeyBind right, int totalWidth, int leftWidth, int centerWidth, int rightWidth) { 176 | int centerX = totalWidth / 2; 177 | int maxWidth = (totalWidth - padding) / 3; 178 | this.renderKeyBox(matrices, x + (centerX - leftWidth - padding - (centerWidth / 2)), y, padding, boxHeight, left); 179 | this.renderKeyBox(matrices, x + (centerX - (centerWidth / 2)), y, padding, boxHeight, center); 180 | this.renderKeyBox(matrices, x + (centerX + padding + (centerWidth / 2)), y, padding, boxHeight, right); 181 | } 182 | 183 | public int renderKeyBox(MatrixStack matrices, int x, int y, int padding, int boxHeight, @NotNull KeyBind keyBinding) { 184 | if (keyBinding.isPressed()) 185 | return AuroraKeystrokes.renderTextBox(matrices, this.client.textRenderer, x, y, padding, boxHeight, this.mod.config.getTextDisplayMode().getText(keyBinding), this.mod.config.getColorPressed(), this.mod.config.getBackgroundPressed()); 186 | else 187 | return AuroraKeystrokes.renderTextBox(matrices, this.client.textRenderer, x, y, padding, boxHeight, this.mod.config.getTextDisplayMode().getText(keyBinding), this.mod.config.getColorNormal(), this.mod.config.getBackgroundNormal()); 188 | } 189 | } 190 | -------------------------------------------------------------------------------- /src/main/java/me/lambdaurora/keystrokes/mixin/MinecraftClientMixin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2020 LambdAurora 3 | * 4 | * This file is part of AuroraKeystrokes. 5 | * 6 | * Licensed under the MIT license. For more information, 7 | * see the LICENSE file. 8 | */ 9 | 10 | package me.lambdaurora.keystrokes.mixin; 11 | 12 | import me.lambdaurora.keystrokes.AuroraKeystrokes; 13 | import net.minecraft.client.MinecraftClient; 14 | import org.spongepowered.asm.mixin.Mixin; 15 | import org.spongepowered.asm.mixin.injection.At; 16 | import org.spongepowered.asm.mixin.injection.Inject; 17 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 18 | 19 | /** 20 | * Injects the CPS counter. 21 | */ 22 | @Mixin(MinecraftClient.class) 23 | public class MinecraftClientMixin { 24 | @Inject(method = "doAttack", at = @At(value = "HEAD")) 25 | private void aurorakeystrokes_onAttack(CallbackInfoReturnable cir) { 26 | AuroraKeystrokes.get().cps++; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/assets/aurora_keystrokes/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LambdAurora/AuroraKeystrokes/ad00fa206d54207368b5f71edc090c0ce7cb0696/src/main/resources/assets/aurora_keystrokes/icon.png -------------------------------------------------------------------------------- /src/main/resources/assets/aurora_keystrokes/lang/en_us.json: -------------------------------------------------------------------------------- 1 | { 2 | "keystrokes.reloaded": "AuroraKeystrokes configuration reloaded!", 3 | "keystrokes.saved": "AuroraKeystrokes configuration saved!", 4 | "keystrokes.layout.cross": "Cross", 5 | "keystrokes.layout.pyramid": "Pyramid", 6 | "keystrokes.menu.show_hud": "Show HUD", 7 | "keystrokes.menu.padding": "Padding", 8 | "keystrokes.menu.show_movement_boxes": "Show movement boxes", 9 | "keystrokes.menu.show_attack_box": "Show attack box", 10 | "keystrokes.menu.show_use_box": "Show use box", 11 | "keystrokes.menu.show_sneak_box": "Show sneak box", 12 | "keystrokes.menu.show_jump_box": "Show jump box", 13 | "keystrokes.menu.open_color_config": "Configure colors", 14 | "keystrokes.menu.text_display_mode": "Text display mode", 15 | "keystrokes.menu.show_cps": "Show CPS", 16 | "keystrokes.menu.attach_cps": "Attach CPS", 17 | "keystrokes.menu.color_config_panel": "Configure colors", 18 | "keystrokes.menu.save": "Save", 19 | "keystrokes.menu.reset": "Reset settings", 20 | "keystrokes.menu.confirm_reset": "Are you sure to reset settings?", 21 | "keystrokes.menu.color_foreground_r": "Foreground (R)", 22 | "keystrokes.menu.color_foreground_g": "Foreground (G)", 23 | "keystrokes.menu.color_foreground_b": "Foreground (B)", 24 | "keystrokes.menu.color_foreground_a": "Foreground (A)", 25 | "keystrokes.menu.color_background_r": "Background (R)", 26 | "keystrokes.menu.color_background_g": "Background (G)", 27 | "keystrokes.menu.color_background_b": "Background (B)", 28 | "keystrokes.menu.color_background_a": "Background (A)", 29 | "keystrokes.menu.color.rainbow": "Rainbow text", 30 | "keystrokes.menu.color.rainbow_saturation": "Rainbow saturation", 31 | "keystrokes.menu.example_text": "Example text", 32 | "keystrokes.menu.layout": "Layout", 33 | "keystrokes.menu.title.main": "AuroraKeystrokes settings", 34 | "keystrokes.menu.title.colors": "AuroraKeystrokes colors settings", 35 | "keystrokes.tooltip.color_config_panel": "Configure the colors of the specified state.", 36 | "keystrokes.tooltip.padding": "The padding of the boxes.", 37 | "keystrokes.tooltip.rainbow": "Enable the rainbow rendering of the indicators.", 38 | "keystrokes.tooltip.rainbow_saturation": "Change the saturation of the rainbow text.", 39 | "keystrokes.tooltip.text_display_mode": "Changes the boxes' naming scheme.", 40 | "keystrokes.tooltip.x": "The X position of the HUD.", 41 | "keystrokes.tooltip.y": "The Y position of the HUD.", 42 | "keystrokes.color_config_panel.normal": "unpressed", 43 | "keystrokes.color_config_panel.pressed": "pressed", 44 | "keystrokes.text_display_mode.action_name": "action name", 45 | "keystrokes.text_display_mode.key_name": "key name", 46 | "keystrokes.error.cannot_reset": "Cannot reset the settings!" 47 | } -------------------------------------------------------------------------------- /src/main/resources/assets/aurora_keystrokes/lang/fr_ca.json: -------------------------------------------------------------------------------- 1 | { 2 | "keystrokes.reloaded": "La configuration de AuroraKeystrokes est rechargé!", 3 | "keystrokes.saved": "La configuration de AuroraKeystrokes est sauvegardé!", 4 | "keystrokes.layout.cross": "Croix", 5 | "keystrokes.layout.pyramid": "Pyramide", 6 | "keystrokes.menu.show_hud": "Afficher les indicateurs", 7 | "keystrokes.menu.padding": "Padding", 8 | "keystrokes.menu.show_movement_boxes": "Afficher les indicateurs de mouvements", 9 | "keystrokes.menu.show_attack_box": "Afficher l'indicateur d'attaque", 10 | "keystrokes.menu.show_use_box": "Afficher l'indicateur d'usage", 11 | "keystrokes.menu.show_sneak_box": "Afficher l'indicateur d'accroupissement", 12 | "keystrokes.menu.show_jump_box": "Afficher l'indicateur de saut", 13 | "keystrokes.menu.open_color_config": "Configurer les couleurs", 14 | "keystrokes.menu.text_display_mode": "Mode d'affichage du texte", 15 | "keystrokes.menu.show_cps": "Afficher le compteur CPS", 16 | "keystrokes.menu.attach_cps": "Attacher le compteur CPS", 17 | "keystrokes.menu.color_config_panel": "Couleur d'indicateur", 18 | "keystrokes.menu.save": "Sauvegarder", 19 | "keystrokes.menu.reset": "Mise à zéro des paramètres", 20 | "keystrokes.menu.confirm_reset": "Voulez-vous vraiment remettre à zéro les paramètres?", 21 | "keystrokes.menu.color_foreground_r": "Couleur de texte (R)", 22 | "keystrokes.menu.color_foreground_g": "Couleur de texte (G)", 23 | "keystrokes.menu.color_foreground_b": "Couleur de texte (B)", 24 | "keystrokes.menu.color_foreground_a": "Couleur de texte (A)", 25 | "keystrokes.menu.color_background_r": "Couleur de fond (R)", 26 | "keystrokes.menu.color_background_g": "Couleur de fond (G)", 27 | "keystrokes.menu.color_background_b": "Couleur de fond (B)", 28 | "keystrokes.menu.color_background_a": "Couleur de fond (A)", 29 | "keystrokes.menu.color.rainbow": "Text arc-en-ciel", 30 | "keystrokes.menu.color.rainbow_saturation": "Saturation de l'arc-en-ciel", 31 | "keystrokes.menu.example_text": "Texte d'exemple", 32 | "keystrokes.menu.layout": "Mise en page", 33 | "keystrokes.menu.title.main": "Paramètres de AuroraKeystrokes", 34 | "keystrokes.menu.title.colors": "Paramètres de couleurs de AuroraKeystrokes", 35 | "keystrokes.tooltip.color_config_panel": "Édite les couleurs de l'état indiqué.", 36 | "keystrokes.tooltip.padding": "Le padding des indicateurs.", 37 | "keystrokes.tooltip.rainbow": "Active le mode arc-en-ciel pour les indicateurs.", 38 | "keystrokes.tooltip.rainbow_saturation": "Change la saturation du text arc-en-ciel.", 39 | "keystrokes.tooltip.text_display_mode": "Change le schéma de nommage des indicateurs.", 40 | "keystrokes.tooltip.x": "La position X du HUD.", 41 | "keystrokes.tooltip.y": "La position Y du HUD.", 42 | "keystrokes.color_config_panel.normal": "non-pressé", 43 | "keystrokes.color_config_panel.pressed": "pressé", 44 | "keystrokes.text_display_mode.action_name": "nom d'action", 45 | "keystrokes.text_display_mode.key_name": "nom de touches", 46 | "keystrokes.error.cannot_reset": "La remise à zéro des paramètres a échoué!" 47 | } -------------------------------------------------------------------------------- /src/main/resources/assets/aurora_keystrokes/lang/fr_fr.json: -------------------------------------------------------------------------------- 1 | { 2 | "keystrokes.reloaded": "La configuration de AuroraKeystrokes est rechargé!", 3 | "keystrokes.saved": "La configuration de AuroraKeystrokes est sauvegardé!", 4 | "keystrokes.layout.cross": "Croix", 5 | "keystrokes.layout.pyramid": "Pyramide", 6 | "keystrokes.menu.show_hud": "Afficher les indicateurs", 7 | "keystrokes.menu.padding": "Padding", 8 | "keystrokes.menu.show_movement_boxes": "Afficher les indicateurs de mouvements", 9 | "keystrokes.menu.show_attack_box": "Afficher l'indicateur d'attaque", 10 | "keystrokes.menu.show_use_box": "Afficher l'indicateur d'usage", 11 | "keystrokes.menu.show_sneak_box": "Afficher l'indicateur d'accroupissement", 12 | "keystrokes.menu.show_jump_box": "Afficher l'indicateur de saut", 13 | "keystrokes.menu.open_color_config": "Configurer les couleurs", 14 | "keystrokes.menu.text_display_mode": "Mode d'affichage du texte", 15 | "keystrokes.menu.show_cps": "Afficher le compteur CPS", 16 | "keystrokes.menu.attach_cps": "Attacher le compteur CPS", 17 | "keystrokes.menu.color_config_panel": "Couleur d'indicateur", 18 | "keystrokes.menu.save": "Sauvegarder", 19 | "keystrokes.menu.reset": "Mise à zéro des paramètres", 20 | "keystrokes.menu.confirm_reset": "Voulez-vous vraiment remettre à zéro les paramètres?", 21 | "keystrokes.menu.color_foreground_r": "Couleur de texte (R)", 22 | "keystrokes.menu.color_foreground_g": "Couleur de texte (G)", 23 | "keystrokes.menu.color_foreground_b": "Couleur de texte (B)", 24 | "keystrokes.menu.color_foreground_a": "Couleur de texte (A)", 25 | "keystrokes.menu.color_background_r": "Couleur de fond (R)", 26 | "keystrokes.menu.color_background_g": "Couleur de fond (G)", 27 | "keystrokes.menu.color_background_b": "Couleur de fond (B)", 28 | "keystrokes.menu.color_background_a": "Couleur de fond (A)", 29 | "keystrokes.menu.color.rainbow": "Texte arc-en-ciel", 30 | "keystrokes.menu.color.rainbow_saturation": "Saturation de l'arc-en-ciel", 31 | "keystrokes.menu.example_text": "Texte d'exemple", 32 | "keystrokes.menu.layout": "Mise en page", 33 | "keystrokes.menu.title.main": "Paramètres de AuroraKeystrokes", 34 | "keystrokes.menu.title.colors": "Paramètres de couleurs de AuroraKeystrokes", 35 | "keystrokes.tooltip.color_config_panel": "Édite les couleurs de l'état indiqué.", 36 | "keystrokes.tooltip.padding": "Le padding des indicateurs.", 37 | "keystrokes.tooltip.rainbow": "Active le mode arc-en-ciel pour les indicateurs.", 38 | "keystrokes.tooltip.rainbow_saturation": "Change la saturation du text arc-en-ciel.", 39 | "keystrokes.tooltip.text_display_mode": "Change le schéma de nommage des indicateurs.", 40 | "keystrokes.tooltip.x": "La position X du HUD.", 41 | "keystrokes.tooltip.y": "La position Y du HUD.", 42 | "keystrokes.color_config_panel.normal": "non-pressé", 43 | "keystrokes.color_config_panel.pressed": "pressé", 44 | "keystrokes.text_display_mode.action_name": "nom d'action", 45 | "keystrokes.text_display_mode.key_name": "nom de touches", 46 | "keystrokes.error.cannot_reset": "La remise à zéro des paramètres a échoué!" 47 | } -------------------------------------------------------------------------------- /src/main/resources/assets/aurora_keystrokes/lang/tr_tr.json: -------------------------------------------------------------------------------- 1 | { 2 | "keystrokes.reloaded": "AuroraKeystrokes ayarlaması yeniden yüklendi!", 3 | "keystrokes.saved": "AuroraKeystrokes ayarlaması kaydedildi!", 4 | "keystrokes.layout.cross": "Haç", 5 | "keystrokes.layout.pyramid": "Piramit", 6 | "keystrokes.menu.show_hud": "HUD'u göster", 7 | "keystrokes.menu.padding": "Dolgu", 8 | "keystrokes.menu.show_movement_boxes": "Hareket kutularını aç", 9 | "keystrokes.menu.show_attack_box": "Saldırma kutusunu aç", 10 | "keystrokes.menu.show_use_box": "Kullanma kutusunu aç", 11 | "keystrokes.menu.show_sneak_box": "Eğilme kutusunu aç", 12 | "keystrokes.menu.show_jump_box": "Zıplama kutusunu aç", 13 | "keystrokes.menu.open_color_config": "Renkleri ayarla", 14 | "keystrokes.menu.text_display_mode": "Text display mode", 15 | "keystrokes.menu.show_cps": "Saniye başı tıklamayı (CPS) göster", 16 | "keystrokes.menu.attach_cps": "Saniye başı tıkı (CPS) sabitle", 17 | "keystrokes.menu.color_config_panel": "Renkleri ayarla", 18 | "keystrokes.menu.save": "Kaydet", 19 | "keystrokes.menu.reset": "Ayarları sıfırla", 20 | "keystrokes.menu.confirm_reset": "Ayarları sıfırlamak istediğinden emin misin?", 21 | "keystrokes.menu.color_foreground_r": "Önplan (R/Kırmızı)", 22 | "keystrokes.menu.color_foreground_g": "Önplan (G/Yeşil)", 23 | "keystrokes.menu.color_foreground_b": "Önplan (B/Mavi)", 24 | "keystrokes.menu.color_foreground_a": "Önplan (A/Opaklık)", 25 | "keystrokes.menu.color_background_r": "Arkaplan (R/Kırmızı)", 26 | "keystrokes.menu.color_background_g": "Arkaplan (G/Yeşil)", 27 | "keystrokes.menu.color_background_b": "Arkaplan (B/Mavi)", 28 | "keystrokes.menu.color_background_a": "Arkaplan (A/Opaklık)", 29 | "keystrokes.menu.color.rainbow": "Gökkuşaklı Metin", 30 | "keystrokes.menu.color.rainbow_saturation": "Gökkuşağın Canlılığı", 31 | "keystrokes.menu.example_text": "Örnek Metin", 32 | "keystrokes.menu.layout": "Düzen", 33 | "keystrokes.menu.title.main": "AuroraKeystrokes Ayarları", 34 | "keystrokes.menu.title.colors": "AuroraKeystrokes Renk Ayarları", 35 | "keystrokes.tooltip.color_config_panel": "Belirli durumların renklerini ayarla.", 36 | "keystrokes.tooltip.padding": "Kutucukların dolgusu", 37 | "keystrokes.tooltip.rainbow": "Göstericilerdeki gökkuşağı görünümünü etkinleştir.", 38 | "keystrokes.tooltip.rainbow_saturation": "Gökkuşaklı metinin canlılığını değiştir.", 39 | "keystrokes.tooltip.text_display_mode": "Kutucukların isimlendirme düzenini değiştirir.", 40 | "keystrokes.tooltip.x": "HUD'un X pozisyonu.", 41 | "keystrokes.tooltip.y": "HUD'un Y pozisyonu.", 42 | "keystrokes.color_config_panel.normal": "basılmamış", 43 | "keystrokes.color_config_panel.pressed": "basılı", 44 | "keystrokes.text_display_mode.action_name": "eylem adı", 45 | "keystrokes.text_display_mode.key_name": "tuş adı", 46 | "keystrokes.error.cannot_reset": "Ayarlar sıfırlanamıyor!" 47 | } 48 | -------------------------------------------------------------------------------- /src/main/resources/assets/aurora_keystrokes/lang/zh_cn.json: -------------------------------------------------------------------------------- 1 | { 2 | "keystrokes.reloaded": "AuroraKeystrokes配置已重新载入!", 3 | "keystrokes.saved": "AuroraKeystrokes配置已保存!", 4 | "keystrokes.layout.cross": "十字型", 5 | "keystrokes.layout.pyramid": "金字塔型", 6 | "keystrokes.menu.show_hud": "显示HUD", 7 | "keystrokes.menu.padding": "文本框填充", 8 | "keystrokes.menu.show_movement_boxes": "显示“移动”文本框", 9 | "keystrokes.menu.show_attack_box": "显示“攻击/摧毁”文本框", 10 | "keystrokes.menu.show_use_box": "显示“使用物品/放置方块”文本框", 11 | "keystrokes.menu.show_sneak_box": "显示“潜行”文本框", 12 | "keystrokes.menu.show_jump_box": "显示“跳跃”文本框", 13 | "keystrokes.menu.open_color_config": "配置文本与文本框的颜色", 14 | "keystrokes.menu.text_display_mode": "文本显示模式", 15 | "keystrokes.menu.show_cps": "显示CPS(每秒“攻击/摧毁”按键点击次数)", 16 | "keystrokes.menu.attach_cps": "CPS的显示位置依附于主HUD", 17 | "keystrokes.menu.color_config_panel": "配置文本与文本框的颜色", 18 | "keystrokes.menu.save": "保存", 19 | "keystrokes.menu.reset": "重置设置", 20 | "keystrokes.menu.confirm_reset": "确定要重置设置吗?", 21 | "keystrokes.menu.color_foreground_r": "文本颜色(R)", 22 | "keystrokes.menu.color_foreground_g": "文本颜色(G)", 23 | "keystrokes.menu.color_foreground_b": "文本颜色(B)", 24 | "keystrokes.menu.color_foreground_a": "文本颜色(A)", 25 | "keystrokes.menu.color_background_r": "文本框颜色(R)", 26 | "keystrokes.menu.color_background_g": "文本框颜色(G)", 27 | "keystrokes.menu.color_background_b": "文本框颜色(B)", 28 | "keystrokes.menu.color_background_a": "文本框颜色(A)", 29 | "keystrokes.menu.color.rainbow": "彩虹文本", 30 | "keystrokes.menu.color.rainbow_saturation": "彩虹的色彩饱和度", 31 | "keystrokes.menu.example_text": "示例文本", 32 | "keystrokes.menu.layout": "“移动”文本框的布局", 33 | "keystrokes.menu.title.main": "AuroraKeystrokes设置", 34 | "keystrokes.menu.title.colors": "AuroraKeystrokes颜色设置", 35 | "keystrokes.tooltip.color_config_panel": "配置按键在处于指定的状态时所显示的颜色。", 36 | "keystrokes.tooltip.padding": "决定文本与文本框边界之间空白距离的大小。", 37 | "keystrokes.tooltip.rainbow": "启用彩虹文本渲染,操作提示文本将以彩虹波浪滚动特效显示。", 38 | "keystrokes.tooltip.rainbow_saturation": "更改彩虹文本的色彩饱和度,饱和度决定色彩的鲜艳程度。", 39 | "keystrokes.tooltip.text_display_mode": "更改文本框内显示的文本内容所遵循的命名规则。", 40 | "keystrokes.tooltip.x": "HUD的X轴位置(左右)", 41 | "keystrokes.tooltip.y": "HUD的Y轴位置(上下)", 42 | "keystrokes.color_config_panel.normal": "按键未触发时", 43 | "keystrokes.color_config_panel.pressed": "按键按下并触发时", 44 | "keystrokes.text_display_mode.action_name": "操作名称", 45 | "keystrokes.text_display_mode.key_name": "按键名称", 46 | "keystrokes.error.cannot_reset": "无法重置设置!" 47 | } -------------------------------------------------------------------------------- /src/main/resources/config.toml: -------------------------------------------------------------------------------- 1 | # AuroraKeystrokes configuration. 2 | 3 | [hud] 4 | # Enables the display of the hud. 5 | enable = true 6 | # X position of the hud. 7 | x = 2.0 8 | # Y position of the hud. 9 | y = 2.0 10 | # The padding of the key boxes. 11 | padding = 4 12 | # Show the movement boxes. 13 | show_movement_boxes = true 14 | # Show the attack box. 15 | show_attack_box = true 16 | # Show the use box. 17 | show_use_box = true 18 | # Show the sneak box. 19 | show_sneak_box = true 20 | # Show the jump box. 21 | show_jump_box = true 22 | # The text display mode, available values: ACTION_NAME and KEY_NAME. 23 | text_display_mode = "action_name" 24 | # The layout mode. 25 | layout = "cross" 26 | 27 | # CPS settings. 28 | [cps] 29 | # Show CPS counter. 30 | show = true 31 | # Attach the CPS counter to the box. 32 | attached = true 33 | 34 | # Colors 35 | [colors] 36 | normal = "#ffffffff" 37 | pressed = "#ffa000ff" 38 | background_normal = "#000000aa" 39 | background_pressed = "#555555aa" 40 | # Enable rainbow text. 41 | rainbow = false 42 | rainbow_saturation = 0.8 43 | -------------------------------------------------------------------------------- /src/main/resources/keystrokes.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "me.lambdaurora.keystrokes.mixin", 4 | "compatibilityLevel": "JAVA_17", 5 | "client": [ 6 | "MinecraftClientMixin" 7 | ], 8 | "injectors": { 9 | "defaultRequire": 1 10 | } 11 | } -------------------------------------------------------------------------------- /src/main/resources/quilt.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schema_version": 1, 3 | "quilt_loader": { 4 | "group": "me.lambdaurora", 5 | "id": "aurora_keystrokes", 6 | "version": "${version}", 7 | "metadata": { 8 | "name": "AuroraKeystrokes", 9 | "description": "Displays the movement keys and mouse clicks on screen.", 10 | "contributors": { 11 | "LambdAurora": "Owner", 12 | "NoComment1105": "Maintainer" 13 | }, 14 | "icon": "assets/aurora_keystrokes/icon.png", 15 | "license": "MIT", 16 | "contact": { 17 | "homepage": "https://www.curseforge.com/minecraft/mc-mods/aurorakeystrokes", 18 | "sources": "https://github.com/LambdAurora/AuroraKeystrokes.git", 19 | "issues": "https://github.com/LambdAurora/AuroraKeystrokes/issues" 20 | } 21 | }, 22 | "intermediate_mappings": "net.fabricmc:intermediary", 23 | "entrypoints": { 24 | "client": "me.lambdaurora.keystrokes.AuroraKeystrokes" 25 | }, 26 | "depends": [ 27 | { 28 | "id": "quilt_loader", 29 | "versions": ">=0.16.1-" 30 | }, 31 | { 32 | "id": "quilted_fabric_api", 33 | "versions": ">=2.0.0-" 34 | }, 35 | { 36 | "id": "minecraft", 37 | "versions": ">=1.19" 38 | }, 39 | { 40 | "id": "spruceui", 41 | "versions": ">=4.0.0" 42 | } 43 | ] 44 | }, 45 | "mixin": "keystrokes.mixins.json" 46 | } --------------------------------------------------------------------------------