Compare commits
11 Commits
architectu
...
1.18
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a70ab1961 | ||
|
|
1722c2ccaa | ||
|
|
46dafc3e71 | ||
|
|
99298b2bc4 | ||
|
|
070083ab6e | ||
|
|
4d74892e53 | ||
|
|
e8cfee7de5 | ||
|
|
06c589e7f8 | ||
|
|
a71dcb9765 | ||
|
|
281b266b18 | ||
|
|
8d4f8822d3 |
16
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: 'Bug: TITLE HERE'
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
@@ -21,17 +21,15 @@ Steps to reproduce the behavior:
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots or videos to help explain your problem.
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. Windows / Linux / MacOS]
|
||||
- Minecraft [e.g. 1.20.4]
|
||||
- Modloader [e.g. Fabric Loader 0.15.6]
|
||||
- Fabric/Quilt Libraries [e.g. Fabric Api 0.96.1+1.20.4]
|
||||
- Mods [e.g. Puzzle v1.6.1, LilTaterReloaded v1.1.15]
|
||||
- OS: [e.g. Linux]
|
||||
- Minecraft [e.g. 1.14.4]
|
||||
- Fabric [e.g. fabric 0.7.2+build.174]
|
||||
- Mods [e.g. aurora_keystrokes v1.0.0, modmenu v1.7.15]
|
||||
- Version [e.g. 1.0.0]
|
||||
- Remove this line if you actually completed it
|
||||
- Branch [e.g. dev]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
In case of a crash, please provide the crash log.
|
||||
|
||||
40
.github/ISSUE_TEMPLATE/controller_support.md
vendored
@@ -1,40 +0,0 @@
|
||||
---
|
||||
name: Controller support
|
||||
about: Report a problem related to a specific controller
|
||||
title: 'Controller Issues: CONTROLLER NAME HERE'
|
||||
labels: controller
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the current state**
|
||||
A clear and concise description of current state of support for the controller and the issues.
|
||||
|
||||
**To Reproduce**
|
||||
If needed, specify steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots or videos to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- Have you checked #263 for your controller? [e.g. Yes/No]
|
||||
- Connection method [e.g. Wired / Bluetooth]
|
||||
|
||||
- OS: [e.g. Windows / Linux / MacOS]
|
||||
- Minecraft [e.g. 1.20.4]
|
||||
- Modloader [e.g. Fabric Loader 0.15.6]
|
||||
- Fabric/Quilt Libraries [e.g. Fabric Api 0.96.1+1.20.4]
|
||||
- Mods [e.g. Puzzle v1.6.1, LilTaterReloaded v1.1.15]
|
||||
- Version [e.g. 1.0.0]
|
||||
- Remove this line if you actually completed it
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
In case of a crash, please provide the crash log.
|
||||
4
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: 'Feature: TITLE HERE'
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
@@ -17,4 +17,4 @@ A clear and concise description of what you want to happen.
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots/videos about the feature request here.
|
||||
Add any other context or screenshots about the feature request here.
|
||||
|
||||
20
.github/ISSUE_TEMPLATE/mod_support.md
vendored
@@ -1,20 +0,0 @@
|
||||
---
|
||||
name: Mod Support
|
||||
about: Compatibility improvements with a specific mod (not for crashes)
|
||||
title: 'Mod Support: MOD NAME HERE'
|
||||
labels: mod compatibility
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your compatibility request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I've always wanted to [...]
|
||||
|
||||
**Describe the way of compatibility you'd imagine**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative mods or workarounds you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots/videos about the compatibility request here.
|
||||
25
.github/workflows/build.yml
vendored
@@ -1,25 +0,0 @@
|
||||
name: Build with Gradle
|
||||
|
||||
on: [ push, pull_request ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Validate Gradle Wrapper
|
||||
uses: gradle/actions/wrapper-validation@v3
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 21
|
||||
check-latest: true
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build
|
||||
- name: Upload artifacts to GitHub
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: MidnightControls-Artifacts
|
||||
path: /build/libs/
|
||||
23
.github/workflows/gradlebuild.yml
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
name: Gradle Build
|
||||
|
||||
on: [ push, pull_request ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 16
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 16
|
||||
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
||||
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Artifacts
|
||||
path: ./build/libs/
|
||||
40
.github/workflows/publish.yml → .github/workflows/gradlepublish.yml
vendored
Normal file → Executable file
@@ -1,24 +1,30 @@
|
||||
name: Publish to Modrinth
|
||||
name: Gradle Package
|
||||
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-24.04
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Validate Gradle Wrapper
|
||||
uses: gradle/actions/wrapper-validation@v3
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 16
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 21
|
||||
check-latest: true
|
||||
java-version: 16
|
||||
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
||||
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Artifacts
|
||||
path: ./build/libs/
|
||||
|
||||
# The USERNAME and PASSWORD need to correspond to the credentials environment variables used in
|
||||
# the publishing section of your build.gradle
|
||||
- name: Publish to GitHub Packages and other Mavens
|
||||
@@ -32,7 +38,3 @@ jobs:
|
||||
midnightcontrols_MAVEN: ${{ secrets.MAVEN_URL }}
|
||||
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
|
||||
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
|
||||
- name: Publish to Modrinth
|
||||
env:
|
||||
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
|
||||
run: ./gradlew publishModrinth
|
||||
23
.github/workflows/modrinth_update.yml
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
name: Gradle Build
|
||||
|
||||
on:
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 16
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 16
|
||||
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
||||
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
||||
|
||||
- name: Build with Gradle
|
||||
env:
|
||||
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
|
||||
run: ./gradlew publishModrinth
|
||||
@@ -8,7 +8,7 @@
|
||||
[](https://github.com/TeamMidnightDust/MidnightControls/releases)
|
||||

|
||||
[![Mod loader: Quilt/Fabric]][Quilt]
|
||||
[](https://www.oracle.com/java/technologies/downloads/#java21)
|
||||
[](https://www.oracle.com/java/technologies/downloads/#java17)
|
||||
[](LICENSE)
|
||||
|
||||
A Fabric Minecraft mod which adds better controls, reach-around and controller support.
|
||||
@@ -62,10 +62,6 @@ Enter the folder created and run:
|
||||
```
|
||||
After this is done, everything should be built just fine!
|
||||
|
||||
## FAQ:
|
||||
### The controller does not work, and it's name appears in orange, what can I do?
|
||||
Create a custom mapping as pointed out in the [wiki](https://midnightdust.eu/wiki/midnightcontrols/)
|
||||
|
||||
[Quilt]: https://quiltmc.org
|
||||
|
||||
[Mod loader: Quilt/Fabric]: https://img.shields.io/badge/modloader-Quilt%2FFabric-blueviolet?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAADGAAAAxgGwdJvFAAAFU0lEQVR4nO1bwW7bOBCdCHtP+wUNxIvhS7yA7kkPOjf9AKPam4/OF2zzB96bblXhH0jPPkS5G1jnIvgib/IFtX/ALoYZemmKtEWRRe3aDzAsURbJGQ6HM4/02Wq1gmNGcNTSnxQA8IdakDK4AOCfJpj3SpiI98r2rAMAbxrWNWFFOMeL1nCJdXQa1gPTbpCbnm34ABIeBThv2hgAfOyVcF+2ZwkAfHGo54kVIRe6NVxiny4d6vpn2g36ugfqFLhwFB6kkUoc67k0XLv0qYKj9wEnBXiqZwEAf/ZKOOuV8BkLWBFesyI8A4C/LOt6AoC39C7HtBvg9Vt65hUnC/BUDzrOf1MGq5S9WkDZnuVle7ZqsBKgw/tO73K0hku8/u64EmhxsoA96MMvxdEroBIKO+CWoshnqqJPYTAGRJ8sql3QO3Op7D19D3z7AV8KeAGArFf+32lWhDwnKNuzuaUCclaE93KBiOU9hMQV+FLAOxz9lPHRR0VkZXs2oBDUNon5ULZnKOgcYwl4FTwna/K+CtRRwIK+dTnCCwkP9I0fkXmh4FcN+6UKqqtHblvtb+18po4TvKaPilsS8qVuYx5havsbJXS1I0ZVAXP1B5jfyzm+hAnN+We1XPluioX03kJtY9oNtG1T+b1aburDxhRAQVMGHw3z9k65F41nktmjUnjjrAj7ZXv27ECIyEKgBd7saBuka7lsPu0GA1MjR0+KVpwgMTlrMkN4YoztlZ/2camTvD0QjcWZF6KxMgcLyKbdAN+HKOb1y6PYH49gEsUwUKw1G48gi2KQZcApkYxH1eldUQBxeKbkRfXEQjDZ21+h2bMiHJDwH2wk1rSX0XWueHZd2yCZ/oVSnilTaA3VAiqjRRahQ0JBjuov3ijfPqAua0kUg67tmyjWCmvsS504wGQRnywjPJ8wtY3xw3827fjMBXziUalL3DcNrIzYRwXcTbvBZ7lgPHoNxKKYky1/+2xsHxXQbw2X/EIoggQHyjC9Yh8VcC6NshDc66jLOHpC5KSAPejDL8U+KuArboTQZgjHeARn+MFnvhvbRyfYaQ2XfNkTVFgUr/mIxlvkJuyjAjCae6BrYQUPW37vhDpT4MnAsCyIgbHBnYbcADJt7/t+deBCiSWsCG8sOv5IgU2FnJh2g+RnBDl1oCpgogqEx1TEURUFokx+tpCYnEzzjg1kh+fq/Ix9OXpG6OjjgI1VIGWcOMhlXh4PPdAz1VTe90rIU8Z/L9JUnALXSK4SjSUzOY+Y1ekyOlzjaamTvf3X8cjunBH1v6OeVtsG1QI66qYEVkoVmyA/O5fYmIHjgSsrskUavAc6q1BLeXXiANMZu0HKwGav7opGv+LticZqHOToLBeZrJRxC97qjOsowCTgZYO9OlNa25haMwgvsFMJPp3gLW1ji8b6dO89fhfYIbzAl23T4adtjyNvD6/mbbs9Xgs1hRcwWoIvCxDb47nQNm5aRDHvoPGcblNYCi+gtQSfU+AdLYfioLXYtHA9eruBhsILVJRwUIGQo/ACG0o4GAV4El5grQSffMA3SqbEnBdb1zeunfYsvAB3jL4UwE92KauA2NnNbLerNKhEqJ6Q+FIAOjpcATAVzjFHoC3qC9OurCW0W9s+6vXpAy4p0hPkSUL3ziNHiY3tqfNdQN4jORgnSEGMLyU8Udbq1QIEdEyRF3hSwlp4vKkwQimrHDuxAR6S4tleFIPzERnhSFXQEtbkD1kbwiMOlhJroISK8IiDpcQsp4NWeMRBc4I1lWAUHnHwpOgOJWwVHvFbsMIGJewUHvFb7QuQYxR/ttgIzbUAgB9KOM3uc+PN7QAAAABJRU5ErkJggg==
|
||||
|
||||
293
build.gradle
@@ -1,88 +1,261 @@
|
||||
plugins {
|
||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
||||
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
|
||||
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
|
||||
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
||||
id 'fabric-loom' version '0.11-SNAPSHOT'
|
||||
id 'java-library'
|
||||
id 'maven-publish'
|
||||
id 'com.github.johnrengelman.shadow' version '7.0.0'
|
||||
id 'com.modrinth.minotaur' version '1.2.+'
|
||||
}
|
||||
|
||||
architectury {
|
||||
minecraft = rootProject.minecraft_version
|
||||
import com.google.gson.GsonBuilder
|
||||
import com.google.gson.JsonObject
|
||||
import com.modrinth.minotaur.TaskModrinthUpload
|
||||
import com.modrinth.minotaur.request.VersionType
|
||||
import com.modrinth.minotaur.responses.ResponseError
|
||||
import org.apache.http.client.config.CookieSpecs
|
||||
import org.apache.http.client.config.RequestConfig
|
||||
import org.apache.http.client.entity.EntityBuilder
|
||||
import org.apache.http.client.methods.HttpPatch
|
||||
import org.apache.http.entity.ContentType
|
||||
import org.apache.http.impl.client.HttpClientBuilder
|
||||
import org.apache.http.util.EntityUtils
|
||||
|
||||
group = project.maven_group
|
||||
version = "${project.mod_version}+${getMCVersionString()}"
|
||||
archivesBaseName = project.archives_base_name
|
||||
|
||||
// This field defines the Java version your mod target.
|
||||
def targetJavaVersion = 17
|
||||
|
||||
boolean isMCVersionNonRelease() {
|
||||
return project.minecraft_version.matches('^\\d\\dw\\d\\d[a-z]$')
|
||||
|| project.minecraft_version.matches('\\d+\\.\\d+-(pre|rc)(\\d+)')
|
||||
}
|
||||
|
||||
String getMCVersionString() {
|
||||
if (isMCVersionNonRelease()) {
|
||||
return project.minecraft_version
|
||||
}
|
||||
def version = project.minecraft_version.split('\\.')
|
||||
return version[0] + '.' + version[1]
|
||||
}
|
||||
|
||||
boolean pingUrl(String address) {
|
||||
try {
|
||||
def conn = (HttpURLConnection) new URL(address).openConnection()
|
||||
int responseCode = conn.getResponseCode()
|
||||
return (200 <= responseCode && responseCode <= 399)
|
||||
} catch (IOException ignored) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
String parseReadme() {
|
||||
def excludeRegex = /(?m)<!-- modrinth_exclude\.start -->(.|\n)*?<!-- modrinth_exclude\.end -->/
|
||||
def linkRegex = /!\[([A-z_ ]+)]\((images\/[A-z.\/_]+)\)/
|
||||
|
||||
def readme = (String) file('README.md').text
|
||||
readme = readme.replaceAll(excludeRegex, '')
|
||||
return readme
|
||||
}
|
||||
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
maven { url 'https://aperlambda.github.io/maven' }
|
||||
maven {
|
||||
url = "https://api.modrinth.com/maven"
|
||||
name 'Gegy'
|
||||
url 'https://maven.gegy.dev'
|
||||
}
|
||||
flatDir {
|
||||
dirs("localMaven")
|
||||
maven {
|
||||
name = "CottonMC"
|
||||
url = "https://server.bbkr.space/artifactory/libs-release"
|
||||
}
|
||||
maven { url "https://maven.terraformersmc.com/releases/" }
|
||||
maven { url 'https://maven.kosmx.dev' }
|
||||
maven { url 'https://maven.shedaniel.me/' }
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven { url "https://api.modrinth.com/maven" }
|
||||
maven { url 'https://maven.quiltmc.org/repository/release'}
|
||||
}
|
||||
|
||||
configurations {
|
||||
shadow
|
||||
api.extendsFrom shadow
|
||||
}
|
||||
|
||||
dependencies {
|
||||
//to change the versions see the gradle.properties file
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
|
||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
|
||||
modImplementation "dev.lambdaurora:spruceui:${project.spruceui_version}"
|
||||
include "dev.lambdaurora:spruceui:${project.spruceui_version}"
|
||||
api('org.aperlambda:lambdajcommon:1.8.1') {
|
||||
exclude group: 'com.google.code.gson'
|
||||
exclude group: 'com.google.guava'
|
||||
}
|
||||
include 'org.aperlambda:lambdajcommon:1.8.1'
|
||||
|
||||
modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}"
|
||||
|
||||
// Compatibility mods
|
||||
|
||||
// Ok Zoomer and LibZoomer are temporarily disabled for the time being, as we are currently using Reflection at runtime instead in OkZoomerCompat due to there being two major, completely incompatible API versions.
|
||||
// modImplementation("maven.modrinth:ok-zoomer:${project.ok_zoomer_version}")
|
||||
// modImplementation "io.github.ennuil:LibZoomer:${project.libzoomer_version}"
|
||||
|
||||
modImplementation "io.github.cottonmc:LibGui:${project.libgui_version}"
|
||||
modImplementation "org.quiltmc:quilt-json5:1.0.0"
|
||||
modCompileOnly "maven.modrinth:sodium:${project.sodium_version}"
|
||||
modImplementation("maven.modrinth:emi:${project.emi_version}")
|
||||
modImplementation "maven.modrinth:emotecraft:${project.emotecraft_version}"
|
||||
modImplementation "io.github.kosmx:bendy-lib:${project.bendylib_version}"
|
||||
|
||||
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
|
||||
include "maven.modrinth:midnightlib:${project.midnightlib_version}"
|
||||
|
||||
shadow 'com.electronwill.night-config:core:3.6.3'
|
||||
shadow 'com.electronwill.night-config:toml:3.6.3'
|
||||
apply plugin: 'java-library'
|
||||
}
|
||||
loom {
|
||||
accessWidenerPath = file("src/main/resources/midnightcontrols.accesswidener")
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.toVersion(targetJavaVersion)
|
||||
targetCompatibility = JavaVersion.toVersion(targetJavaVersion)
|
||||
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
it.options.encoding = 'UTF-8'
|
||||
|
||||
it.options.release.set(targetJavaVersion)
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property 'version', project.version
|
||||
|
||||
filesMatching('fabric.mod.json') {
|
||||
expand 'version': project.version
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply plugin: "dev.architectury.loom"
|
||||
repositories {
|
||||
maven {
|
||||
url = "https://api.modrinth.com/maven"
|
||||
}
|
||||
maven { url 'https://jitpack.io' }
|
||||
flatDir {
|
||||
dirs("../localMaven")
|
||||
task publishModrinth(type: TaskModrinthUpload) {
|
||||
dependsOn(build)
|
||||
onlyIf {
|
||||
System.getenv('MODRINTH_TOKEN')
|
||||
}
|
||||
|
||||
token = System.getenv('MODRINTH_TOKEN')
|
||||
projectId = project.modrinth_id
|
||||
versionNumber = version
|
||||
versionName = "midnightcontrols ${project.mod_version} (${getMCVersionString()})"
|
||||
addGameVersion((String) project.minecraft_version)
|
||||
addLoader('fabric')
|
||||
versionType = isMCVersionNonRelease() ? VersionType.BETA : VersionType.RELEASE
|
||||
|
||||
// Changelog fetching
|
||||
def changelogText = file('CHANGELOG.md').text
|
||||
def regexVersion = ((String) project.mod_version).replaceAll('\\.', /\\./).replaceAll('\\+', '\\+')
|
||||
def changelogRegex = ~"###? ${regexVersion}\\n\\n(( *- .+\\n)+)"
|
||||
def matcher = changelogText =~ changelogRegex
|
||||
|
||||
if (matcher.find()) {
|
||||
changelog = matcher.group(1)
|
||||
|
||||
def changelogLines = changelogText.split('\n')
|
||||
def linkRefRegex = ~'^\\[([A-z0-9 _\\-/+.]+)]: '
|
||||
for (int i = changelogLines.length - 1; i > 0; i--) {
|
||||
def line = changelogLines[i]
|
||||
if ((line =~ linkRefRegex).find())
|
||||
changelog += '\n' + line
|
||||
else break
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
|
||||
// The following line declares the mojmap mappings, you may use other mappings as well
|
||||
//mappings loom.officialMojangMappings()
|
||||
// The following line declares the yarn mappings you may select this one as well.
|
||||
mappings loom.layered {
|
||||
it.mappings("net.fabricmc:yarn:$rootProject.yarn_mappings:v2")
|
||||
it.mappings("dev.architectury:yarn-mappings-patch-neoforge:$rootProject.yarn_mappings_patch_neoforge_version")
|
||||
// Readme
|
||||
doFirst {
|
||||
final def client = HttpClientBuilder.create().setDefaultRequestConfig(RequestConfig.custom().setCookieSpec(CookieSpecs.IGNORE_COOKIES).build()).build()
|
||||
final def patch = new HttpPatch((String) (apiURL + '/v1/mod/' + projectId))
|
||||
patch.addHeader("Authorization", token)
|
||||
|
||||
var json = new JsonObject()
|
||||
json.addProperty("body", parseReadme())
|
||||
patch.setEntity(EntityBuilder.create()
|
||||
.setText(json.toString())
|
||||
.setContentType(ContentType.APPLICATION_JSON)
|
||||
.build())
|
||||
|
||||
final def response = client.execute(patch)
|
||||
final int status = response.getStatusLine().getStatusCode()
|
||||
|
||||
final def gson = new GsonBuilder().create()
|
||||
if (status == 200) {
|
||||
project.getLogger().lifecycle("Successfully updated readme to ${projectId}.")
|
||||
} else {
|
||||
errorInfo = gson.fromJson(EntityUtils.toString(response.getEntity()), ResponseError.class)
|
||||
project.getLogger().error("Upload failed! Status: ${status} Error: ${errorInfo.getError()} Reason: ${errorInfo.getDescription()}")
|
||||
throw new GradleException("Upload failed! Status: ${status} Reason: ${errorInfo.getDescription()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// configure the maven publication
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
artifact(sourcesJar) {
|
||||
builtBy remapSourcesJar
|
||||
}
|
||||
|
||||
allprojects {
|
||||
apply plugin: "java"
|
||||
apply plugin: "architectury-plugin"
|
||||
apply plugin: "maven-publish"
|
||||
pom {
|
||||
name = 'midnightcontrols'
|
||||
description = 'Adds better controls, and controller support.'
|
||||
}
|
||||
|
||||
archivesBaseName = rootProject.archives_base_name
|
||||
version = rootProject.mod_version
|
||||
group = rootProject.maven_group
|
||||
pom.withXml {
|
||||
def dependenciesNode = asNode().appendNode('dependencies')
|
||||
|
||||
repositories {
|
||||
maven { url 'https://aperlambda.github.io/maven' }
|
||||
}
|
||||
dependencies {
|
||||
implementation('org.aperlambda:lambdajcommon:1.8.1') {
|
||||
exclude group: 'com.google.code.gson'
|
||||
exclude group: 'com.google.guava'
|
||||
}
|
||||
}
|
||||
configurations.shadow.allDependencies.each {
|
||||
def dependencyNode = dependenciesNode.appendNode('dependency')
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
options.release = 21
|
||||
}
|
||||
ext {
|
||||
releaseChangelog = {
|
||||
def changes = new StringBuilder()
|
||||
changes << "## MidnightControls v$project.version for $project.minecraft_version\n[View the changelog](https://www.github.com/TeamMidnightDust/MidnightControls/commits/)"
|
||||
def proc = "git log --max-count=1 --pretty=format:%s".execute()
|
||||
proc.in.eachLine { line ->
|
||||
def processedLine = line.toString()
|
||||
if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) {
|
||||
changes << "\n- ${processedLine.capitalize()}"
|
||||
dependencyNode.appendNode('groupId', it.group)
|
||||
dependencyNode.appendNode('artifactId', it.name)
|
||||
dependencyNode.appendNode('version', it.version)
|
||||
dependencyNode.appendNode('scope', 'compile')
|
||||
}
|
||||
}
|
||||
proc.waitFor()
|
||||
return changes.toString()
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven {
|
||||
name 'GithubPackages'
|
||||
url uri('https://maven.pkg.github.com/LambdAurora/midnightcontrols')
|
||||
credentials {
|
||||
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
|
||||
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
|
||||
}
|
||||
}
|
||||
def midnightcontrolsMaven = System.getenv('midnightcontrols_MAVEN')
|
||||
if (midnightcontrolsMaven) {
|
||||
maven {
|
||||
name 'midnightcontrolsMaven'
|
||||
url uri(midnightcontrolsMaven)
|
||||
credentials {
|
||||
username = project.findProperty('gpr.user') ?: System.getenv('MAVEN_USERNAME')
|
||||
password = project.findProperty('gpr.key') ?: System.getenv('MAVEN_PASSWORD')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
architectury {
|
||||
common(rootProject.enabled_platforms.split(","))
|
||||
}
|
||||
loom {
|
||||
accessWidenerPath = file("src/main/resources/midnightcontrols.accesswidener")
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
name 'Gegy'
|
||||
url 'https://maven.gegy.dev'
|
||||
}
|
||||
maven {
|
||||
name = "CottonMC"
|
||||
url = "https://server.bbkr.space/artifactory/libs-release"
|
||||
}
|
||||
maven { url "https://maven.terraformersmc.com/releases/" }
|
||||
maven { url 'https://maven.kosmx.dev' }
|
||||
maven { url 'https://maven.isxander.dev/releases' }
|
||||
maven { url 'https://maven.shedaniel.me/' }
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven { url "https://api.modrinth.com/maven" }
|
||||
maven { url 'https://maven.quiltmc.org/repository/release'}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
|
||||
// Do NOT use other classes from fabric loader
|
||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||
// Using the Fabric version of midnightlib here to create a common config and get useful utilities
|
||||
// Just make sure NOT to use classes from the .fabric classpath
|
||||
modCompileOnlyApi "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric"
|
||||
modCompileOnlyApi "maven.modrinth:obsidianui:${rootProject.obsidianui_version}-fabric"
|
||||
modCompileOnlyApi ("com.terraformersmc:modmenu:${project.modmenu_version}") {
|
||||
exclude(group: "net.fabricmc.fabric-api")
|
||||
}
|
||||
|
||||
// Compatibility mods
|
||||
modCompileOnlyApi "io.github.cottonmc:LibGui:${project.libgui_version}"
|
||||
modCompileOnlyApi "org.quiltmc:quilt-json5:1.0.0"
|
||||
modImplementation "maven.modrinth:sodium:${project.sodium_version}-fabric"
|
||||
modCompileOnlyApi "maven.modrinth:emi:${project.emi_version}"
|
||||
modCompileOnlyApi "maven.modrinth:emotecraft:${project.emotecraft_version}"
|
||||
modCompileOnlyApi "io.github.kosmx:bendy-lib:${project.bendylib_version}"
|
||||
modCompileOnlyApi "dev.isxander:yet-another-config-lib:${project.yacl_version}"
|
||||
modCompileOnlyApi "maven.modrinth:inventory-tabs-updated:${project.inventorytabs_version}"
|
||||
modCompileOnlyApi "maven.modrinth:bedrockify:${project.bedrockify_version}"
|
||||
// Required for Inventory Tabs
|
||||
modCompileOnlyApi("me.shedaniel.cloth:cloth-config-fabric:${project.clothconfig_version}") {
|
||||
exclude(group: "net.fabricmc.fabric-api")
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenCommon(MavenPublication) {
|
||||
artifactId = rootProject.archives_base_name
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
|
||||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
||||
repositories {
|
||||
// Add repositories to publish to here.
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
||||
*
|
||||
* This file is part of midnightcontrols.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package eu.midnightdust.midnightcontrols;
|
||||
|
||||
import eu.midnightdust.lib.util.PlatformFunctions;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Represents the MidnightControls mod.
|
||||
*
|
||||
* @author LambdAurora & Motschen
|
||||
* @version 1.8.0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public class MidnightControls {
|
||||
public static boolean isExtrasLoaded;
|
||||
|
||||
public static final Logger logger = LogManager.getLogger("MidnightControls");
|
||||
|
||||
public static void init() {
|
||||
isExtrasLoaded = PlatformFunctions.isModLoaded("midnightcontrols-extra");
|
||||
log("Initializing MidnightControls...");
|
||||
}
|
||||
public static Identifier id(String path) {
|
||||
return Identifier.of(MidnightControlsConstants.NAMESPACE, path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a message to the terminal.
|
||||
*
|
||||
* @param info the message to print
|
||||
*/
|
||||
public static void log(String info) {
|
||||
logger.info("[MidnightControls] {}", info);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a warning to the terminal.
|
||||
*
|
||||
* @param warning the warning to print
|
||||
*/
|
||||
public static void warn(String warning) {
|
||||
logger.warn("[MidnightControls] {}", warning);
|
||||
}
|
||||
}
|
||||
@@ -1,263 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
||||
*
|
||||
* This file is part of midnightcontrols.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package eu.midnightdust.midnightcontrols.client;
|
||||
|
||||
import eu.midnightdust.lib.util.PlatformFunctions;
|
||||
import eu.midnightdust.midnightcontrols.ControlsMode;
|
||||
import eu.midnightdust.midnightcontrols.MidnightControls;
|
||||
import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
|
||||
import eu.midnightdust.midnightcontrols.MidnightControlsFeature;
|
||||
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonCategory;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.Controller;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.InputManager;
|
||||
import eu.midnightdust.midnightcontrols.client.gui.MidnightControlsHud;
|
||||
import eu.midnightdust.midnightcontrols.client.gui.RingScreen;
|
||||
import eu.midnightdust.midnightcontrols.client.touch.gui.TouchscreenOverlay;
|
||||
import eu.midnightdust.midnightcontrols.client.mixin.KeyBindingIDAccessor;
|
||||
import eu.midnightdust.midnightcontrols.client.ring.ButtonBindingRingAction;
|
||||
import eu.midnightdust.midnightcontrols.client.ring.MidnightRing;
|
||||
import eu.midnightdust.midnightcontrols.client.util.platform.NetworkUtil;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import org.thinkingstudio.obsidianui.hud.HudManager;
|
||||
import eu.midnightdust.midnightcontrols.client.touch.TouchInput;
|
||||
import eu.midnightdust.midnightcontrols.client.util.RainbowColor;
|
||||
import eu.midnightdust.midnightcontrols.packet.ControlsModePayload;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import net.minecraft.client.toast.SystemToast;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/**
|
||||
* Represents the midnightcontrols client mod.
|
||||
*
|
||||
* @author Motschen, LambdAurora
|
||||
* @version 1.10.0
|
||||
* @since 1.1.0
|
||||
*/
|
||||
public class MidnightControlsClient extends MidnightControls {
|
||||
public static boolean lateInitDone = false;
|
||||
public static final KeyBinding BINDING_LOOK_UP = InputManager.makeKeyBinding(id("look_up"),
|
||||
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_8, "key.categories.midnightcontrols");
|
||||
public static final KeyBinding BINDING_LOOK_RIGHT = InputManager.makeKeyBinding(id("look_right"),
|
||||
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_6, "key.categories.midnightcontrols");
|
||||
public static final KeyBinding BINDING_LOOK_DOWN = InputManager.makeKeyBinding(id("look_down"),
|
||||
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_2, "key.categories.midnightcontrols");
|
||||
public static final KeyBinding BINDING_LOOK_LEFT = InputManager.makeKeyBinding(id("look_left"),
|
||||
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_4, "key.categories.midnightcontrols");
|
||||
public static final KeyBinding BINDING_RING = InputManager.makeKeyBinding(id("ring"),
|
||||
InputUtil.Type.KEYSYM, InputUtil.UNKNOWN_KEY.getCode(), "key.categories.midnightcontrols");
|
||||
public static final Identifier CONTROLLER_BUTTONS = id("textures/gui/controller_buttons.png");
|
||||
public static final Identifier CONTROLLER_EXPANDED = id("textures/gui/controller_expanded.png");
|
||||
public static final Identifier CONTROLLER_AXIS = id("textures/gui/controller_axis.png");
|
||||
public static final Identifier WAYLAND_CURSOR_TEXTURE_LIGHT = id("cursor/light/mouse_pointer");
|
||||
public static final Identifier WAYLAND_CURSOR_TEXTURE_DARK = id("cursor/dark/mouse_pointer");
|
||||
public static final File MAPPINGS_FILE = new File("config/gamecontrollercustommappings.txt");
|
||||
public static final MinecraftClient client = MinecraftClient.getInstance();
|
||||
public static final MidnightInput input = new MidnightInput();
|
||||
public static final MidnightRing ring = new MidnightRing();
|
||||
public static final MidnightReacharound reacharound = new MidnightReacharound();
|
||||
public static boolean isWayland;
|
||||
private static MidnightControlsHud hud;
|
||||
private static ControlsMode previousControlsMode;
|
||||
|
||||
public static void initClient() {
|
||||
ring.registerAction("buttonbinding", ButtonBindingRingAction.FACTORY);
|
||||
|
||||
int delay = 0; // delay for 0 sec.
|
||||
int period = 1; // repeat every 0.001 sec. (1000 times a second)
|
||||
Timer timer = new Timer();
|
||||
timer.scheduleAtFixedRate(new TimerTask() {
|
||||
public void run() { // TODO: Add a try/catch here after the alpha testing period
|
||||
if (lateInitDone && client.isRunning()) {
|
||||
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && (client.isWindowFocused() || MidnightControlsConfig.unfocusedInput)) {
|
||||
input.tickCameraStick();
|
||||
input.updateCamera();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, delay, period);
|
||||
|
||||
HudManager.register(hud = new MidnightControlsHud());
|
||||
isWayland = GLFW.glfwGetVersionString().contains("Wayland");
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called when Minecraft is initializing.
|
||||
*/
|
||||
public static void onMcInit(@NotNull MinecraftClient client) {
|
||||
ButtonBinding.init(client.options);
|
||||
MidnightControlsConfig.load();
|
||||
if (MidnightControlsConfig.configVersion < 2) {
|
||||
MidnightControlsConfig.mouseScreens.remove("me.jellysquid.mods.sodium.client.gui");
|
||||
MidnightControlsConfig.mouseScreens.remove("net.coderbot.iris.gui");
|
||||
MidnightControlsConfig.mouseScreens.remove("net.minecraft.class_5375");
|
||||
MidnightControlsConfig.mouseScreens.remove("net.minecraft.client.gui.screen.pack.PackScreen");
|
||||
MidnightControlsConfig.configVersion = 2;
|
||||
MidnightControlsConfig.write(MidnightControlsConstants.NAMESPACE);
|
||||
}
|
||||
hud.setVisible(MidnightControlsConfig.hudEnable);
|
||||
Controller.updateMappings();
|
||||
try {
|
||||
GLFW.glfwSetJoystickCallback((jid, event) -> {
|
||||
if (event == GLFW.GLFW_CONNECTED) {
|
||||
var controller = Controller.byId(jid);
|
||||
client.getToastManager().add(new SystemToast(SystemToast.Type.PERIODIC_NOTIFICATION, Text.translatable("midnightcontrols.controller.connected", jid),
|
||||
Text.literal(controller.getName())));
|
||||
} else if (event == GLFW.GLFW_DISCONNECTED) {
|
||||
client.getToastManager().add(new SystemToast(SystemToast.Type.PERIODIC_NOTIFICATION, Text.translatable("midnightcontrols.controller.disconnected", jid),
|
||||
null));
|
||||
}
|
||||
|
||||
switchControlsMode();
|
||||
});
|
||||
} catch (Exception e) {e.fillInStackTrace();}
|
||||
|
||||
MidnightControlsCompat.init();
|
||||
}
|
||||
/**
|
||||
* This method is called to initialize keybindings
|
||||
*/
|
||||
public static void initKeybindings() {
|
||||
if (lateInitDone) return;
|
||||
if (KeyBindingIDAccessor.getKEYS_BY_ID() == null || KeyBindingIDAccessor.getKEYS_BY_ID().isEmpty()) return;
|
||||
if (PlatformFunctions.isModLoaded("voxelmap") && !KeyBindingIDAccessor.getKEYS_BY_ID().containsKey("key.minimap.toggleingamewaypoints")) return;
|
||||
if (PlatformFunctions.isModLoaded("wynntils") && KeyBindingIDAccessor.getKEYS_BY_ID().entrySet().stream().noneMatch(b -> Objects.equals(b.getValue().getCategory(), "Wynntils"))) return;
|
||||
for (int i = 0; i < KeyBindingIDAccessor.getKEYS_BY_ID().size(); ++i) {
|
||||
KeyBinding keyBinding = KeyBindingIDAccessor.getKEYS_BY_ID().entrySet().stream().toList().get(i).getValue();
|
||||
if (MidnightControlsConfig.excludedKeybindings.stream().noneMatch(excluded -> keyBinding.getTranslationKey().startsWith(excluded))) {
|
||||
if (!keyBinding.getTranslationKey().contains(MidnightControlsConstants.NAMESPACE)) {
|
||||
AtomicReference<ButtonCategory> category = new AtomicReference<>();
|
||||
InputManager.streamCategories().forEach(buttonCategory -> {
|
||||
if (buttonCategory.getIdentifier().equals(validVanillaId(keyBinding.getCategory())))
|
||||
category.set(buttonCategory);
|
||||
});
|
||||
if (category.get() == null) {
|
||||
category.set(new ButtonCategory(validVanillaId(keyBinding.getCategory())));
|
||||
InputManager.registerCategory(category.get());
|
||||
}
|
||||
ButtonBinding buttonBinding = new ButtonBinding.Builder(keyBinding.getTranslationKey()).category(category.get()).linkKeybind(keyBinding).register();
|
||||
if (MidnightControlsConfig.debug) {
|
||||
MidnightControls.log(keyBinding.getTranslationKey());
|
||||
MidnightControls.log(String.valueOf(buttonBinding));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
InputManager.loadButtonBindings();
|
||||
lateInitDone = true;
|
||||
}
|
||||
private static Identifier validVanillaId(String path) {
|
||||
for(int i = 0; i < path.length(); ++i) {
|
||||
if (!Identifier.isPathCharacterValid(path.charAt(i))) {
|
||||
path = path.replace(path.charAt(i), '_');
|
||||
}
|
||||
}
|
||||
return Identifier.ofVanilla(path);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called every Minecraft tick.
|
||||
*
|
||||
* @param client the client instance
|
||||
*/
|
||||
public static void onTick(@NotNull MinecraftClient client) {
|
||||
initKeybindings();
|
||||
input.tick();
|
||||
reacharound.tick();
|
||||
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && (client.isWindowFocused() || MidnightControlsConfig.unfocusedInput))
|
||||
input.tickController();
|
||||
|
||||
if (BINDING_RING.wasPressed()) {
|
||||
ring.loadFromUnbound();
|
||||
client.setScreen(new RingScreen());
|
||||
}
|
||||
if (client.world != null && MidnightControlsConfig.enableHints && !MidnightControlsConfig.autoSwitchMode && MidnightControlsConfig.controlsMode == ControlsMode.DEFAULT && MidnightControlsConfig.getController().isGamepad()) {
|
||||
client.getToastManager().add(SystemToast.create(client, SystemToast.Type.PERIODIC_NOTIFICATION, Text.translatable("midnightcontrols.controller.tutorial.title"),
|
||||
Text.translatable("midnightcontrols.controller.tutorial.description", Text.translatable("options.title"), Text.translatable("controls.title"),
|
||||
Text.translatable("midnightcontrols.menu.title.controller"))));
|
||||
MidnightControlsConfig.enableHints = false;
|
||||
MidnightControlsConfig.save();
|
||||
}
|
||||
RainbowColor.tick();
|
||||
TouchInput.tick();
|
||||
}
|
||||
/**
|
||||
* Called when opening a screen.
|
||||
*/
|
||||
public static void onScreenOpen(Screen screen) {
|
||||
if (screen == null && MidnightControlsConfig.controlsMode == ControlsMode.TOUCHSCREEN) {
|
||||
screen = new TouchscreenOverlay();
|
||||
screen.init(client, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight());
|
||||
client.skipGameRender = false;
|
||||
client.currentScreen = screen;
|
||||
} else if (screen != null) {
|
||||
MidnightControlsClient.input.onScreenOpen(client.getWindow().getWidth(), client.getWindow().getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when leaving a server.
|
||||
*/
|
||||
public static void onLeave() {
|
||||
MidnightControlsFeature.resetAllAllowed();
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches the controls mode if the auto switch is enabled.
|
||||
*/
|
||||
public static void switchControlsMode() {
|
||||
if (MidnightControlsConfig.autoSwitchMode) {
|
||||
if (MidnightControlsConfig.getController().isGamepad()) {
|
||||
previousControlsMode = MidnightControlsConfig.controlsMode;
|
||||
MidnightControlsConfig.controlsMode = ControlsMode.CONTROLLER;
|
||||
} else {
|
||||
if (previousControlsMode == null) {
|
||||
previousControlsMode = ControlsMode.DEFAULT;
|
||||
}
|
||||
|
||||
MidnightControlsConfig.controlsMode = previousControlsMode;
|
||||
}
|
||||
NetworkUtil.sendPayloadC2S(new ControlsModePayload(MidnightControlsConfig.controlsMode.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the HUD is enabled or not.
|
||||
*
|
||||
* @param enabled true if the HUD is enabled, else false
|
||||
*/
|
||||
public static void setHudEnabled(boolean enabled) {
|
||||
MidnightControlsConfig.hudEnable = enabled;
|
||||
hud.setVisible(enabled);
|
||||
}
|
||||
|
||||
private static final MidnightControlsClient INSTANCE = new MidnightControlsClient();
|
||||
/**
|
||||
* Gets the midnightcontrols client instance.
|
||||
*
|
||||
* @return the midnightcontrols client instance
|
||||
*/
|
||||
@Deprecated
|
||||
public static MidnightControlsClient get() {
|
||||
return INSTANCE;
|
||||
}
|
||||
}
|
||||
@@ -1,414 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
||||
*
|
||||
* This file is part of midnightcontrols.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package eu.midnightdust.midnightcontrols.client;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.mojang.blaze3d.platform.GlDebugInfo;
|
||||
import eu.midnightdust.lib.config.MidnightConfig;
|
||||
import eu.midnightdust.midnightcontrols.ControlsMode;
|
||||
import eu.midnightdust.midnightcontrols.MidnightControls;
|
||||
import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
|
||||
import eu.midnightdust.midnightcontrols.MidnightControlsFeature;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.Controller;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.InputManager;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.ButtonState;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.CameraMode;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.ControllerType;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.HudSide;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.VirtualMouseSkin;
|
||||
import eu.midnightdust.midnightcontrols.client.gui.RingScreen;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.TouchMode;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.ChatScreen;
|
||||
import net.minecraft.client.gui.screen.advancement.AdvancementsScreen;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Represents MidnightControls configuration.
|
||||
*/
|
||||
public class MidnightControlsConfig extends MidnightConfig {
|
||||
public static final String CONTROLLER = "controller";
|
||||
public static final String TOUCH = "touch";
|
||||
public static final String GAMEPLAY = "gameplay";
|
||||
public static final String SCREENS = "screens";
|
||||
public static final String VISUAL = "visual";
|
||||
public static final String MISC = "misc";
|
||||
public static boolean isEditing = false;
|
||||
@Hidden @Entry public static int configVersion = 2;
|
||||
// General
|
||||
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.controls_mode") public static ControlsMode controlsMode = ControlsMode.DEFAULT;
|
||||
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.auto_switch_mode") public static boolean autoSwitchMode = true;
|
||||
@Entry(category = MISC, name = "Debug") public static boolean debug = false;
|
||||
// HUD
|
||||
@Entry(category = VISUAL, name = "midnightcontrols.menu.hud_enable") public static boolean hudEnable = true;
|
||||
@Entry(category = VISUAL, name = "midnightcontrols.menu.hud_side") public static HudSide hudSide = HudSide.LEFT;
|
||||
@Entry(category = SCREENS, name = "midnightcontrols.menu.move_chat") public static boolean moveChat = false;
|
||||
// Gameplay
|
||||
@Entry(category = GAMEPLAY, name = "midnightcontrols.menu.analog_movement") public static boolean analogMovement = true;
|
||||
@Entry(category = GAMEPLAY, name = "midnightcontrols.menu.double_tap_to_sprint") public static boolean doubleTapToSprint = true;
|
||||
@Entry(category = GAMEPLAY, name = "midnightcontrols.menu.controller_toggle_sneak") public static boolean controllerToggleSneak = MinecraftClient.getInstance().options.getSneakToggled().getValue();
|
||||
@Entry(category = GAMEPLAY, name = "midnightcontrols.menu.controller_toggle_sprint") public static boolean controllerToggleSprint = MinecraftClient.getInstance().options.getSprintToggled().getValue();
|
||||
@Entry(category = GAMEPLAY, name = "midnightcontrols.menu.fast_block_placing") public static boolean fastBlockPlacing = false; // Disabled by default as this behaviour can be considered cheating on multiplayer servers.
|
||||
@Entry(category = GAMEPLAY, name = "midnightcontrols.menu.fly_drifting") public static boolean flyDrifting = true; // Enabled by default as disabling this behaviour can be considered cheating on multiplayer servers. It can also conflict with some other mods.
|
||||
@Entry(category = GAMEPLAY, name = "midnightcontrols.menu.fly_drifting_vertical") public static boolean verticalFlyDrifting = true; // Enabled by default as disabling this behaviour can be considered cheating on multiplayer servers.
|
||||
@Entry(category = GAMEPLAY, name = "midnightcontrols.menu.reacharound.horizontal") public static boolean horizontalReacharound = false; // Disabled by default as this behaviour can be considered cheating on multiplayer servers.
|
||||
@Entry(category = GAMEPLAY, name = "midnightcontrols.menu.reacharound.vertical") public static boolean verticalReacharound = false; // Disabled by default as this behaviour can be considered cheating on multiplayer servers.
|
||||
@Entry(category = VISUAL, name = "Reacharound Outline") public static boolean shouldRenderReacharoundOutline = true;
|
||||
@Entry(category = VISUAL, name = "Reacharound Outline Color", isColor = true) public static String reacharoundOutlineColorHex = "#ffffff";
|
||||
@Entry(category = VISUAL, name = "Reacharound Outline Alpha", isSlider = true, min = 0, max = 255) public static int reacharoundOutlineColorAlpha = 102;
|
||||
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.right_dead_zone", isSlider = true, min = 0.05, max = 1) public static double rightDeadZone = 0.25;
|
||||
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.left_dead_zone", isSlider = true, min = 0.05, max = 1) public static double leftDeadZone = 0.25;
|
||||
@Entry(category = CONTROLLER, name = "Trigger Dead-Zone", isSlider = true, min = 0.05, max = 1) public static double triggerDeadZone = 0.1;
|
||||
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.invert_right_y_axis") public static boolean invertRightYAxis = false;
|
||||
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.invert_right_x_axis") public static boolean invertRightXAxis = false;
|
||||
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.rotation_speed", isSlider = true, min = 0, max = 100, precision = 10) public static double rotationSpeed = 35.0; //used for x-axis, name kept for compatibility
|
||||
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.y_axis_rotation_speed", isSlider = true, min = 0, max = 100, precision = 10) public static double yAxisRotationSpeed = rotationSpeed;
|
||||
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.camera_mode") public static CameraMode cameraMode = CameraMode.FLAT;
|
||||
@Entry(category = SCREENS, name = "midnightcontrols.menu.mouse_speed", isSlider = true, min = 0, max = 150, precision = 10) public static double mouseSpeed = 25.0;
|
||||
@Entry(category = SCREENS, name = "midnightcontrols.menu.joystick_as_mouse") public static boolean joystickAsMouse = false;
|
||||
@Entry(category = SCREENS, name = "midnightcontrols.menu.eye_tracker_as_mouse") public static boolean eyeTrackerAsMouse = false;
|
||||
@Entry(category = SCREENS, name = "midnightcontrols.menu.eye_tracker_deadzone", isSlider = true, min = 0, max = 0.4) public static double eyeTrackerDeadzone = 0.05;
|
||||
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.unfocused_input") public static boolean unfocusedInput = false;
|
||||
@Entry(category = SCREENS, name = "midnightcontrols.menu.virtual_mouse") public static boolean virtualMouse = false;
|
||||
@Entry(category = SCREENS, name = "midnightcontrols.menu.virtual_mouse.skin") public static VirtualMouseSkin virtualMouseSkin = VirtualMouseSkin.DEFAULT_LIGHT;
|
||||
@Entry(category = SCREENS, name = "midnightcontrols.menu.hide_cursor") public static boolean hideNormalMouse = false;
|
||||
@Entry(category = CONTROLLER, name = "Controller ID") @Hidden public static Object controllerID = 0;
|
||||
@Entry(category = CONTROLLER, name = "2nd Controller ID") @Hidden public static Object secondControllerID = -1;
|
||||
@Entry(category = VISUAL, name = "midnightcontrols.menu.controller_type") public static ControllerType controllerType = ControllerType.DEFAULT;
|
||||
@Entry(category = SCREENS, name = "Mouse screens") public static List<String> mouseScreens = Lists.newArrayList("net.minecraft.client.gui.screen.advancement",
|
||||
"net.minecraft.class_457", "net.minecraft.class_408", "net.minecraft.class_3872", "me.flashyreese.mods.reeses_sodium_options.client.gui", "dev.emi.emi.screen",
|
||||
"hardcorequesting.client.interfaces.GuiQuestBook", "hardcorequesting.client.interfaces.GuiReward", "hardcorequesting.client.interfaces.EditTrackerScreen",
|
||||
"me.shedaniel.clothconfig2.gui.ClothConfigScreen", "com.mamiyaotaru.voxelmap.gui.GuiWaypoints", "com.mamiyaotaru.voxelmap.gui.GuiPersistentMap");
|
||||
@Entry(category = SCREENS, name = "Arrow screens") public static List<String> arrowScreens = Lists.newArrayList(ChatScreen.class.getCanonicalName());
|
||||
@Entry(category = SCREENS, name = "WASD screens") public static List<String> wasdScreens = Lists.newArrayList("com.ultreon.devices.core.Laptop");
|
||||
@Entry(category = TOUCH, name = "Screens with close button") public static List<String> closeButtonScreens = Lists.newArrayList(ChatScreen.class.getCanonicalName(), AdvancementsScreen.class.getCanonicalName(), RingScreen.class.getCanonicalName());
|
||||
@Entry(category = TOUCH, name = "midnightcontrols.menu.touch_with_controller") public static boolean touchInControllerMode = false;
|
||||
@Entry(category = TOUCH, name = "midnightcontrols.menu.touch_speed", isSlider = true, min = 0, max = 150, precision = 10) public static double touchSpeed = 50.0;
|
||||
@Entry(category = TOUCH, name = "midnightcontrols.menu.invert_touch") public static boolean invertTouch = false;
|
||||
@Entry(category = TOUCH, name = "midnightcontrols.menu.touch_mode") public static TouchMode touchMode = TouchMode.CROSSHAIR;
|
||||
@Entry(category = TOUCH, name = "midnightcontrols.menu.touch_break_delay", isSlider = true, min = 50, max = 500) public static int touchBreakDelay = 120;
|
||||
@Entry(category = TOUCH, name = "midnightcontrols.menu.touch_transparency", isSlider = true, min = 0, max = 100) public static int touchTransparency = 75;
|
||||
@Entry(category = TOUCH, name = "Touch Outline Color", isColor = true) public static String touchOutlineColorHex = "#ffffff";
|
||||
@Entry(category = TOUCH, name = "Touch Outline Alpha", isSlider = true, min = 0, max = 255) public static int touchOutlineColorAlpha = 150;
|
||||
@Entry(category = TOUCH, name = "Left Touch button bindings") public static List<String> leftTouchBinds = Lists.newArrayList("debug_screen", "screenshot","toggle_perspective");
|
||||
@Entry(category = TOUCH, name = "Right Touch button bindings") public static List<String> rightTouchBinds = Lists.newArrayList("screenshot","toggle_perspective", "use");
|
||||
|
||||
@Entry @Hidden public static Map<String, String> BINDING = new HashMap<>();
|
||||
|
||||
private static final Pattern BUTTON_BINDING_PATTERN = Pattern.compile("(-?\\d+)\\+?");
|
||||
@Entry(category = CONTROLLER, name = "Max analog value: Left X", isSlider = true, min = .25f, max = 1.f) public static double maxAnalogValueLeftX = 1;
|
||||
@Entry(category = CONTROLLER, name = "Max analog value: Left Y", isSlider = true, min = .25f, max = 1.f) public static double maxAnalogValueLeftY = 1;
|
||||
@Entry(category = CONTROLLER, name = "Max analog value: Right X", isSlider = true, min = .25f, max = 1.f) public static double maxAnalogValueRightX = 1;
|
||||
@Entry(category = CONTROLLER, name = "Max analog value: Right Y", isSlider = true, min = .25f, max = 1.f) public static double maxAnalogValueRightY = 1;
|
||||
@Entry(category = CONTROLLER, name = "Trigger button fix") public static boolean triggerFix = true;
|
||||
@Entry(category = CONTROLLER, name = "Excluded Controllers (Name Regex)") public static List<String> excludedControllers = Lists.newArrayList(".*(Keyboard)$", ".*(Touchpad)$", ".*(Pen)$", ".*(Finger)$");
|
||||
@Entry(category = MISC, name = "Excluded Keybindings") public static List<String> excludedKeybindings = Lists.newArrayList("key.forward", "key.left", "key.back", "key.right", "key.jump", "key.sneak", "key.sprint", "key.inventory",
|
||||
"key.swapOffhand", "key.drop", "key.use", "key.attack", "key.chat", "key.playerlist", "key.screenshot", "key.togglePerspective", "key.smoothCamera", "key.fullscreen", "key.saveToolbarActivator", "key.loadToolbarActivator",
|
||||
"key.pickItem", "key.hotbar.1", "key.hotbar.2", "key.hotbar.3", "key.hotbar.4", "key.hotbar.5", "key.hotbar.6", "key.hotbar.7", "key.hotbar.8", "key.hotbar.9");
|
||||
@Entry(category = GAMEPLAY, name = "Enable Hints") public static boolean enableHints = true;
|
||||
@Entry(category = SCREENS, name = "Enable Shortcut in Controls Options") public static boolean shortcutInControls = true;
|
||||
@Entry(category = MISC, name = "Ring Bindings (WIP)") public static List<String> ringBindings = new ArrayList<>();
|
||||
@Entry(category = MISC, name = "Ignored Unbound Keys") public static List<String> ignoredUnboundKeys = Lists.newArrayList("inventorytabs.key.next_tab");
|
||||
@Entry @Hidden public static Map<String, Map<String, String>> controllerBindingProfiles = new HashMap<>();
|
||||
private static Map<String, String> currentBindingProfile = new HashMap<>();
|
||||
private static Controller prevController;
|
||||
|
||||
/**
|
||||
* Loads the configuration
|
||||
*/
|
||||
public static void load() {
|
||||
MidnightControlsConfig.init(MidnightControlsConstants.NAMESPACE, MidnightControlsConfig.class);
|
||||
MidnightControls.log("Configuration loaded.");
|
||||
// Controller controls.
|
||||
InputManager.loadButtonBindings();
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the configuration.
|
||||
*/
|
||||
public static void save() {
|
||||
MidnightControlsConfig.write(MidnightControlsConstants.NAMESPACE);
|
||||
MidnightControls.log("Configuration saved.");
|
||||
MidnightControlsFeature.refreshEnabled();
|
||||
}
|
||||
public static void updateBindingsForController(Controller controller) {
|
||||
if (controller.isConnected() && controller.isGamepad() && controllerBindingProfiles.containsKey(controller.getGuid()))
|
||||
currentBindingProfile = controllerBindingProfiles.get(controller.getGuid());
|
||||
else currentBindingProfile = Maps.newHashMap(BINDING);
|
||||
InputManager.loadButtonBindings();
|
||||
}
|
||||
public static Map<String, String> getBindingsForController() {
|
||||
return currentBindingProfile;
|
||||
}
|
||||
/**
|
||||
* Gets the used controller.
|
||||
*
|
||||
* @return the controller
|
||||
*/
|
||||
public static Controller getController() {
|
||||
var raw = MidnightControlsConfig.controllerID;
|
||||
Controller controller = Controller.byId(GLFW.GLFW_JOYSTICK_1);
|
||||
if (raw instanceof Number) {
|
||||
controller = Controller.byId(((Number) raw).intValue());
|
||||
} else if (raw instanceof String) {
|
||||
controller = Controller.byGuid((String) raw).orElse(Controller.byId(GLFW.GLFW_JOYSTICK_1));
|
||||
}
|
||||
if ((!controller.isConnected() || !controller.isGamepad()) && MidnightControlsConfig.autoSwitchMode && !isEditing) {
|
||||
for (int i = 0; i < GLFW.GLFW_JOYSTICK_LAST; ++i) {
|
||||
Controller gamepad = Controller.byId(i);
|
||||
if (gamepad.isConnected() && gamepad.isGamepad()) {
|
||||
controller = gamepad;
|
||||
i = GLFW_JOYSTICK_LAST;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (controller.isConnected() && controller.isGamepad() && MidnightControlsConfig.autoSwitchMode && !isEditing) MidnightControlsConfig.controlsMode = ControlsMode.CONTROLLER;
|
||||
if (prevController != controller) updateBindingsForController(controller);
|
||||
prevController = controller;
|
||||
return controller;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the used controller.
|
||||
*
|
||||
* @param controller the controller
|
||||
*/
|
||||
public static void setController(Controller controller) {
|
||||
MidnightControlsConfig.controllerID = controller.id();
|
||||
MidnightControlsConfig.write(MidnightControlsConstants.NAMESPACE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the second controller (for Joy-Con supports).
|
||||
*
|
||||
* @return the second controller
|
||||
*/
|
||||
public static Optional<Controller> getSecondController() {
|
||||
var raw = MidnightControlsConfig.secondControllerID;
|
||||
if (raw instanceof Number) {
|
||||
if (((Number) raw).intValue() == -1)
|
||||
return Optional.empty();
|
||||
return Optional.of(Controller.byId(((Number) raw).intValue()));
|
||||
} else if (raw instanceof String) {
|
||||
return Optional.of(Controller.byGuid((String) raw).orElse(Controller.byId(GLFW.GLFW_JOYSTICK_1)));
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the second controller.
|
||||
*
|
||||
* @param controller the second controller
|
||||
*/
|
||||
public static void setSecondController(@Nullable Controller controller) {
|
||||
MidnightControlsConfig.secondControllerID = controller == null ? -1 : controller.id();
|
||||
}
|
||||
/**
|
||||
* Gets the right X axis sign.
|
||||
*
|
||||
* @return the right X axis sign
|
||||
*/
|
||||
public static double getRightXAxisSign() {
|
||||
return MidnightControlsConfig.invertRightXAxis ? -1.0 : 1.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the right Y axis sign.
|
||||
*
|
||||
* @return the right Y axis sign
|
||||
*/
|
||||
public static double getRightYAxisSign() {
|
||||
return MidnightControlsConfig.invertRightYAxis ? -1.0 : 1.0;
|
||||
}
|
||||
|
||||
public static double getAxisMaxValue(int axis) {
|
||||
return switch (axis) {
|
||||
case GLFW_GAMEPAD_AXIS_LEFT_X -> MidnightControlsConfig.maxAnalogValueLeftX;
|
||||
case GLFW_GAMEPAD_AXIS_LEFT_Y -> MidnightControlsConfig.maxAnalogValueLeftY;
|
||||
case GLFW_GAMEPAD_AXIS_RIGHT_X -> MidnightControlsConfig.maxAnalogValueRightX;
|
||||
default -> MidnightControlsConfig.maxAnalogValueRightY;
|
||||
};
|
||||
}
|
||||
|
||||
public static void setAxisMaxValue(int axis, double value) {
|
||||
switch (axis) {
|
||||
case GLFW_GAMEPAD_AXIS_LEFT_X -> MidnightControlsConfig.maxAnalogValueLeftX = value;
|
||||
case GLFW_GAMEPAD_AXIS_LEFT_Y -> MidnightControlsConfig.maxAnalogValueLeftY = value;
|
||||
case GLFW_GAMEPAD_AXIS_RIGHT_X -> MidnightControlsConfig.maxAnalogValueRightX = value;
|
||||
default -> MidnightControlsConfig.maxAnalogValueRightY = value;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the button binding from configuration.
|
||||
*
|
||||
* @param button the button binding
|
||||
*/
|
||||
public static void loadButtonBinding(@NotNull ButtonBinding button) {
|
||||
button.setButton(button.getDefaultButton());
|
||||
var code = getBindingsForController().getOrDefault("controller.controls." + button.getName(), button.getButtonCode());
|
||||
|
||||
var matcher = BUTTON_BINDING_PATTERN.matcher(code);
|
||||
|
||||
try {
|
||||
var buttons = new int[1];
|
||||
int count = 0;
|
||||
while (matcher.find()) {
|
||||
count++;
|
||||
if (count > buttons.length)
|
||||
buttons = Arrays.copyOf(buttons, count);
|
||||
String current;
|
||||
if (!MidnightControlsConfig.checkValidity(button, code, current = matcher.group(1)))
|
||||
return;
|
||||
buttons[count - 1] = Integer.parseInt(current);
|
||||
}
|
||||
if (count == 0) {
|
||||
MidnightControls.warn("Malformed config value \"" + code + "\" for binding \"" + button.getName() + "\".");
|
||||
MidnightControlsConfig.setButtonBinding(button, new int[]{-1});
|
||||
}
|
||||
|
||||
button.setButton(buttons);
|
||||
} catch (Exception e) {
|
||||
MidnightControls.warn("Malformed config value \"" + code + "\" for binding \"" + button.getName() + "\".");
|
||||
setButtonBinding(button, button.getButton());
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean checkValidity(@NotNull ButtonBinding binding, @NotNull String input, String group) {
|
||||
if (group == null) {
|
||||
MidnightControls.warn("Malformed config value \"" + input + "\" for binding \"" + binding.getName() + "\".");
|
||||
setButtonBinding(binding, binding.getButton());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the button binding in configuration.
|
||||
*
|
||||
* @param binding the button binding
|
||||
* @param button the button
|
||||
*/
|
||||
public static void setButtonBinding(@NotNull ButtonBinding binding, int[] button) {
|
||||
binding.setButton(button);
|
||||
getBindingsForController().put("controller.controls." + binding.getName(), binding.getButtonCode());
|
||||
if (controllerBindingProfiles.containsKey(getController().getGuid())) controllerBindingProfiles.get(getController().getGuid()).put("controller.controls." + binding.getName(), binding.getButtonCode());
|
||||
else BINDING.put("controller.controls." + binding.getName(), binding.getButtonCode());
|
||||
}
|
||||
|
||||
public static boolean isBackButton(int btn, boolean isBtn, ButtonState state) {
|
||||
if (!isBtn && state == ButtonState.NONE)
|
||||
return false;
|
||||
return ButtonBinding.axisAsButton(GLFW_GAMEPAD_AXIS_LEFT_Y, false) == ButtonBinding.axisAsButton(btn, state == ButtonState.PRESS);
|
||||
}
|
||||
|
||||
public static boolean isForwardButton(int btn, boolean isBtn, ButtonState state) {
|
||||
if (!isBtn && state == ButtonState.NONE)
|
||||
return false;
|
||||
return ButtonBinding.axisAsButton(GLFW_GAMEPAD_AXIS_LEFT_Y, true) == ButtonBinding.axisAsButton(btn, state == ButtonState.PRESS);
|
||||
}
|
||||
|
||||
public static boolean isLeftButton(int btn, boolean isBtn, ButtonState state) {
|
||||
if (!isBtn && state == ButtonState.NONE)
|
||||
return false;
|
||||
return ButtonBinding.axisAsButton(GLFW_GAMEPAD_AXIS_LEFT_X, false) == ButtonBinding.axisAsButton(btn, state == ButtonState.PRESS);
|
||||
}
|
||||
|
||||
public static boolean isRightButton(int btn, boolean isBtn, ButtonState state) {
|
||||
if (!isBtn && state == ButtonState.NONE)
|
||||
return false;
|
||||
return ButtonBinding.axisAsButton(GLFW_GAMEPAD_AXIS_LEFT_X, true) == ButtonBinding.axisAsButton(btn, state == ButtonState.PRESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the specified axis is an axis used for movements.
|
||||
*
|
||||
* @param axis the axis index
|
||||
* @return true if the axis is used for movements, else false
|
||||
*/
|
||||
public static boolean isMovementAxis(int axis) {
|
||||
return axis == GLFW_GAMEPAD_AXIS_LEFT_Y || axis == GLFW_GAMEPAD_AXIS_LEFT_X;
|
||||
}
|
||||
|
||||
public static void reset() {
|
||||
controlsMode = ControlsMode.DEFAULT;
|
||||
autoSwitchMode = true;
|
||||
debug = false;
|
||||
hudEnable = true;
|
||||
hudSide = HudSide.LEFT;
|
||||
analogMovement = true;
|
||||
doubleTapToSprint = true;
|
||||
controllerToggleSneak = MinecraftClient.getInstance().options.getSneakToggled().getValue();
|
||||
controllerToggleSprint = MinecraftClient.getInstance().options.getSprintToggled().getValue();
|
||||
fastBlockPlacing = false;
|
||||
flyDrifting = true;
|
||||
verticalFlyDrifting = true;
|
||||
horizontalReacharound = false;
|
||||
verticalReacharound = false;
|
||||
shouldRenderReacharoundOutline = true;
|
||||
reacharoundOutlineColorHex = "#ffffff";
|
||||
reacharoundOutlineColorAlpha = 102;
|
||||
rightDeadZone = 0.25;
|
||||
leftDeadZone = 0.25;
|
||||
invertRightYAxis = false;
|
||||
invertRightXAxis = false;
|
||||
rotationSpeed = 35.0;
|
||||
yAxisRotationSpeed = rotationSpeed;
|
||||
mouseSpeed = 25.0;
|
||||
unfocusedInput = false;
|
||||
virtualMouse = false;
|
||||
virtualMouseSkin = VirtualMouseSkin.DEFAULT_LIGHT;
|
||||
controllerID = 0;
|
||||
secondControllerID = -1;
|
||||
controllerType = ControllerType.DEFAULT;
|
||||
mouseScreens = Lists.newArrayList("net.minecraft.client.gui.screen.advancement", "net.minecraft.class_457", "net.minecraft.class_408", "net.minecraft.class_3872", "me.flashyreese.mods.reeses_sodium_options.client.gui", "dev.emi.emi.screen", "me.shedaniel.clothconfig2.gui.ClothConfigScreen", "com.mamiyaotaru.voxelmap.gui.GuiWaypoints", "com.mamiyaotaru.voxelmap.gui.GuiPersistentMap");
|
||||
BINDING = new HashMap<>();
|
||||
maxAnalogValueLeftX = 1;
|
||||
maxAnalogValueLeftY = 1;
|
||||
maxAnalogValueRightX = 1;
|
||||
maxAnalogValueRightY = 1;
|
||||
triggerFix = true;
|
||||
enableHints = true;
|
||||
shortcutInControls = true;
|
||||
ringBindings = new ArrayList<>();
|
||||
ignoredUnboundKeys = Lists.newArrayList("inventorytabs.key.next_tab");
|
||||
controllerBindingProfiles = new HashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the controller type from the controller's identifier.
|
||||
*
|
||||
* @return the controller name matches a type, else empty
|
||||
*/
|
||||
public static @NotNull ControllerType matchControllerToType() {
|
||||
String controller = getController().getName().toLowerCase();
|
||||
if (controller.contains("xbox 360")) return ControllerType.XBOX_360;
|
||||
else if (controller.contains("xbox") || controller.contains("afterglow")) return ControllerType.XBOX;
|
||||
else if (controller.contains("steam") && GlDebugInfo.getCpuInfo().contains("AMD Custom APU")) return ControllerType.STEAM_DECK;
|
||||
else if (controller.contains("steam")) return ControllerType.STEAM_CONTROLLER;
|
||||
else if (controller.contains("dualsense") || controller.contains("ps5")) return ControllerType.DUALSENSE;
|
||||
else if (controller.contains("dualshock") || controller.contains("ps4") || controller.contains("sony")) return ControllerType.DUALSHOCK;
|
||||
else if (controller.contains("switch") || controller.contains("joy-con") || controller.contains("wii") || controller.contains("nintendo")) return ControllerType.SWITCH;
|
||||
else if (controller.contains("ouya")) return ControllerType.OUYA;
|
||||
else return ControllerType.DEFAULT;
|
||||
}
|
||||
public static boolean doMixedInput() {
|
||||
return touchInControllerMode && controlsMode == ControlsMode.CONTROLLER;
|
||||
}
|
||||
}
|
||||
@@ -1,819 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
||||
*
|
||||
* This file is part of midnightcontrols.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package eu.midnightdust.midnightcontrols.client;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import eu.midnightdust.lib.util.PlatformFunctions;
|
||||
import eu.midnightdust.midnightcontrols.client.compat.EmotecraftCompat;
|
||||
import eu.midnightdust.midnightcontrols.client.compat.LibGuiCompat;
|
||||
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
|
||||
import eu.midnightdust.midnightcontrols.client.compat.YACLCompat;
|
||||
import eu.midnightdust.midnightcontrols.client.mixin.AdvancementsScreenAccessor;
|
||||
import eu.midnightdust.midnightcontrols.client.mixin.CreativeInventoryScreenAccessor;
|
||||
import eu.midnightdust.midnightcontrols.client.mixin.MouseAccessor;
|
||||
import eu.midnightdust.midnightcontrols.client.util.InventoryUtil;
|
||||
import eu.midnightdust.midnightcontrols.client.util.storage.AxisStorage;
|
||||
import eu.midnightdust.midnightcontrols.client.util.storage.ButtonStorage;
|
||||
import net.minecraft.client.gui.screen.option.KeybindsScreen;
|
||||
import net.minecraft.client.gui.widget.EntryListWidget;
|
||||
import net.minecraft.client.gui.widget.PressableWidget;
|
||||
import net.minecraft.client.gui.widget.SliderWidget;
|
||||
import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import org.thinkingstudio.obsidianui.widget.AbstractSpruceWidget;
|
||||
import org.thinkingstudio.obsidianui.widget.container.SpruceEntryListWidget;
|
||||
import eu.midnightdust.midnightcontrols.MidnightControls;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.Controller;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.InputManager;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.CameraMode;
|
||||
import eu.midnightdust.midnightcontrols.client.gui.RingScreen;
|
||||
import eu.midnightdust.midnightcontrols.client.touch.gui.TouchscreenOverlay;
|
||||
import eu.midnightdust.midnightcontrols.client.gui.widget.ControllerControlsWidget;
|
||||
import eu.midnightdust.midnightcontrols.client.ring.RingPage;
|
||||
import eu.midnightdust.midnightcontrols.client.util.HandledScreenAccessor;
|
||||
import eu.midnightdust.midnightcontrols.client.util.MathUtil;
|
||||
import org.thinkingstudio.obsidianui.navigation.NavigationDirection;
|
||||
import org.thinkingstudio.obsidianui.screen.SpruceScreen;
|
||||
import org.thinkingstudio.obsidianui.widget.AbstractSprucePressableButtonWidget;
|
||||
import org.thinkingstudio.obsidianui.widget.SpruceElement;
|
||||
import org.thinkingstudio.obsidianui.widget.SpruceLabelWidget;
|
||||
import org.thinkingstudio.obsidianui.widget.container.SpruceParentWidget;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.ButtonState;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.ParentElement;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.advancement.AdvancementTab;
|
||||
import net.minecraft.client.gui.screen.advancement.AdvancementsScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.MerchantScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.StonecutterScreen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
||||
import net.minecraft.client.gui.screen.multiplayer.MultiplayerServerListWidget;
|
||||
import net.minecraft.client.gui.screen.world.WorldListWidget;
|
||||
import net.minecraft.text.TranslatableTextContent;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.glfw.GLFWGamepadState;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.client;
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Represents the midnightcontrols' input handler.
|
||||
*
|
||||
* @author Motschen, LambdAurora
|
||||
* @version 1.10.0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public class MidnightInput {
|
||||
public static final Map<Integer, Integer> BUTTON_COOLDOWNS = new HashMap<>();
|
||||
// Cooldowns
|
||||
public int actionGuiCooldown = 0;
|
||||
public int joystickCooldown = 0;
|
||||
public boolean ignoreNextARelease = false;
|
||||
public boolean ignoreNextXRelease = false;
|
||||
private double targetYaw = 0.0;
|
||||
private double targetPitch = 0.0;
|
||||
private float prevXAxis = 0.f;
|
||||
private float prevYAxis = 0.f;
|
||||
public float mouseSpeedX = 0.f;
|
||||
public float mouseSpeedY = 0.f;
|
||||
public int inventoryInteractionCooldown = 0;
|
||||
public int screenCloseCooldown = 0;
|
||||
|
||||
private ControllerControlsWidget controlsInput = null;
|
||||
|
||||
public MidnightInput() {}
|
||||
|
||||
/**
|
||||
* This method is called every Minecraft tick.
|
||||
*/
|
||||
public void tick() {
|
||||
this.targetYaw = 0.F;
|
||||
this.targetPitch = 0.F;
|
||||
|
||||
// Handles the key bindings.
|
||||
if (MidnightControlsClient.BINDING_LOOK_UP.isPressed()) {
|
||||
this.handleFlatLook(AxisStorage.of(GLFW_GAMEPAD_AXIS_RIGHT_Y, -0.8F, 0d));
|
||||
} else if (MidnightControlsClient.BINDING_LOOK_DOWN.isPressed()) {
|
||||
this.handleFlatLook(AxisStorage.of(GLFW_GAMEPAD_AXIS_RIGHT_Y, 0.8F, 0d));
|
||||
}
|
||||
if (MidnightControlsClient.BINDING_LOOK_LEFT.isPressed()) {
|
||||
this.handleFlatLook(AxisStorage.of(GLFW_GAMEPAD_AXIS_RIGHT_X, -0.8F, 0d));
|
||||
} else if (MidnightControlsClient.BINDING_LOOK_RIGHT.isPressed()) {
|
||||
this.handleFlatLook(AxisStorage.of(GLFW_GAMEPAD_AXIS_RIGHT_X, 0.8F, 0d));
|
||||
}
|
||||
|
||||
InputManager.INPUT_MANAGER.tick();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called every Minecraft tick for controller input update.
|
||||
*/
|
||||
public void tickController() {
|
||||
BUTTON_COOLDOWNS.entrySet().stream().filter(entry -> entry.getValue() > 0)
|
||||
.forEach(entry -> BUTTON_COOLDOWNS.put(entry.getKey(), entry.getValue() - 1));
|
||||
// Decreases the cooldown for GUI actions.
|
||||
if (this.actionGuiCooldown > 0)
|
||||
--this.actionGuiCooldown;
|
||||
if (this.screenCloseCooldown > 0)
|
||||
--this.screenCloseCooldown;
|
||||
if (this.joystickCooldown > 0)
|
||||
--this.joystickCooldown;
|
||||
|
||||
InputManager.updateStates();
|
||||
|
||||
var controller = MidnightControlsConfig.getController();
|
||||
|
||||
if (controller.isConnected()) {
|
||||
var state = controller.getState();
|
||||
this.fetchButtonInput(state, false);
|
||||
this.fetchTriggerInput(state, false);
|
||||
this.fetchJoystickInput(state, false, false);
|
||||
}
|
||||
MidnightControlsConfig.getSecondController().filter(Controller::isConnected)
|
||||
.ifPresent(joycon -> {
|
||||
var state = joycon.getState();
|
||||
this.fetchButtonInput(state, true);
|
||||
this.fetchTriggerInput(state, true);
|
||||
this.fetchJoystickInput(state, true, false);
|
||||
});
|
||||
|
||||
boolean allowInput = this.controlsInput == null || this.controlsInput.focusedBinding == null;
|
||||
|
||||
if (allowInput)
|
||||
InputManager.updateBindings();
|
||||
|
||||
if (this.controlsInput != null) {
|
||||
InputManager.STATES.forEach((num, button) -> {
|
||||
if (button.isPressed()) System.out.println(num);
|
||||
});
|
||||
}
|
||||
if (this.controlsInput != null && InputManager.STATES.int2ObjectEntrySet().parallelStream().map(Map.Entry::getValue).allMatch(ButtonState::isUnpressed)) {
|
||||
if (MidnightControlsConfig.debug) MidnightControls.log("Starting MidnightInput Button Edit");
|
||||
if (this.controlsInput.focusedBinding != null && !this.controlsInput.waiting) {
|
||||
int[] buttons = new int[this.controlsInput.currentButtons.size()];
|
||||
for (int i = 0; i < this.controlsInput.currentButtons.size(); i++)
|
||||
buttons[i] = this.controlsInput.currentButtons.get(i);
|
||||
this.controlsInput.finishBindingEdit(buttons);
|
||||
this.controlsInput = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.inventoryInteractionCooldown > 0)
|
||||
this.inventoryInteractionCooldown--;
|
||||
}
|
||||
/**
|
||||
* This method is called 1000 times a second for smooth camera input
|
||||
*/
|
||||
public void tickCameraStick() {
|
||||
var controller = MidnightControlsConfig.getController();
|
||||
|
||||
if (controller.isConnected()) {
|
||||
this.fetchJoystickInput(controller.getState(), false, true);
|
||||
}
|
||||
MidnightControlsConfig.getSecondController().filter(Controller::isConnected)
|
||||
.ifPresent(joycon -> this.fetchJoystickInput(joycon.getState(), true, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called before the screen is rendered.
|
||||
*
|
||||
* @param screen the screen to render
|
||||
*/
|
||||
public void onPreRenderScreen(@NotNull Screen screen) {
|
||||
if (!isScreenInteractive(screen)) {
|
||||
InputManager.INPUT_MANAGER.updateMousePosition(client);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called to update the camera
|
||||
*/
|
||||
public void updateCamera() {
|
||||
if (!(client.currentScreen == null || client.currentScreen instanceof TouchscreenOverlay))
|
||||
return;
|
||||
|
||||
var player = client.player;
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (this.targetYaw != 0.f || this.targetPitch != 0.f) {
|
||||
float rotationYaw = (float) (client.player.prevYaw + (this.targetYaw * 0.175));
|
||||
float rotationPitch = (float) (client.player.prevPitch + (this.targetPitch * 0.175));
|
||||
client.player.prevYaw = rotationYaw;
|
||||
client.player.prevPitch = MathHelper.clamp(rotationPitch, -90.f, 90.f);
|
||||
client.player.setYaw(rotationYaw);
|
||||
client.player.setPitch(MathHelper.clamp(rotationPitch, -90.f, 90.f));
|
||||
if (client.player.isRiding() && client.player.getVehicle() != null) {
|
||||
client.player.getVehicle().onPassengerLookAround(client.player);
|
||||
}
|
||||
client.getTutorialManager().onUpdateMouse(this.targetPitch, this.targetYaw);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called when a Screen is opened.
|
||||
*
|
||||
* @param windowWidth the window width
|
||||
* @param windowHeight the window height
|
||||
*/
|
||||
public void onScreenOpen(int windowWidth, int windowHeight) {
|
||||
if (client.currentScreen == null) {
|
||||
this.mouseSpeedX = this.mouseSpeedY = 0.0F;
|
||||
InputManager.INPUT_MANAGER.resetMousePosition(windowWidth, windowHeight);
|
||||
} else if (isScreenInteractive(client.currentScreen) && MidnightControlsConfig.virtualMouse) {
|
||||
((MouseAccessor) client.mouse).midnightcontrols$onCursorPos(client.getWindow().getHandle(), 0, 0);
|
||||
InputManager.INPUT_MANAGER.resetMouseTarget(client);
|
||||
}
|
||||
this.inventoryInteractionCooldown = 5;
|
||||
}
|
||||
|
||||
public void beginControlsInput(ControllerControlsWidget widget) {
|
||||
this.controlsInput = widget;
|
||||
if (widget != null) {
|
||||
this.controlsInput.currentButtons.clear();
|
||||
this.controlsInput.waiting = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void fetchButtonInput(@NotNull GLFWGamepadState gamepadState, boolean leftJoycon) {
|
||||
var buffer = gamepadState.buttons();
|
||||
for (int i = 0; i < buffer.limit(); i++) {
|
||||
int btn = leftJoycon ? ButtonBinding.controller2Button(i) : i;
|
||||
boolean pressed = buffer.get() == (byte) 1;
|
||||
var state = ButtonState.NONE;
|
||||
var previousState = InputManager.STATES.getOrDefault(btn, ButtonState.NONE);
|
||||
|
||||
if (pressed != previousState.isPressed()) {
|
||||
state = pressed ? ButtonState.PRESS : ButtonState.RELEASE;
|
||||
this.handleButton(ButtonStorage.of(btn, state));
|
||||
if (pressed)
|
||||
BUTTON_COOLDOWNS.put(btn, 5);
|
||||
} else if (pressed) {
|
||||
state = ButtonState.REPEAT;
|
||||
if (BUTTON_COOLDOWNS.getOrDefault(btn, 0) == 0) {
|
||||
BUTTON_COOLDOWNS.put(btn, 5);
|
||||
this.handleButton(ButtonStorage.of(btn, state));
|
||||
}
|
||||
}
|
||||
|
||||
InputManager.STATES.put(btn, state);
|
||||
}
|
||||
}
|
||||
final MathUtil.PolarUtil polarUtil = new MathUtil.PolarUtil();
|
||||
|
||||
private void fetchJoystickInput(@NotNull GLFWGamepadState gamepadState, boolean leftJoycon, boolean cameraTick) {
|
||||
var buffer = gamepadState.axes();
|
||||
|
||||
polarUtil.calculate(buffer.get(GLFW_GAMEPAD_AXIS_LEFT_X), buffer.get(GLFW_GAMEPAD_AXIS_LEFT_Y), 1, MidnightControlsConfig.leftDeadZone);
|
||||
float leftX = polarUtil.polarX;
|
||||
float leftY = polarUtil.polarY;
|
||||
polarUtil.calculate(buffer.get(GLFW_GAMEPAD_AXIS_RIGHT_X), buffer.get(GLFW_GAMEPAD_AXIS_RIGHT_Y), 1, MidnightControlsConfig.rightDeadZone);
|
||||
float rightX = polarUtil.polarX;
|
||||
float rightY = polarUtil.polarY;
|
||||
|
||||
boolean isRadialMenu = client.currentScreen instanceof RingScreen || (PlatformFunctions.isModLoaded("emotecraft") && EmotecraftCompat.isEmotecraftScreen(client.currentScreen));
|
||||
|
||||
if (!isRadialMenu) {
|
||||
for (int i = cameraTick ? GLFW_GAMEPAD_AXIS_RIGHT_X : 0; i < (cameraTick ? GLFW_GAMEPAD_AXIS_LEFT_TRIGGER : GLFW_GAMEPAD_AXIS_RIGHT_X); i++) {
|
||||
int axis = leftJoycon ? ButtonBinding.controller2Button(i) : i;
|
||||
float value = buffer.get(i);
|
||||
|
||||
switch (i) {
|
||||
case GLFW_GAMEPAD_AXIS_LEFT_X -> {
|
||||
if (MidnightControlsConfig.analogMovement) value = leftX;
|
||||
}
|
||||
case GLFW_GAMEPAD_AXIS_LEFT_Y -> {
|
||||
if (MidnightControlsConfig.analogMovement) value = leftY;
|
||||
}
|
||||
case GLFW_GAMEPAD_AXIS_RIGHT_X -> value = rightX;
|
||||
case GLFW_GAMEPAD_AXIS_RIGHT_Y -> value = rightY;
|
||||
}
|
||||
|
||||
if (i == GLFW.GLFW_GAMEPAD_AXIS_LEFT_Y)
|
||||
value *= -1.0F;
|
||||
|
||||
this.handleJoystickAxis(AxisStorage.of(axis, value));
|
||||
}
|
||||
}
|
||||
else {
|
||||
boolean leftStickActive = leftX != 0 || leftY != 0;
|
||||
handleRadialMenu(leftStickActive ? leftX : rightX, leftStickActive ? leftY : rightY);
|
||||
}
|
||||
}
|
||||
|
||||
private void fetchTriggerInput(@NotNull GLFWGamepadState gamepadState, boolean leftJoycon) {
|
||||
var buffer = gamepadState.axes();
|
||||
|
||||
for (int i = GLFW_GAMEPAD_AXIS_LEFT_TRIGGER; i <= GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER; i++) {
|
||||
int axis = leftJoycon ? ButtonBinding.controller2Button(i) : i;
|
||||
float value = buffer.get(i);
|
||||
|
||||
this.handleTriggerAxis(AxisStorage.of(axis, value, MidnightControlsConfig.triggerDeadZone));
|
||||
}
|
||||
}
|
||||
|
||||
public void handleButton(ButtonStorage storage) {
|
||||
if (this.controlsInput != null && this.controlsInput.focusedBinding != null) {
|
||||
if (storage.state == ButtonState.PRESS && !this.controlsInput.currentButtons.contains(storage.button)) {
|
||||
this.controlsInput.currentButtons.add(storage.button);
|
||||
|
||||
var buttons = new int[this.controlsInput.currentButtons.size()];
|
||||
for (int i = 0; i < this.controlsInput.currentButtons.size(); i++)
|
||||
buttons[i] = this.controlsInput.currentButtons.get(i);
|
||||
this.controlsInput.focusedBinding.setButton(buttons);
|
||||
|
||||
this.controlsInput.waiting = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (client.currentScreen != null && storage.state.isPressed() && storage.button == GLFW_GAMEPAD_BUTTON_Y &&
|
||||
MidnightControlsConfig.arrowScreens.contains(client.currentScreen.getClass().getCanonicalName())) {
|
||||
pressKeyboardKey(client, GLFW.GLFW_KEY_ENTER);
|
||||
this.screenCloseCooldown = 5;
|
||||
}
|
||||
else if (storage.state.isPressed()) {
|
||||
if (client.currentScreen != null && storage.isDpad() && this.actionGuiCooldown == 0) {
|
||||
switch (storage.button) {
|
||||
case GLFW_GAMEPAD_BUTTON_DPAD_UP -> this.changeFocus(client.currentScreen, NavigationDirection.UP);
|
||||
case GLFW_GAMEPAD_BUTTON_DPAD_DOWN -> this.changeFocus(client.currentScreen, NavigationDirection.DOWN);
|
||||
case GLFW_GAMEPAD_BUTTON_DPAD_LEFT -> this.handleLeftRight(client.currentScreen, false);
|
||||
case GLFW_GAMEPAD_BUTTON_DPAD_RIGHT -> this.handleLeftRight(client.currentScreen, true);
|
||||
}
|
||||
if (MidnightControlsConfig.wasdScreens.contains(client.currentScreen.getClass().getCanonicalName())) {
|
||||
switch (storage.button) {
|
||||
case GLFW_GAMEPAD_BUTTON_DPAD_UP -> pressKeyboardKey(client, GLFW.GLFW_KEY_W);
|
||||
case GLFW_GAMEPAD_BUTTON_DPAD_DOWN -> pressKeyboardKey(client, GLFW.GLFW_KEY_S);
|
||||
case GLFW_GAMEPAD_BUTTON_DPAD_LEFT -> pressKeyboardKey(client, GLFW.GLFW_KEY_A);
|
||||
case GLFW_GAMEPAD_BUTTON_DPAD_RIGHT -> pressKeyboardKey(client, GLFW.GLFW_KEY_D);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (storage.button == GLFW.GLFW_GAMEPAD_BUTTON_A && client.currentScreen != null) {
|
||||
if (this.actionGuiCooldown == 0) {
|
||||
var focused = client.currentScreen.getFocused();
|
||||
if (focused != null && isScreenInteractive(client.currentScreen)) {
|
||||
if (this.handleAButton(client.currentScreen, focused)) {
|
||||
this.actionGuiCooldown = 5; // Set the cooldown to 5 ticks to avoid unintended button presses.
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (PlatformFunctions.isModLoaded("libgui")) LibGuiCompat.handlePress(client.currentScreen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (storage.button == GLFW.GLFW_GAMEPAD_BUTTON_A && client.currentScreen != null && !isScreenInteractive(client.currentScreen)
|
||||
&& this.actionGuiCooldown == 0) {
|
||||
if (client.currentScreen instanceof HandledScreen<?> handledScreen && ((HandledScreenAccessor) handledScreen).midnightcontrols$getSlotAt(
|
||||
client.mouse.getX() * (double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth(),
|
||||
client.mouse.getY() * (double) client.getWindow().getScaledHeight() / (double) client.getWindow().getHeight()) != null) return;
|
||||
if (!this.ignoreNextARelease && client.currentScreen != null) {
|
||||
var accessor = (MouseAccessor) client.mouse;
|
||||
accessor.midnightcontrols$onCursorPos(client.getWindow().getHandle(), client.mouse.getX(), client.mouse.getY());
|
||||
switch (storage.state) {
|
||||
// Button pressed
|
||||
case PRESS -> accessor.midnightcontrols$onMouseButton(client.getWindow().getHandle(), GLFW_MOUSE_BUTTON_LEFT, 1, 0);
|
||||
case RELEASE -> { // Button released
|
||||
accessor.midnightcontrols$onMouseButton(client.getWindow().getHandle(), GLFW_MOUSE_BUTTON_LEFT, 0, 0);
|
||||
client.currentScreen.setDragging(false);
|
||||
}
|
||||
case REPEAT -> client.currentScreen.setDragging(true); // Button held down / dragging
|
||||
}
|
||||
this.screenCloseCooldown = 5;
|
||||
} else {
|
||||
this.ignoreNextARelease = false;
|
||||
}
|
||||
}
|
||||
else if (storage.button == GLFW.GLFW_GAMEPAD_BUTTON_X && client.currentScreen != null && !isScreenInteractive(client.currentScreen)
|
||||
&& this.actionGuiCooldown == 0) {
|
||||
double mouseX = client.mouse.getX() * (double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth();
|
||||
double mouseY = client.mouse.getY() * (double) client.getWindow().getScaledHeight() / (double) client.getWindow().getHeight();
|
||||
if (client.currentScreen instanceof HandledScreen<?> handledScreen && ((HandledScreenAccessor) handledScreen).midnightcontrols$getSlotAt(
|
||||
mouseX, mouseY) != null) return;
|
||||
if (!this.ignoreNextXRelease && client.currentScreen != null) {
|
||||
if (storage.state == ButtonState.PRESS) client.currentScreen.mouseClicked(mouseX, mouseY, GLFW.GLFW_MOUSE_BUTTON_2);
|
||||
else if (storage.state == ButtonState.RELEASE) client.currentScreen.mouseReleased(mouseX, mouseY, GLFW.GLFW_MOUSE_BUTTON_2);
|
||||
this.screenCloseCooldown = 5;
|
||||
} else {
|
||||
this.ignoreNextXRelease = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void handleTriggerAxis(AxisStorage storage) {
|
||||
storage.setupButtonStates();
|
||||
}
|
||||
|
||||
private void handleJoystickAxis(AxisStorage storage) {
|
||||
storage.setupButtonStates();
|
||||
|
||||
this.handleJoystickMovement(storage);
|
||||
|
||||
if (this.handleScreenScrolling(client.currentScreen, storage)) return;
|
||||
|
||||
storage.absValue = (float) MathHelper.clamp(storage.absValue / MidnightControlsConfig.getAxisMaxValue(storage.axis), 0.f, 1.f);
|
||||
if (client.currentScreen == null) {
|
||||
// Handles the look direction.
|
||||
this.handleLook(storage);
|
||||
} else {
|
||||
boolean allowMouseControl = true;
|
||||
|
||||
if (this.actionGuiCooldown == 0 && MidnightControlsConfig.isMovementAxis(storage.axis) && isScreenInteractive(client.currentScreen)) {
|
||||
if (MidnightControlsConfig.isForwardButton(storage.axis, false, storage.buttonState)) {
|
||||
allowMouseControl = this.changeFocus(client.currentScreen, NavigationDirection.UP);
|
||||
} else if (MidnightControlsConfig.isBackButton(storage.axis, false, storage.buttonState)) {
|
||||
allowMouseControl = this.changeFocus(client.currentScreen, NavigationDirection.DOWN);
|
||||
} else if (MidnightControlsConfig.isLeftButton(storage.axis, false, storage.buttonState)) {
|
||||
allowMouseControl = this.handleLeftRight(client.currentScreen, false);
|
||||
} else if (MidnightControlsConfig.isRightButton(storage.axis, false, storage.buttonState)) {
|
||||
allowMouseControl = this.handleLeftRight(client.currentScreen, true);
|
||||
}
|
||||
}
|
||||
|
||||
float movementX = 0.f;
|
||||
float movementY = 0.f;
|
||||
|
||||
if (MidnightControlsConfig.isBackButton(storage.axis, false, (storage.value > 0 ? ButtonState.PRESS : ButtonState.RELEASE))) {
|
||||
movementY = storage.absValue;
|
||||
} else if (MidnightControlsConfig.isForwardButton(storage.axis, false, (storage.value > 0 ? ButtonState.PRESS : ButtonState.RELEASE))) {
|
||||
movementY = -storage.absValue;
|
||||
} else if (MidnightControlsConfig.isLeftButton(storage.axis, false, (storage.value > 0 ? ButtonState.PRESS : ButtonState.RELEASE))) {
|
||||
movementX = -storage.absValue;
|
||||
} else if (MidnightControlsConfig.isRightButton(storage.axis, false, (storage.value > 0 ? ButtonState.PRESS : ButtonState.RELEASE))) {
|
||||
movementX = storage.absValue;
|
||||
}
|
||||
|
||||
if (client.currentScreen != null && allowMouseControl) {
|
||||
boolean moving = movementY != 0 || movementX != 0;
|
||||
if (moving) {
|
||||
/*
|
||||
Updates the target mouse position when the initial movement stick movement is detected.
|
||||
It prevents the cursor to jump to the old target mouse position if the user moves the cursor with the mouse.
|
||||
*/
|
||||
if (Math.abs(prevXAxis) < storage.deadZone && Math.abs(prevYAxis) < storage.deadZone) {
|
||||
InputManager.INPUT_MANAGER.resetMouseTarget(client);
|
||||
}
|
||||
|
||||
this.mouseSpeedX = movementX;
|
||||
this.mouseSpeedY = movementY;
|
||||
} else {
|
||||
this.mouseSpeedX = 0.f;
|
||||
this.mouseSpeedY = 0.f;
|
||||
}
|
||||
|
||||
if (Math.abs(this.mouseSpeedX) >= .05f || Math.abs(this.mouseSpeedY) >= .05f) {
|
||||
InputManager.queueMoveMousePosition(
|
||||
this.mouseSpeedX * MidnightControlsConfig.mouseSpeed,
|
||||
this.mouseSpeedY * MidnightControlsConfig.mouseSpeed
|
||||
);
|
||||
}
|
||||
|
||||
InventoryUtil.moveMouseToClosestSlot(client.currentScreen);
|
||||
}
|
||||
|
||||
this.prevXAxis = movementX;
|
||||
this.prevYAxis = movementY;
|
||||
}
|
||||
}
|
||||
|
||||
private void handleJoystickMovement(AxisStorage storage) {
|
||||
float axisValue = storage.absValue;
|
||||
if (!MidnightControlsConfig.analogMovement || (client.player != null && client.player.getVehicle() instanceof BoatEntity)) {
|
||||
axisValue = (float) (storage.absValue - storage.deadZone);
|
||||
axisValue /= (float) (1.0 - storage.deadZone);
|
||||
axisValue *= (float) storage.deadZone;
|
||||
}
|
||||
axisValue = (float) Math.min(axisValue / MidnightControlsConfig.getAxisMaxValue(storage.axis), 1);
|
||||
if (AxisStorage.isLeftAxis(storage.axis)) MidnightControlsCompat.handleMovement(storage, axisValue);
|
||||
InputManager.BUTTON_VALUES.put(storage.getButtonId(true), storage.polarity == AxisStorage.Polarity.PLUS ? axisValue : 0.f);
|
||||
InputManager.BUTTON_VALUES.put(storage.getButtonId(false), storage.polarity == AxisStorage.Polarity.MINUS ? axisValue : 0.f);
|
||||
storage.absValue = axisValue;
|
||||
}
|
||||
|
||||
private boolean handleScreenScrolling(Screen screen, AxisStorage storage) {
|
||||
if (screen == null) return false;
|
||||
// @TODO allow rebinding to left stick
|
||||
int preferredAxis = true ? GLFW_GAMEPAD_AXIS_RIGHT_Y : GLFW_GAMEPAD_AXIS_LEFT_Y;
|
||||
|
||||
if (this.controlsInput != null && this.controlsInput.focusedBinding != null) {
|
||||
if (storage.buttonState != ButtonState.NONE && !this.controlsInput.currentButtons.contains(storage.getButtonId(storage.buttonState == ButtonState.PRESS))) {
|
||||
|
||||
this.controlsInput.currentButtons.add(storage.getButtonId(storage.buttonState == ButtonState.PRESS));
|
||||
|
||||
int[] buttons = new int[this.controlsInput.currentButtons.size()];
|
||||
for (int i = 0; i < this.controlsInput.currentButtons.size(); i++)
|
||||
buttons[i] = this.controlsInput.currentButtons.get(i);
|
||||
this.controlsInput.focusedBinding.setButton(buttons);
|
||||
|
||||
this.controlsInput.waiting = false;
|
||||
}
|
||||
return true;
|
||||
} else if (storage.absValue >= storage.deadZone) {
|
||||
if (screen instanceof CreativeInventoryScreen creativeInventoryScreen) {
|
||||
if (storage.axis == preferredAxis) {
|
||||
var accessor = (CreativeInventoryScreenAccessor) creativeInventoryScreen;
|
||||
if (accessor.midnightcontrols$hasScrollbar() && storage.absValue >= storage.deadZone) {
|
||||
creativeInventoryScreen.mouseScrolled(0.0, 0.0, 0, -(storage.value * 0.0175f));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else if (screen instanceof AdvancementsScreen advancementsScreen) {
|
||||
if (storage.axis == GLFW_GAMEPAD_AXIS_RIGHT_X || storage.axis == GLFW_GAMEPAD_AXIS_RIGHT_Y) {
|
||||
var accessor = (AdvancementsScreenAccessor) advancementsScreen;
|
||||
AdvancementTab tab = accessor.getSelectedTab();
|
||||
tab.move(storage.axis == GLFW_GAMEPAD_AXIS_RIGHT_X ? -storage.value * 1.0 : 0.0, storage.axis == GLFW_GAMEPAD_AXIS_RIGHT_Y ? -storage.value * 5.0 : 0.0);
|
||||
return true;
|
||||
}
|
||||
} else if (screen != null) {
|
||||
if (storage.axis == preferredAxis && !handleListWidgetScrolling(screen.children(), storage.value)) {
|
||||
try {
|
||||
screen.mouseScrolled(0.0, 0.0, 0, -(storage.value * 0.0175f));
|
||||
} catch (NullPointerException ignored) {}
|
||||
} else if (isScreenInteractive(screen)) {
|
||||
if (joystickCooldown == 0) {
|
||||
switch (storage.axis) {
|
||||
case GLFW_GAMEPAD_AXIS_LEFT_Y -> {
|
||||
this.changeFocus(screen, storage.value > 0 ? NavigationDirection.UP : NavigationDirection.DOWN);
|
||||
joystickCooldown = 4;
|
||||
}
|
||||
case GLFW_GAMEPAD_AXIS_LEFT_X -> {
|
||||
this.handleLeftRight(screen, storage.value > 0);
|
||||
joystickCooldown = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void handleRadialMenu(float x, float y) {
|
||||
int index = -1;
|
||||
float border = 0.3f;
|
||||
if (x < -border) {
|
||||
index = 3;
|
||||
if (y < -border) index = 0;
|
||||
else if (y > border) index = 5;
|
||||
} else if (x > border) {
|
||||
index = 4;
|
||||
if (y < -border) index = 2;
|
||||
else if (y > border) index = 7;
|
||||
} else {
|
||||
if (y < -border) index = 1;
|
||||
else if (y > border) index = 6;
|
||||
}
|
||||
if (client.currentScreen instanceof RingScreen && index > -1) RingPage.selected = index;
|
||||
if (PlatformFunctions.isModLoaded("emotecraft") && EmotecraftCompat.isEmotecraftScreen(client.currentScreen)) EmotecraftCompat.handleEmoteSelector(index);
|
||||
}
|
||||
|
||||
public boolean handleListWidgetScrolling(List<? extends Element> children, float value) {
|
||||
return children.stream().filter(element -> element instanceof SpruceEntryListWidget)
|
||||
.map(element -> (SpruceEntryListWidget<?>) element)
|
||||
.filter(AbstractSpruceWidget::isFocusedOrHovered)
|
||||
.anyMatch(element -> {
|
||||
element.mouseScrolled(0.0, 0.0, 0, -value);
|
||||
return true;
|
||||
}) ||
|
||||
children.stream().filter(element -> element instanceof EntryListWidget)
|
||||
.map(element -> (EntryListWidget<?>) element)
|
||||
.filter(element -> element.getType().isFocused())
|
||||
.anyMatch(element -> {
|
||||
element.mouseScrolled(0.0, 0.0, 0, -value);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
public boolean handleAButton(@NotNull Screen screen, @NotNull Element focused) {
|
||||
if (focused instanceof PressableWidget widget) {
|
||||
widget.playDownSound(MinecraftClient.getInstance().getSoundManager());
|
||||
widget.onPress();
|
||||
return true;
|
||||
} else if (focused instanceof AbstractSprucePressableButtonWidget widget) {
|
||||
widget.playDownSound();
|
||||
widget.onPress();
|
||||
return true;
|
||||
} else if (focused instanceof SpruceLabelWidget labelWidget) {
|
||||
labelWidget.onPress();
|
||||
return true;
|
||||
} else if (focused instanceof WorldListWidget list) {
|
||||
list.getSelectedAsOptional().ifPresent(WorldListWidget.WorldEntry::play);
|
||||
return true;
|
||||
} else if (focused instanceof MultiplayerServerListWidget list) {
|
||||
var entry = list.getSelectedOrNull();
|
||||
if (entry instanceof MultiplayerServerListWidget.LanServerEntry || entry instanceof MultiplayerServerListWidget.ServerEntry) {
|
||||
((MultiplayerScreen) screen).select(entry);
|
||||
((MultiplayerScreen) screen).connect();
|
||||
}
|
||||
} else if (focused instanceof SpruceParentWidget) {
|
||||
var childFocused = ((SpruceParentWidget<?>) focused).getFocused();
|
||||
if (childFocused != null)
|
||||
return this.handleAButton(screen, childFocused);
|
||||
} else if (focused instanceof ParentElement widget) {
|
||||
var childFocused = widget.getFocused();
|
||||
if (childFocused != null)
|
||||
return this.handleAButton(screen, childFocused);
|
||||
} else if (PlatformFunctions.isModLoaded("yet-another-config-lib") && YACLCompat.handleAButton(screen, focused)) {
|
||||
return true;
|
||||
}
|
||||
else pressKeyboardKey(screen, GLFW_KEY_ENTER);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the left and right buttons.
|
||||
*
|
||||
* @param screen the current screen
|
||||
* @param right true if the right button is pressed, else false
|
||||
*/
|
||||
private boolean handleLeftRight(@NotNull Screen screen, boolean right) {
|
||||
if (screen instanceof SpruceScreen spruceScreen) {
|
||||
spruceScreen.onNavigation(right ? NavigationDirection.RIGHT : NavigationDirection.LEFT, false);
|
||||
this.actionGuiCooldown = 5;
|
||||
return false;
|
||||
}
|
||||
if (PlatformFunctions.isModLoaded("yet-another-config-lib") && YACLCompat.handleLeftRight(screen, right)) {
|
||||
this.actionGuiCooldown = 5;
|
||||
return false;
|
||||
}
|
||||
var focused = screen.getFocused();
|
||||
if (focused != null)
|
||||
if (this.handleRightLeftElement(focused, right))
|
||||
return this.changeFocus(screen, right ? NavigationDirection.RIGHT : NavigationDirection.LEFT);
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean handleRightLeftElement(@NotNull Element element, boolean right) {
|
||||
switch (element) {
|
||||
case SpruceElement spruceElement -> {
|
||||
if (spruceElement.requiresCursor())
|
||||
return true;
|
||||
return !spruceElement.onNavigation(right ? NavigationDirection.RIGHT : NavigationDirection.LEFT, false);
|
||||
}
|
||||
case SliderWidget slider -> {
|
||||
if (slider.active) {
|
||||
slider.keyPressed(right ? 262 : 263, 0, 0);
|
||||
this.actionGuiCooldown = 2; // Prevent to press too quickly the focused element, so we have to skip 5 ticks.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// case AlwaysSelectedEntryListWidget<?> alwaysSelectedEntryListWidget -> {
|
||||
// //TODO ((EntryListWidgetAccessor) element).midnightcontrols$moveSelection(right ? EntryListWidget.MoveDirection.DOWN : EntryListWidget.MoveDirection.UP);
|
||||
// return false;
|
||||
// }
|
||||
case ParentElement entryList -> {
|
||||
var focused = entryList.getFocused();
|
||||
if (focused == null)
|
||||
return true;
|
||||
return this.handleRightLeftElement(focused, right);
|
||||
}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private double prevX = 0;
|
||||
private double prevY = 0;
|
||||
private double xValue;
|
||||
private AxisStorage.Polarity xPolarity;
|
||||
|
||||
/**
|
||||
* Handles the look direction input.
|
||||
*
|
||||
* @param storage the state of the provided axis
|
||||
*/
|
||||
public void handleLook(AxisStorage storage) {
|
||||
if (client.player == null || !(storage.axis == GLFW_GAMEPAD_AXIS_RIGHT_Y || storage.axis == GLFW_GAMEPAD_AXIS_RIGHT_X)) return;
|
||||
// Handles the look direction.
|
||||
if (MidnightControlsConfig.cameraMode == CameraMode.FLAT) handleFlatLook(storage);
|
||||
else handleAdaptiveLook(storage);
|
||||
MidnightControlsCompat.handleCamera(this.targetYaw, this.targetPitch);
|
||||
}
|
||||
private void handleFlatLook(AxisStorage storage) {
|
||||
if (storage.polarity != AxisStorage.Polarity.ZERO) {
|
||||
double rotation = Math.pow(storage.value, 2.0) * 0.11D * storage.polarity.multiplier;
|
||||
|
||||
if (storage.axis == GLFW_GAMEPAD_AXIS_RIGHT_Y) this.targetPitch = rotation * MidnightControlsConfig.getRightYAxisSign() * MidnightControlsConfig.yAxisRotationSpeed / 2;
|
||||
else this.targetYaw = rotation * MidnightControlsConfig.getRightXAxisSign() * MidnightControlsConfig.rotationSpeed / 2;
|
||||
}
|
||||
}
|
||||
private void handleAdaptiveLook(AxisStorage storage) {
|
||||
if (storage.axis == GLFW_GAMEPAD_AXIS_RIGHT_X) {
|
||||
xValue = storage.value;
|
||||
xPolarity = storage.polarity;
|
||||
}
|
||||
else {
|
||||
double yStep = (MidnightControlsConfig.yAxisRotationSpeed / 50) * 0.6000000238418579 + 0.20000000298023224;
|
||||
double xStep = (MidnightControlsConfig.rotationSpeed / 50) * 0.6000000238418579 + 0.20000000298023224;
|
||||
float yValue = storage.value;
|
||||
AxisStorage.Polarity yPolarity = storage.polarity;
|
||||
|
||||
double cursorDeltaX = 2 * xValue - this.prevX;
|
||||
double cursorDeltaY = 2 * yValue - this.prevY;
|
||||
boolean slowdown = client.options.getPerspective().isFirstPerson() && Objects.requireNonNull(client.player).isUsingSpyglass();
|
||||
double x = cursorDeltaX * xStep * (slowdown ? xStep : 1);
|
||||
double y = cursorDeltaY * yStep * (slowdown ? yStep : 1);
|
||||
|
||||
double powXValue = Math.pow(x, 2.0);
|
||||
double powYValue = Math.pow(y, 2.0);
|
||||
|
||||
if (xPolarity != AxisStorage.Polarity.ZERO) {
|
||||
double sign = MidnightControlsConfig.getRightXAxisSign() * MidnightControlsConfig.rotationSpeed;
|
||||
this.targetYaw = sign * powXValue * 0.11D * xPolarity.multiplier;
|
||||
}
|
||||
if (yPolarity != AxisStorage.Polarity.ZERO) {
|
||||
double sign = MidnightControlsConfig.getRightYAxisSign() * MidnightControlsConfig.yAxisRotationSpeed;
|
||||
this.targetPitch = sign * powYValue * 0.11D * yPolarity.multiplier;
|
||||
}
|
||||
|
||||
this.prevY = yValue;
|
||||
this.prevX = xValue;
|
||||
}
|
||||
}
|
||||
public void handleTouchscreenLook(AxisStorage storage) {
|
||||
if (storage.polarity != AxisStorage.Polarity.ZERO) {
|
||||
double rotation = storage.value * 0.11D * MidnightControlsConfig.touchSpeed/5;
|
||||
|
||||
if (storage.axis == GLFW_GAMEPAD_AXIS_RIGHT_Y) this.targetPitch = rotation;
|
||||
else this.targetYaw = rotation;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean changeFocus(@NotNull Screen screen, NavigationDirection direction) {
|
||||
if (!isScreenInteractive(screen) && !screen.getClass().getCanonicalName().contains("me.jellysquid.mods.sodium.client.gui")) return false;
|
||||
try {
|
||||
if (screen instanceof SpruceScreen spruceScreen) {
|
||||
if (spruceScreen.onNavigation(direction, false)) {
|
||||
this.actionGuiCooldown = 5;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
switch (direction) {
|
||||
case UP -> pressKeyboardKey(screen, GLFW.GLFW_KEY_UP);
|
||||
case DOWN -> pressKeyboardKey(screen, GLFW.GLFW_KEY_DOWN);
|
||||
case LEFT -> pressKeyboardKey(screen, GLFW.GLFW_KEY_LEFT);
|
||||
case RIGHT -> pressKeyboardKey(screen, GLFW.GLFW_KEY_RIGHT);
|
||||
}
|
||||
this.actionGuiCooldown = 5;
|
||||
return true;
|
||||
} catch (Exception exception) {MidnightControls.warn("Unknown exception encountered while trying to change focus: "+exception);}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to go back.
|
||||
*
|
||||
* @param screen the current screen
|
||||
* @return true if successful, else false
|
||||
*/
|
||||
public boolean tryGoBack(@NotNull Screen screen) {
|
||||
var set = ImmutableSet.of("gui.back", "gui.done", "gui.cancel", "gui.toTitle", "gui.toMenu");
|
||||
if (screen instanceof KeybindsScreen) return false;
|
||||
|
||||
return screen.children().stream().filter(element -> element instanceof PressableWidget)
|
||||
.map(element -> (PressableWidget) element)
|
||||
.filter(element -> element.getMessage() != null && element.getMessage().getContent() != null)
|
||||
.anyMatch(element -> {
|
||||
if (element.getMessage().getContent() instanceof TranslatableTextContent translatableText) {
|
||||
if (set.stream().anyMatch(key -> translatableText.getKey().equals(key))) {
|
||||
element.onPress();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isScreenInteractive(@NotNull Screen screen) {
|
||||
return !(screen instanceof HandledScreen || MidnightControlsConfig.joystickAsMouse || MidnightControlsConfig.mouseScreens.stream().anyMatch(a -> screen.getClass().toString().contains(a))
|
||||
|| (screen instanceof SpruceScreen && ((SpruceScreen) screen).requiresCursor())
|
||||
|| MidnightControlsCompat.requireMouseOnScreen(screen));
|
||||
}
|
||||
|
||||
public void pressKeyboardKey(MinecraftClient client, int key) {
|
||||
client.keyboard.onKey(client.getWindow().getHandle(), key, 0, 1, 0);
|
||||
}
|
||||
public void pressKeyboardKey(Screen screen, int key) {
|
||||
screen.keyPressed(key, 0, 1);
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2022 Motschen <motschen@midnightdust.eu>
|
||||
*
|
||||
* This file is part of midnightcontrols.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package eu.midnightdust.midnightcontrols.client.compat;
|
||||
|
||||
import me.juancarloscp52.bedrockify.client.BedrockifyClient;
|
||||
|
||||
/**
|
||||
* Represents HQM compatibility handler.
|
||||
*
|
||||
* @author Motschen
|
||||
* @version 1.7.0
|
||||
* @since 1.7.0
|
||||
*/
|
||||
public class BedrockifyCompat implements CompatHandler {
|
||||
|
||||
@Override
|
||||
public void handle() {
|
||||
BedrockifyClient.getInstance().settings.disableFlyingMomentum = false;
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.compat;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.client.controller.InputManager;
|
||||
import io.github.kosmx.emotes.arch.gui.EmoteMenuImpl;
|
||||
import io.github.kosmx.emotes.arch.gui.screen.ingame.FastChosseScreen;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
|
||||
public class EmotecraftCompat {
|
||||
private static final MinecraftClient client = MinecraftClient.getInstance();
|
||||
|
||||
public static void openEmotecraftScreen(Screen parent) {
|
||||
client.setScreen(new EmoteMenuImpl(parent));
|
||||
}
|
||||
public static boolean isEmotecraftScreen(Screen screen) {
|
||||
return screen instanceof FastChosseScreen;
|
||||
}
|
||||
|
||||
public static void handleEmoteSelector(int index) {
|
||||
if (client.currentScreen instanceof FastChosseScreen) {
|
||||
int x = client.getWindow().getWidth() / 2;
|
||||
int y = client.getWindow().getHeight() / 2;
|
||||
switch (index) {
|
||||
case 0, 3, 5 -> x -= 200;
|
||||
case 2, 4, 7 -> x += 200;
|
||||
}
|
||||
switch (index) {
|
||||
case 0, 1, 2 -> y -= 200;
|
||||
case 5, 6, 7 -> y += 200;
|
||||
}
|
||||
InputManager.queueMousePosition(x, y);
|
||||
|
||||
InputManager.INPUT_MANAGER.updateMousePosition(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.compat;
|
||||
|
||||
import com.kqp.inventorytabs.tabs.TabManager;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||
|
||||
public class InventoryTabsCompat implements CompatHandler {
|
||||
@Override
|
||||
public boolean handleTabs(Screen screen, boolean next) {
|
||||
if (screen instanceof HandledScreen<?> && !(screen instanceof CreativeInventoryScreen)) {
|
||||
TabManager tabManager = TabManager.getInstance();
|
||||
int tabIndex = tabManager.tabs.indexOf(tabManager.currentTab);
|
||||
if (next) {
|
||||
if (tabIndex < tabManager.tabs.size() - 1) tabManager.onTabClick(tabManager.tabs.get(tabIndex + 1));
|
||||
else tabManager.onTabClick(tabManager.tabs.getFirst());
|
||||
} else {
|
||||
if (tabIndex > 0) tabManager.onTabClick(tabManager.tabs.get(tabIndex - 1));
|
||||
else tabManager.onTabClick(tabManager.tabs.getLast());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean handlePages(Screen screen, boolean next) {
|
||||
if (screen instanceof HandledScreen<?> && !(screen instanceof CreativeInventoryScreen)) {
|
||||
TabManager tabManager = TabManager.getInstance();
|
||||
if (next) {
|
||||
if (tabManager.canGoForwardAPage()) {
|
||||
tabManager.setCurrentPage(tabManager.currentPage + 1);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (tabManager.canGoBackAPage()) {
|
||||
tabManager.setCurrentPage(tabManager.currentPage - 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.compat;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.client.compat.mixin.sodium.SodiumOptionsGUIAccessor;
|
||||
import net.caffeinemc.mods.sodium.client.gui.SodiumOptionsGUI;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
|
||||
public class SodiumCompat implements CompatHandler {
|
||||
@Override
|
||||
public boolean handleTabs(Screen screen, boolean direction) {
|
||||
if (screen instanceof SodiumOptionsGUI optionsGUI) {
|
||||
SodiumOptionsGUIAccessor accessor = (SodiumOptionsGUIAccessor) optionsGUI;
|
||||
final int max = accessor.getPages().size()-1;
|
||||
int i = accessor.getPages().indexOf(accessor.getCurrentPage());
|
||||
i = (direction ? ((max > i) ? ++i : 0) : (i > 0 ? --i : max));
|
||||
optionsGUI.setPage(accessor.getPages().get(i));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.compat;
|
||||
|
||||
import dev.isxander.yacl.gui.AbstractWidget;
|
||||
import dev.isxander.yacl.gui.OptionListWidget;
|
||||
import dev.isxander.yacl.gui.YACLScreen;
|
||||
import dev.isxander.yacl.gui.controllers.ControllerWidget;
|
||||
import dev.isxander.yacl.gui.controllers.slider.SliderControllerElement;
|
||||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public class YACLCompat implements CompatHandler {
|
||||
public static boolean handleAButton(Screen screen, Element element) {
|
||||
if (element instanceof AbstractWidget abstractWidget) {
|
||||
// imitate enter key press
|
||||
return abstractWidget.keyPressed(GLFW.GLFW_KEY_ENTER, 0, 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean handleLeftRight(Screen screen, boolean direction) {
|
||||
if (screen instanceof YACLScreen yaclScreen) {
|
||||
SliderControllerElement focusedSlider = yaclScreen.optionList.children().stream()
|
||||
.filter(OptionListWidget.OptionEntry.class::isInstance)
|
||||
.map(entry -> ((OptionListWidget.OptionEntry) entry).widget)
|
||||
.filter(ControllerWidget.class::isInstance)
|
||||
.map(ControllerWidget.class::cast)
|
||||
.filter(SliderControllerElement.class::isInstance)
|
||||
.map(SliderControllerElement.class::cast)
|
||||
.filter(ControllerWidget::isHovered)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (focusedSlider == null)
|
||||
return false;
|
||||
|
||||
focusedSlider.incrementValue(direction ? 1 : -1);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleTabs(Screen screen, boolean direction) {
|
||||
if (screen instanceof YACLScreen yaclScreen) {
|
||||
int categoryIdx = yaclScreen.getCurrentCategoryIdx();
|
||||
if (direction) categoryIdx++; else categoryIdx--;
|
||||
if (categoryIdx < 0) categoryIdx = yaclScreen.config.categories().size() - 1;
|
||||
if (categoryIdx >= yaclScreen.config.categories().size()) categoryIdx = 0;
|
||||
|
||||
yaclScreen.changeCategory(categoryIdx);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,317 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
||||
*
|
||||
* This file is part of midnightcontrols.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package eu.midnightdust.midnightcontrols.client.controller;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.ButtonState;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightInput;
|
||||
import eu.midnightdust.midnightcontrols.client.compat.InventoryTabsCompat;
|
||||
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
|
||||
import eu.midnightdust.midnightcontrols.client.gui.RingScreen;
|
||||
import eu.midnightdust.midnightcontrols.client.touch.gui.TouchscreenOverlay;
|
||||
import eu.midnightdust.midnightcontrols.client.mixin.*;
|
||||
import eu.midnightdust.midnightcontrols.client.util.HandledScreenAccessor;
|
||||
import eu.midnightdust.midnightcontrols.client.util.InventoryUtil;
|
||||
import eu.midnightdust.midnightcontrols.client.util.ToggleSneakSprintUtil;
|
||||
import eu.midnightdust.midnightcontrols.client.util.platform.ItemGroupUtil;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.TitleScreen;
|
||||
import net.minecraft.client.gui.screen.advancement.AdvancementsScreen;
|
||||
import net.minecraft.client.gui.screen.ingame.*;
|
||||
import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget;
|
||||
import net.minecraft.client.gui.widget.TabNavigationWidget;
|
||||
import net.minecraft.client.util.ScreenshotRecorder;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import net.minecraft.screen.slot.SlotActionType;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.client;
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_2;
|
||||
|
||||
/**
|
||||
* Represents some input handlers.
|
||||
*
|
||||
* @author LambdAurora
|
||||
* @version 1.7.0
|
||||
* @since 1.1.0
|
||||
*/
|
||||
public class InputHandlers {
|
||||
private InputHandlers() {
|
||||
}
|
||||
|
||||
public static PressAction handleHotbar(boolean next) {
|
||||
return (client, button, value, action) -> {
|
||||
if (action == ButtonState.RELEASE)
|
||||
return false;
|
||||
|
||||
// When in-game
|
||||
if (client.currentScreen == null && client.player != null) {
|
||||
if (!client.player.isSpectator()) {
|
||||
var inv = client.player.getInventory();
|
||||
if (next)
|
||||
inv.setSelectedSlot(inv.selectedSlot < 8 ? inv.selectedSlot + 1 : inv.selectedSlot - 8);
|
||||
else
|
||||
inv.setSelectedSlot(inv.selectedSlot > 0 ? inv.selectedSlot - 1 : inv.selectedSlot + 8);
|
||||
}
|
||||
else {
|
||||
if (client.inGameHud.getSpectatorHud().isOpen()) {
|
||||
client.inGameHud.getSpectatorHud().cycleSlot(next ? -1 : 1);
|
||||
} else {
|
||||
float g = MathHelper.clamp(client.player.getAbilities().getFlySpeed() + (next ? 1 : -1) * 0.005F, 0.0F, 0.2F);
|
||||
client.player.getAbilities().setFlySpeed(g);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (client.currentScreen instanceof RingScreen) {
|
||||
MidnightControlsClient.ring.cyclePage(next);
|
||||
} else if (client.currentScreen instanceof CreativeInventoryScreenAccessor inventory) {
|
||||
inventory.midnightcontrols$setSelectedTab(ItemGroupUtil.cycleTab(next, client));
|
||||
return true;
|
||||
} else if (client.currentScreen instanceof RecipeBookScreen<?> recipeBookScreen) {
|
||||
RecipeBookWidget<?> recipeBook = ((RecipeBookScreenAccessor) recipeBookScreen).getRecipeBook();
|
||||
|
||||
var recipeBookAccessor = (RecipeBookWidgetAccessor) recipeBook;
|
||||
var tabs = recipeBookAccessor.getTabButtons();
|
||||
var currentTab = recipeBookAccessor.getCurrentTab();
|
||||
if (currentTab == null || !recipeBook.isOpen()) {
|
||||
return MidnightControlsCompat.handleTabs(client.currentScreen, next);
|
||||
}
|
||||
int nextTab = tabs.indexOf(currentTab) + (next ? 1 : -1);
|
||||
if (nextTab < 0)
|
||||
nextTab = tabs.size() - 1;
|
||||
else if (nextTab >= tabs.size())
|
||||
nextTab = 0;
|
||||
currentTab.setToggled(false);
|
||||
recipeBookAccessor.setCurrentTab(currentTab = tabs.get(nextTab));
|
||||
currentTab.setToggled(true);
|
||||
recipeBookScreen.refreshRecipeBook();
|
||||
return true;
|
||||
} else if (client.currentScreen instanceof AdvancementsScreenAccessor screen) {
|
||||
var tabs = screen.getTabs().values().stream().distinct().toList();
|
||||
var tab = screen.getSelectedTab();
|
||||
if (tab == null)
|
||||
return false;
|
||||
for (int i = 0; i < tabs.size(); i++) {
|
||||
if (tabs.get(i).equals(tab)) {
|
||||
int nextTab = i + (next ? 1 : -1);
|
||||
if (nextTab < 0)
|
||||
nextTab = tabs.size() - 1;
|
||||
else if (nextTab >= tabs.size())
|
||||
nextTab = 0;
|
||||
screen.getAdvancementManager().selectTab(tabs.get(nextTab).getRoot().getAdvancementEntry(), true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (client.currentScreen != null && client.currentScreen.children().stream().anyMatch(e -> e instanceof TabNavigationWidget)) {
|
||||
return Lists.newCopyOnWriteArrayList(client.currentScreen.children()).stream().anyMatch(e -> {
|
||||
if (e instanceof TabNavigationWidget tabs) {
|
||||
TabNavigationWidgetAccessor accessor = (TabNavigationWidgetAccessor) tabs;
|
||||
int tabIndex = accessor.getTabs().indexOf(accessor.getTabManager().getCurrentTab());
|
||||
if (next ? tabIndex+1 < accessor.getTabs().size() : tabIndex > 0) {
|
||||
if (next) tabs.selectTab(tabIndex + 1, true);
|
||||
else tabs.selectTab(tabIndex - 1, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
} else return MidnightControlsCompat.handleTabs(client.currentScreen, next);
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
public static PressAction handlePage(boolean next) {
|
||||
return (client, button, value, action) -> {
|
||||
if (action == ButtonState.RELEASE)
|
||||
return false;
|
||||
if (client.currentScreen instanceof CreativeInventoryScreen creativeScreen) {
|
||||
return ItemGroupUtil.cyclePage(next, creativeScreen);
|
||||
}
|
||||
|
||||
|
||||
return MidnightControlsCompat.handlePages(client.currentScreen, next);
|
||||
};
|
||||
}
|
||||
public static PressAction handleExit() {
|
||||
return (client, button, value, action) -> {
|
||||
if (client.currentScreen != null && client.currentScreen.getClass() != TitleScreen.class) {
|
||||
if (!MidnightControlsCompat.handleMenuBack(client, client.currentScreen))
|
||||
if (!MidnightControlsClient.input.tryGoBack(client.currentScreen))
|
||||
client.currentScreen.close();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
public static PressAction handleActions() {
|
||||
return (client, button, value, action) -> {
|
||||
if (!(client.currentScreen instanceof HandledScreen<?> screen)) return false;
|
||||
if (client.interactionManager == null || client.player == null)
|
||||
return false;
|
||||
|
||||
if (MidnightControlsClient.input.inventoryInteractionCooldown > 0)
|
||||
return true;
|
||||
double x = client.mouse.getX() * (double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth();
|
||||
double y = client.mouse.getY() * (double) client.getWindow().getScaledHeight() / (double) client.getWindow().getHeight();
|
||||
|
||||
var accessor = (HandledScreenAccessor) screen;
|
||||
Slot slot = accessor.midnightcontrols$getSlotAt(x, y);
|
||||
|
||||
int slotId;
|
||||
if (slot == null) {
|
||||
if (button.getName().equals("take_all")) {
|
||||
return false;
|
||||
}
|
||||
slotId = accessor.midnightcontrols$isClickOutsideBounds(x, y, accessor.getX(), accessor.getY(), GLFW_MOUSE_BUTTON_1) ? -999 : -1;
|
||||
} else {
|
||||
slotId = slot.id;
|
||||
}
|
||||
var actionType = SlotActionType.PICKUP;
|
||||
int clickData = GLFW.GLFW_MOUSE_BUTTON_1;
|
||||
|
||||
MidnightControlsClient.input.inventoryInteractionCooldown = 5;
|
||||
switch (button.getName()) {
|
||||
case "take_all" -> {
|
||||
if (screen instanceof CreativeInventoryScreen) {
|
||||
if (slot != null && (((CreativeInventoryScreenAccessor) accessor).midnightcontrols$isCreativeInventorySlot(slot) || MidnightControlsCompat.streamCompatHandlers().anyMatch(handler -> handler.isCreativeSlot(screen, slot))))
|
||||
actionType = SlotActionType.CLONE;
|
||||
}
|
||||
}
|
||||
case "take" -> {
|
||||
clickData = GLFW_MOUSE_BUTTON_2;
|
||||
}
|
||||
case "quick_move" -> {
|
||||
actionType = SlotActionType.QUICK_MOVE;
|
||||
}
|
||||
default -> {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
accessor.midnightcontrols$onMouseClick(slot, slotId, clickData, actionType);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
public static boolean handlePauseGame(@NotNull MinecraftClient client, @NotNull ButtonBinding binding, float value, @NotNull ButtonState action) {
|
||||
if (action == ButtonState.PRESS) {
|
||||
// If in game, then pause the game.
|
||||
if (client.currentScreen == null || client.currentScreen instanceof RingScreen)
|
||||
client.openGameMenu(false);
|
||||
else if (client.currentScreen instanceof HandledScreen && client.player != null) // If the current screen is a container then close it.
|
||||
client.player.closeHandledScreen();
|
||||
else // Else just close the current screen.
|
||||
client.currentScreen.close();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the screenshot action.
|
||||
*
|
||||
* @param client the client instance
|
||||
* @param binding the binding which fired the action
|
||||
* @param action the action done on the binding
|
||||
* @return true if handled, else false
|
||||
*/
|
||||
public static boolean handleScreenshot(@NotNull MinecraftClient client, @NotNull ButtonBinding binding, float value, @NotNull ButtonState action) {
|
||||
if (action == ButtonState.RELEASE)
|
||||
ScreenshotRecorder.saveScreenshot(client.runDirectory, client.getFramebuffer(),
|
||||
text -> client.execute(() -> client.inGameHud.getChatHud().addMessage(text)));
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean handleToggleSneak(@NotNull MinecraftClient client, @NotNull ButtonBinding button, float value, @NotNull ButtonState action) {
|
||||
return ToggleSneakSprintUtil.toggleSneak(button);
|
||||
}
|
||||
public static boolean handleToggleSprint(@NotNull MinecraftClient client, @NotNull ButtonBinding button, float value, @NotNull ButtonState action) {
|
||||
return ToggleSneakSprintUtil.toggleSprint(button);
|
||||
}
|
||||
|
||||
public static PressAction handleInventorySlotPad(int direction) {
|
||||
return (client, binding, value, action) -> {
|
||||
if (!(client.currentScreen instanceof HandledScreen<?> inventory && action != ButtonState.RELEASE))
|
||||
return false;
|
||||
|
||||
var accessor = (HandledScreenAccessor) inventory;
|
||||
|
||||
Optional<Slot> closestSlot = InventoryUtil.findClosestSlot(inventory, direction);
|
||||
|
||||
if (closestSlot.isPresent()) {
|
||||
var slot = closestSlot.get();
|
||||
int x = accessor.getX() + slot.x + 8;
|
||||
int y = accessor.getY() + slot.y + 8;
|
||||
InputManager.queueMousePosition(x * (double) client.getWindow().getWidth() / (double) client.getWindow().getScaledWidth(),
|
||||
y * (double) client.getWindow().getHeight() / (double) client.getWindow().getScaledHeight());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns always true to the filter.
|
||||
*
|
||||
* @param binding the affected binding
|
||||
* @return true
|
||||
*/
|
||||
public static boolean always(@NotNull ButtonBinding binding) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the client is in game or not.
|
||||
*
|
||||
* @param binding the affected binding
|
||||
* @return true if the client is in game, else false
|
||||
*/
|
||||
public static boolean inGame(@NotNull ButtonBinding binding) {
|
||||
return (client.currentScreen == null && MidnightControlsClient.input.screenCloseCooldown <= 0) || client.currentScreen instanceof TouchscreenOverlay || client.currentScreen instanceof RingScreen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the client is in a non-interactive screen (which means require mouse input) or not.
|
||||
*
|
||||
* @param binding the affected binding
|
||||
* @return true if the client is in a non-interactive screen, else false
|
||||
*/
|
||||
public static boolean inNonInteractiveScreens(@NotNull ButtonBinding binding) {
|
||||
if (client.currentScreen == null)
|
||||
return false;
|
||||
return !MidnightInput.isScreenInteractive(client.currentScreen);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the client is in an inventory or not.
|
||||
*
|
||||
* @param binding the affected binding
|
||||
* @return true if the client is in an inventory, else false
|
||||
*/
|
||||
public static boolean inInventory(@NotNull ButtonBinding binding) {
|
||||
return client.currentScreen instanceof HandledScreen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the client is in the advancements screen or not.
|
||||
*
|
||||
* @param binding the affected binding
|
||||
* @return true if the client is in the advancements screen, else false
|
||||
*/
|
||||
public static boolean inAdvancements(@NotNull ButtonBinding binding) {
|
||||
return client.currentScreen instanceof AdvancementsScreen;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.enums;
|
||||
|
||||
import net.minecraft.text.Text;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public enum CameraMode {
|
||||
FLAT, ADAPTIVE;
|
||||
public Text getTranslatedText() {
|
||||
return Text.translatable("midnightcontrols.midnightconfig.enum."+this.getClass().getSimpleName()+"."+this.name());
|
||||
}
|
||||
public @NotNull CameraMode next() {
|
||||
var v = values();
|
||||
if (v.length == this.ordinal() + 1)
|
||||
return v[0];
|
||||
return v[this.ordinal() + 1];
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.enums;
|
||||
|
||||
import net.minecraft.text.Text;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public enum TouchMode {
|
||||
CROSSHAIR, FINGER_POS;
|
||||
public Text getTranslatedText() {
|
||||
return Text.translatable("midnightcontrols.midnightconfig.enum."+this.getClass().getSimpleName()+"."+this.name());
|
||||
}
|
||||
public @NotNull TouchMode next() {
|
||||
var v = values();
|
||||
if (v.length == this.ordinal() + 1)
|
||||
return v[0];
|
||||
return v[this.ordinal() + 1];
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
||||
*
|
||||
* This file is part of midnightcontrols.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package eu.midnightdust.midnightcontrols.client.gui;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||
import eu.midnightdust.midnightcontrols.client.ring.RingButtonMode;
|
||||
import eu.midnightdust.midnightcontrols.client.ring.RingPage;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.ring;
|
||||
|
||||
/**
|
||||
* Represents the controls ring screen.
|
||||
*
|
||||
* @author LambdAurora
|
||||
* @version 1.4.3
|
||||
* @since 1.4.3
|
||||
*/
|
||||
public class RingScreen extends Screen {
|
||||
|
||||
public RingScreen() {
|
||||
super(Text.literal("midnightcontrols.menu.title.ring"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
if (ring.getMaxPages() > 1) {
|
||||
this.addDrawableChild(ButtonWidget.builder(Text.of("◀"), button -> ring.cyclePage(false)).dimensions(5, 5, 20, 20).build());
|
||||
this.addDrawableChild(ButtonWidget.builder(Text.of("▶"), button -> ring.cyclePage(true)).dimensions(width - 25, 5, 20, 20).build());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldPause() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
|
||||
RingPage page = ring.getCurrentPage();
|
||||
page.render(context, this.textRenderer, this.width, this.height, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
super.close();
|
||||
assert client != null;
|
||||
client.currentScreen = null;
|
||||
RingPage page = ring.getCurrentPage();
|
||||
if (RingPage.selected >= 0 && page.actions[RingPage.selected] != null)
|
||||
page.actions[RingPage.selected].activate(RingButtonMode.PRESS);
|
||||
RingPage.selected = -1;
|
||||
this.removed();
|
||||
}
|
||||
// @Override
|
||||
// public boolean changeFocus(boolean lookForwards) {
|
||||
// if (lookForwards) {
|
||||
// if (RingPage.selected < 7) ++RingPage.selected;
|
||||
// else RingPage.selected = -1;
|
||||
// }
|
||||
// else {
|
||||
// if (RingPage.selected > -1) --RingPage.selected;
|
||||
// else RingPage.selected = 7;
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean mouseReleased(double mouseX, double mouseY, int button) {
|
||||
if (ring.getCurrentPage().onClick(width, height, (int) mouseX, (int) mouseY)) {
|
||||
this.close();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ChatScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ChatScreen.class)
|
||||
public abstract class ChatScreenMixin extends Screen {
|
||||
@Shadow protected TextFieldWidget chatField;
|
||||
|
||||
protected ChatScreenMixin(Text title) {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "init")
|
||||
private void midnightcontrols$moveInputField(CallbackInfo ci) {
|
||||
if (MidnightControlsConfig.moveChat) chatField.setY(4);
|
||||
}
|
||||
@Inject(method = "render", at = @At("HEAD"))
|
||||
private void midnightcontrols$moveInputFieldBackground(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
if (MidnightControlsConfig.moveChat) context.getMatrices().translate(0f, -this.height + 16, 0f);
|
||||
}
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/TextFieldWidget;render(Lnet/minecraft/client/gui/DrawContext;IIF)V", shift = At.Shift.BEFORE))
|
||||
private void midnightcontrols$dontMoveOtherStuff(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||
if (MidnightControlsConfig.moveChat) context.getMatrices().translate(0f, this.height - 16, 0f);
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
||||
*
|
||||
* This file is part of midnightcontrols.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(DrawContext.class)
|
||||
public interface DrawContextAccessor {
|
||||
@Accessor("vertexConsumers")
|
||||
VertexConsumerProvider.Immediate getVertexConsumers();
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
||||
*
|
||||
* This file is part of midnightcontrols.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.client.gui.MidnightControlsSettingsScreen;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.option.ControlsOptionsScreen;
|
||||
import net.minecraft.client.gui.screen.option.GameOptionsScreen;
|
||||
import net.minecraft.client.gui.widget.OptionListWidget;
|
||||
import net.minecraft.client.gui.widget.TextIconButtonWidget;
|
||||
import net.minecraft.text.Text;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.MidnightControls.id;
|
||||
|
||||
/**
|
||||
* Injects the new controls settings button.
|
||||
*/
|
||||
@Mixin(GameOptionsScreen.class)
|
||||
public abstract class GameOptionsScreenMixin extends Screen {
|
||||
@Shadow @Nullable protected OptionListWidget body;
|
||||
@Unique TextIconButtonWidget midnightcontrols$button = TextIconButtonWidget.builder(Text.translatable("midnightcontrols.menu.title.controller"), (button -> this.client.setScreen(new MidnightControlsSettingsScreen(this, false))), true)
|
||||
.dimension(20,20).texture(id("icon/controller"), 20, 20).build();
|
||||
|
||||
protected GameOptionsScreenMixin(Text title) {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Inject(method = "init", at = @At("TAIL"))
|
||||
public void midnightcontrols$addMCButton(CallbackInfo ci) {
|
||||
if (this.getClass().toString().equals(ControlsOptionsScreen.class.toString())) {
|
||||
this.midnightcontrols$setButtonPos();
|
||||
this.addDrawableChild(midnightcontrols$button);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "refreshWidgetPositions", at = @At("TAIL"))
|
||||
public void midnightcontrols$onResize(CallbackInfo ci) {
|
||||
this.midnightcontrols$setButtonPos();
|
||||
}
|
||||
@Unique
|
||||
public void midnightcontrols$setButtonPos() {
|
||||
if (body != null) {
|
||||
midnightcontrols$button.setPosition(body.getWidth() / 2 + 158, body.getY() + 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
||||
*
|
||||
* This file is part of midnightcontrols.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import eu.midnightdust.midnightcontrols.ControlsMode;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import eu.midnightdust.midnightcontrols.client.gui.MidnightControlsRenderer;
|
||||
import eu.midnightdust.midnightcontrols.client.touch.TouchUtils;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.client.render.RenderTickCounter;
|
||||
import org.joml.Matrix4f;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(GameRenderer.class)
|
||||
public abstract class GameRendererMixin {
|
||||
@Shadow @Final MinecraftClient client;
|
||||
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Mouse;getX()D", shift = At.Shift.BEFORE))
|
||||
private void midnightcontrols$onRender(RenderTickCounter tickCounter, boolean tick, CallbackInfo ci) {
|
||||
if (this.client.currentScreen != null && MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER)
|
||||
MidnightControlsClient.input.onPreRenderScreen(this.client.currentScreen);
|
||||
}
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;draw()V", shift = At.Shift.BEFORE))
|
||||
private void midnightcontrols$renderVirtualCursor(RenderTickCounter tickCounter, boolean tick, CallbackInfo ci, @Local DrawContext drawContext) {
|
||||
MidnightControlsRenderer.renderVirtualCursor(drawContext, client);
|
||||
if (MidnightControlsClient.isWayland) MidnightControlsRenderer.renderWaylandCursor(drawContext, client);
|
||||
drawContext.draw();
|
||||
}
|
||||
@Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/GameRenderer;renderHand:Z"), method = "renderWorld")
|
||||
private void midnigtcontrols$captureMatrices(RenderTickCounter tickCounter, CallbackInfo ci, @Local(ordinal = 1) Matrix4f matrices) {
|
||||
TouchUtils.lastProjMat.set(RenderSystem.getProjectionMatrix());
|
||||
TouchUtils.lastModMat.set(RenderSystem.getModelViewMatrix());
|
||||
TouchUtils.lastWorldSpaceMatrix.set(matrices);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(InputUtil.class)
|
||||
public abstract class InputUtilMixin {
|
||||
|
||||
/**
|
||||
* @author kabliz
|
||||
* @reason This method is static, and there is a terrible UX issue if raw input is turned on at the same time as
|
||||
* eye tracking. Raw input only tracks literal mice and not other devices, leading to the game appearing to be
|
||||
* unresponsive and the player not understanding why. This overwrite preserves the user's mouse preferences,
|
||||
* while not interfering with eye tracking, and the two modes can be switched between during a play session.
|
||||
*/
|
||||
@Inject(method = "isRawMouseMotionSupported", at = @At("HEAD"), cancellable = true)
|
||||
private static void setRawMouseMotionSupported(CallbackInfoReturnable<Boolean> cir) {
|
||||
if (MidnightControlsConfig.eyeTrackerAsMouse) cir.setReturnValue(false);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mixin(KeyBinding.class)
|
||||
public interface KeyBindingIDAccessor {
|
||||
@Accessor @Final
|
||||
static Map<String, KeyBinding> getKEYS_BY_ID() {return null;};
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.client.touch.gui.TouchscreenOverlay;
|
||||
import net.minecraft.client.Keyboard;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(Keyboard.class)
|
||||
public class KeyboardMixin {
|
||||
@Redirect(method = "onKey", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;"))
|
||||
private Screen midnightcontrols$ignoreTouchOverlay(MinecraftClient instance) {
|
||||
if (instance.currentScreen instanceof TouchscreenOverlay) return null;
|
||||
return instance.currentScreen;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||
|
||||
import net.minecraft.client.Mouse;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||
|
||||
@Mixin(Mouse.class)
|
||||
public interface MouseAccessor {
|
||||
@Invoker("onCursorPos")
|
||||
void midnightcontrols$onCursorPos(long window, double x, double y);
|
||||
@Invoker("onMouseButton")
|
||||
void midnightcontrols$onMouseButton(long window, int button, int action, int mods);
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
||||
*
|
||||
* This file is part of midnightcontrols.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.ControlsMode;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import eu.midnightdust.midnightcontrols.client.touch.gui.TouchscreenOverlay;
|
||||
import eu.midnightdust.midnightcontrols.client.touch.TouchInput;
|
||||
import eu.midnightdust.midnightcontrols.client.touch.TouchUtils;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.Mouse;
|
||||
import net.minecraft.client.util.GlfwUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ThrowablePotionItem;
|
||||
import net.minecraft.item.consume.UseAction;
|
||||
import net.minecraft.util.math.Smoother;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import eu.midnightdust.midnightcontrols.client.mouse.EyeTrackerHandler;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsConfig.doMixedInput;
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
|
||||
/**
|
||||
* Adds extra access to the mouse.
|
||||
*/
|
||||
@Mixin(Mouse.class)
|
||||
public abstract class MouseMixin implements MouseAccessor {
|
||||
@Shadow @Final private MinecraftClient client;
|
||||
|
||||
@Shadow private double y;
|
||||
|
||||
@Shadow private double cursorDeltaX;
|
||||
|
||||
@Shadow private double cursorDeltaY;
|
||||
|
||||
@Shadow private double x;
|
||||
|
||||
@Shadow private boolean cursorLocked;
|
||||
|
||||
@Shadow private boolean hasResolutionChanged;
|
||||
|
||||
@Shadow private double glfwTime;
|
||||
|
||||
@Shadow @Final private Smoother cursorXSmoother;
|
||||
|
||||
@Shadow @Final private Smoother cursorYSmoother;
|
||||
|
||||
@Shadow private boolean leftButtonClicked;
|
||||
|
||||
@Inject(method = "onMouseButton", at = @At(value = "HEAD"), cancellable = true)
|
||||
private void midnightcontrols$onMouseButton(long window, int button, int action, int mods, CallbackInfo ci) {
|
||||
if (window != this.client.getWindow().getHandle()) return;
|
||||
if (action == 1 && button == GLFW.GLFW_MOUSE_BUTTON_4 && client.currentScreen != null) {
|
||||
MidnightControlsClient.input.tryGoBack(client.currentScreen);
|
||||
}
|
||||
else if ((client.currentScreen == null && doMixedInput() || client.currentScreen instanceof TouchscreenOverlay) && client.player != null && button == GLFW_MOUSE_BUTTON_1) {
|
||||
double mouseX = x / client.getWindow().getScaleFactor();
|
||||
double mouseY = y / client.getWindow().getScaleFactor();
|
||||
int centerX = client.getWindow().getScaledWidth() / 2;
|
||||
if (action == 1 && mouseY >= (double) (client.getWindow().getScaledHeight() - 22) && mouseX >= (double) (centerX - 90) && mouseX <= (double) (centerX + 90)) {
|
||||
for (int slot = 0; slot < 9; ++slot) {
|
||||
int slotX = centerX - 90 + slot * 20 + 2;
|
||||
if (mouseX >= (double) slotX && mouseX <= (double) (slotX + 20)) {
|
||||
client.player.getInventory().selectedSlot = slot;
|
||||
ci.cancel();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (action == 1) {
|
||||
TouchInput.clickStartTime = System.currentTimeMillis();
|
||||
boolean bl = false;
|
||||
if (client.currentScreen instanceof TouchscreenOverlay overlay) bl = overlay.mouseClicked(mouseX, mouseY, button);
|
||||
if (!bl) TouchInput.firstHitResult = TouchUtils.getTargetedObject(mouseX, mouseY);
|
||||
if (client.currentScreen == null) ci.cancel();
|
||||
}
|
||||
else if (TouchInput.mouseReleased(mouseX, mouseY, button)) ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "isCursorLocked", at = @At("HEAD"), cancellable = true)
|
||||
private void midnightcontrols$isCursorLocked(CallbackInfoReturnable<Boolean> ci) {
|
||||
if (this.client.currentScreen == null) {
|
||||
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && MidnightControlsConfig.virtualMouse) {
|
||||
ci.setReturnValue(true);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "lockCursor", at = @At("HEAD"), cancellable = true)
|
||||
private void midnightcontrols$onCursorLocked(CallbackInfo ci) {
|
||||
if ((MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && MidnightControlsConfig.virtualMouse) ||
|
||||
MidnightControlsConfig.controlsMode == ControlsMode.TOUCHSCREEN || doMixedInput())
|
||||
ci.cancel();
|
||||
}
|
||||
|
||||
@Inject(method = "updateMouse", at = @At("HEAD"), cancellable = true)
|
||||
private void midnightcontrols$updateMouse(CallbackInfo ci) {
|
||||
if (MidnightControlsConfig.eyeTrackerAsMouse && cursorLocked && client.isWindowFocused()) {
|
||||
// Eye Tracking is only for the camera controlling cursor, we need the normal cursor everywhere else.
|
||||
if (!client.options.smoothCameraEnabled) {
|
||||
cursorXSmoother.clear();
|
||||
cursorYSmoother.clear();
|
||||
}
|
||||
EyeTrackerHandler.updateMouseWithEyeTracking(x + cursorDeltaX, y + cursorDeltaY, client,
|
||||
glfwTime, leftButtonClicked, midnightcontrols$isUsingLongRangedTool(), cursorXSmoother, cursorYSmoother);
|
||||
glfwTime = GlfwUtil.getTime();
|
||||
cursorDeltaX = 0.0;
|
||||
cursorDeltaY = 0.0;
|
||||
ci.cancel();
|
||||
}
|
||||
if (doMixedInput() && client.isWindowFocused()) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Unique
|
||||
private boolean midnightcontrols$isUsingLongRangedTool() {
|
||||
if (client.player == null) return false;
|
||||
ItemStack stack = client.player.getActiveItem();
|
||||
return (leftButtonClicked && (stack.getUseAction() == UseAction.BOW || stack.getUseAction() == UseAction.CROSSBOW ||
|
||||
stack.getUseAction() == UseAction.SPEAR || stack.getItem() instanceof ThrowablePotionItem));
|
||||
}
|
||||
|
||||
@Inject(method = "lockCursor", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/InputUtil;setCursorParameters(JIDD)V",shift = At.Shift.BEFORE), cancellable = true)
|
||||
private void midnightcontrols$lockCursor(CallbackInfo ci) {
|
||||
if ((doMixedInput() || MidnightControlsConfig.eyeTrackerAsMouse)) {
|
||||
//In eye tracking mode, we cannot have the cursor locked to the center.
|
||||
GLFW.glfwSetInputMode(client.getWindow().getHandle(), GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
|
||||
client.setScreen(null);
|
||||
hasResolutionChanged = true;
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
||||
*
|
||||
* This file is part of midnightcontrols.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||
|
||||
import net.minecraft.client.gui.screen.ingame.RecipeBookScreen;
|
||||
import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(RecipeBookScreen.class)
|
||||
public interface RecipeBookScreenAccessor {
|
||||
@Accessor("recipeBook")
|
||||
RecipeBookWidget<?> getRecipeBook();
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||
|
||||
import org.thinkingstudio.obsidianui.Position;
|
||||
import eu.midnightdust.midnightcontrols.ControlsMode;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.ButtonState;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.InputHandlers;
|
||||
import eu.midnightdust.midnightcontrols.client.touch.gui.SilentTexturedButtonWidget;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.Drawable;
|
||||
import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.Selectable;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||
import net.minecraft.text.Text;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.client.touch.gui.TouchscreenOverlay.WIDGETS_LOCATION;
|
||||
|
||||
@Mixin(Screen.class)
|
||||
public abstract class ScreenMixin {
|
||||
@Shadow protected abstract <T extends Element & Drawable & Selectable> T addDrawableChild(T drawableElement);
|
||||
|
||||
@Shadow public int width;
|
||||
|
||||
@Inject(method = "init(Lnet/minecraft/client/MinecraftClient;II)V", at = @At("TAIL"))
|
||||
public void midnightcontrols$addCloseButton(MinecraftClient client, int width, int height, CallbackInfo ci) {
|
||||
if (MidnightControlsConfig.controlsMode == ControlsMode.TOUCHSCREEN && (MidnightControlsConfig.closeButtonScreens.stream().anyMatch(s -> this.getClass().getName().startsWith(s) || ((Object)this) instanceof HandledScreen<?>))) {
|
||||
this.addDrawableChild(new SilentTexturedButtonWidget(Position.of(this.width - 30, 10), 20, 20, Text.empty(), btn ->
|
||||
InputHandlers.handleExit().press(client, ButtonBinding.BACK, 0f, ButtonState.PRESS), 20, 160, 20, WIDGETS_LOCATION));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.client.gui.tab.Tab;
|
||||
import net.minecraft.client.gui.tab.TabManager;
|
||||
import net.minecraft.client.gui.widget.TabNavigationWidget;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
||||
@Mixin(TabNavigationWidget.class)
|
||||
public interface TabNavigationWidgetAccessor {
|
||||
@Accessor
|
||||
TabManager getTabManager();
|
||||
@Accessor
|
||||
ImmutableList<Tab> getTabs();
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
||||
*
|
||||
* This file is part of midnightcontrols.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||
|
||||
import eu.midnightdust.lib.util.MidnightColorUtil;
|
||||
import eu.midnightdust.midnightcontrols.ControlsMode;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import eu.midnightdust.midnightcontrols.client.touch.TouchInput;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.TouchMode;
|
||||
import eu.midnightdust.midnightcontrols.client.util.RainbowColor;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.item.ItemUsageContext;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
import net.minecraft.util.math.ColorHelper;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.reacharound;
|
||||
|
||||
/**
|
||||
* Represents a mixin to WorldRenderer.
|
||||
* <p>
|
||||
* Handles the rendering of the block outline of the reach-around features.
|
||||
*/
|
||||
@Mixin(WorldRenderer.class)
|
||||
public abstract class WorldRendererMixin {
|
||||
@Shadow
|
||||
@Final
|
||||
private MinecraftClient client;
|
||||
|
||||
@Shadow
|
||||
private ClientWorld world;
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private BufferBuilderStorage bufferBuilders;
|
||||
|
||||
@Redirect(method = "renderTargetBlockOutline", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/hit/BlockHitResult;getType()Lnet/minecraft/util/hit/HitResult$Type;"))
|
||||
private HitResult.Type dontRenderOutline(BlockHitResult instance) {
|
||||
if (MidnightControlsConfig.controlsMode == ControlsMode.TOUCHSCREEN && MidnightControlsConfig.touchMode == TouchMode.FINGER_POS) {
|
||||
return HitResult.Type.MISS;
|
||||
}
|
||||
return instance.getType();
|
||||
}
|
||||
|
||||
@Inject(
|
||||
method = "renderTargetBlockOutline",
|
||||
at = @At("HEAD")
|
||||
)
|
||||
private void onOutlineRender(Camera camera, VertexConsumerProvider.Immediate vertexConsumers, MatrixStack matrices, boolean translucent, CallbackInfo ci) {
|
||||
if (((MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && MidnightControlsConfig.touchInControllerMode) || MidnightControlsConfig.controlsMode == ControlsMode.TOUCHSCREEN)
|
||||
&& MidnightControlsConfig.touchMode == TouchMode.FINGER_POS) {
|
||||
this.midnightcontrols$renderFingerOutline(matrices, camera);
|
||||
}
|
||||
this.midnightcontrols$renderReacharoundOutline(matrices, camera);
|
||||
}
|
||||
@Unique
|
||||
private void midnightcontrols$renderFingerOutline(MatrixStack matrices, Camera camera) {
|
||||
if (TouchInput.firstHitResult == null || TouchInput.firstHitResult.getType() != HitResult.Type.BLOCK)
|
||||
return;
|
||||
BlockHitResult result = (BlockHitResult) TouchInput.firstHitResult;
|
||||
var blockPos = result.getBlockPos();
|
||||
if (this.world.getWorldBorder().contains(blockPos) && this.client.player != null) {
|
||||
var outlineShape = this.world.getBlockState(blockPos).getOutlineShape(this.client.world, blockPos, ShapeContext.of(camera.getFocusedEntity()));
|
||||
Color rgb = MidnightColorUtil.hex2Rgb(MidnightControlsConfig.touchOutlineColorHex);
|
||||
if (MidnightControlsConfig.touchOutlineColorHex.isEmpty()) rgb = RainbowColor.radialRainbow(1,1);
|
||||
var pos = camera.getPos();
|
||||
matrices.push();
|
||||
var vertexConsumer = this.bufferBuilders.getEntityVertexConsumers().getBuffer(RenderLayer.getLines());
|
||||
VertexRendering.drawOutline(matrices, vertexConsumer, outlineShape, blockPos.getX() - pos.getX(), blockPos.getY() - pos.getY(), blockPos.getZ() - pos.getZ(),
|
||||
ColorHelper.withAlpha(MidnightControlsConfig.touchOutlineColorAlpha, rgb.getRGB()));
|
||||
matrices.pop();
|
||||
}
|
||||
}
|
||||
@Unique
|
||||
private void midnightcontrols$renderReacharoundOutline(MatrixStack matrices, Camera camera) {
|
||||
if (this.client.crosshairTarget == null || this.client.crosshairTarget.getType() != HitResult.Type.MISS || !MidnightControlsConfig.shouldRenderReacharoundOutline)
|
||||
return;
|
||||
var result = reacharound.getLastReacharoundResult();
|
||||
if (result == null)
|
||||
return;
|
||||
var blockPos = result.getBlockPos();
|
||||
if (this.world.getWorldBorder().contains(blockPos) && this.client.player != null) {
|
||||
var stack = this.client.player.getStackInHand(Hand.MAIN_HAND);
|
||||
if (stack == null || !(stack.getItem() instanceof BlockItem))
|
||||
return;
|
||||
|
||||
var block = ((BlockItem) stack.getItem()).getBlock();
|
||||
result = reacharound.withSideForReacharound(result, block);
|
||||
var context = new ItemPlacementContext(new ItemUsageContext(this.client.player, Hand.MAIN_HAND, result));
|
||||
|
||||
var placementState = block.getPlacementState(context);
|
||||
if (placementState == null)
|
||||
return;
|
||||
var pos = camera.getPos();
|
||||
|
||||
var outlineShape = placementState.getOutlineShape(this.client.world, blockPos, ShapeContext.of(camera.getFocusedEntity()));
|
||||
Color rgb = MidnightColorUtil.hex2Rgb(MidnightControlsConfig.reacharoundOutlineColorHex);
|
||||
if (MidnightControlsConfig.reacharoundOutlineColorHex.isEmpty()) rgb = RainbowColor.radialRainbow(1,1);
|
||||
matrices.push();
|
||||
var vertexConsumer = this.bufferBuilders.getEntityVertexConsumers().getBuffer(RenderLayer.getLines());
|
||||
VertexRendering.drawOutline(matrices, vertexConsumer, outlineShape, blockPos.getX() - pos.getX(), blockPos.getY() - pos.getY(), blockPos.getZ() - pos.getZ(),
|
||||
ColorHelper.withAlpha(MidnightControlsConfig.touchOutlineColorAlpha, rgb.getRGB()));
|
||||
matrices.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.mouse;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.util.GlfwUtil;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import net.minecraft.util.math.Smoother;
|
||||
|
||||
public class EyeTrackerHandler {
|
||||
|
||||
/**
|
||||
* Based on the updateMouse method in the Mouse.class, this changes the mouse algorithm to suit eye tracking.
|
||||
* This requires the cursor to not be locked, and the raw input setting to be turned off.
|
||||
*/
|
||||
public static void updateMouseWithEyeTracking(double mouseX, double mouseY, MinecraftClient client, double lastMouseUpdateTime, boolean holdingLeftMouseButton, boolean usingLongRangedTool, Smoother smoothX, Smoother smoothY) {
|
||||
if (client.player == null) return;
|
||||
/* The player wants objects of interest to be moved under the crosshair that is always center of screen.
|
||||
* Normal mouse controls operate with the delta values from the direction of mouse movement,
|
||||
* but in eye tracking we want to use the cursor's actual x,y values (their point of gaze), relative to
|
||||
* the screen center (where the crosshair is). This new eye tracking delta creates a vector that points
|
||||
* from the crosshair to the gaze point. As the player keeps their eyes on the object of interest, we pull
|
||||
* that object into the center until the object is underneath the crosshair.
|
||||
*/
|
||||
double deltaTime = GlfwUtil.getTime() - lastMouseUpdateTime;
|
||||
|
||||
// The center of screen is the new (0,0)
|
||||
double centerX = client.getWindow().getWidth() / 2.0;
|
||||
double centerY = client.getWindow().getHeight() / 2.0;
|
||||
double gazeRawX = mouseX - centerX;
|
||||
double gazeRawY = mouseY - centerY;
|
||||
|
||||
//This part follows the original mouse.java somewhat closely, with different constants
|
||||
double feeling = 2.5;
|
||||
double sensitivity = client.options.getMouseSensitivity().getValue() * feeling;
|
||||
double spyglass = sensitivity * sensitivity * sensitivity;
|
||||
double moveScalar = spyglass * 8.0;
|
||||
|
||||
double frameScalar;
|
||||
if(client.options.getPerspective().isFirstPerson() && client.player.isUsingSpyglass()) {
|
||||
frameScalar = spyglass;
|
||||
} else {
|
||||
frameScalar = moveScalar;
|
||||
}
|
||||
if(holdingLeftMouseButton && !usingLongRangedTool) {
|
||||
frameScalar *= 0.5; //Don't move the camera so much while mining. It's annoying.
|
||||
}
|
||||
|
||||
// The longest vector connects the center to the corner of the screen, so that is our maximum magnitude for
|
||||
// normalization. We use normalized screen size vector for resolution independent control
|
||||
double magnitudeMax = Math.sqrt(centerX*centerX + centerY*centerY);
|
||||
double normalizedX = gazeRawX / magnitudeMax;
|
||||
double normalizedY = gazeRawY / magnitudeMax;
|
||||
|
||||
double moveX = normalizedX * frameScalar;
|
||||
double moveY = normalizedY * frameScalar;
|
||||
if (client.options.smoothCameraEnabled) {
|
||||
moveX = smoothX.smooth(moveX, moveScalar*deltaTime);
|
||||
moveY = smoothY.smooth(moveY, moveScalar*deltaTime);
|
||||
}
|
||||
|
||||
// The player entity's needs their facing rotated.
|
||||
double invertY = 1.0;
|
||||
double moveMagnitude = Math.sqrt(normalizedX*normalizedX + normalizedY*normalizedY);
|
||||
if (client.options.getInvertYMouse().getValue()) {
|
||||
invertY = -1.0;
|
||||
}
|
||||
boolean notInDeadzone = (moveMagnitude > MidnightControlsConfig.eyeTrackerDeadzone) && !usingLongRangedTool;
|
||||
if (client.player != null && notInDeadzone) {
|
||||
client.player.changeLookDirection(moveX, moveY * invertY);
|
||||
client.getTutorialManager().onUpdateMouse(moveX, moveY);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
||||
*
|
||||
* This file is part of midnightcontrols.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package eu.midnightdust.midnightcontrols.client.ring;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.ButtonState;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
||||
import eu.midnightdust.midnightcontrols.client.util.KeyBindingAccessor;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.text.OrderedText;
|
||||
import net.minecraft.text.Text;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class ButtonBindingRingAction extends RingAction {
|
||||
public static final Factory FACTORY = new Factory();
|
||||
public final ButtonBinding binding;
|
||||
|
||||
public ButtonBindingRingAction(@NotNull ButtonBinding binding) {
|
||||
super();
|
||||
this.binding = binding;
|
||||
}
|
||||
|
||||
public @NotNull String getName() {
|
||||
return this.binding.getTranslationKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAction(@NotNull RingButtonMode mode) {
|
||||
binding.handle(MinecraftClient.getInstance(), 1.0f, ButtonState.PRESS);
|
||||
if (binding.asKeyBinding().isPresent()) {
|
||||
binding.asKeyBinding().get().setPressed(true);
|
||||
((KeyBindingAccessor)binding.asKeyBinding().get()).midnightcontrols$press();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawIcon(@NotNull DrawContext context, @NotNull TextRenderer textRenderer, int x, int y, boolean hovered) {
|
||||
List<OrderedText> lines = textRenderer.wrapLines(Text.translatable(this.getName()), MidnightRing.ELEMENT_SIZE);
|
||||
for (int i = 0; i < lines.size(); ++i) {
|
||||
context.drawCenteredTextWithShadow(textRenderer, lines.get(i), x + MidnightRing.ELEMENT_SIZE / 2, y + MidnightRing.ELEMENT_SIZE / 2 - textRenderer.fontHeight / 2 * (lines.size()-1) - textRenderer.fontHeight / 2 + textRenderer.fontHeight * i, 0xffffff);
|
||||
}
|
||||
}
|
||||
|
||||
protected static class Factory implements RingAction.Factory {
|
||||
@Override
|
||||
public @NotNull Supplier<RingAction> newFromGui(@NotNull Screen screen) {
|
||||
return () -> null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable RingAction parse(@NotNull Gson config) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
||||
*
|
||||
* This file is part of midnightcontrols.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package eu.midnightdust.midnightcontrols.client.ring;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.MidnightControls;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.InputManager;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Represents a key binding ring.
|
||||
*
|
||||
* @author LambdAurora
|
||||
* @version 1.7.0
|
||||
* @since 1.4.0
|
||||
*/
|
||||
public final class MidnightRing {
|
||||
public static final int ELEMENT_SIZE = 75;
|
||||
|
||||
private final Map<String, RingAction.Factory> actionFactories = new Object2ObjectOpenHashMap<>();
|
||||
private final List<RingPage> pages = new ArrayList<>(Collections.singletonList(RingPage.DEFAULT));
|
||||
private int currentPage = 0;
|
||||
|
||||
public MidnightRing() {
|
||||
}
|
||||
|
||||
public void registerAction(@NotNull String name, @NotNull RingAction.Factory factory) {
|
||||
if (this.actionFactories.containsKey(name)) {
|
||||
MidnightControls.warn("Tried to register a ring action twice: \"" + name + "\".");
|
||||
return;
|
||||
}
|
||||
this.actionFactories.put(name, factory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the ring from configuration.
|
||||
*/
|
||||
public void loadFromConfig() {
|
||||
List<String> configBindings = MidnightControlsConfig.ringBindings;
|
||||
if (configBindings != null) {
|
||||
this.pages.clear();
|
||||
int bindingIndex = 0;
|
||||
for (int i = 0; i < MathHelper.ceil(configBindings.size() / 8f); ++i) {
|
||||
this.pages.add(new RingPage(i+1 + " / " + MathHelper.ceil(configBindings.size() / 8f)));
|
||||
}
|
||||
|
||||
for (String binding : configBindings) {
|
||||
ButtonBinding buttonBinding = InputManager.getBinding(binding);
|
||||
if (buttonBinding != null) {
|
||||
RingPage page = this.pages.get(MathHelper.floor(bindingIndex / 8f));
|
||||
page.actions[bindingIndex - 8 * (MathHelper.floor(bindingIndex / 8f))] = (new ButtonBindingRingAction(buttonBinding));
|
||||
++bindingIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.pages.isEmpty()) {
|
||||
this.pages.add(RingPage.DEFAULT);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Loads the ring from all unbound keys.
|
||||
*/
|
||||
public void loadFromUnbound() {
|
||||
List<ButtonBinding> unboundBindings = InputManager.getUnboundBindings();
|
||||
if (unboundBindings != null) {
|
||||
this.pages.clear();
|
||||
int bindingIndex = 0;
|
||||
for (int i = 0; i < MathHelper.ceil(unboundBindings.size() / 8f); ++i) {
|
||||
this.pages.add(new RingPage(i+1 + " / " + MathHelper.ceil(unboundBindings.size() / 8f)));
|
||||
}
|
||||
|
||||
for (ButtonBinding buttonBinding : unboundBindings) {
|
||||
if (buttonBinding != null) {
|
||||
RingPage page = this.pages.get(MathHelper.floor(bindingIndex / 8f));
|
||||
page.actions[bindingIndex - 8 * (MathHelper.floor(bindingIndex / 8f))] = (new ButtonBindingRingAction(buttonBinding));
|
||||
++bindingIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.pages.isEmpty()) {
|
||||
this.pages.add(RingPage.DEFAULT);
|
||||
}
|
||||
}
|
||||
public int getMaxPages() {
|
||||
return this.pages.size();
|
||||
}
|
||||
|
||||
public @NotNull RingPage getCurrentPage() {
|
||||
if (this.currentPage >= this.pages.size())
|
||||
this.currentPage = this.pages.size() - 1;
|
||||
else if (this.currentPage < 0)
|
||||
this.currentPage = 0;
|
||||
return this.pages.get(this.currentPage);
|
||||
}
|
||||
public void cyclePage(boolean forwards) {
|
||||
if (forwards) {
|
||||
if (currentPage < pages.size()-1) ++currentPage;
|
||||
else currentPage = 0;
|
||||
} else {
|
||||
if (currentPage > 0) --currentPage;
|
||||
else currentPage = pages.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.touch;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import eu.midnightdust.midnightcontrols.client.touch.gui.TouchscreenOverlay;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.hit.EntityHitResult;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsConfig.doMixedInput;
|
||||
|
||||
public class TouchInput {
|
||||
private static final MinecraftClient client = MinecraftClient.getInstance();
|
||||
public static long clickStartTime;
|
||||
public static HitResult firstHitResult = null;
|
||||
public static boolean isDragging = false;
|
||||
|
||||
public static void tick() {
|
||||
if ((client.currentScreen == null && doMixedInput()) || client.currentScreen instanceof TouchscreenOverlay) {
|
||||
double scaleFactor = client.getWindow().getScaleFactor();
|
||||
if (clickStartTime > 0 && System.currentTimeMillis() - clickStartTime >= MidnightControlsConfig.touchBreakDelay) {
|
||||
mouseHeldDown(client.mouse.getX() / scaleFactor, client.mouse.getY() / scaleFactor);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void mouseHeldDown(double mouseX, double mouseY) {
|
||||
assert client != null;
|
||||
assert client.player != null;
|
||||
assert client.interactionManager != null;
|
||||
|
||||
if (client.player.getMainHandStack() != null && TouchUtils.hasInWorldUseAction(client.player.getMainHandStack())) {
|
||||
client.interactionManager.interactItem(client.player, client.player.getActiveHand());
|
||||
return;
|
||||
}
|
||||
HitResult result = TouchUtils.getTargetedObject(mouseX, mouseY);
|
||||
if (result == null || firstHitResult == null) {
|
||||
client.interactionManager.cancelBlockBreaking();
|
||||
return;
|
||||
}
|
||||
|
||||
if (result instanceof BlockHitResult blockHit && firstHitResult instanceof BlockHitResult firstBlock && blockHit.getBlockPos().equals(firstBlock.getBlockPos())) {
|
||||
if (MidnightControlsConfig.debug) System.out.println(blockHit.getBlockPos().toString());
|
||||
if (client.interactionManager.updateBlockBreakingProgress(blockHit.getBlockPos(), blockHit.getSide())) {
|
||||
client.particleManager.addBlockBreakingParticles(blockHit.getBlockPos(), blockHit.getSide());
|
||||
client.player.swingHand(Hand.MAIN_HAND);
|
||||
} else client.interactionManager.cancelBlockBreaking();
|
||||
firstHitResult = TouchUtils.getTargetedObject(mouseX, mouseY);
|
||||
}
|
||||
else if (result instanceof EntityHitResult entityHit && firstHitResult instanceof EntityHitResult firstEntity && entityHit.getEntity().getUuid().compareTo(firstEntity.getEntity().getUuid()) == 0) {
|
||||
if (client.interactionManager.interactEntity(client.player, entityHit.getEntity(), client.player.getActiveHand()) == ActionResult.SUCCESS) {
|
||||
client.player.swingHand(Hand.MAIN_HAND);
|
||||
}
|
||||
firstHitResult = TouchUtils.getTargetedObject(mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
public static boolean mouseReleased(double mouseX, double mouseY, int button) {
|
||||
isDragging = false;
|
||||
firstHitResult = null;
|
||||
if (client.interactionManager != null) client.interactionManager.cancelBlockBreaking();
|
||||
if ((client.currentScreen == null || !client.currentScreen.mouseReleased(mouseX, mouseY, button)) && System.currentTimeMillis() - clickStartTime < MidnightControlsConfig.touchBreakDelay) {
|
||||
assert client.player != null;
|
||||
assert client.world != null;
|
||||
assert client.interactionManager != null;
|
||||
clickStartTime = -1;
|
||||
|
||||
if (client.player.getMainHandStack() != null && TouchUtils.hasInWorldUseAction(client.player.getMainHandStack())) {
|
||||
client.interactionManager.stopUsingItem(client.player);
|
||||
return true;
|
||||
}
|
||||
HitResult result = TouchUtils.getTargetedObject(mouseX, mouseY);
|
||||
if (result == null) return false;
|
||||
|
||||
|
||||
if (result instanceof BlockHitResult blockHit) {
|
||||
BlockPos blockPos = blockHit.getBlockPos().offset(blockHit.getSide());
|
||||
BlockState state = client.world.getBlockState(blockPos);
|
||||
|
||||
if (client.world.isAir(blockPos) || state.isReplaceable()) {
|
||||
ItemStack stackInHand = client.player.getMainHandStack();
|
||||
int previousStackCount = stackInHand.getCount();
|
||||
var interaction = client.interactionManager.interactBlock(client.player, client.player.getActiveHand(), blockHit);
|
||||
if (interaction.isAccepted()) {
|
||||
//if (interaction.shouldSwingHand()) {
|
||||
client.player.swingHand(client.player.preferredHand);
|
||||
if (!stackInHand.isEmpty() && (stackInHand.getCount() != previousStackCount || client.interactionManager.hasCreativeInventory())) {
|
||||
client.gameRenderer.firstPersonRenderer.resetEquipProgress(client.player.preferredHand);
|
||||
}
|
||||
//}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result instanceof EntityHitResult entityHit) {
|
||||
client.interactionManager.attackEntity(client.player, entityHit.getEntity());
|
||||
client.player.swingHand(Hand.MAIN_HAND);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
clickStartTime = -1;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.touch;
|
||||
|
||||
import eu.midnightdust.lib.util.PlatformFunctions;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.TouchMode;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.Camera;
|
||||
import net.minecraft.entity.projectile.ProjectileUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.consume.UseAction;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.hit.EntityHitResult;
|
||||
import net.minecraft.util.hit.HitResult;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.RaycastContext;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Vector3f;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightReacharound.getPlayerRange;
|
||||
|
||||
public class TouchUtils {
|
||||
private static final MinecraftClient client = MinecraftClient.getInstance();
|
||||
public static final Matrix4f lastWorldSpaceMatrix = new Matrix4f();
|
||||
public static final Matrix4f lastProjMat = new Matrix4f();
|
||||
public static final Matrix4f lastModMat = new Matrix4f();
|
||||
|
||||
public static HitResult getTargetedObject(double mouseX, double mouseY) {
|
||||
if (client.player == null || client.world == null || MidnightControlsConfig.touchMode == TouchMode.CROSSHAIR || PlatformFunctions.isModLoaded("vulkanmod")) {
|
||||
return client.crosshairTarget;
|
||||
}
|
||||
Vec3d near = screenSpaceToWorldSpace(mouseX, mouseY, 0);
|
||||
Vec3d far = screenSpaceToWorldSpace(mouseX, mouseY, 1);
|
||||
|
||||
float playerRange = getPlayerRange(client);
|
||||
EntityHitResult entityCast = ProjectileUtil.raycast(client.player, near, far, Box.from(client.player.getPos()).expand(playerRange), entity -> (!entity.isSpectator() && entity.isAttackable()), playerRange * playerRange);
|
||||
|
||||
if (entityCast != null && entityCast.getType() == HitResult.Type.ENTITY) return entityCast;
|
||||
|
||||
BlockHitResult result = client.world.raycast(new RaycastContext(near, far, RaycastContext.ShapeType.OUTLINE, RaycastContext.FluidHandling.ANY, client.player));
|
||||
|
||||
if (client.player.getPos().distanceTo(result.getPos()) > playerRange) return null;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Taken from https://github.com/0x3C50/Renderer/blob/master/src/main/java/me/x150/renderer/util/RendererUtils.java#L270
|
||||
* Credits to 0x3C50 */
|
||||
public static Vec3d screenSpaceToWorldSpace(double x, double y, double d) {
|
||||
Camera camera = client.getEntityRenderDispatcher().camera;
|
||||
int displayHeight = client.getWindow().getScaledHeight();
|
||||
int displayWidth = client.getWindow().getScaledWidth();
|
||||
int[] viewport = new int[4];
|
||||
GL11.glGetIntegerv(GL11.GL_VIEWPORT, viewport);
|
||||
Vector3f target = new Vector3f();
|
||||
|
||||
Matrix4f matrixProj = new Matrix4f(lastProjMat);
|
||||
Matrix4f matrixModel = new Matrix4f(lastModMat);
|
||||
|
||||
matrixProj.mul(matrixModel)
|
||||
.mul(lastWorldSpaceMatrix)
|
||||
.unproject((float) x / displayWidth * viewport[2],
|
||||
(float) (displayHeight - y) / displayHeight * viewport[3], (float) d, viewport, target);
|
||||
|
||||
return new Vec3d(target.x, target.y, target.z).add(camera.getPos());
|
||||
}
|
||||
|
||||
public static boolean hasInWorldUseAction(ItemStack stack) {
|
||||
UseAction action = stack.getUseAction();
|
||||
return action == UseAction.BOW || action == UseAction.BRUSH || action == UseAction.SPEAR;
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.touch.gui;
|
||||
|
||||
import net.minecraft.item.consume.UseAction;
|
||||
import org.thinkingstudio.obsidianui.Position;
|
||||
import org.thinkingstudio.obsidianui.widget.SpruceButtonWidget;
|
||||
import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import net.minecraft.item.ArmorItem;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
public class ItemUseButtonWidget extends SpruceButtonWidget {
|
||||
|
||||
public ItemUseButtonWidget(Position position, int width, int height, Text message, PressAction action) {
|
||||
super(position, width, height, message, action);
|
||||
}
|
||||
@Override
|
||||
protected void onRelease(double mouseX, double mouseY) {
|
||||
assert client.player != null;
|
||||
assert client.interactionManager != null;
|
||||
UseAction action = client.player.getMainHandStack().getUseAction();
|
||||
if (action == UseAction.SPYGLASS || action == UseAction.TOOT_HORN) client.interactionManager.stopUsingItem(client.player);
|
||||
super.onRelease(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean visible) {
|
||||
if (visible && client.player != null && client.player.getMainHandStack() != null) {
|
||||
UseAction action = client.player.getMainHandStack().getUseAction();
|
||||
if (action == UseAction.EAT) {
|
||||
this.setMessage(Text.translatable(MidnightControlsConstants.NAMESPACE+".action.eat"));
|
||||
} else if (action == UseAction.DRINK) {
|
||||
this.setMessage(Text.translatable(MidnightControlsConstants.NAMESPACE+".action.drink"));
|
||||
} else if (client.player.getMainHandStack().getItem() instanceof ArmorItem) {
|
||||
this.setMessage(Text.translatable(MidnightControlsConstants.NAMESPACE+".action.equip"));
|
||||
} else if (!action.equals(UseAction.NONE)) {
|
||||
this.setMessage(Text.translatable(MidnightControlsConstants.NAMESPACE+".action.use"));
|
||||
}
|
||||
}
|
||||
this.setAlpha(MidnightControlsConfig.touchTransparency / 100f);
|
||||
super.setVisible(visible);
|
||||
}
|
||||
}
|
||||
@@ -1,368 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2021 LambdAurora <aurora42lambda@gmail.com>
|
||||
*
|
||||
* This file is part of midnightcontrols.
|
||||
*
|
||||
* Licensed under the MIT license. For more information,
|
||||
* see the LICENSE file.
|
||||
*/
|
||||
|
||||
package eu.midnightdust.midnightcontrols.client.touch.gui;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.client.touch.TouchInput;
|
||||
import eu.midnightdust.midnightcontrols.client.util.storage.AxisStorage;
|
||||
import net.minecraft.client.gui.screen.ChatScreen;
|
||||
import net.minecraft.client.gui.screen.GameMenuScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.item.ArmorItem;
|
||||
import net.minecraft.item.consume.UseAction;
|
||||
import net.minecraft.util.Arm;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.thinkingstudio.obsidianui.Position;
|
||||
import org.thinkingstudio.obsidianui.widget.SpruceButtonWidget;
|
||||
import eu.midnightdust.lib.util.PlatformFunctions;
|
||||
import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.ButtonState;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.HudSide;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import eu.midnightdust.midnightcontrols.client.compat.EmotecraftCompat;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.InputManager;
|
||||
import eu.midnightdust.midnightcontrols.client.touch.TouchUtils;
|
||||
import eu.midnightdust.midnightcontrols.client.util.KeyBindingAccessor;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
||||
import net.minecraft.client.gui.widget.TextIconButtonWidget;
|
||||
import net.minecraft.client.option.KeyBinding;
|
||||
import net.minecraft.client.texture.MissingSprite;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.util.InputUtil;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.MidnightControls.id;
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.input;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_GAMEPAD_AXIS_RIGHT_X;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_GAMEPAD_AXIS_RIGHT_Y;
|
||||
|
||||
/**
|
||||
* Represents the touchscreen overlay
|
||||
*/
|
||||
public class TouchscreenOverlay extends Screen {
|
||||
public static final Identifier WIDGETS_LOCATION = id("textures/gui/widgets.png");
|
||||
private SilentTexturedButtonWidget inventoryButton;
|
||||
private SilentTexturedButtonWidget swapHandsButton;
|
||||
private SilentTexturedButtonWidget dropButton;
|
||||
private ItemUseButtonWidget useButton;
|
||||
private SilentTexturedButtonWidget jumpButton;
|
||||
private SilentTexturedButtonWidget flyButton;
|
||||
private SilentTexturedButtonWidget flyUpButton;
|
||||
private SilentTexturedButtonWidget flyDownButton;
|
||||
private SilentTexturedButtonWidget forwardButton;
|
||||
private SilentTexturedButtonWidget forwardLeftButton;
|
||||
private SilentTexturedButtonWidget forwardRightButton;
|
||||
private SilentTexturedButtonWidget leftButton;
|
||||
private SilentTexturedButtonWidget rightButton;
|
||||
private SilentTexturedButtonWidget backButton;
|
||||
private SilentTexturedButtonWidget startSneakButton;
|
||||
private SilentTexturedButtonWidget endSneakButton;
|
||||
private int flyButtonEnableTicks = 0;
|
||||
private int forwardButtonTick = 0;
|
||||
|
||||
public TouchscreenOverlay() {
|
||||
super(Text.literal("Touchscreen Overlay"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldPause() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(DrawContext context, int mouseX, int mouseY, float delta) {}
|
||||
|
||||
private void pauseGame() {
|
||||
assert this.client != null;
|
||||
this.client.setScreen(new GameMenuScreen(true));
|
||||
if (this.client.isIntegratedServerRunning() && !Objects.requireNonNull(this.client.getServer()).isRemote()) {
|
||||
this.client.getSoundManager().pauseAll();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the forward button ticks cooldown.
|
||||
*
|
||||
* @param state The button state.
|
||||
*
|
||||
*/
|
||||
private void updateForwardButtonsState(boolean state) {
|
||||
this.forwardButtonTick = state ? -1 : 20;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the jump buttons.
|
||||
*/
|
||||
private void updateJumpButtons() {
|
||||
assert this.client != null;
|
||||
assert this.client.player != null;
|
||||
float transparency = MidnightControlsConfig.touchTransparency / 100f;
|
||||
|
||||
if (this.client.player.getAbilities().flying) {
|
||||
boolean oldStateFly = this.flyButton.isVisible();
|
||||
this.jumpButton.setVisible(false);
|
||||
this.flyButton.setVisible(true);
|
||||
this.flyUpButton.setVisible(true);
|
||||
this.flyDownButton.setVisible(true);
|
||||
this.flyButton.setAlpha(transparency);
|
||||
this.flyUpButton.setAlpha(transparency);
|
||||
this.flyDownButton.setAlpha(transparency);
|
||||
if (oldStateFly != this.flyButton.isVisible()) {
|
||||
this.flyButtonEnableTicks = 5;
|
||||
this.setJump(false);
|
||||
} else if (this.flyButtonEnableTicks > 0)
|
||||
this.flyButtonEnableTicks--;
|
||||
} else {
|
||||
this.jumpButton.setVisible(true);
|
||||
this.flyButton.setVisible(false);
|
||||
this.flyUpButton.setVisible(false);
|
||||
this.flyDownButton.setVisible(false);
|
||||
this.jumpButton.setAlpha(transparency);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the jump button.
|
||||
*
|
||||
* @param btn The pressed button.
|
||||
*/
|
||||
private void handleJump(SpruceButtonWidget btn) {
|
||||
assert this.client != null;
|
||||
((KeyBindingAccessor) this.client.options.jumpKey).midnightcontrols$handlePressState(btn.isActive());
|
||||
}
|
||||
/**
|
||||
* Handles the jump button.
|
||||
*
|
||||
* @param state The state.
|
||||
*/
|
||||
private void setJump(boolean state) {
|
||||
assert this.client != null;
|
||||
((KeyBindingAccessor) this.client.options.jumpKey).midnightcontrols$handlePressState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
assert this.client != null;
|
||||
assert this.client.player != null;
|
||||
assert this.client.interactionManager != null;
|
||||
int scaledWidth = this.client.getWindow().getScaledWidth();
|
||||
int scaledHeight = this.client.getWindow().getScaledHeight();
|
||||
int emoteOffset = 0;
|
||||
if (PlatformFunctions.isModLoaded("emotecraft")) {
|
||||
emoteOffset = 10;
|
||||
TextIconButtonWidget emoteButton = TextIconButtonWidget.builder(Text.empty(), btn -> EmotecraftCompat.openEmotecraftScreen(this), true).width(20).texture(id("touch/emote"), 20, 20).build();
|
||||
emoteButton.setPosition(scaledWidth / 2 - 30, 0);
|
||||
this.addDrawableChild(emoteButton);
|
||||
}
|
||||
|
||||
TextIconButtonWidget chatButton = TextIconButtonWidget.builder(Text.empty(), btn -> this.client.setScreen(new ChatScreen("")), true).width(20).texture(id("touch/chat"), 20, 20).build();
|
||||
chatButton.setPosition(scaledWidth / 2 - 20 + emoteOffset, 0);
|
||||
this.addDrawableChild(chatButton);
|
||||
TextIconButtonWidget pauseButton = TextIconButtonWidget.builder(Text.empty(), btn -> this.pauseGame(), true).width(20).texture(id("touch/pause"), 20, 20).build();
|
||||
pauseButton.setPosition(scaledWidth / 2 + emoteOffset, 0);
|
||||
this.addDrawableChild(pauseButton);
|
||||
// Inventory buttons.
|
||||
int inventoryButtonX = scaledWidth / 2;
|
||||
int inventoryButtonY = scaledHeight - 16 - 5;
|
||||
if (this.client.options.getMainArm().getValue() == Arm.LEFT) {
|
||||
inventoryButtonX = inventoryButtonX - 91 - 24;
|
||||
} else {
|
||||
inventoryButtonX = inventoryButtonX + 91 + 4;
|
||||
}
|
||||
this.addDrawableChild(this.inventoryButton = new SilentTexturedButtonWidget(Position.of(inventoryButtonX, inventoryButtonY), 20, 20, Text.empty(), btn -> {
|
||||
if (this.client.interactionManager.hasRidingInventory()) {
|
||||
this.client.player.openRidingInventory();
|
||||
} else {
|
||||
this.client.getTutorialManager().onInventoryOpened();
|
||||
this.client.setScreen(new InventoryScreen(this.client.player));
|
||||
}
|
||||
}, 20, 0, 20, WIDGETS_LOCATION, 256, 256));
|
||||
;
|
||||
int jumpButtonX, swapHandsX, sneakButtonX;
|
||||
int sneakButtonY = scaledHeight - 10 - 40 - 5;
|
||||
if (MidnightControlsConfig.hudSide == HudSide.LEFT) {
|
||||
jumpButtonX = scaledWidth - 20 - 20;
|
||||
swapHandsX = jumpButtonX - 5 - 40;
|
||||
sneakButtonX = 10 + 20 + 5;
|
||||
} else {
|
||||
jumpButtonX = 20;
|
||||
swapHandsX = jumpButtonX + 5 + 40;
|
||||
sneakButtonX = scaledWidth - 10 - 40 - 5;
|
||||
}
|
||||
// Swap items hand.
|
||||
this.addDrawableChild(this.swapHandsButton = new SilentTexturedButtonWidget(Position.of(swapHandsX, sneakButtonY), 20, 20, Text.empty(),
|
||||
button -> {
|
||||
if (button.isActive()) {
|
||||
if (!this.client.player.isSpectator()) {
|
||||
Objects.requireNonNull(this.client.getNetworkHandler()).sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.SWAP_ITEM_WITH_OFFHAND, BlockPos.ORIGIN, Direction.DOWN));
|
||||
}
|
||||
}
|
||||
},0, 160, 20, WIDGETS_LOCATION));
|
||||
// Drop
|
||||
this.addDrawableChild(this.dropButton = new SilentTexturedButtonWidget(Position.of(swapHandsX, sneakButtonY + 5 + 20), 20, 20, Text.empty(), btn -> {
|
||||
if (btn.isActive() && !client.player.isSpectator() && client.player.dropSelectedItem(false)) {
|
||||
client.player.swingHand(Hand.MAIN_HAND);
|
||||
}
|
||||
}, 20, 160, 20, WIDGETS_LOCATION));
|
||||
// Use
|
||||
this.addDrawableChild(this.useButton = new ItemUseButtonWidget(Position.of(width/2-25, height - 70), 50, 17, Text.translatable(MidnightControlsConstants.NAMESPACE+".action.eat"), btn ->
|
||||
client.interactionManager.interactItem(client.player, client.player.getActiveHand())));
|
||||
// Jump keys
|
||||
this.addDrawableChild(this.jumpButton = new SilentTexturedButtonWidget(Position.of(jumpButtonX, sneakButtonY), 20, 20, Text.empty(), this::handleJump, 0, 40, 20, WIDGETS_LOCATION));
|
||||
this.addDrawableChild(this.flyButton = new SilentTexturedButtonWidget(Position.of(jumpButtonX, sneakButtonY), 20, 20, Text.empty(),btn -> {
|
||||
if (this.flyButtonEnableTicks == 0) this.client.player.getAbilities().flying = false;
|
||||
}, 20, 40, 20, WIDGETS_LOCATION)
|
||||
);
|
||||
this.addDrawableChild(this.flyUpButton = new SilentTexturedButtonWidget(Position.of(jumpButtonX, sneakButtonY - 5 - 20), 20, 20,Text.empty(),
|
||||
this::handleJump, 40, 40, 20, WIDGETS_LOCATION
|
||||
));
|
||||
this.addDrawableChild(this.flyDownButton = new SilentTexturedButtonWidget(Position.of(jumpButtonX, sneakButtonY + 20 + 5), 20, 20, Text.empty(),
|
||||
btn -> ((KeyBindingAccessor) this.client.options.sneakKey).midnightcontrols$handlePressState(btn.isActive()), 60, 40, 20, WIDGETS_LOCATION
|
||||
));
|
||||
this.updateJumpButtons();
|
||||
// Movements keys
|
||||
this.addDrawableChild((this.startSneakButton = new SilentTexturedButtonWidget(Position.of(sneakButtonX, sneakButtonY), 20, 20, Text.empty(), btn -> {
|
||||
if (btn.isActive()) {
|
||||
((KeyBindingAccessor) this.client.options.sneakKey).midnightcontrols$handlePressState(true);
|
||||
this.startSneakButton.setVisible(false);
|
||||
this.endSneakButton.setVisible(true);
|
||||
}
|
||||
}, 0, 120, 20, WIDGETS_LOCATION))
|
||||
);
|
||||
this.addDrawableChild((this.endSneakButton = new SilentTexturedButtonWidget(Position.of(sneakButtonX, sneakButtonY), 20, 20, Text.empty(), btn -> {
|
||||
if (btn.isActive()) {
|
||||
((KeyBindingAccessor) this.client.options.sneakKey).midnightcontrols$handlePressState(false);
|
||||
this.endSneakButton.setVisible(false);
|
||||
this.startSneakButton.setVisible(true);
|
||||
}
|
||||
}, 20, 120, 20, WIDGETS_LOCATION)));
|
||||
this.addDrawableChild(this.forwardLeftButton = new SilentTexturedButtonWidget(Position.of(sneakButtonX - 20 - 5, sneakButtonY - 5 - 20), 20, 20, Text.empty(), btn -> {
|
||||
((KeyBindingAccessor) this.client.options.forwardKey).midnightcontrols$handlePressState(btn.isActive());
|
||||
((KeyBindingAccessor) this.client.options.leftKey).midnightcontrols$handlePressState(btn.isActive());
|
||||
this.updateForwardButtonsState(btn.isActive());
|
||||
}, 80, 80, 20, WIDGETS_LOCATION
|
||||
));
|
||||
this.addDrawableChild(this.forwardButton = new SilentTexturedButtonWidget(Position.of(sneakButtonX, sneakButtonY - 5 - 20), 20, 20, Text.empty(), btn -> {
|
||||
((KeyBindingAccessor) this.client.options.forwardKey).midnightcontrols$handlePressState(btn.isActive());
|
||||
this.updateForwardButtonsState(btn.isActive());
|
||||
this.forwardLeftButton.setVisible(true);
|
||||
this.forwardRightButton.setVisible(true);
|
||||
}, 0, 80, 20, WIDGETS_LOCATION
|
||||
));
|
||||
this.addDrawableChild(this.forwardRightButton = new SilentTexturedButtonWidget(Position.of(sneakButtonX + 20 + 5, sneakButtonY - 5 - 20), 20, 20, Text.empty(), btn -> {
|
||||
((KeyBindingAccessor) this.client.options.forwardKey).midnightcontrols$handlePressState(btn.isActive());
|
||||
((KeyBindingAccessor) this.client.options.rightKey).midnightcontrols$handlePressState(btn.isActive());
|
||||
this.updateForwardButtonsState(btn.isActive());
|
||||
}, 100, 80, 20, WIDGETS_LOCATION
|
||||
));
|
||||
|
||||
this.addDrawableChild(this.rightButton =new SilentTexturedButtonWidget(Position.of(sneakButtonX + 20 + 5, sneakButtonY), 20, 20, Text.empty(),
|
||||
btn -> ((KeyBindingAccessor) this.client.options.rightKey).midnightcontrols$handlePressState(btn.isActive()), 20, 80, 20, WIDGETS_LOCATION
|
||||
));
|
||||
this.addDrawableChild(this.backButton = new SilentTexturedButtonWidget(Position.of(sneakButtonX, sneakButtonY + 20 + 5), 20, 20, Text.empty(),
|
||||
btn -> ((KeyBindingAccessor) this.client.options.backKey).midnightcontrols$handlePressState(btn.isActive()), 40, 80, 20, WIDGETS_LOCATION
|
||||
));
|
||||
this.addDrawableChild(this.leftButton = new SilentTexturedButtonWidget(Position.of(sneakButtonX - 20 - 5, sneakButtonY), 20, 20, Text.empty(),
|
||||
btn -> ((KeyBindingAccessor) this.client.options.leftKey).midnightcontrols$handlePressState(btn.isActive()), 60, 80, 20, WIDGETS_LOCATION
|
||||
));
|
||||
initCustomButtons(true);
|
||||
initCustomButtons(false);
|
||||
|
||||
this.setButtonProperties(MidnightControlsConfig.touchTransparency / 100f);
|
||||
}
|
||||
private void initCustomButtons(boolean left) {
|
||||
assert client != null;
|
||||
Identifier emptySprite = id("touch/empty");
|
||||
List<String> list = left ? MidnightControlsConfig.leftTouchBinds : MidnightControlsConfig.rightTouchBinds;
|
||||
Sprite missingSprite = client.getGuiAtlasManager().getSprite(MissingSprite.getMissingSpriteId());
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
String bindName = list.get(i);
|
||||
ButtonBinding binding = InputManager.getBinding(bindName);
|
||||
if (binding == null) continue;
|
||||
boolean hasTexture = client.getGuiAtlasManager().getSprite(id("binding/"+bindName)) != missingSprite;
|
||||
if (MidnightControlsConfig.debug) System.out.println(left +" "+id("binding/"+bindName)+" "+ hasTexture);
|
||||
var button = TextIconButtonWidget.builder(Text.translatable(binding.getTranslationKey()), b -> binding.handle(client, 1, ButtonState.PRESS), hasTexture)
|
||||
.texture(hasTexture ? id("binding/"+bindName) : emptySprite, 20, 20).dimension(20, 20).build();
|
||||
button.setPosition(left ? (3+(i*23)) : this.width-(23+(i*23)), 3);
|
||||
button.setAlpha(MidnightControlsConfig.touchTransparency / 100f);
|
||||
this.addDrawableChild(button);
|
||||
}
|
||||
}
|
||||
private void setButtonProperties(float transparency) {
|
||||
this.inventoryButton.setAlpha(transparency);
|
||||
this.dropButton.setAlpha(transparency);
|
||||
this.swapHandsButton.setAlpha(transparency);
|
||||
this.jumpButton.setAlpha(transparency);
|
||||
this.flyButton.setAlpha(transparency);
|
||||
this.flyUpButton.setAlpha(transparency);
|
||||
this.useButton.setAlpha(Math.min(transparency+0.1f, 1.0f));
|
||||
this.flyDownButton.setAlpha(transparency);
|
||||
this.startSneakButton.setAlpha(transparency);
|
||||
this.endSneakButton.setAlpha(transparency);
|
||||
this.forwardButton.setAlpha(transparency);
|
||||
this.forwardLeftButton.setAlpha(Math.max(0.05f, transparency-0.1f));
|
||||
this.forwardRightButton.setAlpha(Math.max(0.05f, transparency-0.1f));
|
||||
this.leftButton.setAlpha(transparency);
|
||||
this.rightButton.setAlpha(transparency);
|
||||
this.backButton.setAlpha(transparency);
|
||||
this.useButton.setAlpha(Math.min(transparency+0.1f, 1.0f));
|
||||
this.endSneakButton.setVisible(false);
|
||||
this.forwardLeftButton.setVisible(false);
|
||||
this.forwardRightButton.setVisible(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
assert this.client != null;
|
||||
assert this.client.interactionManager != null;
|
||||
assert this.client.player != null;
|
||||
|
||||
if (this.forwardButtonTick > 0) {
|
||||
--this.forwardButtonTick;
|
||||
} else {
|
||||
this.forwardLeftButton.setVisible(false);
|
||||
this.forwardRightButton.setVisible(false);
|
||||
}
|
||||
this.useButton.setVisible(client.player.getMainHandStack() != null && (client.player.getMainHandStack().getUseAction() != UseAction.NONE || client.player.getMainHandStack().getItem() instanceof ArmorItem) && !TouchUtils.hasInWorldUseAction(client.player.getMainHandStack()));
|
||||
this.updateJumpButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
|
||||
if (button == GLFW.GLFW_MOUSE_BUTTON_1 && this.client != null) {
|
||||
if (TouchInput.isDragging) {
|
||||
if (!MidnightControlsConfig.invertTouch) {
|
||||
deltaX = -deltaX;
|
||||
deltaY = -deltaY;
|
||||
}
|
||||
input.handleTouchscreenLook(AxisStorage.of(GLFW_GAMEPAD_AXIS_RIGHT_Y, (float) deltaY, 0.25d));
|
||||
input.handleTouchscreenLook(AxisStorage.of(GLFW_GAMEPAD_AXIS_RIGHT_X, (float) deltaX, 0.25d));
|
||||
}
|
||||
else TouchInput.isDragging = true;
|
||||
}
|
||||
return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
|
||||
}
|
||||
@Override
|
||||
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
||||
KeyBinding.onKeyPressed(InputUtil.fromKeyCode(keyCode, scanCode));
|
||||
super.keyPressed(keyCode,scanCode,modifiers);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.util;
|
||||
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.ingame.HandledScreen;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import org.aperlambda.lambdacommon.utils.Pair;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.client;
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.input;
|
||||
|
||||
public class InventoryUtil {
|
||||
// Finds the closest slot in the GUI within 14 pixels.
|
||||
public static Optional<Slot> findClosestSlot(HandledScreen<?> inventory, int direction) {
|
||||
var accessor = (HandledScreenAccessor) inventory;
|
||||
int guiLeft = accessor.getX();
|
||||
int guiTop = accessor.getY();
|
||||
double mouseX = client.mouse.getX() * (double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth();
|
||||
double mouseY = client.mouse.getY() * (double) client.getWindow().getScaledHeight() / (double) client.getWindow().getHeight();
|
||||
// Finds the hovered slot.
|
||||
var mouseSlot = accessor.midnightcontrols$getSlotAt(mouseX, mouseY);
|
||||
return inventory.getScreenHandler().slots.parallelStream()
|
||||
.filter(Predicate.isEqual(mouseSlot).negate())
|
||||
.map(slot -> {
|
||||
int posX = guiLeft + slot.x + 8;
|
||||
int posY = guiTop + slot.y + 8;
|
||||
|
||||
int otherPosX = (int) mouseX;
|
||||
int otherPosY = (int) mouseY;
|
||||
if (mouseSlot != null) {
|
||||
otherPosX = guiLeft + mouseSlot.x + 8;
|
||||
otherPosY = guiTop + mouseSlot.y + 8;
|
||||
}
|
||||
|
||||
// Distance between the slot and the cursor.
|
||||
double distance = Math.sqrt(Math.pow(posX - otherPosX, 2) + Math.pow(posY - otherPosY, 2));
|
||||
return Pair.of(slot, distance);
|
||||
}).filter(entry -> {
|
||||
var slot = entry.key;
|
||||
int posX = guiLeft + slot.x + 8;
|
||||
int posY = guiTop + slot.y + 8;
|
||||
int otherPosX = (int) mouseX;
|
||||
int otherPosY = (int) mouseY;
|
||||
if (mouseSlot != null) {
|
||||
otherPosX = guiLeft + mouseSlot.x + 8;
|
||||
otherPosY = guiTop + mouseSlot.y + 8;
|
||||
}
|
||||
if (direction == 0)
|
||||
return posY < otherPosY;
|
||||
else if (direction == 1)
|
||||
return posY > otherPosY;
|
||||
else if (direction == 2)
|
||||
return posX > otherPosX;
|
||||
else if (direction == 3)
|
||||
return posX < otherPosX;
|
||||
else
|
||||
return false;
|
||||
})
|
||||
.min(Comparator.comparingDouble(p -> p.value))
|
||||
.map(p -> p.key);
|
||||
}
|
||||
|
||||
private static int targetMouseX = 0;
|
||||
private static int targetMouseY = 0;
|
||||
|
||||
// Inspired from https://github.com/MrCrayfish/Controllable/blob/1.14.X/src/main/java/com/mrcrayfish/controllable/client/ControllerInput.java#L686.
|
||||
public static void moveMouseToClosestSlot(@Nullable Screen screen) {
|
||||
// Makes the mouse attracted to slots. This helps with selecting items when using a controller.
|
||||
if (screen instanceof HandledScreen<?> inventoryScreen) {
|
||||
var accessor = (HandledScreenAccessor) inventoryScreen;
|
||||
int guiLeft = accessor.getX();
|
||||
int guiTop = accessor.getY();
|
||||
int mouseX = (int) (targetMouseX * (double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth());
|
||||
int mouseY = (int) (targetMouseY * (double) client.getWindow().getScaledHeight() / (double) client.getWindow().getHeight());
|
||||
|
||||
// Finds the closest slot in the GUI within 14 pixels.
|
||||
Optional<net.minecraft.util.Pair<Slot, Double>> closestSlot = inventoryScreen.getScreenHandler().slots.parallelStream()
|
||||
.map(slot -> {
|
||||
int x = guiLeft + slot.x + 8;
|
||||
int y = guiTop + slot.y + 8;
|
||||
|
||||
// Distance between the slot and the cursor.
|
||||
double distance = Math.sqrt(Math.pow(x - mouseX, 2) + Math.pow(y - mouseY, 2));
|
||||
return new net.minecraft.util.Pair<>(slot, distance);
|
||||
}).filter(entry -> entry.getRight() <= 14.0)
|
||||
.min(Comparator.comparingDouble(net.minecraft.util.Pair::getRight));
|
||||
|
||||
if (closestSlot.isPresent() && client.player != null) {
|
||||
var slot = closestSlot.get().getLeft();
|
||||
if (slot.hasStack() || !client.player.getInventory().getMainHandStack().isEmpty()) {
|
||||
int slotCenterXScaled = guiLeft + slot.x + 8;
|
||||
int slotCenterYScaled = guiTop + slot.y + 8;
|
||||
int slotCenterX = (int) (slotCenterXScaled / ((double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth()));
|
||||
int slotCenterY = (int) (slotCenterYScaled / ((double) client.getWindow().getScaledHeight() / (double) client.getWindow().getHeight()));
|
||||
double deltaX = slotCenterX - targetMouseX;
|
||||
double deltaY = slotCenterY - targetMouseY;
|
||||
|
||||
if (mouseX != slotCenterXScaled || mouseY != slotCenterYScaled) {
|
||||
targetMouseX += (int) (deltaX * 0.75);
|
||||
targetMouseY += (int) (deltaY * 0.75);
|
||||
} else {
|
||||
input.mouseSpeedX *= 0.3F;
|
||||
input.mouseSpeedY *= 0.3F;
|
||||
}
|
||||
input.mouseSpeedX *= .75F;
|
||||
input.mouseSpeedY *= .75F;
|
||||
} else {
|
||||
input.mouseSpeedX *= .1F;
|
||||
input.mouseSpeedY *= .1F;
|
||||
}
|
||||
} else {
|
||||
input.mouseSpeedX *= .3F;
|
||||
input.mouseSpeedY *= .3F;
|
||||
}
|
||||
} else {
|
||||
input.mouseSpeedX = 0.F;
|
||||
input.mouseSpeedY = 0.F;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.util;
|
||||
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class MathUtil {
|
||||
public static class PolarUtil {
|
||||
public float polarX;
|
||||
public float polarY;
|
||||
public PolarUtil() {}
|
||||
|
||||
public void calculate(float x, float y, float speedFactor) {
|
||||
calculate(x, y, speedFactor, 0);
|
||||
}
|
||||
public void calculate(float x, float y, float speedFactor, double deadZone) {
|
||||
double inputR = Math.pow(x, 2) + Math.pow(y, 2);
|
||||
inputR = (Math.abs(speedFactor * MathHelper.clamp(inputR,0.f,1.f)));
|
||||
inputR = inputR < deadZone ? 0f : (inputR-deadZone) / (1f-deadZone);
|
||||
double inputTheta = Math.atan2(y, x);
|
||||
polarX = (float) (inputR *Math.cos(inputTheta));
|
||||
polarY = (float) (inputR *Math.sin(inputTheta));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.util;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class RainbowColor {
|
||||
public static float hue;
|
||||
public static void tick() {
|
||||
if (hue > 1) hue = 0f;
|
||||
hue = hue + 0.01f;
|
||||
}
|
||||
|
||||
public static Color radialRainbow(float saturation, float brightness) {
|
||||
return Color.getHSBColor(hue, saturation, brightness);
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.util;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.client;
|
||||
|
||||
public class ToggleSneakSprintUtil {
|
||||
public static boolean toggleSneak(ButtonBinding button) {
|
||||
if (client.player == null) return false;
|
||||
boolean isFlying = client.player.getAbilities().flying;
|
||||
var option = client.options.getSneakToggled();
|
||||
|
||||
button.asKeyBinding().ifPresent(binding -> {
|
||||
boolean sneakToggled = option.getValue();
|
||||
if (isFlying && sneakToggled)
|
||||
option.setValue(false);
|
||||
else if (MidnightControlsConfig.controllerToggleSneak != sneakToggled)
|
||||
option.setValue(!sneakToggled);
|
||||
binding.setPressed(button.isPressed());
|
||||
if (isFlying && sneakToggled)
|
||||
option.setValue(true);
|
||||
else if (MidnightControlsConfig.controllerToggleSneak != sneakToggled)
|
||||
option.setValue(sneakToggled);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
public static boolean toggleSprint(ButtonBinding button) {
|
||||
if (client.player == null) return false;
|
||||
boolean isFlying = client.player.getAbilities().flying;
|
||||
var option = client.options.getSprintToggled();
|
||||
|
||||
button.asKeyBinding().ifPresent(binding -> {
|
||||
boolean sprintToggled = option.getValue();
|
||||
if (isFlying && sprintToggled)
|
||||
option.setValue(false);
|
||||
else if (MidnightControlsConfig.controllerToggleSprint != sprintToggled)
|
||||
option.setValue(!sprintToggled);
|
||||
binding.setPressed(button.isPressed());
|
||||
if (client.player.getAbilities().flying && sprintToggled)
|
||||
option.setValue(true);
|
||||
else if (MidnightControlsConfig.controllerToggleSprint != sprintToggled)
|
||||
option.setValue(sprintToggled);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.util.platform;
|
||||
|
||||
import dev.architectury.injectables.annotations.ExpectPlatform;
|
||||
import eu.midnightdust.midnightcontrols.client.mixin.CreativeInventoryScreenAccessor;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
|
||||
import net.minecraft.client.gui.widget.PressableWidget;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemGroups;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemGroupUtil {
|
||||
@ExpectPlatform
|
||||
public static List<ItemGroup> getVisibleGroups(CreativeInventoryScreen screen) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
public static boolean cyclePage(boolean next, CreativeInventoryScreen screen) {
|
||||
try {
|
||||
return screen.children().stream().filter(element -> element instanceof PressableWidget)
|
||||
.map(element -> (PressableWidget) element)
|
||||
.filter(element -> element.getMessage() != null && element.getMessage().getContent() != null)
|
||||
.anyMatch(element -> {
|
||||
if (next && element.getMessage().getString().equals(">")) {
|
||||
element.onPress();
|
||||
return true;
|
||||
} else if (element.getMessage().getString().equals("<")) {
|
||||
element.onPress();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
} catch (Exception ignored) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static @NotNull ItemGroup cycleTab(boolean next, MinecraftClient client) {
|
||||
ItemGroup currentTab = CreativeInventoryScreenAccessor.getSelectedTab();
|
||||
int currentColumn = currentTab.getColumn();
|
||||
ItemGroup.Row currentRow = currentTab.getRow();
|
||||
ItemGroup newTab = null;
|
||||
List<ItemGroup> visibleTabs = ItemGroupUtil.getVisibleGroups((CreativeInventoryScreen) client.currentScreen);
|
||||
for (ItemGroup tab : visibleTabs) {
|
||||
if (tab.getRow().equals(currentRow) && ((newTab == null && ((next && tab.getColumn() > currentColumn) ||
|
||||
(!next && tab.getColumn() < currentColumn))) || (newTab != null && ((next && tab.getColumn() > currentColumn && tab.getColumn() < newTab.getColumn()) ||
|
||||
(!next && tab.getColumn() < currentColumn && tab.getColumn() > newTab.getColumn())))))
|
||||
newTab = tab;
|
||||
}
|
||||
if (newTab == null)
|
||||
for (ItemGroup tab : visibleTabs) {
|
||||
if ((tab.getRow().compareTo(currentRow)) != 0 && ((next && newTab == null || next && newTab.getColumn() > tab.getColumn()) || (!next && newTab == null) || (!next && newTab.getColumn() < tab.getColumn())))
|
||||
newTab = tab;
|
||||
}
|
||||
if (newTab == null) {
|
||||
for (ItemGroup tab : visibleTabs) {
|
||||
if ((next && tab.getRow() == ItemGroup.Row.TOP && tab.getColumn() == 0) ||
|
||||
!next && tab.getRow() == ItemGroup.Row.BOTTOM && (newTab == null || tab.getColumn() > newTab.getColumn()))
|
||||
newTab = tab;
|
||||
}
|
||||
}
|
||||
if (newTab == null || newTab.equals(currentTab)) newTab = ItemGroups.getDefaultTab();
|
||||
return newTab;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.util.platform;
|
||||
|
||||
import dev.architectury.injectables.annotations.ExpectPlatform;
|
||||
import net.minecraft.network.packet.CustomPayload;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
|
||||
public class NetworkUtil {
|
||||
@ExpectPlatform
|
||||
public static void sendPacketC2S(Packet<?> packet) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
@ExpectPlatform
|
||||
public static void sendPayloadC2S(CustomPayload payload) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.util.storage;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
||||
import eu.midnightdust.midnightcontrols.client.enums.ButtonState;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightInput.BUTTON_COOLDOWNS;
|
||||
import static eu.midnightdust.midnightcontrols.client.controller.InputManager.STATES;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_GAMEPAD_AXIS_LEFT_TRIGGER;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_GAMEPAD_AXIS_LEFT_X;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_GAMEPAD_AXIS_LEFT_Y;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER;
|
||||
|
||||
public class AxisStorage {
|
||||
public final int axis;
|
||||
public float value, absValue;
|
||||
public final double deadZone;
|
||||
public final Polarity polarity;
|
||||
public final boolean isTrigger;
|
||||
public final ButtonState buttonState;
|
||||
|
||||
// Used for joysticks
|
||||
public static AxisStorage of(int axis, float value) {
|
||||
return new AxisStorage(axis, value, isLeftAxis(axis) ? MidnightControlsConfig.leftDeadZone : MidnightControlsConfig.rightDeadZone);
|
||||
}
|
||||
public static AxisStorage of(int axis, float value, double deadZone) {
|
||||
return new AxisStorage(axis, value, deadZone);
|
||||
}
|
||||
|
||||
private AxisStorage(int axis, float value, double deadZone) {
|
||||
this.axis = axis;
|
||||
this.deadZone = deadZone;
|
||||
|
||||
if (axis == GLFW_GAMEPAD_AXIS_LEFT_TRIGGER || axis == GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER
|
||||
|| axis == ButtonBinding.controller2Button(GLFW.GLFW_GAMEPAD_AXIS_LEFT_TRIGGER) || axis == ButtonBinding.controller2Button(GLFW.GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER)) {
|
||||
this.isTrigger = true;
|
||||
if (value < -.5f) {
|
||||
value = 0f;
|
||||
}
|
||||
else {
|
||||
// Fixes Triggers not working correctly on some controllers
|
||||
if (MidnightControlsConfig.triggerFix) {
|
||||
value = 1.0f;
|
||||
}
|
||||
}
|
||||
} else isTrigger = false;
|
||||
|
||||
this.value = value;
|
||||
this.buttonState = value > .5f ? ButtonState.PRESS : (value < -.5f ? ButtonState.RELEASE : ButtonState.NONE);
|
||||
this.absValue = Math.abs(value);
|
||||
boolean currentPlusState = value > deadZone;
|
||||
boolean currentMinusState = value < -deadZone;
|
||||
if (isTrigger) currentMinusState = false;
|
||||
else if (!MidnightControlsConfig.analogMovement && isLeftAxis(axis)) {
|
||||
currentPlusState = buttonState == ButtonState.PRESS;
|
||||
currentMinusState = buttonState == ButtonState.RELEASE;
|
||||
}
|
||||
this.polarity = currentPlusState ? AxisStorage.Polarity.PLUS : currentMinusState ? AxisStorage.Polarity.MINUS : AxisStorage.Polarity.ZERO;
|
||||
}
|
||||
/**
|
||||
* Returns the specified axis as a button.
|
||||
*
|
||||
* @param positive true if the axis part is positive, else false
|
||||
* @return the axis as a button
|
||||
*/
|
||||
public int getButtonId(boolean positive) {
|
||||
return ButtonBinding.axisAsButton(axis, positive);
|
||||
}
|
||||
|
||||
public void setupButtonStates() {
|
||||
var posButton = getButtonId(true);
|
||||
var negButton = getButtonId(false);
|
||||
var previousPlusState = STATES.getOrDefault(posButton, ButtonState.NONE);
|
||||
var previousMinusState = STATES.getOrDefault(negButton, ButtonState.NONE);
|
||||
|
||||
if (polarity.isPositive() != previousPlusState.isPressed()) {
|
||||
STATES.put(posButton, polarity.isPositive() ? ButtonState.PRESS : ButtonState.RELEASE);
|
||||
if (polarity.isPositive())
|
||||
BUTTON_COOLDOWNS.put(posButton, 5);
|
||||
} else if (polarity.isPositive()) {
|
||||
STATES.put(posButton, ButtonState.REPEAT);
|
||||
if (BUTTON_COOLDOWNS.getOrDefault(posButton, 0) == 0) {
|
||||
BUTTON_COOLDOWNS.put(posButton, 5);
|
||||
}
|
||||
}
|
||||
|
||||
if (polarity.isNegative() != previousMinusState.isPressed()) {
|
||||
STATES.put(negButton, polarity.isNegative() ? ButtonState.PRESS : ButtonState.RELEASE);
|
||||
if (polarity.isNegative())
|
||||
BUTTON_COOLDOWNS.put(negButton, 5);
|
||||
} else if (polarity.isNegative()) {
|
||||
STATES.put(negButton, ButtonState.REPEAT);
|
||||
if (BUTTON_COOLDOWNS.getOrDefault(negButton, 0) == 0) {
|
||||
BUTTON_COOLDOWNS.put(negButton, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static boolean isLeftAxis(int axis) {
|
||||
return axis == GLFW_GAMEPAD_AXIS_LEFT_X || axis == GLFW_GAMEPAD_AXIS_LEFT_Y || axis == GLFW_GAMEPAD_AXIS_LEFT_TRIGGER;
|
||||
}
|
||||
public static boolean isRightAxis(int axis) {
|
||||
return !isLeftAxis(axis);
|
||||
}
|
||||
|
||||
public enum Polarity {
|
||||
MINUS(-1), ZERO(0), PLUS(1);
|
||||
|
||||
public final int multiplier;
|
||||
Polarity(int multiplier) {
|
||||
this.multiplier = multiplier;
|
||||
}
|
||||
public boolean isPositive() {
|
||||
return this == PLUS;
|
||||
}
|
||||
public boolean isNegative() {
|
||||
return this == MINUS;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.util.storage;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.client.enums.ButtonState;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_GAMEPAD_BUTTON_DPAD_LEFT;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_GAMEPAD_BUTTON_DPAD_UP;
|
||||
|
||||
public class ButtonStorage {
|
||||
public final int button;
|
||||
public final ButtonState state;
|
||||
|
||||
public static ButtonStorage of(int button, ButtonState state) {
|
||||
return new ButtonStorage(button, state);
|
||||
}
|
||||
|
||||
private ButtonStorage(int button, ButtonState state) {
|
||||
this.button = button;
|
||||
this.state = state;
|
||||
}
|
||||
public boolean isDpad() {
|
||||
return button >= GLFW_GAMEPAD_BUTTON_DPAD_UP && button <= GLFW_GAMEPAD_BUTTON_DPAD_LEFT;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.packet;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
|
||||
import net.minecraft.network.RegistryByteBuf;
|
||||
import net.minecraft.network.codec.PacketCodec;
|
||||
import net.minecraft.network.packet.CustomPayload;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public record ControlsModePayload(String controlsMode) implements CustomPayload {
|
||||
public static final Id<ControlsModePayload> PACKET_ID = new Id<>(MidnightControlsConstants.CONTROLS_MODE_CHANNEL);
|
||||
public static final PacketCodec<RegistryByteBuf, ControlsModePayload> codec = PacketCodec.of(ControlsModePayload::write, ControlsModePayload::read);
|
||||
|
||||
public static ControlsModePayload read(RegistryByteBuf buf) {
|
||||
return new ControlsModePayload(buf.readString(32));
|
||||
}
|
||||
|
||||
public void write(RegistryByteBuf buf) {
|
||||
Objects.requireNonNull(controlsMode, "Controls mode cannot be null.");
|
||||
buf.writeString(controlsMode, 32);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Id<? extends CustomPayload> getId() {
|
||||
return PACKET_ID;
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.packet;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
|
||||
import eu.midnightdust.midnightcontrols.MidnightControlsFeature;
|
||||
import net.minecraft.network.RegistryByteBuf;
|
||||
import net.minecraft.network.codec.PacketCodec;
|
||||
import net.minecraft.network.packet.CustomPayload;
|
||||
|
||||
public record FeaturePayload(MidnightControlsFeature... features) implements CustomPayload {
|
||||
public static final Id<FeaturePayload> PACKET_ID = new Id<>(MidnightControlsConstants.FEATURE_CHANNEL);
|
||||
public static final PacketCodec<RegistryByteBuf, FeaturePayload> codec = PacketCodec.of(FeaturePayload::write, FeaturePayload::read);
|
||||
|
||||
public static FeaturePayload read(RegistryByteBuf buf) {
|
||||
int featureLength = buf.readVarInt();
|
||||
MidnightControlsFeature[] receivedFeatures = new MidnightControlsFeature[featureLength];
|
||||
for (int i = 0; i < featureLength; i++) {
|
||||
var name = buf.readString(64);
|
||||
boolean allowed = buf.readBoolean();
|
||||
var feature = MidnightControlsFeature.fromName(name);
|
||||
if (feature.isPresent()) {
|
||||
feature.get().setAllowed(allowed);
|
||||
receivedFeatures[i] = feature.get();
|
||||
}
|
||||
}
|
||||
return new FeaturePayload(receivedFeatures);
|
||||
}
|
||||
|
||||
public void write(RegistryByteBuf buf) {
|
||||
if (features.length == 0)
|
||||
throw new IllegalArgumentException("At least one feature must be provided.");
|
||||
|
||||
buf.writeVarInt(features.length);
|
||||
for (var feature : features) {
|
||||
buf.writeString(feature.getName(), 64);
|
||||
buf.writeBoolean(feature.isAllowed());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Id<? extends CustomPayload> getId() {
|
||||
return PACKET_ID;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.packet;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
|
||||
import net.minecraft.network.RegistryByteBuf;
|
||||
import net.minecraft.network.codec.PacketCodec;
|
||||
import net.minecraft.network.packet.CustomPayload;
|
||||
|
||||
public record HelloPayload(String version, String controlsMode) implements CustomPayload {
|
||||
public static final CustomPayload.Id<HelloPayload> PACKET_ID = new CustomPayload.Id<>(MidnightControlsConstants.HELLO_CHANNEL);
|
||||
public static final PacketCodec<RegistryByteBuf, HelloPayload> codec = PacketCodec.of(HelloPayload::write, HelloPayload::read);
|
||||
|
||||
public static HelloPayload read(RegistryByteBuf buf) {
|
||||
return new HelloPayload(buf.readString(32), buf.readString(32));
|
||||
}
|
||||
|
||||
public void write(RegistryByteBuf buf) {
|
||||
buf.writeString(version, 32).writeString(controlsMode, 32);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Id<? extends CustomPayload> getId() {
|
||||
return PACKET_ID;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"accessWidener": "midnightcontrols.accesswidener"
|
||||
}
|
||||
@@ -1,238 +0,0 @@
|
||||
{
|
||||
"midnightcontrols.midnightconfig.title": "MidnightControls Advanced Config",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.DEFAULT_LIGHT": "Default Light",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.DEFAULT_DARK": "Default Dark",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.SECOND_LIGHT": "Second Light",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.SECOND_DARK": "Second Dark",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.DEFAULT": "Default",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.DUALSHOCK": "DualShock",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.DUALSENSE": "DualSense",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.SWITCH": "Switch/Wii Controller",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.XBOX": "Xbox One/Series Controller",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.XBOX_360": "Xbox 360 Controller",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.STEAM_CONTROLLER": "Steam Controller",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.STEAM_DECK": "Steam Deck",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.OUYA": "OUYA Controller",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.NUMBERED": "Numbered Controller",
|
||||
"midnightcontrols.midnightconfig.enum.ControlsMode.DEFAULT": "Keyboard/Mouse",
|
||||
"midnightcontrols.midnightconfig.enum.ControlsMode.CONTROLLER": "Controller",
|
||||
"midnightcontrols.midnightconfig.enum.ControlsMode.TOUCHSCREEN": "Touchscreen (Beta)",
|
||||
"midnightcontrols.midnightconfig.enum.HudSide.LEFT": "Left",
|
||||
"midnightcontrols.midnightconfig.enum.HudSide.RIGHT": "Right",
|
||||
"midnightcontrols.midnightconfig.enum.TouchMode.CROSSHAIR": "At Crosshair",
|
||||
"midnightcontrols.midnightconfig.enum.TouchMode.FINGER_POS": "Finger Position",
|
||||
"midnightcontrols.midnightconfig.enum.CameraMode.FLAT": "Flat",
|
||||
"midnightcontrols.midnightconfig.enum.CameraMode.ADAPTIVE": "Adaptive",
|
||||
"key.categories.midnightcontrols": "MidnightControls",
|
||||
"key.midnightcontrols.look_down": "Look Down",
|
||||
"key.midnightcontrols.look_left": "Look Left",
|
||||
"key.midnightcontrols.look_right": "Look Right",
|
||||
"key.midnightcontrols.look_up": "Look Up",
|
||||
"key.midnightcontrols.ring": "Open Unbound Keybind Ring",
|
||||
"midnightcontrols.action.attack": "Attack",
|
||||
"midnightcontrols.action.back": "Back",
|
||||
"midnightcontrols.action.chat": "Open Chat",
|
||||
"midnightcontrols.action.controls_ring": "Open Unbound Keybind Ring",
|
||||
"midnightcontrols.action.debug_screen": "Open Debug HUD (F3)",
|
||||
"midnightcontrols.action.drop_item": "Drop Item",
|
||||
"midnightcontrols.action.drink": "Drink",
|
||||
"midnightcontrols.action.eat": "Eat",
|
||||
"midnightcontrols.action.equip": "Equip",
|
||||
"midnightcontrols.action.exit": "Exit Screen",
|
||||
"midnightcontrols.action.forward": "Forward",
|
||||
"midnightcontrols.action.hit": "Hit",
|
||||
"midnightcontrols.action.hotbar_left": "Hotbar left",
|
||||
"midnightcontrols.action.hotbar_right": "Hotbar right",
|
||||
"midnightcontrols.action.inventory": "Inventory",
|
||||
"midnightcontrols.action.jump": "Jump",
|
||||
"midnightcontrols.action.left": "Left",
|
||||
"midnightcontrols.action.pause_game": "Pause Game",
|
||||
"midnightcontrols.action.pick_block": "Pick Block",
|
||||
"midnightcontrols.action.pickup": "Pickup",
|
||||
"midnightcontrols.action.pickup_all": "Pickup all",
|
||||
"midnightcontrols.action.place": "Place",
|
||||
"midnightcontrols.action.player_list": "Player List",
|
||||
"midnightcontrols.action.quick_move": "Quick move",
|
||||
"midnightcontrols.action.right": "Right",
|
||||
"midnightcontrols.action.screenshot": "Take Screenshot",
|
||||
"midnightcontrols.action.slot_up": "Move Slot up",
|
||||
"midnightcontrols.action.slot_down": "Move Slot down",
|
||||
"midnightcontrols.action.slot_left": "Move Slot left",
|
||||
"midnightcontrols.action.slot_right": "Move Slot right",
|
||||
"midnightcontrols.action.sneak": "Sneak",
|
||||
"midnightcontrols.action.sprint": "Sprint",
|
||||
"midnightcontrols.action.swap_hands": "Swap Hands",
|
||||
"midnightcontrols.action.toggle_perspective": "Toggle Perspective",
|
||||
"midnightcontrols.action.toggle_smooth_camera": "Toggle Cinematic Camera",
|
||||
"midnightcontrols.action.page_back": "Previous Page",
|
||||
"midnightcontrols.action.page_next": "Next Page",
|
||||
"midnightcontrols.action.tab_back": "Previous Tab",
|
||||
"midnightcontrols.action.tab_next": "Next Tab",
|
||||
"midnightcontrols.action.take": "Take Item",
|
||||
"midnightcontrols.action.take_all": "Take Stack",
|
||||
"midnightcontrols.action.use": "Use",
|
||||
"midnightcontrols.action.zoom": "Zoom",
|
||||
"midnightcontrols.action.zoom_in": "Increase Zoom",
|
||||
"midnightcontrols.action.zoom_out": "Decrease Zoom",
|
||||
"midnightcontrols.action.zoom_reset": "Reset Zoom",
|
||||
"midnightcontrols.action.emi_page_left": "Previous Page",
|
||||
"midnightcontrols.action.emi_page_right": "Next Page",
|
||||
"midnightcontrols.category.emi": "EMI",
|
||||
"midnightcontrols.button.a": "A",
|
||||
"midnightcontrols.button.b": "B",
|
||||
"midnightcontrols.button.x": "X",
|
||||
"midnightcontrols.button.y": "Y",
|
||||
"midnightcontrols.button.left_bumper": "Left bumper",
|
||||
"midnightcontrols.button.right_bumper": "Right bumper",
|
||||
"midnightcontrols.button.back": "Back",
|
||||
"midnightcontrols.button.start": "Start",
|
||||
"midnightcontrols.button.guide": "Guide",
|
||||
"midnightcontrols.button.left_thumb": "Left thumb",
|
||||
"midnightcontrols.button.right_thumb": "Right thumb",
|
||||
"midnightcontrols.button.dpad_up": "DPAD up",
|
||||
"midnightcontrols.button.dpad_right": "DPAD right",
|
||||
"midnightcontrols.button.dpad_down": "DPAD down",
|
||||
"midnightcontrols.button.dpad_left": "DPAD left",
|
||||
"midnightcontrols.button.l4": "L4",
|
||||
"midnightcontrols.button.l5": "L5",
|
||||
"midnightcontrols.button.r4": "R4",
|
||||
"midnightcontrols.button.r5": "L5",
|
||||
"midnightcontrols.axis.left_x+": "Left X+",
|
||||
"midnightcontrols.axis.left_y+": "Left Y+",
|
||||
"midnightcontrols.axis.right_x+": "Right X+",
|
||||
"midnightcontrols.axis.right_y+": "Right Y+",
|
||||
"midnightcontrols.axis.left_trigger": "Left trigger",
|
||||
"midnightcontrols.axis.right_trigger": "Right trigger",
|
||||
"midnightcontrols.axis.left_x-": "Left X-",
|
||||
"midnightcontrols.axis.left_y-": "Left Y-",
|
||||
"midnightcontrols.axis.right_x-": "Right X-",
|
||||
"midnightcontrols.axis.right_y-": "Right Y-",
|
||||
"midnightcontrols.button.unknown": "Unknown (%d)",
|
||||
"midnightcontrols.controller.tutorial.title": "Play the game with a Controller!",
|
||||
"midnightcontrols.controller.tutorial.description": "Go to %s -> %s -> %s",
|
||||
"midnightcontrols.controller.connected": "Controller %d connected.",
|
||||
"midnightcontrols.controller.disconnected": "Controller %d disconnected.",
|
||||
"midnightcontrols.controller.mappings.1": "To configure the controller mappings, please use %s",
|
||||
"midnightcontrols.controller.mappings.3": "and paste the mapping in the mappings file editor.",
|
||||
"midnightcontrols.controller.mappings.error": "Error while loading mappings.",
|
||||
"midnightcontrols.controller.mappings.error.write": "Error while writing mappings to file.",
|
||||
"midnightcontrols.controller.mappings.updated": "Updated mappings!",
|
||||
"midnightcontrols.controller_type.default": "Default",
|
||||
"midnightcontrols.controller_type.dualshock": "DualShock",
|
||||
"midnightcontrols.controller_type.dualsense": "DualSense",
|
||||
"midnightcontrols.controller_type.switch": "Switch/Wii Controller",
|
||||
"midnightcontrols.controller_type.xbox": "Xbox One/Series Controller",
|
||||
"midnightcontrols.controller_type.xbox_360": "Xbox 360 Controller",
|
||||
"midnightcontrols.controller_type.steam_controller": "Steam Controller",
|
||||
"midnightcontrols.controller_type.steam_deck": "Steam Deck",
|
||||
"midnightcontrols.controller_type.ouya": "OUYA Controller",
|
||||
"midnightcontrols.controller_type.numbered": "Numbered Controller",
|
||||
"midnightcontrols.controls_mode.default": "Keyboard/Mouse",
|
||||
"midnightcontrols.controls_mode.controller": "Controller",
|
||||
"midnightcontrols.controls_mode.touchscreen": "Touchscreen (Beta)",
|
||||
"midnightcontrols.hud_side.LEFT": "Left",
|
||||
"midnightcontrols.hud_side.RIGHT": "Right",
|
||||
"midnightcontrols.menu.analog_movement": "Analog Movement",
|
||||
"midnightcontrols.menu.analog_movement.tooltip": "When possible, enables analog movement.",
|
||||
"midnightcontrols.menu.auto_switch_mode": "Auto Switch Mode",
|
||||
"midnightcontrols.menu.auto_switch_mode.tooltip": "Whether the controls mode should be switched to Controller automatically if one is connected.",
|
||||
"midnightcontrols.menu.camera_mode": "Camera Mode",
|
||||
"midnightcontrols.menu.controller": "Controller",
|
||||
"midnightcontrols.menu.controller2": "Second Controller",
|
||||
"midnightcontrols.menu.controller2.tooltip": "Second controller to use, which allows (for example) Joy-Cons support.",
|
||||
"midnightcontrols.menu.controller_toggle_sneak": "Toggle Sneak on Controller",
|
||||
"midnightcontrols.menu.controller_toggle_sprint": "Toggle Sprint on Controller",
|
||||
"midnightcontrols.menu.controller_type": "Controller Type",
|
||||
"midnightcontrols.menu.controller_type.tooltip": "The controller type you're using (needed to display the correct buttons)",
|
||||
"midnightcontrols.menu.controls_mode": "Mode",
|
||||
"midnightcontrols.menu.controls_mode.tooltip": "The controls mode.",
|
||||
"midnightcontrols.menu.copy_controller_guid": "Copy GUID",
|
||||
"midnightcontrols.menu.current_controller_guid": "Current controller's GUID: %s",
|
||||
"midnightcontrols.menu.double_tap_to_sprint": "Double-Tap to Sprint",
|
||||
"midnightcontrols.menu.double_tap_to_sprint.tooltip": "Toggles whether the Walk Forwards key makes the player sprint when double-tapped quickly",
|
||||
"midnightcontrols.menu.fast_block_placing": "Fast Block Placing",
|
||||
"midnightcontrols.menu.fast_block_placing.tooltip": "While flying in creative mode, enables fast block placing depending on your speed. §cOn some servers this might be considered as cheating.",
|
||||
"midnightcontrols.menu.fly_drifting": "Fly Drifting",
|
||||
"midnightcontrols.menu.fly_drifting.tooltip": "While flying, enables Vanilla drifting/inertia.",
|
||||
"midnightcontrols.menu.fly_drifting_vertical": "Vertical Fly Drifting",
|
||||
"midnightcontrols.menu.fly_drifting_vertical.tooltip": "While flying, enables Vanilla vertical drifting/intertia.",
|
||||
"midnightcontrols.menu.hud_enable": "Enable HUD",
|
||||
"midnightcontrols.menu.hud_enable.tooltip": "Toggles the on-screen controller button indicator.",
|
||||
"midnightcontrols.menu.hud_side": "HUD Side",
|
||||
"midnightcontrols.menu.hud_side.tooltip": "The position of the HUD.",
|
||||
"midnightcontrols.menu.invert_right_x_axis": "Invert Right X",
|
||||
"midnightcontrols.menu.invert_right_y_axis": "Invert Right Y",
|
||||
"midnightcontrols.menu.joystick_as_mouse": "Always use left stick as mouse",
|
||||
"midnightcontrols.menu.joystick_as_mouse.tooltip": "Make the joystick behave like a mouse in every menu.",
|
||||
"midnightcontrols.menu.eye_tracker_as_mouse": "Use Eye Tracker as Mouse",
|
||||
"midnightcontrols.menu.eye_tracker_as_mouse.tooltip": "Replace the mouse with an eye tracking device, (for example) the Tobii 5.",
|
||||
"midnightcontrols.menu.eye_tracker_deadzone": "Eye Tracker Deadzone Size",
|
||||
"midnightcontrols.menu.eye_tracker_deadzone.tooltip": "Stops camera movement when looking near the cross hair",
|
||||
"midnightcontrols.menu.keyboard_controls": "Keyboard Controls...",
|
||||
"midnightcontrols.menu.left_dead_zone": "Left Stick Dead Zone",
|
||||
"midnightcontrols.menu.left_dead_zone.tooltip": "The dead zone for the controller's left analog stick.",
|
||||
"midnightcontrols.menu.mappings.open_input_str": "Open Mappings File Editor",
|
||||
"midnightcontrols.menu.max_left_x_value": "Left X Axis Max Value",
|
||||
"midnightcontrols.menu.max_left_x_value.tooltip": "Changes what the mod considers the highest value for the left X axis. Useful if your axis does not use the full range and seems slow.",
|
||||
"midnightcontrols.menu.max_left_y_value": "Left Y Axis Max Value",
|
||||
"midnightcontrols.menu.max_left_y_value.tooltip": "Changes what the mod considers the highest value for the left Y axis. Useful if your axis does not use the full range and seems slow.",
|
||||
"midnightcontrols.menu.max_right_x_value": "Right X Axis Max Value",
|
||||
"midnightcontrols.menu.max_right_x_value.tooltip": "Changes what the mod considers the highest value for the right X axis. Useful if your axis does not use the full range and seems slow.",
|
||||
"midnightcontrols.menu.max_right_y_value": "Right Y Axis Max Value",
|
||||
"midnightcontrols.menu.max_right_y_value.tooltip": "Changes what the mod considers the highest value for the right Y axis. Useful if your axis does not use the full range and seems slow.",
|
||||
"midnightcontrols.menu.mouse_speed": "Mouse Speed",
|
||||
"midnightcontrols.menu.mouse_speed.tooltip": "The controller's emulated mouse speed.",
|
||||
"midnightcontrols.menu.move_chat": "Move chat input box to top",
|
||||
"midnightcontrols.menu.move_chat.tooltip": "Moves the chat input field to the top, for better input on devices with on-screen keyboards.",
|
||||
"midnightcontrols.menu.multiple_mapping_tip": "(Tip: You can also insert multiple mappings at the same time)",
|
||||
"midnightcontrols.menu.reacharound.horizontal": "Front Block Placing",
|
||||
"midnightcontrols.menu.reacharound.horizontal.tooltip": "Enables front block placing, §cmight be considered cheating on some servers§r.",
|
||||
"midnightcontrols.menu.reacharound.vertical": "Vertical Reacharound",
|
||||
"midnightcontrols.menu.reacharound.vertical.tooltip": "Enables vertical reacharound, §cmight be considered cheating on some servers§r.",
|
||||
"midnightcontrols.menu.reload_controller_mappings": "Reload Controller Mappings",
|
||||
"midnightcontrols.menu.reload_controller_mappings.tooltip": "Reloads the controller mappings file.",
|
||||
"midnightcontrols.menu.right_dead_zone": "Right Stick Dead Zone",
|
||||
"midnightcontrols.menu.right_dead_zone.tooltip": "The dead zone for the controller's right analog stick.",
|
||||
"midnightcontrols.menu.rotation_speed": "X Axis Rotation Speed",
|
||||
"midnightcontrols.menu.rotation_speed.tooltip": "The camera's X Axis rotation speed in controller mode.",
|
||||
"midnightcontrols.menu.y_axis_rotation_speed": "Y Axis Rotation Speed",
|
||||
"midnightcontrols.menu.y_axis_rotation_speed.tooltip": "The camera's Y Axis rotation speed in controller mode.",
|
||||
"midnightcontrols.menu.separate_controller_profile": "Separate Controller Profile",
|
||||
"midnightcontrols.menu.separator.controller": "Controller",
|
||||
"midnightcontrols.menu.separator.general": "General",
|
||||
"midnightcontrols.menu.title": "MidnightControls - Settings",
|
||||
"midnightcontrols.menu.title.controller": "Controller Options",
|
||||
"midnightcontrols.menu.title.controller_controls": "Controller Bindings",
|
||||
"midnightcontrols.menu.title.gameplay": "Gameplay Options",
|
||||
"midnightcontrols.menu.title.general": "General Options",
|
||||
"midnightcontrols.menu.title.hud": "HUD Options",
|
||||
"midnightcontrols.menu.title.mappings.string": "Mappings File Editor",
|
||||
"midnightcontrols.menu.title.touch": "Touch Options",
|
||||
"midnightcontrols.menu.title.visual": "Appearance Options",
|
||||
"midnightcontrols.menu.touch_break_delay": "Touch Break Delay",
|
||||
"midnightcontrols.menu.touch_speed": "Touch Speed",
|
||||
"midnightcontrols.menu.invert_touch": "Invert Touch Direction",
|
||||
"midnightcontrols.menu.touch_mode": "Touch Interaction Mode",
|
||||
"midnightcontrols.menu.touch_transparency": "Touch HUD Transparency",
|
||||
"midnightcontrols.menu.touch_with_controller": "Touch in Controller mode",
|
||||
"midnightcontrols.menu.unfocused_input": "Unfocused Input",
|
||||
"midnightcontrols.menu.unfocused_input.tooltip": "Allows controller input when the window is not focused.",
|
||||
"midnightcontrols.menu.virtual_mouse": "Virtual Mouse",
|
||||
"midnightcontrols.menu.virtual_mouse.tooltip": "Enables the virtual mouse, which is useful during splitscreen.",
|
||||
"midnightcontrols.menu.virtual_mouse.skin": "Virtual Mouse Skin",
|
||||
"midnightcontrols.menu.hide_cursor": "Hide Normal Mouse Cursor",
|
||||
"midnightcontrols.menu.hide_cursor.tooltip": "Hides the normal mouse cursor, leaving only the virtual mouse visible.",
|
||||
"midnightcontrols.narrator.unbound": "Unbound %s",
|
||||
"midnightcontrols.not_bound": "Not bound",
|
||||
"midnightcontrols.virtual_mouse.skin.default_light": "Default Light",
|
||||
"midnightcontrols.virtual_mouse.skin.default_dark": "Default Dark",
|
||||
"midnightcontrols.virtual_mouse.skin.second_light": "Second Light",
|
||||
"midnightcontrols.virtual_mouse.skin.second_dark": "Second Dark",
|
||||
"midnightcontrols.midnightconfig.category.controller": "Controller",
|
||||
"midnightcontrols.midnightconfig.category.misc": "Miscellaneous",
|
||||
"midnightcontrols.midnightconfig.category.screens": "Screens",
|
||||
"midnightcontrols.midnightconfig.category.gameplay": "Gameplay",
|
||||
"midnightcontrols.midnightconfig.category.touch": "Touch",
|
||||
"midnightcontrols.midnightconfig.category.visual": "Visual",
|
||||
"modmenu.descriptionTranslation.midnightcontrols": "Adds controller support and enhanced controls overall.\nForked from LambdaControls, which sadly got discontinued."
|
||||
}
|
||||
@@ -1,203 +0,0 @@
|
||||
{
|
||||
"midnightcontrols.midnightconfig.title": "Configurazione Avanzata MidnightControls",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.DEFAULT_LIGHT": "Default Chiaro",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.DEFAULT_DARK": "Default Scuro",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.SECOND_LIGHT": "Chiaro Secondario",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.SECOND_DARK": "Scuro secondario",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.DEFAULT": "Default",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.DUALSHOCK": "DualShock",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.DUALSENSE": "DualSense",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.SWITCH": "Controller Switch/Wii",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.XBOX": "Controller Xbox One/Series",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.XBOX_360": "Controller Xbox 360",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.STEAM_CONTROLLER": "Controller Steam",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.STEAM_DECK": "Steam Deck",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.OUYA": "Controller OUYA",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.NUMBERED": "Controller Numerato",
|
||||
"midnightcontrols.midnightconfig.enum.ControlsMode.DEFAULT": "Tastiera/Mouse",
|
||||
"midnightcontrols.midnightconfig.enum.ControlsMode.CONTROLLER": "Controller",
|
||||
"midnightcontrols.midnightconfig.enum.ControlsMode.TOUCHSCREEN": "Touchscreen (WIP)",
|
||||
"midnightcontrols.midnightconfig.enum.HudSide.LEFT": "Sinistra",
|
||||
"midnightcontrols.midnightconfig.enum.HudSide.RIGHT": "Destra",
|
||||
"key.midnightcontrols.look_down": "Guarda in basso",
|
||||
"key.midnightcontrols.look_left": "Guarda a sinistra",
|
||||
"key.midnightcontrols.look_right": "Guarda a destra",
|
||||
"key.midnightcontrols.look_up": "Guarda sopra",
|
||||
"key.midnightcontrols.ring": "Apri Tasti non impostati",
|
||||
"midnightcontrols.action.attack": "Attacca",
|
||||
"midnightcontrols.action.back": "Indietro",
|
||||
"midnightcontrols.action.chat": "Apri Chat",
|
||||
"midnightcontrols.action.controls_ring": "Apri Tasti non impostati",
|
||||
"midnightcontrols.action.debug_screen": "Apri HUD di Debug (F3)",
|
||||
"midnightcontrols.action.drop_item": "Rilascia oggetto",
|
||||
"midnightcontrols.action.exit": "Esci",
|
||||
"midnightcontrols.action.forward": "Avanti",
|
||||
"midnightcontrols.action.hit": "Colpisci",
|
||||
"midnightcontrols.action.hotbar_left": "Hotbar sinistra",
|
||||
"midnightcontrols.action.hotbar_right": "Hotbar destra",
|
||||
"midnightcontrols.action.inventory": "Inventario",
|
||||
"midnightcontrols.action.jump": "Salta",
|
||||
"midnightcontrols.action.left": "Sinistra",
|
||||
"midnightcontrols.action.pause_game": "Pausa il gioco",
|
||||
"midnightcontrols.action.pick_block": "Prendi Blocco",
|
||||
"midnightcontrols.action.pickup": "Raccogli",
|
||||
"midnightcontrols.action.pickup_all": "Raccogli Tutto",
|
||||
"midnightcontrols.action.place": "Piazza",
|
||||
"midnightcontrols.action.player_list": "Lista Giocatori",
|
||||
"midnightcontrols.action.quick_move": "Muovi veloce",
|
||||
"midnightcontrols.action.right": "Destra",
|
||||
"midnightcontrols.action.screenshot": "Fai uno Screenshot",
|
||||
"midnightcontrols.action.slot_up": "Muovi slot sopra",
|
||||
"midnightcontrols.action.slot_down": "Muovi slot sotto",
|
||||
"midnightcontrols.action.slot_left": "Muovi slot a sinistra",
|
||||
"midnightcontrols.action.slot_right": "Muovi slot a destra",
|
||||
"midnightcontrols.action.sneak": "Accovaccia",
|
||||
"midnightcontrols.action.sprint": "Corri",
|
||||
"midnightcontrols.action.swap_hands": "Scambia le mani",
|
||||
"midnightcontrols.action.toggle_perspective": "Cambia la prospettiva",
|
||||
"midnightcontrols.action.toggle_smooth_camera": "Cambia Camera Cinematica",
|
||||
"midnightcontrols.action.page_back": "Pagina precedente",
|
||||
"midnightcontrols.action.page_next": "Pagina Successica",
|
||||
"midnightcontrols.action.tab_back": "Tab Precedente",
|
||||
"midnightcontrols.action.tab_next": "Tab Successiva",
|
||||
"midnightcontrols.action.take": "Prendi Item",
|
||||
"midnightcontrols.action.take_all": "Prendi Stack",
|
||||
"midnightcontrols.action.use": "Usa",
|
||||
"midnightcontrols.action.zoom": "Zoom",
|
||||
"midnightcontrols.action.zoom_in": "Aumenta Zoom",
|
||||
"midnightcontrols.action.zoom_out": "Diminuisci Zoom",
|
||||
"midnightcontrols.action.zoom_reset": "Resetta Zoom",
|
||||
"midnightcontrols.action.emi_page_left": "Pagina Precedente",
|
||||
"midnightcontrols.action.emi_page_right": "Pagina Successiva",
|
||||
"midnightcontrols.category.emi": "EMI",
|
||||
"midnightcontrols.button.a": "A",
|
||||
"midnightcontrols.button.b": "B",
|
||||
"midnightcontrols.button.x": "X",
|
||||
"midnightcontrols.button.y": "Y",
|
||||
"midnightcontrols.button.left_bumper": "Bumper Destro",
|
||||
"midnightcontrols.button.right_bumper": "Bumper Sinistro",
|
||||
"midnightcontrols.button.back": "Indietro",
|
||||
"midnightcontrols.button.start": "Avvia",
|
||||
"midnightcontrols.button.guide": "Guida",
|
||||
"midnightcontrols.button.left_thumb": "Pollice Sinistro",
|
||||
"midnightcontrols.button.right_thumb": "Pollice Destro",
|
||||
"midnightcontrols.button.dpad_up": "DPAD Sopra",
|
||||
"midnightcontrols.button.dpad_right": "DPAD Destra",
|
||||
"midnightcontrols.button.dpad_down": "DPAD Sotto",
|
||||
"midnightcontrols.button.dpad_left": "DPAD Sinistra",
|
||||
"midnightcontrols.button.l4": "L4",
|
||||
"midnightcontrols.button.l5": "L5",
|
||||
"midnightcontrols.button.r4": "R4",
|
||||
"midnightcontrols.button.r5": "L5",
|
||||
"midnightcontrols.axis.left_x+": "Sinistra X+",
|
||||
"midnightcontrols.axis.left_y+": "Sinistra Y+",
|
||||
"midnightcontrols.axis.right_x+": "Destra X+",
|
||||
"midnightcontrols.axis.right_y+": "Destra Y+",
|
||||
"midnightcontrols.axis.left_trigger": "Trigger Sinistro",
|
||||
"midnightcontrols.axis.right_trigger": "Trigger Destro",
|
||||
"midnightcontrols.axis.left_x-": "Sinistra X-",
|
||||
"midnightcontrols.axis.left_y-": "Sinistra Y-",
|
||||
"midnightcontrols.axis.right_x-": "Destra X-",
|
||||
"midnightcontrols.axis.right_y-": "Destra Y-",
|
||||
"midnightcontrols.button.unknown": "Sconosciuto",
|
||||
"midnightcontrols.controller.tutorial.title": "Gioca il gioco con un Controller!",
|
||||
"midnightcontrols.controller.tutorial.description": "Vai a %s -> %s -> %s",
|
||||
"midnightcontrols.controller.connected": "Controller %d connesso.",
|
||||
"midnightcontrols.controller.disconnected": "Controller %d disconnesso",
|
||||
"midnightcontrols.controller.mappings.1": "Per configurare le mappature dei controller, per favore usa %s",
|
||||
"midnightcontrols.controller.mappings.3": "e incolla le mappature nel file editor.",
|
||||
"midnightcontrols.controller.mappings.error": "Errore durante il caricamento delle mappature",
|
||||
"midnightcontrols.controller.mappings.error.write": "Errore durante la scrittura delle mappature su file",
|
||||
"midnightcontrols.controller.mappings.updated": "Aggiornate le mappature!",
|
||||
"midnightcontrols.controller_type.default": "Default",
|
||||
"midnightcontrols.controller_type.dualshock": "DualShock",
|
||||
"midnightcontrols.controller_type.dualsense": "DualSense",
|
||||
"midnightcontrols.controller_type.switch": "Controller Switch/Wii",
|
||||
"midnightcontrols.controller_type.xbox": "Controller Xbox One/Series",
|
||||
"midnightcontrols.controller_type.xbox_360": "Controller Xbox 360",
|
||||
"midnightcontrols.controller_type.steam_controller": "Controller Steam",
|
||||
"midnightcontrols.controller_type.steam_deck": "Steam Deck",
|
||||
"midnightcontrols.controller_type.ouya": "Controller OUYA",
|
||||
"midnightcontrols.controller_type.numbered": "Controller Numerato",
|
||||
"midnightcontrols.controls_mode.default": "Tastiera/Mouse",
|
||||
"midnightcontrols.controls_mode.controller": "Controller",
|
||||
"midnightcontrols.controls_mode.touchscreen": "Touchscreen (WIP)",
|
||||
"midnightcontrols.hud_side.left": "Left",
|
||||
"midnightcontrols.hud_side.right": "Destra",
|
||||
"midnightcontrols.menu.analog_movement": "Movimento Analogo",
|
||||
"midnightcontrols.menu.auto_switch_mode": "Modalità Cambio Automatico",
|
||||
"midnightcontrols.menu.controller": "Controller",
|
||||
"midnightcontrols.menu.controller2": "Controller Secondario",
|
||||
"midnightcontrols.menu.controller_toggle_sneak": "Attiva/Disattiva Accovacciamento su Controller",
|
||||
"midnightcontrols.menu.controller_toggle_sprint": "Attiva/Disattiva Correre su Controller",
|
||||
"midnightcontrols.menu.controller_type": "Tipo di Controller",
|
||||
"midnightcontrols.menu.controls_mode": "Modalità",
|
||||
"midnightcontrols.menu.double_tap_to_sprint": "Doppio Tap per Sprintare",
|
||||
"midnightcontrols.menu.fast_block_placing": "Veloce Piazzamento di Blocchi",
|
||||
"midnightcontrols.menu.fly_drifting": "Drift in Volo",
|
||||
"midnightcontrols.menu.fly_drifting_vertical": "Drift in Volo Verticale",
|
||||
"midnightcontrols.menu.hud_enable": "Attiva HUD",
|
||||
"midnightcontrols.menu.hud_side": "Lato HUD",
|
||||
"midnightcontrols.menu.invert_right_x_axis": "Inverti Destro X",
|
||||
"midnightcontrols.menu.invert_right_y_axis": "Inverti Destro Y",
|
||||
"midnightcontrols.menu.keyboard_controls": "Controlli da Tastiera...",
|
||||
"midnightcontrols.menu.left_dead_zone": "Zona Morta dello Stick Sinistro",
|
||||
"midnightcontrols.menu.mappings.open_input_str": "Apri il File Editor delle Mappature",
|
||||
"midnightcontrols.menu.max_left_x_value": "Asse X Sinistro Massimo Valore",
|
||||
"midnightcontrols.menu.max_left_y_value": "Asse Y Sinistro Massimo Valore",
|
||||
"midnightcontrols.menu.max_right_x_value": "Asse Destro X Massimo Valore",
|
||||
"midnightcontrols.menu.max_right_y_value": "Asse Destro Y Massimo Valore",
|
||||
"midnightcontrols.menu.mouse_speed": "Velocità Mouse",
|
||||
"midnightcontrols.menu.reacharound.horizontal": "Piazza blocchi Davanti",
|
||||
"midnightcontrols.menu.reacharound.vertical": "Reach Verticale",
|
||||
"midnightcontrols.menu.reload_controller_mappings": "Ricarica Mappature del Controller",
|
||||
"midnightcontrols.menu.right_dead_zone": "Zona Morta Stick Destro",
|
||||
"midnightcontrols.menu.rotation_speed": "Velocità di rotazione dell'Asse X",
|
||||
"midnightcontrols.menu.y_axis_rotation_speed": "Velocità di rotazione dell'Asse Y",
|
||||
"midnightcontrols.menu.separate_controller_profile": "Profilo Controller Separato",
|
||||
"midnightcontrols.menu.separator.controller": "Controller",
|
||||
"midnightcontrols.menu.separator.general": "Generale",
|
||||
"midnightcontrols.menu.title": "MidnightControls - Impostazioni",
|
||||
"midnightcontrols.menu.title.controller": "Opzioni Controller",
|
||||
"midnightcontrols.menu.title.controller_controls": "Tasti Controller",
|
||||
"midnightcontrols.menu.title.gameplay": "Opzioni del Gameplay",
|
||||
"midnightcontrols.menu.title.general": "Impostazioni Generali",
|
||||
"midnightcontrols.menu.title.hud": "Opzioni della HUD",
|
||||
"midnightcontrols.menu.title.mappings.string": "Editor di file delle Mappature",
|
||||
"midnightcontrols.menu.title.visual": "Aspetto",
|
||||
"midnightcontrols.menu.unfocused_input": "Input non a fuoco",
|
||||
"midnightcontrols.menu.virtual_mouse": "Mouse Virtuale",
|
||||
"midnightcontrols.menu.virtual_mouse.skin": "Aspetto Mouse Virtuale",
|
||||
"midnightcontrols.narrator.unbound": "Disimpostato %s",
|
||||
"midnightcontrols.not_bound": "Non Impostato",
|
||||
"midnightcontrols.menu.analog_movement.tooltip": "Quando possibile, attiva movimento analogo.",
|
||||
"midnightcontrols.menu.auto_switch_mode.tooltip": "Quando la modalità controlli dovrebbe passare a Controller automaticamente se uno è connesso",
|
||||
"midnightcontrols.menu.controller2.tooltip": "Secondo controller da usare, che permette (per esempio) Supporto dei Joy-Cons.",
|
||||
"midnightcontrols.menu.controller_type.tooltip": "Il tipo di controller che stai usando (usato per mostrare i pulsanti corretti)",
|
||||
"midnightcontrols.menu.controls_mode.tooltip": "Modalita controlli.",
|
||||
"midnightcontrols.menu.double_tap_to_sprint.tooltip": "Attiva quando il tasto \"Cammina Avanti\" fa correre il giocatore con doppio tap velocemente",
|
||||
"midnightcontrols.menu.fast_block_placing.tooltip": "Quando si vola in creativa, attiva il movimento veloce dei blocchi in base alla tua velocità. §cSu alcuni server potrebbe essere considerato un cheat.§r",
|
||||
"midnightcontrols.menu.fly_drifting.tooltip": "Quando si vola, attiva L'inerzia del Vanilla",
|
||||
"midnightcontrols.menu.fly_drifting_vertical.tooltip": "Quando si vola, attiva l'inerzia verticale Vanilla",
|
||||
"midnightcontrols.menu.hud_enable.tooltip": "Attiva gli indicatori dei pulsanti dei controller sullo schermo.",
|
||||
"midnightcontrols.menu.hud_side.tooltip": "La posizione della HUD",
|
||||
"midnightcontrols.menu.left_dead_zone.tooltip": "La zona morta per lo stick sinistro del controller.",
|
||||
"midnightcontrols.menu.max_left_x_value.tooltip": "Cambia cosa la mod considera il più alto valore per l'asse X sinistro. Utile se il tuo asse non usa il range massimo e sembra lento",
|
||||
"midnightcontrols.menu.max_left_y_value.tooltip": "Cambia cosa la mod considera il più alto valore per l'asse Y sinistro. Utile se il tuo asse non usa il range massimo e sembra lento",
|
||||
"midnightcontrols.menu.max_right_x_value.tooltip": "Cambia cosa la mod considera il più alto valore per l'asse X Destro. Utile se il tuo asse non usa il range massimo e sembra lento.",
|
||||
"midnightcontrols.menu.max_right_y_value.tooltip": "Cambia cosa la mod considera il più alto valore per l'asse Y Destro. Utile se il tuo asse non usa il range massimo e sembra lento.",
|
||||
"midnightcontrols.menu.mouse_speed.tooltip": "La velocità del controller emulato.",
|
||||
"midnightcontrols.menu.reacharound.horizontal.tooltip": "Attiva il piazzare blocchi davanti, Potrebbe essere considerato un cheat su alcuni server.",
|
||||
"midnightcontrols.menu.reacharound.vertical.tooltip": "Attiva il reach verticale, potrebbe essere considerato cheating su alcuni server",
|
||||
"midnightcontrols.menu.reload_controller_mappings.tooltip": "Riavvia il file dlle mappature del controller",
|
||||
"midnightcontrols.menu.right_dead_zone.tooltip": "La zona morta per lo stick destro del controller",
|
||||
"midnightcontrols.menu.rotation_speed.tooltip": "L'asse X della velocità di rotazione della camera im modalità controller",
|
||||
"midnightcontrols.menu.y_axis_rotation_speed.tooltip": "L'asse Y della velocità di rotazione della camera im modalità controller",
|
||||
"midnightcontrols.menu.unfocused_input.tooltip": "Permette imput dei controller quando la finestra non è messa a fuoco",
|
||||
"midnightcontrols.menu.virtual_mouse.tooltip": "Attiva il mouse virtuale, che può essere utile nello schermo diviso.",
|
||||
"midnightcontrols.virtual_mouse.skin.default_light": "Chiaro Default",
|
||||
"midnightcontrols.virtual_mouse.skin.default_dark": "Scuro Default",
|
||||
"midnightcontrols.virtual_mouse.skin.second_light": "Chiaro Secondario",
|
||||
"midnightcontrols.virtual_mouse.skin.second_dark": "Scuro Secondario",
|
||||
"modmenu.descriptionTranslation.midnightcontrols": "Aggiunge supporto e controlli migliorati in generale. \\nProveniente da LambdaControls, che è stato rimosso."
|
||||
}
|
||||
@@ -1,238 +0,0 @@
|
||||
{
|
||||
"midnightcontrols.midnightconfig.title": "Configurações avançadas do MidnightControls",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.DEFAULT_LIGHT": "Padrão claro",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.DEFAULT_DARK": "Padrão escuro",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.SECOND_LIGHT": "Segundo claro",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.SECOND_DARK": "Segundo escuro",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.DEFAULT": "Padrão",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.DUALSHOCK": "DualShock",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.DUALSENSE": "DualSense",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.SWITCH": "Controle de Switch/Wii",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.XBOX": "Controle de Xbox One/Series",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.XBOX_360": "Controle de Xbox 360",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.STEAM_CONTROLLER": "Controle da Steam",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.STEAM_DECK": "Steam Deck",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.OUYA": "Controle de OUYA",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.NUMBERED": "Controle númerado",
|
||||
"midnightcontrols.midnightconfig.enum.ControlsMode.DEFAULT": "Teclado/Mouse",
|
||||
"midnightcontrols.midnightconfig.enum.ControlsMode.CONTROLLER": "Controle",
|
||||
"midnightcontrols.midnightconfig.enum.ControlsMode.TOUCHSCREEN": "Tela sensível ao toque (Beta)",
|
||||
"midnightcontrols.midnightconfig.enum.HudSide.LEFT": "Esquerda",
|
||||
"midnightcontrols.midnightconfig.enum.HudSide.RIGHT": "Direita",
|
||||
"midnightcontrols.midnightconfig.enum.TouchMode.CROSSHAIR": "Na mira",
|
||||
"midnightcontrols.midnightconfig.enum.TouchMode.FINGER_POS": "Posição do dedo",
|
||||
"midnightcontrols.midnightconfig.enum.CameraMode.FLAT": "Plano",
|
||||
"midnightcontrols.midnightconfig.enum.CameraMode.ADAPTIVE": "Adaptativo",
|
||||
"key.categories.midnightcontrols": "MidnightControls",
|
||||
"key.midnightcontrols.look_down": "Olhar para baixo",
|
||||
"key.midnightcontrols.look_left": "Olhar para a esquerda",
|
||||
"key.midnightcontrols.look_right": "Olhar para a direita",
|
||||
"key.midnightcontrols.look_up": "Olhar para cima",
|
||||
"key.midnightcontrols.ring": "Abrir anel de teclas não vinculadas",
|
||||
"midnightcontrols.action.attack": "Atacar",
|
||||
"midnightcontrols.action.back": "Voltar",
|
||||
"midnightcontrols.action.chat": "Abrir bate-papo",
|
||||
"midnightcontrols.action.controls_ring": "Abrir anel de teclas não vinculadas",
|
||||
"midnightcontrols.action.debug_screen": "Abrir HUD de depuração (F3)",
|
||||
"midnightcontrols.action.drop_item": "Soltar item",
|
||||
"midnightcontrols.action.drink": "Beber",
|
||||
"midnightcontrols.action.eat": "Comer",
|
||||
"midnightcontrols.action.equip": "Equipar",
|
||||
"midnightcontrols.action.exit": "Sair da tela",
|
||||
"midnightcontrols.action.forward": "Para frente",
|
||||
"midnightcontrols.action.hit": "Atacar",
|
||||
"midnightcontrols.action.hotbar_left": "Move a barra rápida para esquerda",
|
||||
"midnightcontrols.action.hotbar_right": "Move a barra rápida para direita",
|
||||
"midnightcontrols.action.inventory": "Invetário",
|
||||
"midnightcontrols.action.jump": "Pular",
|
||||
"midnightcontrols.action.left": "Esquerda",
|
||||
"midnightcontrols.action.pause_game": "Pausar",
|
||||
"midnightcontrols.action.pick_block": "Pegar bloco",
|
||||
"midnightcontrols.action.pickup": "Pegar",
|
||||
"midnightcontrols.action.pickup_all": "Pegar todos",
|
||||
"midnightcontrols.action.place": "Colocar",
|
||||
"midnightcontrols.action.player_list": "Lista de jogadores",
|
||||
"midnightcontrols.action.quick_move": "Mover rápido",
|
||||
"midnightcontrols.action.right": "Direita",
|
||||
"midnightcontrols.action.screenshot": "Tirar Screenshot",
|
||||
"midnightcontrols.action.slot_up": "Mover Slot para cima",
|
||||
"midnightcontrols.action.slot_down": "Mover Slot para baixo",
|
||||
"midnightcontrols.action.slot_left": "Mover Slot para esquerda",
|
||||
"midnightcontrols.action.slot_right": "Mover Slot para direita",
|
||||
"midnightcontrols.action.sneak": "Esgueirar",
|
||||
"midnightcontrols.action.sprint": "Correr",
|
||||
"midnightcontrols.action.swap_hands": "Trocar de mãos",
|
||||
"midnightcontrols.action.toggle_perspective": "Alternar perspectiva",
|
||||
"midnightcontrols.action.toggle_smooth_camera": "Ativar câmera cinemática",
|
||||
"midnightcontrols.action.page_back": "Página anterior",
|
||||
"midnightcontrols.action.page_next": "Próxima página",
|
||||
"midnightcontrols.action.tab_back": "Aba anterior",
|
||||
"midnightcontrols.action.tab_next": "Próxima aba",
|
||||
"midnightcontrols.action.take": "Pegar item",
|
||||
"midnightcontrols.action.take_all": "Pegar pilha",
|
||||
"midnightcontrols.action.use": "Usar",
|
||||
"midnightcontrols.action.zoom": "Zoom",
|
||||
"midnightcontrols.action.zoom_in": "Aumentar o Zoom",
|
||||
"midnightcontrols.action.zoom_out": "Diminuir o Zoom",
|
||||
"midnightcontrols.action.zoom_reset": "Resetar o Zoom",
|
||||
"midnightcontrols.action.emi_page_left": "Página anterior",
|
||||
"midnightcontrols.action.emi_page_right": "Próxima pickup",
|
||||
"midnightcontrols.category.emi": "EMI",
|
||||
"midnightcontrols.button.a": "A",
|
||||
"midnightcontrols.button.b": "B",
|
||||
"midnightcontrols.button.x": "X",
|
||||
"midnightcontrols.button.y": "Y",
|
||||
"midnightcontrols.button.left_bumper": "Botão L1",
|
||||
"midnightcontrols.button.right_bumper": "Botão R1",
|
||||
"midnightcontrols.button.back": "Voltar",
|
||||
"midnightcontrols.button.start": "Começar",
|
||||
"midnightcontrols.button.guide": "Guia",
|
||||
"midnightcontrols.button.left_thumb": "Analógico esquerdo",
|
||||
"midnightcontrols.button.right_thumb": "Analógico direito",
|
||||
"midnightcontrols.button.dpad_up": "Botão direcional para cima",
|
||||
"midnightcontrols.button.dpad_right": "Botão direcional para direita",
|
||||
"midnightcontrols.button.dpad_down": "Botão direcional para baixo",
|
||||
"midnightcontrols.button.dpad_left": "Botão direcional para esquerda",
|
||||
"midnightcontrols.button.l4": "L4",
|
||||
"midnightcontrols.button.l5": "L5",
|
||||
"midnightcontrols.button.r4": "R4",
|
||||
"midnightcontrols.button.r5": "L5",
|
||||
"midnightcontrols.axis.left_x+": "Esquerda X+",
|
||||
"midnightcontrols.axis.left_y+": "Esquerda Y+",
|
||||
"midnightcontrols.axis.right_x+": "Direita X+",
|
||||
"midnightcontrols.axis.right_y+": "Direita Y+",
|
||||
"midnightcontrols.axis.left_trigger": "Gatilho da esquerda",
|
||||
"midnightcontrols.axis.right_trigger": "Gatilho da direita",
|
||||
"midnightcontrols.axis.left_x-": "Esquerda X-",
|
||||
"midnightcontrols.axis.left_y-": "Esquerda Y-",
|
||||
"midnightcontrols.axis.right_x-": "Direita X-",
|
||||
"midnightcontrols.axis.right_y-": "Direita Y-",
|
||||
"midnightcontrols.button.unknown": "Desconhecido (%d)",
|
||||
"midnightcontrols.controller.tutorial.title": "Jogue o jogo com um controle!",
|
||||
"midnightcontrols.controller.tutorial.description": "Vá para %s -> %s -> %s",
|
||||
"midnightcontrols.controller.connected": "Controle %d conectado.",
|
||||
"midnightcontrols.controller.disconnected": "Controle %d desconectado.",
|
||||
"midnightcontrols.controller.mappings.1": "Para configurar o mapeamento do controle, por favor use %s",
|
||||
"midnightcontrols.controller.mappings.3": "e cole o mapeamento no editor de arquivos do mapeamento.",
|
||||
"midnightcontrols.controller.mappings.error": "Erro ao carregar mapeamentos.",
|
||||
"midnightcontrols.controller.mappings.error.write": "Erro ao gravar mapeamentos no arquivo.",
|
||||
"midnightcontrols.controller.mappings.updated": "Atualizando mapeamentos!",
|
||||
"midnightcontrols.controller_type.default": "Padrão",
|
||||
"midnightcontrols.controller_type.dualshock": "DualShock",
|
||||
"midnightcontrols.controller_type.dualsense": "DualSense",
|
||||
"midnightcontrols.controller_type.switch": "Controle de Switch/Wii",
|
||||
"midnightcontrols.controller_type.xbox": "Controle de Xbox One/Series",
|
||||
"midnightcontrols.controller_type.xbox_360": "Controle de Xbox 360",
|
||||
"midnightcontrols.controller_type.steam_controller": "Controle da Steam",
|
||||
"midnightcontrols.controller_type.steam_deck": "Steam Deck",
|
||||
"midnightcontrols.controller_type.ouya": "Controle de OUYA",
|
||||
"midnightcontrols.controller_type.numbered": "Controle númerado",
|
||||
"midnightcontrols.controls_mode.default": "Teclado/Mouse",
|
||||
"midnightcontrols.controls_mode.controller": "Controle",
|
||||
"midnightcontrols.controls_mode.touchscreen": "Tela sensível ao toque (Beta)",
|
||||
"midnightcontrols.hud_side.LEFT": "Esquerda",
|
||||
"midnightcontrols.hud_side.RIGHT": "Direita",
|
||||
"midnightcontrols.menu.analog_movement": "Movemento analógico",
|
||||
"midnightcontrols.menu.analog_movement.tooltip": "Quando possível, ative o movemento analógico.",
|
||||
"midnightcontrols.menu.auto_switch_mode": "Modo de troca automática",
|
||||
"midnightcontrols.menu.auto_switch_mode.tooltip": "Se o modo de controle deve ser alterado automaticamente para o controle quando um for conectado.",
|
||||
"midnightcontrols.menu.camera_mode": "Modo de câmera",
|
||||
"midnightcontrols.menu.controller": "Controle",
|
||||
"midnightcontrols.menu.controller2": "Segundo controle",
|
||||
"midnightcontrols.menu.controller2.tooltip": "Segundo controle a ser usado, o que permite (por exemplo) o suporte a Joy-Cons.",
|
||||
"midnightcontrols.menu.controller_toggle_sneak": "Alternar Esgueirar no Controle",
|
||||
"midnightcontrols.menu.controller_toggle_sprint": "Alternar Correr no Controle",
|
||||
"midnightcontrols.menu.controller_type": "Tipo de controle",
|
||||
"midnightcontrols.menu.controller_type.tooltip": "O tipo de controle que você está usando (é preciso para mostrar os botões corretos)",
|
||||
"midnightcontrols.menu.controls_mode": "Modo",
|
||||
"midnightcontrols.menu.controls_mode.tooltip": "O modo de controle.",
|
||||
"midnightcontrols.menu.copy_controller_guid": "Copiar o GUID",
|
||||
"midnightcontrols.menu.current_controller_guid": "GUID do controle atual: %s",
|
||||
"midnightcontrols.menu.double_tap_to_sprint": "Toque duplo para correr",
|
||||
"midnightcontrols.menu.double_tap_to_sprint.tooltip": "Alterna se a tecla Andar para Frente faz o jogador correr quando pressionada duas vezes rapidamente",
|
||||
"midnightcontrols.menu.fast_block_placing": "Colocação Rápida de Blocos",
|
||||
"midnightcontrols.menu.fast_block_placing.tooltip": "Enquanto voando no criativo, ativar a Colocação de Rápida de Blocos. §cEm alguns servidores isso pode ser considerado como trapaça.",
|
||||
"midnightcontrols.menu.fly_drifting": "Derrapagem ao Voar",
|
||||
"midnightcontrols.menu.fly_drifting.tooltip": "Enquanto voando, ativa a deparragem/inércia Vanilla.",
|
||||
"midnightcontrols.menu.fly_drifting_vertical": "Derrapagem vertical ao Voar",
|
||||
"midnightcontrols.menu.fly_drifting_vertical.tooltip": "Enquanto voando, ativa a deparragem/inércia vertical Vanilla.",
|
||||
"midnightcontrols.menu.hud_enable": "Ativar HUD",
|
||||
"midnightcontrols.menu.hud_enable.tooltip": "Alterna o indicador de botão do controle na tela.",
|
||||
"midnightcontrols.menu.hud_side": "Lado do HUD",
|
||||
"midnightcontrols.menu.hud_side.tooltip": "A posição do HUD.",
|
||||
"midnightcontrols.menu.invert_right_x_axis": "Inverter X Direito",
|
||||
"midnightcontrols.menu.invert_right_y_axis": "Inverter Y Direito",
|
||||
"midnightcontrols.menu.joystick_as_mouse": "Sempre usar analógico esquerdo como mouse",
|
||||
"midnightcontrols.menu.joystick_as_mouse.tooltip": "Fazer o analógico agir como um mouse em todos os menus.",
|
||||
"midnightcontrols.menu.eye_tracker_as_mouse": "Usar o rastreador ocular como um mouse",
|
||||
"midnightcontrols.menu.eye_tracker_as_mouse.tooltip": "Substituir o mouse com um dispositivo de rastreamento ocular, (por exemplo) o Tobii 5.",
|
||||
"midnightcontrols.menu.eye_tracker_deadzone": "Tamanho da zona morta do rastreador ocular",
|
||||
"midnightcontrols.menu.eye_tracker_deadzone.tooltip": "Parar o movimento da camera quando olhar perto da mira",
|
||||
"midnightcontrols.menu.keyboard_controls": "Controles do teclado...",
|
||||
"midnightcontrols.menu.left_dead_zone": "Zona morta do analógico esquerdo",
|
||||
"midnightcontrols.menu.left_dead_zone.tooltip": "A zona morta para o analógico esquerdo do controle.",
|
||||
"midnightcontrols.menu.mappings.open_input_str": "Abrir editor de arquivo de mapeamentos",
|
||||
"midnightcontrols.menu.max_left_x_value": "Valor máximo do eixo X esquerdo",
|
||||
"midnightcontrols.menu.max_left_x_value.tooltip": "Altera o valor máximo considerado pelo mod para o eixo X esquerdo. Útil se o seu eixo não usa toda a faixa e parece lento.",
|
||||
"midnightcontrols.menu.max_left_y_value": "Valor máximo do eixo Y esquerdo",
|
||||
"midnightcontrols.menu.max_left_y_value.tooltip": "Altera o valor máximo considerado pelo mod para o eixo Y esquerdo. Útil se o seu eixo não usa toda a faixa e parece lento.",
|
||||
"midnightcontrols.menu.max_right_x_value": "Valor máximo do eixo X direito",
|
||||
"midnightcontrols.menu.max_right_x_value.tooltip": "Altera o valor máximo considerado pelo mod para o eixo X direito. Útil se o seu eixo não usa toda a faixa e parece lento.",
|
||||
"midnightcontrols.menu.max_right_y_value": "Valor máximo do eixo Y direito",
|
||||
"midnightcontrols.menu.max_right_y_value.tooltip": "Altera o valor máximo considerado pelo mod para o eixo Y direito. Útil se o seu eixo não usa toda a faixa e parece lento.",
|
||||
"midnightcontrols.menu.mouse_speed": "Velocidade do mouse",
|
||||
"midnightcontrols.menu.mouse_speed.tooltip": "A velocidade do mouse emulado pelo controle",
|
||||
"midnightcontrols.menu.move_chat": "Mover a caixa do chat para o topo",
|
||||
"midnightcontrols.menu.move_chat.tooltip": "Move a caixa do chat para o topo, para uma melhor digitação em dispositivos com teclados na tela.",
|
||||
"midnightcontrols.menu.multiple_mapping_tip": "(Dica: Você também pode inserir múltiplos mapeamentos ao mesmo tempo)",
|
||||
"midnightcontrols.menu.reacharound.horizontal": "Colocação frontal de blocos",
|
||||
"midnightcontrols.menu.reacharound.horizontal.tooltip": "Ativa colocação frontal de blocos, §cEm alguns servidores isso pode ser considerado como trapaça.§r.",
|
||||
"midnightcontrols.menu.reacharound.vertical": "Alcance vertical",
|
||||
"midnightcontrols.menu.reacharound.vertical.tooltip": "Ativa alcance vertical, §c§cEm alguns servidores isso pode ser considerado como trapaça.§r.",
|
||||
"midnightcontrols.menu.reload_controller_mappings": "Recarregar o mapeamento do controle",
|
||||
"midnightcontrols.menu.reload_controller_mappings.tooltip": "Recarrega o arquivo de mapeamentos do controle.",
|
||||
"midnightcontrols.menu.right_dead_zone": "Zona morta do analógico direito",
|
||||
"midnightcontrols.menu.right_dead_zone.tooltip": "A zona morta para o analógico direito do controle..",
|
||||
"midnightcontrols.menu.rotation_speed": "Velocidade de rotação do eixo X",
|
||||
"midnightcontrols.menu.rotation_speed.tooltip": "A velocidade de rotação do eixo X da câmera no modo controle.",
|
||||
"midnightcontrols.menu.y_axis_rotation_speed": "Velocidade de rotação do eixo Y",
|
||||
"midnightcontrols.menu.y_axis_rotation_speed.tooltip": "A velocidade de rotação do eixo Y da câmera no modo controle.",
|
||||
"midnightcontrols.menu.separate_controller_profile": "Separar perfil do controle",
|
||||
"midnightcontrols.menu.separator.controller": "Controle",
|
||||
"midnightcontrols.menu.separator.general": "Geral",
|
||||
"midnightcontrols.menu.title": "MidnightControls - Configurações",
|
||||
"midnightcontrols.menu.title.controller": "Configurações do controle",
|
||||
"midnightcontrols.menu.title.controller_controls": "Mapeamento de controle",
|
||||
"midnightcontrols.menu.title.gameplay": "Configurações de jogabilidade",
|
||||
"midnightcontrols.menu.title.general": "Configurações gerais",
|
||||
"midnightcontrols.menu.title.hud": "Configurações de HUD",
|
||||
"midnightcontrols.menu.title.mappings.string": "Editor de arquivo de mapeamentos",
|
||||
"midnightcontrols.menu.title.touch": "Configurações de toque",
|
||||
"midnightcontrols.menu.title.visual": "Configurações de aparência",
|
||||
"midnightcontrols.menu.touch_break_delay": "Atrasado de destruição do toque",
|
||||
"midnightcontrols.menu.touch_speed": "Velocidade do toque",
|
||||
"midnightcontrols.menu.invert_touch": "Inverter direção do toque",
|
||||
"midnightcontrols.menu.touch_mode": "Modo de interação de toque",
|
||||
"midnightcontrols.menu.touch_transparency": "Transparência do HUD de toque",
|
||||
"midnightcontrols.menu.touch_with_controller": "Toque no modo do controle",
|
||||
"midnightcontrols.menu.unfocused_input": "Entrada desfocada",
|
||||
"midnightcontrols.menu.unfocused_input.tooltip": "Permite entrada de sinais do controle quando a janela não está em foco.",
|
||||
"midnightcontrols.menu.virtual_mouse": "Mouse virtual",
|
||||
"midnightcontrols.menu.virtual_mouse.tooltip": "Ativa o mouse virtual, que é útil durante o modo tela dividida.",
|
||||
"midnightcontrols.menu.virtual_mouse.skin": "Tema do mouse virtual",
|
||||
"midnightcontrols.menu.hide_cursor": "Desativar cursor do mouse padrão",
|
||||
"midnightcontrols.menu.hide_cursor.tooltip": "Esconde o cursor padrão do mouse, deixando apenas o mouse virtual visível.",
|
||||
"midnightcontrols.narrator.unbound": "Desmapear %s",
|
||||
"midnightcontrols.not_bound": "Não mapeado",
|
||||
"midnightcontrols.virtual_mouse.skin.default_light": "Padrão claro",
|
||||
"midnightcontrols.virtual_mouse.skin.default_dark": "Padrão escuro",
|
||||
"midnightcontrols.virtual_mouse.skin.second_light": "Segundo claro",
|
||||
"midnightcontrols.virtual_mouse.skin.second_dark": "Segundo escuro",
|
||||
"midnightcontrols.midnightconfig.category.controller": "Controle",
|
||||
"midnightcontrols.midnightconfig.category.misc": "Variados",
|
||||
"midnightcontrols.midnightconfig.category.screens": "Telas",
|
||||
"midnightcontrols.midnightconfig.category.gameplay": "Jogabilidade",
|
||||
"midnightcontrols.midnightconfig.category.touch": "Toque",
|
||||
"midnightcontrols.midnightconfig.category.visual": "Visual",
|
||||
"modmenu.descriptionTranslation.midnightcontrols": "Adiciona suporte a controles e aprimora o controle no geral.\nDerivado do LambdaControls, que infelizmente foi descontinuado."
|
||||
}
|
||||
@@ -1,184 +0,0 @@
|
||||
{
|
||||
"midnightcontrols.midnightconfig.title": "Розширена конфігурація MidnightControls",
|
||||
"key.midnightcontrols.look_down": "Дивитись вниз",
|
||||
"key.midnightcontrols.look_left": "Дивитись ліворуч",
|
||||
"key.midnightcontrols.look_right": "Дивитись направо",
|
||||
"key.midnightcontrols.look_up": "Дивитись вгору",
|
||||
"key.midnightcontrols.ring": "Показати кільце управління",
|
||||
"midnightcontrols.action.attack": "Атакувати",
|
||||
"midnightcontrols.action.back": "Назад",
|
||||
"midnightcontrols.action.chat": "Відкрити чат",
|
||||
"midnightcontrols.action.debug_screen": "Відкрити налагодження (F3)",
|
||||
"midnightcontrols.action.drop_item": "Викинути предмет",
|
||||
"midnightcontrols.action.exit": "Вийти",
|
||||
"midnightcontrols.action.forward": "Вперед",
|
||||
"midnightcontrols.action.hit": "Вдарити",
|
||||
"midnightcontrols.action.hotbar_left": "Панель швидкого доступу ліворуч",
|
||||
"midnightcontrols.action.hotbar_right": "Панель швидкого доступу праворуч",
|
||||
"midnightcontrols.action.inventory": "Інвентар",
|
||||
"midnightcontrols.action.jump": "Стрибок",
|
||||
"midnightcontrols.action.left": "Наліво",
|
||||
"midnightcontrols.action.pause_game": "Зупинити гру",
|
||||
"midnightcontrols.action.pick_block": "Вибір блоку",
|
||||
"midnightcontrols.action.pickup": "Взяти половину",
|
||||
"midnightcontrols.action.pickup_all": "Взяти все",
|
||||
"midnightcontrols.action.place": "Поставити",
|
||||
"midnightcontrols.action.player_list": "Аркуш гравців",
|
||||
"midnightcontrols.action.quick_move": "Перекласти",
|
||||
"midnightcontrols.action.right": "Направо",
|
||||
"midnightcontrols.action.screenshot": "Зробити скріншот",
|
||||
"midnightcontrols.action.slot_up": "Двинути на слот вгору",
|
||||
"midnightcontrols.action.slot_down": "Повернути на слот вниз",
|
||||
"midnightcontrols.action.slot_left": "Двинути на слот вліво",
|
||||
"midnightcontrols.action.slot_right": "Повернути на слот вправо",
|
||||
"midnightcontrols.action.sneak": "Крастися",
|
||||
"midnightcontrols.action.sprint": "Біг",
|
||||
"midnightcontrols.action.swap_hands": "Змінити руку",
|
||||
"midnightcontrols.action.toggle_perspective": "Переключити перспективу",
|
||||
"midnightcontrols.action.toggle_smooth_camera": "Переключити кінематографічну камеру",
|
||||
"midnightcontrols.action.page_back": "Попередня сторінка",
|
||||
"midnightcontrols.action.page_next": "Наступна сторінка",
|
||||
"midnightcontrols.action.tab_back": "Попередня секція",
|
||||
"midnightcontrols.action.tab_next": "Наступна секція",
|
||||
"midnightcontrols.action.take": "Взяти предмет",
|
||||
"midnightcontrols.action.take_all": "Взяти стак",
|
||||
"midnightcontrols.action.use": "Використовувати",
|
||||
"midnightcontrols.action.zoom": "Наблизити",
|
||||
"midnightcontrols.action.zoom_in": "Збільшити масштаб",
|
||||
"midnightcontrols.action.zoom_out": "Зменшити масштаб",
|
||||
"midnightcontrols.action.zoom_reset": "Скинути масштаб",
|
||||
"midnightcontrols.action.emi_page_left": "Попередня сторінка",
|
||||
"midnightcontrols.action.emi_page_right": "Наступна сторінка",
|
||||
"midnightcontrols.category.emi": "ЕМІ",
|
||||
"midnightcontrols.button.a": "A",
|
||||
"midnightcontrols.button.b": "B",
|
||||
"midnightcontrols.button.x": "X",
|
||||
"midnightcontrols.button.y": "Y",
|
||||
"midnightcontrols.button.left_bumper": "Лівий бампер",
|
||||
"midnightcontrols.button.right_bumper": "Правий бампер",
|
||||
"midnightcontrols.button.back": "Назад",
|
||||
"midnightcontrols.button.start": "Старт",
|
||||
"midnightcontrols.button.guide": "Гайд кнопка",
|
||||
"midnightcontrols.button.left_thumb": "Лівий стік",
|
||||
"midnightcontrols.button.right_thumb": "Правий стік",
|
||||
"midnightcontrols.button.dpad_up": "Хрестовина вг.",
|
||||
"midnightcontrols.button.dpad_right": "Хрестовина пр.",
|
||||
"midnightcontrols.button.dpad_down": "Хрестовина вн.",
|
||||
"midnightcontrols.button.dpad_left": "Хрестовина лів.",
|
||||
"midnightcontrols.button.l4": "L4",
|
||||
"midnightcontrols.button.l5": "L5",
|
||||
"midnightcontrols.button.r4": "R4",
|
||||
"midnightcontrols.button.r5": "L5",
|
||||
"midnightcontrols.axis.left_x+": "Лівий cтік X+",
|
||||
"midnightcontrols.axis.left_y+": "Лівий cтік Y+",
|
||||
"midnightcontrols.axis.right_x+": "Правий cтік X+",
|
||||
"midnightcontrols.axis.right_y+": "Правий cтік Y+",
|
||||
"midnightcontrols.axis.left_trigger": "Лівий тригер",
|
||||
"midnightcontrols.axis.right_trigger": "Правий тригер",
|
||||
"midnightcontrols.axis.left_x-": "Лівий стік X-",
|
||||
"midnightcontrols.axis.left_y-": "Лівий стік Y-",
|
||||
"midnightcontrols.axis.right_x-": "Правий стік X-",
|
||||
"midnightcontrols.axis.right_y-": "Правий стік Y-",
|
||||
"midnightcontrols.button.unknown": "Невідомий (%d)",
|
||||
"midnightcontrols.controller.connected": "Контролер %d був приєднаний.",
|
||||
"midnightcontrols.controller.disconnected": "Контролер %d вимкнений.",
|
||||
"midnightcontrols.controller.mappings.1": "Щоб налаштувати розкладку контролера, використовуйте %s",
|
||||
"midnightcontrols.controller.mappings.3": "і вставте ваш підсумок у редактор файлів розкладок.",
|
||||
"midnightcontrols.controller.mappings.error": "Помилка під час завантаження розкладки.",
|
||||
"midnightcontrols.controller.mappings.error.write": "Помилка під час запису розкладки у файл.",
|
||||
"midnightcontrols.controller.mappings.updated": "Розкладка оновлена!",
|
||||
"midnightcontrols.controller_type.default": "За стандартом",
|
||||
"midnightcontrols.controller_type.dualshock": "DualShock",
|
||||
"midnightcontrols.controller_type.dualsense": "DualSense",
|
||||
"midnightcontrols.controller_type.switch": "Switch",
|
||||
"midnightcontrols.controller_type.xbox": "Xbox",
|
||||
"midnightcontrols.controller_type.xbox_360": "Xbox 360",
|
||||
"midnightcontrols.controller_type.steam_controller": "Steam Controller",
|
||||
"midnightcontrols.controller_type.steam_deck": "Steam Deck",
|
||||
"midnightcontrols.controller_type.ouya": "OUYA",
|
||||
"midnightcontrols.controls_mode.default": "Клавіатура/Миша",
|
||||
"midnightcontrols.controls_mode.controller": "Контролер",
|
||||
"midnightcontrols.controls_mode.touchscreen": "Сенсорний екран (Розроб.)",
|
||||
"midnightcontrols.hud_side.left": "Більше ліворуч",
|
||||
"midnightcontrols.hud_side.right": "Більше направо",
|
||||
"midnightcontrols.menu.analog_movement": "Аналоговий рух",
|
||||
"midnightcontrols.menu.auto_switch_mode": "Автоматичне перемикання",
|
||||
"midnightcontrols.menu.controller": "Контролер",
|
||||
"midnightcontrols.menu.controller2": "Додатковий контролер",
|
||||
"midnightcontrols.menu.controller_type": "Тип контролера",
|
||||
"midnightcontrols.menu.controls_mode": "Тип",
|
||||
"midnightcontrols.menu.double_tap_to_sprint": "Двічі відвести лівий стік, щоб почати бігти",
|
||||
"midnightcontrols.menu.fast_block_placing": "Швидка постачання блоків",
|
||||
"midnightcontrols.menu.fly_drifting": "Інерція при польоті",
|
||||
"midnightcontrols.menu.fly_drifting_vertical": "Вертикальна інерція при польоті",
|
||||
"midnightcontrols.menu.hud_enable": "Увімкнути іконоки контролера",
|
||||
"midnightcontrols.menu.hud_side": "Розташування інтерфейсу",
|
||||
"midnightcontrols.menu.invert_right_x_axis": "Інвертувати прав. X",
|
||||
"midnightcontrols.menu.invert_right_y_axis": "Інвертувати прав. Y",
|
||||
"midnightcontrols.menu.keyboard_controls": "Клавіатурне налаштування...",
|
||||
"midnightcontrols.menu.left_dead_zone": "Мертва зона лівого стіка",
|
||||
"midnightcontrols.menu.mappings.open_input_str": "Відкрити редактор файлів розкладок",
|
||||
"midnightcontrols.menu.max_left_x_value": "Максимальне значення вісь лівого X",
|
||||
"midnightcontrols.menu.max_left_y_value": "Максимальне значення вісь лівого Y",
|
||||
"midnightcontrols.menu.max_right_x_value": "Максимальне значення вісь правого X",
|
||||
"midnightcontrols.menu.max_right_y_value": "Максимальне значення Вісь правого Y",
|
||||
"midnightcontrols.menu.mouse_speed": "Швидкість курсору",
|
||||
"midnightcontrols.menu.reacharound.horizontal": "Розміщення переднього блоку",
|
||||
"midnightcontrols.menu.reacharound.vertical": "Вертикальний охоплення",
|
||||
"midnightcontrols.menu.reload_controller_mappings": "Перезавантажити розкладку контролера",
|
||||
"midnightcontrols.menu.right_dead_zone": "Мертва зона правого стіка",
|
||||
"midnightcontrols.menu.rotation_speed": "Швидкість обертання по осі X",
|
||||
"midnightcontrols.menu.y_axis_rotation_speed": "Швидкість обертання по осі Y",
|
||||
"midnightcontrols.menu.separator.controller": "Контролер",
|
||||
"midnightcontrols.menu.separator.general": "Загальні",
|
||||
"midnightcontrols.menu.title": "MidnightControls - налаштування",
|
||||
"midnightcontrols.menu.title.controller": "Налаштування контролера",
|
||||
"midnightcontrols.menu.title.controller_controls": "Управління контролером",
|
||||
"midnightcontrols.menu.title.gameplay": "Налаштування під час гри",
|
||||
"midnightcontrols.menu.title.general": "Загальні Налаштування",
|
||||
"midnightcontrols.menu.title.hud": "Налаштування інтерфейсу",
|
||||
"midnightcontrols.menu.title.mappings.string": "Редактор файлів розкладок",
|
||||
"midnightcontrols.menu.title.visual": "Налаштування зовнішнього вигляду",
|
||||
"midnightcontrols.menu.unfocused_input": "Несфокусоване введення",
|
||||
"midnightcontrols.menu.virtual_mouse": "Віртуальні мишки",
|
||||
"midnightcontrols.menu.virtual_mouse.skin": "Дизайн віртуальної мишки",
|
||||
"midnightcontrols.narrator.unbound": "Звільнений %s",
|
||||
"midnightcontrols.not_bound": "Не призначено",
|
||||
"midnightcontrols.menu.analog_movement.tooltip": "Включає аналоговий рух, коли це можливо.",
|
||||
"midnightcontrols.menu.auto_switch_mode.tooltip": "Автоматичне перемикання на новий, тільки підключений контролер.",
|
||||
"midnightcontrols.menu.controller2.tooltip": "Додатковий контролер, наприклад для джой-конів.",
|
||||
"midnightcontrols.menu.controller_type.tooltip": "Тип контролера, щоб правильно зіставити іконки кнопок.",
|
||||
"midnightcontrols.menu.controls_mode.tooltip": "Тип контролю за грою.",
|
||||
"midnightcontrols.menu.double_tap_to_sprint.tooltip": "При подвійному переміщенні на лівий стик, персонаж починає бігти.",
|
||||
"midnightcontrols.menu.fast_block_placing.tooltip": "Під час польоту в творчому режимі дозволяє швидко розміщувати блоки в залежності від вашої швидкості. §cНа деяких серверах це може розцінюватися як читерство.§r",
|
||||
"midnightcontrols.menu.fly_drifting.tooltip": "Під час польоту включає ванільну інерцію.",
|
||||
"midnightcontrols.menu.fly_drifting_vertical.tooltip": "Під час польоту включає ванільну вертикальну інерцію.",
|
||||
"midnightcontrols.menu.hud_enable.tooltip": "Переключає бачення іконок кнопок контролера на екрані.",
|
||||
"midnightcontrols.menu.hud_side.tooltip": "Розташування інтерфейсу у певний бік.",
|
||||
"midnightcontrols.menu.left_dead_zone.tooltip": "Мертва зона для лівого аналогового стику контролера.",
|
||||
"midnightcontrols.menu.max_left_x_value.tooltip": "Змінює те, що мод в результаті вважає максимальним значенням для лівої осі X. Корисно, якщо ваша вісь не використовує весь діапазон і здається повільною.",
|
||||
"midnightcontrols.menu.max_left_y_value.tooltip": "Змінює те, що мод в результаті вважає максимальним значенням для лівої осі Y. Корисно, якщо ваша вісь не використовує весь діапазон і здається повільною.",
|
||||
"midnightcontrols.menu.max_right_x_value.tooltip": "Змінює те, що мод в результаті вважає максимальним значенням для правої осі X. Корисно, якщо ваша вісь не використовує весь діапазон і здається повільною.",
|
||||
"midnightcontrols.menu.max_right_y_value.tooltip": "Змінює те, що мод в результаті вважає максимальним значенням для правої осі Y. Корисно, якщо ваша вісь не використовує весь діапазон і здається повільною.",
|
||||
"midnightcontrols.menu.mouse_speed.tooltip": "Швидкість миші, що емульується контролером.",
|
||||
"midnightcontrols.menu.reacharound.horizontal.tooltip": "Дозволяє розміщувати передній блок перед собою. §cМоже розглядатися як читерство на деяких серверах§r.",
|
||||
"midnightcontrols.menu.reacharound.vertical.tooltip": "Забезпечує вертикальне охоплення. §cМоже розглядатися як шахрайство на деяких серверах§r.",
|
||||
"midnightcontrols.menu.reload_controller_mappings.tooltip": "Перезавантажує файл розкладки контролерів.",
|
||||
"midnightcontrols.menu.right_dead_zone.tooltip": "Мертва зона для правого аналогового стику контролера.",
|
||||
"midnightcontrols.menu.rotation_speed.tooltip": "Швидкість обертання камери по осі X в режимі контролера.",
|
||||
"midnightcontrols.menu.y_axis_rotation_speed.tooltip": "Швидкість обертання камери по осі Y в режимі контролера.",
|
||||
"midnightcontrols.menu.unfocused_input.tooltip": "Дозволити введення з контролера, навіть якщо гра сфокусована.",
|
||||
"midnightcontrols.menu.virtual_mouse.tooltip": "Включити віртуальну мишу дуже корисно при грі двом на одному комп'ютері.",
|
||||
"midnightcontrols.virtual_mouse.skin.default_light": "Звичайний світлий",
|
||||
"midnightcontrols.virtual_mouse.skin.default_dark": "Звичайний темний",
|
||||
"midnightcontrols.virtual_mouse.skin.second_light": "Додатковий світлий",
|
||||
"midnightcontrols.virtual_mouse.skin.second_dark": "Додатковий темний",
|
||||
"modmenu.descriptionTranslation.midnightcontrols": "Додавання підтримки контролера та покращення елементів керування в цілому.\nРозгалужений від LambdaControls, підтримка якого, на жаль, припинена..",
|
||||
"midnightcontrols.menu.joystick_as_mouse": "Завжди використовуйте лівий стік як мишку",
|
||||
"midnightcontrols.menu.joystick_as_mouse.tooltip": "Джойстик поводиться як миша в кожному меню.",
|
||||
"midnightcontrols.menu.controller_toggle_sneak": "Перемикач присідання на контролері",
|
||||
"midnightcontrols.menu.controller_toggle_sprint": "Перемикач бігу на контролері",
|
||||
"midnightcontrols.menu.move_chat": "Перемістити поле введення чату вгору",
|
||||
"midnightcontrols.action.controls_ring": "Показати кільце Управління",
|
||||
"midnightcontrols.menu.separate_controller_profile": "Окремий профіль контролера"
|
||||
}
|
||||
@@ -1,214 +0,0 @@
|
||||
{
|
||||
"midnightcontrols.midnightconfig.title": "Cấu hình MidnightControls nâng cao",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.DEFAULT_LIGHT": "Sáng mặc định",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.DEFAULT_DARK": "Tối mặc định",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.SECOND_LIGHT": "Sáng thứ hai",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.SECOND_DARK": "Tối thứ hai",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.DEFAULT": "Mặc định",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.DUALSHOCK": "DualShock",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.DUALSENSE": "DualSense",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.SWITCH": "Bộ điều khiển Switch/Wii",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.XBOX": "Bộ điều khiển Xbox One/Series",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.XBOX_360": "Bộ điều khiển Xbox 360",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.STEAM_CONTROLLER": "Bộ điều khiển Steam",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.STEAM_DECK": "Steam Deck",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.OUYA": "Bộ điều khiển OUYA",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.NUMBERED": "Bộ điều khiển được đánh số",
|
||||
"midnightcontrols.midnightconfig.enum.ControlsMode.DEFAULT": "Bàn phím/Chuột",
|
||||
"midnightcontrols.midnightconfig.enum.ControlsMode.CONTROLLER": "Bộ điều khiển",
|
||||
"midnightcontrols.midnightconfig.enum.ControlsMode.TOUCHSCREEN": "Màn hình cảm ứng (WIP)",
|
||||
"midnightcontrols.midnightconfig.enum.HudSide.LEFT": "Trái",
|
||||
"midnightcontrols.midnightconfig.enum.HudSide.RIGHT": "Phải",
|
||||
"key.midnightcontrols.look_down": "Nhìn xuống",
|
||||
"key.midnightcontrols.look_left": "Nhìn trái",
|
||||
"key.midnightcontrols.look_right": "Nhìn phải",
|
||||
"key.midnightcontrols.look_up": "Nhìn lên",
|
||||
"key.midnightcontrols.ring": "Mở vòng liên kết phím không liên kết",
|
||||
"midnightcontrols.action.attack": "Tấn công",
|
||||
"midnightcontrols.action.back": "Trở lại",
|
||||
"midnightcontrols.action.chat": "Mở trò chuyện",
|
||||
"midnightcontrols.action.controls_ring": "Mở vòng liên kết phím không liên kết",
|
||||
"midnightcontrols.action.debug_screen": "Mở HUD gỡ lỗi (F3)",
|
||||
"midnightcontrols.action.drop_item": "Thả vật phẩm",
|
||||
"midnightcontrols.action.exit": "Màn hình thoát",
|
||||
"midnightcontrols.action.forward": "Tiến",
|
||||
"midnightcontrols.action.hit": "Đánh",
|
||||
"midnightcontrols.action.hotbar_left": "Thanh nóng bên trái",
|
||||
"midnightcontrols.action.hotbar_right": "Thanh nóng bên phải",
|
||||
"midnightcontrols.action.inventory": "Túi đồ",
|
||||
"midnightcontrols.action.jump": "Nhảy",
|
||||
"midnightcontrols.action.left": "Trái",
|
||||
"midnightcontrols.action.pause_game": "Tạm dừng trò chơi",
|
||||
"midnightcontrols.action.pick_block": "Chọn khối",
|
||||
"midnightcontrols.action.pickup": "Nhặt",
|
||||
"midnightcontrols.action.pickup_all": "Nhặt tất cả",
|
||||
"midnightcontrols.action.place": "Đặt",
|
||||
"midnightcontrols.action.player_list": "Danh sách người chơi",
|
||||
"midnightcontrols.action.quick_move": "Di chuyển nhanh",
|
||||
"midnightcontrols.action.right": "Phải",
|
||||
"midnightcontrols.action.screenshot": "Chụp màn hình",
|
||||
"midnightcontrols.action.slot_up": "Di chuyển vị trí lên",
|
||||
"midnightcontrols.action.slot_down": "Di chuyển vị trí xuống",
|
||||
"midnightcontrols.action.slot_left": "Di chuyển vị trí qua trái",
|
||||
"midnightcontrols.action.slot_right": "Di chuyển vị trí qua phải",
|
||||
"midnightcontrols.action.sneak": "Đi rón rén",
|
||||
"midnightcontrols.action.sprint": "Chạy nhanh",
|
||||
"midnightcontrols.action.swap_hands": "Đổi tay",
|
||||
"midnightcontrols.action.toggle_perspective": "Đổi góc nhìn",
|
||||
"midnightcontrols.action.toggle_smooth_camera": "Đổi góc nhìn kịch tính",
|
||||
"midnightcontrols.action.page_back": "Trang trước",
|
||||
"midnightcontrols.action.page_next": "Trang tiếp theo",
|
||||
"midnightcontrols.action.tab_back": "Tab trước",
|
||||
"midnightcontrols.action.tab_next": "Tab trước",
|
||||
"midnightcontrols.action.take": "Lấy vật phẩm",
|
||||
"midnightcontrols.action.take_all": "Lấy Stack",
|
||||
"midnightcontrols.action.use": "Sử dụng",
|
||||
"midnightcontrols.action.zoom": "Phóng",
|
||||
"midnightcontrols.action.zoom_in": "Tăng Phóng",
|
||||
"midnightcontrols.action.zoom_out": "Giảm Phóng",
|
||||
"midnightcontrols.action.zoom_reset": "Đặt lại Phóng",
|
||||
"midnightcontrols.action.emi_page_left": "Trang trước",
|
||||
"midnightcontrols.action.emi_page_right": "Trang tiếp theo",
|
||||
"midnightcontrols.category.emi": "EMI",
|
||||
"midnightcontrols.button.a": "A",
|
||||
"midnightcontrols.button.b": "B",
|
||||
"midnightcontrols.button.x": "X",
|
||||
"midnightcontrols.button.y": "Y",
|
||||
"midnightcontrols.button.left_bumper": "Cản trái",
|
||||
"midnightcontrols.button.right_bumper": "Cản phải",
|
||||
"midnightcontrols.button.back": "Trở lại",
|
||||
"midnightcontrols.button.start": "Bắt đầu",
|
||||
"midnightcontrols.button.guide": "Hướng dẫn",
|
||||
"midnightcontrols.button.left_thumb": "Ngón cái trái",
|
||||
"midnightcontrols.button.right_thumb": "Ngón cái phải",
|
||||
"midnightcontrols.button.dpad_up": "DPAD lên",
|
||||
"midnightcontrols.button.dpad_right": "DPAD qua phải",
|
||||
"midnightcontrols.button.dpad_down": "DPAD xuống",
|
||||
"midnightcontrols.button.dpad_left": "DPAD qua trái",
|
||||
"midnightcontrols.button.l4": "L4",
|
||||
"midnightcontrols.button.l5": "L5",
|
||||
"midnightcontrols.button.r4": "R4",
|
||||
"midnightcontrols.button.r5": "L5",
|
||||
"midnightcontrols.axis.left_x+": "X+ trái",
|
||||
"midnightcontrols.axis.left_y+": "Y+ phải",
|
||||
"midnightcontrols.axis.right_x+": "X+ phải",
|
||||
"midnightcontrols.axis.right_y+": "Y+ trái",
|
||||
"midnightcontrols.axis.left_trigger": "Bấm nút trái",
|
||||
"midnightcontrols.axis.right_trigger": "Bấm nút phải",
|
||||
"midnightcontrols.axis.left_x-": "X- trái",
|
||||
"midnightcontrols.axis.left_y-": "Y- phải",
|
||||
"midnightcontrols.axis.right_x-": "X- phải",
|
||||
"midnightcontrols.axis.right_y-": "Y- trái",
|
||||
"midnightcontrols.button.unknown": "Không biết (%d)",
|
||||
"midnightcontrols.controller.tutorial.title": "Chơi trò chơi với Bộ điều khiển!",
|
||||
"midnightcontrols.controller.tutorial.description": "Đi tới %s -> %s -> %s",
|
||||
"midnightcontrols.controller.connected": "Bộ điều khiển %d đã được kết nối.",
|
||||
"midnightcontrols.controller.disconnected": "Bộ điều khiển %d đã bị ngắt kết nối.",
|
||||
"midnightcontrols.controller.mappings.1": "Để định cấu hình mapping bộ điều khiển, vui lòng sử dụng %s",
|
||||
"midnightcontrols.controller.mappings.3": "và dán mapping vào trình chỉnh sửa tệp mapping.",
|
||||
"midnightcontrols.controller.mappings.error": "Lỗi khi tải mapping.",
|
||||
"midnightcontrols.controller.mappings.error.write": "Lỗi khi ghi mapping vào tệp.",
|
||||
"midnightcontrols.controller.mappings.updated": "Mapping đã được cập nhật!",
|
||||
"midnightcontrols.controller_type.default": "Mặc định",
|
||||
"midnightcontrols.controller_type.dualshock": "DualShock",
|
||||
"midnightcontrols.controller_type.dualsense": "DualSense",
|
||||
"midnightcontrols.controller_type.switch": "Bộ điều khiển Switch/Wii",
|
||||
"midnightcontrols.controller_type.xbox": "Bộ điều khiển Xbox One/Series",
|
||||
"midnightcontrols.controller_type.xbox_360": "Bộ điều khiển Xbox 360",
|
||||
"midnightcontrols.controller_type.steam_controller": "Bộ điều khiển Steam",
|
||||
"midnightcontrols.controller_type.steam_deck": "Steam Deck",
|
||||
"midnightcontrols.controller_type.ouya": "Bộ điều khiển OUYA",
|
||||
"midnightcontrols.controller_type.numbered": "Bộ điều khiển được đánh số",
|
||||
"midnightcontrols.controls_mode.default": "Bàn phím/Chuột",
|
||||
"midnightcontrols.controls_mode.controller": "Bộ điều khiển",
|
||||
"midnightcontrols.controls_mode.touchscreen": "Màn hình cảm ứng (WIP)",
|
||||
"midnightcontrols.hud_side.left": "Trái",
|
||||
"midnightcontrols.hud_side.right": "Phải",
|
||||
"midnightcontrols.menu.analog_movement": "Chuyển động tương tự",
|
||||
"midnightcontrols.menu.analog_movement.tooltip": "Khi có thể, hãy bật chuyển động tương tự.",
|
||||
"midnightcontrols.menu.auto_switch_mode": "Chế độ tự động chuyển đổi",
|
||||
"midnightcontrols.menu.auto_switch_mode.tooltip": "Có nên tự động chuyển chế độ điều khiển sang Bộ điều khiển nếu một bộ điều khiển được kết nối hay không.",
|
||||
"midnightcontrols.menu.controller": "Bộ điều khiển",
|
||||
"midnightcontrols.menu.controller2": "Bộ điều khiển thứ hai",
|
||||
"midnightcontrols.menu.controller2.tooltip": "Bộ điều khiển thứ hai để sử dụng, cho phép (ví dụ) hỗ trợ Joy-Cons.",
|
||||
"midnightcontrols.menu.controller_toggle_sneak": "Đổi đi rón rén trên bộ điều khiển",
|
||||
"midnightcontrols.menu.controller_toggle_sprint": "Đổi chạy nhanh trên bộ điều khiển",
|
||||
"midnightcontrols.menu.controller_type": "Loại bộ điều khiển",
|
||||
"midnightcontrols.menu.controller_type.tooltip": "Loại bộ điều khiển bạn đang sử dụng (cần thiết để hiển thị các nút chính xác)",
|
||||
"midnightcontrols.menu.controls_mode": "Chế độ",
|
||||
"midnightcontrols.menu.controls_mode.tooltip": "Chế độ điều khiển.",
|
||||
"midnightcontrols.menu.double_tap_to_sprint": "Nhấn đúp để chạy nhanh",
|
||||
"midnightcontrols.menu.double_tap_to_sprint.tooltip": "Chuyển đổi liệu phím Tiến lên phía trước có khiến người chơi chạy nhanh khi nhấn chạm nhanh hai lần hay không",
|
||||
"midnightcontrols.menu.fast_block_placing": "Đặt khối nhanh",
|
||||
"midnightcontrols.menu.fast_block_placing.tooltip": "Trong khi bay ở chế độ sáng tạo, cho phép đặt khối nhanh tùy thuộc vào tốc độ của bạn. §cTrên một số máy chủ, điều này có thể bị coi là gian lận.",
|
||||
"midnightcontrols.menu.fly_drifting": "Trôi bay",
|
||||
"midnightcontrols.menu.fly_drifting.tooltip": "Khi đang bay, cho phép trôi dọc/xen kẽ truyền thống.",
|
||||
"midnightcontrols.menu.fly_drifting_vertical": "Trôi theo phương thẳng đứng",
|
||||
"midnightcontrols.menu.fly_drifting_vertical.tooltip": "Trong khi bay, cho phép trôi dọc/xen kẽ truyền thống.",
|
||||
"midnightcontrols.menu.hud_enable": "Bật HUD",
|
||||
"midnightcontrols.menu.hud_enable.tooltip": "Chuyển đổi chỉ báo nút điều khiển trên màn hình.",
|
||||
"midnightcontrols.menu.hud_side": "Phía HUD",
|
||||
"midnightcontrols.menu.hud_side.tooltip": "Vị trí của HUD.",
|
||||
"midnightcontrols.menu.invert_right_x_axis": "Đảo ngược X phải",
|
||||
"midnightcontrols.menu.invert_right_y_axis": "Đảo ngược Y phải",
|
||||
"midnightcontrols.menu.joystick_as_mouse": "Luôn sử dụng thanh bên trái làm chuột",
|
||||
"midnightcontrols.menu.joystick_as_mouse.tooltip": "Làm cho cần điều khiển hoạt động giống như một con chuột trong mọi menu.",
|
||||
"midnightcontrols.menu.keyboard_controls": "Điều khiển bàn phím...",
|
||||
"midnightcontrols.menu.left_dead_zone": "Vùng chết thanh bên trái",
|
||||
"midnightcontrols.menu.left_dead_zone.tooltip": "Vùng chết cho thanh analog bên trái của bộ điều khiển.",
|
||||
"midnightcontrols.menu.mappings.open_input_str": "Mở Trình chỉnh sửa tệp mapping",
|
||||
"midnightcontrols.menu.max_left_x_value": "Giá trị tối đa của trục X bên trái",
|
||||
"midnightcontrols.menu.max_left_x_value.tooltip": "Thay đổi những gì mod coi là giá trị cao nhất cho trục X bên trái. Hữu ích nếu trục của bạn không sử dụng hết phạm vi và có vẻ chậm.",
|
||||
"midnightcontrols.menu.max_left_y_value": "Giá trị tối đa của trục Y bên trái",
|
||||
"midnightcontrols.menu.max_left_y_value.tooltip": "Thay đổi những gì mod coi là giá trị cao nhất cho trục Y bên trái. Hữu ích nếu trục của bạn không sử dụng hết phạm vi và có vẻ chậm.",
|
||||
"midnightcontrols.menu.max_right_x_value": "Giá trị tối đa của trục X bên phải",
|
||||
"midnightcontrols.menu.max_right_x_value.tooltip": "Thay đổi những gì mod coi là giá trị cao nhất cho trục X bên phải. Hữu ích nếu trục của bạn không sử dụng hết phạm vi và có vẻ chậm.",
|
||||
"midnightcontrols.menu.max_right_y_value": "Giá trị tối đa của trục Y bên phải",
|
||||
"midnightcontrols.menu.max_right_y_value.tooltip": "Thay đổi những gì mod coi là giá trị cao nhất cho trục Y bên phải. Hữu ích nếu trục của bạn không sử dụng hết phạm vi và có vẻ chậm.",
|
||||
"midnightcontrols.menu.mouse_speed": "Tốc độ chuột",
|
||||
"midnightcontrols.menu.mouse_speed.tooltip": "Tốc độ chuột mô phỏng của bộ điều khiển.",
|
||||
"midnightcontrols.menu.move_chat": "Di chuyển hộp nhập trò chuyện lên trên cùng",
|
||||
"midnightcontrols.menu.move_chat.tooltip": "Di chuyển phần nhập trò chuyện lên trên cùng để nhập tốt hơn trên các thiết bị có bàn phím ảo.",
|
||||
"midnightcontrols.menu.reacharound.horizontal": "Đặt khối phía trước",
|
||||
"midnightcontrols.menu.reacharound.horizontal.tooltip": "Cho phép đặt khối phía trước, §cmcó thể bị coi là gian lận trên một số máy chủ §r.",
|
||||
"midnightcontrols.menu.reacharound.vertical": "Tiếp cận theo chiều dọc",
|
||||
"midnightcontrols.menu.reacharound.vertical.tooltip": "Cho phép tiếp cận theo chiều dọc, §cm có thể bị coi là gian lận trên một số máy chủ §r.",
|
||||
"midnightcontrols.menu.reload_controller_mappings": "Tải lại mapping bộ điều khiển",
|
||||
"midnightcontrols.menu.reload_controller_mappings.tooltip": "Tải lại tệp mapping bộ điều khiển.",
|
||||
"midnightcontrols.menu.right_dead_zone": "Vùng chết thanh bên phải",
|
||||
"midnightcontrols.menu.right_dead_zone.tooltip": "Vùng chết cho thanh analog bên phải của bộ điều khiển.",
|
||||
"midnightcontrols.menu.rotation_speed": "Tốc độ quay trục X",
|
||||
"midnightcontrols.menu.rotation_speed.tooltip": "Tốc độ quay Trục X của máy ảnh ở chế độ bộ điều khiển.",
|
||||
"midnightcontrols.menu.y_axis_rotation_speed": "Tốc độ quay trục Y",
|
||||
"midnightcontrols.menu.y_axis_rotation_speed.tooltip": "Tốc độ quay Trục Y của máy ảnh ở chế độ bộ điều khiển.",
|
||||
"midnightcontrols.menu.separate_controller_profile": "Hồ sơ bộ điều khiển riêng biệt",
|
||||
"midnightcontrols.menu.separator.controller": "Bộ điều khiển",
|
||||
"midnightcontrols.menu.separator.general": "Chung",
|
||||
"midnightcontrols.menu.title": "MidnightControls - Cài đặt",
|
||||
"midnightcontrols.menu.title.controller": "Tùy chọn bộ điều khiển",
|
||||
"midnightcontrols.menu.title.controller_controls": "Ràng buộc bộ điều khiển",
|
||||
"midnightcontrols.menu.title.gameplay": "Tuỳ chọn Gameplay",
|
||||
"midnightcontrols.menu.title.general": "Tuỳ chọn chung",
|
||||
"midnightcontrols.menu.title.hud": "Tuỳ chọn HUD",
|
||||
"midnightcontrols.menu.title.mappings.string": "Trình chỉnh sửa tệp mapping",
|
||||
"midnightcontrols.menu.title.visual": "Tùy chọn giao diện",
|
||||
"midnightcontrols.menu.unfocused_input": "Đầu vào không tập trung",
|
||||
"midnightcontrols.menu.unfocused_input.tooltip": "Cho phép đầu vào bộ điều khiển khi cửa sổ không được đặt tiêu điểm.",
|
||||
"midnightcontrols.menu.virtual_mouse": "Chuột ảo",
|
||||
"midnightcontrols.menu.virtual_mouse.tooltip": "Bật chuột ảo, rất hữu ích trong quá trình chia đôi màn hình.",
|
||||
"midnightcontrols.menu.virtual_mouse.skin": "Skin chuột ảo",
|
||||
"midnightcontrols.menu.hide_cursor": "Ẩn con trỏ chuột bình thường",
|
||||
"midnightcontrols.menu.hide_cursor.tooltip": "Ẩn con trỏ chuột bình thường, chỉ để lại con chuột ảo.",
|
||||
"midnightcontrols.narrator.unbound": "Bỏ ràng buộc %s",
|
||||
"midnightcontrols.not_bound": "Không ràng buộc",
|
||||
"midnightcontrols.virtual_mouse.skin.default_light": "Sáng mặc định",
|
||||
"midnightcontrols.virtual_mouse.skin.default_dark": "Tối mặc định",
|
||||
"midnightcontrols.virtual_mouse.skin.second_light": "Sáng thứ hai",
|
||||
"midnightcontrols.virtual_mouse.skin.second_dark": "Tối thứ hai",
|
||||
"midnightcontrols.midnightconfig.category.controller": "Bộ điều khiển",
|
||||
"midnightcontrols.midnightconfig.category.misc": "Khác",
|
||||
"midnightcontrols.midnightconfig.category.screens": "Màn hình",
|
||||
"midnightcontrols.midnightconfig.category.gameplay": "Gameplay",
|
||||
"midnightcontrols.midnightconfig.category.visual": "Hình ảnh",
|
||||
"modmenu.descriptionTranslation.midnightcontrols": "Thêm hỗ trợ bộ điều khiển và kiểm soát nâng cao tổng thể.\nĐược phân tách từ LambdaControls, đáng tiếc là đã ngừng hoạt động."
|
||||
}
|
||||
@@ -1,214 +0,0 @@
|
||||
{
|
||||
"midnightcontrols.midnightconfig.title": "Midnightcontrols 進階設定",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.DEFAULT_LIGHT": "預設淺色",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.DEFAULT_DARK": "預設深色",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.SECOND_LIGHT": "額外淺色",
|
||||
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.SECOND_DARK": "額外深色",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.DEFAULT": "預設",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.DUALSHOCK": "DualShock",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.DUALSENSE": "DualSense",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.SWITCH": "Switch/Wii 手把",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.XBOX": "Xbox One/Series 手把",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.XBOX_360": "Xbox 360 手把",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.STEAM_CONTROLLER": "Steam 手把",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.STEAM_DECK": "Steam Deck",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.OUYA": "OUYA 手把",
|
||||
"midnightcontrols.midnightconfig.enum.ControllerType.NUMBERED": "Numbered 手把",
|
||||
"midnightcontrols.midnightconfig.enum.ControlsMode.DEFAULT": "鍵盤/滑鼠",
|
||||
"midnightcontrols.midnightconfig.enum.ControlsMode.CONTROLLER": "手把",
|
||||
"midnightcontrols.midnightconfig.enum.ControlsMode.TOUCHSCREEN": "觸控螢幕",
|
||||
"midnightcontrols.midnightconfig.enum.HudSide.LEFT": "左",
|
||||
"midnightcontrols.midnightconfig.enum.HudSide.RIGHT": "右",
|
||||
"key.midnightcontrols.look_down": "視角下移",
|
||||
"key.midnightcontrols.look_left": "視角左移",
|
||||
"key.midnightcontrols.look_right": "視角右移",
|
||||
"key.midnightcontrols.look_up": "視角上移",
|
||||
"key.midnightcontrols.ring": "開啟額外按鍵菜單",
|
||||
"midnightcontrols.action.attack": "攻擊",
|
||||
"midnightcontrols.action.back": "後退",
|
||||
"midnightcontrols.action.chat": "開啟聊天畫面",
|
||||
"midnightcontrols.action.controls_ring": "開啟未綁定",
|
||||
"midnightcontrols.action.debug_screen": "開啟除錯畫面(F3)",
|
||||
"midnightcontrols.action.drop_item": "丟棄已選擇的物品",
|
||||
"midnightcontrols.action.exit": "退出畫面",
|
||||
"midnightcontrols.action.forward": "向前移動",
|
||||
"midnightcontrols.action.hit": "挖掘",
|
||||
"midnightcontrols.action.hotbar_left": "向左循環選擇快捷欄",
|
||||
"midnightcontrols.action.hotbar_right": "向右循環選擇快捷欄",
|
||||
"midnightcontrols.action.inventory": "物品欄",
|
||||
"midnightcontrols.action.jump": "跳躍",
|
||||
"midnightcontrols.action.left": "往左",
|
||||
"midnightcontrols.action.pause_game": "暫停遊戲",
|
||||
"midnightcontrols.action.pick_block": "選取方塊",
|
||||
"midnightcontrols.action.pickup": "拿取一個/拿取一半",
|
||||
"midnightcontrols.action.pickup_all": "拿取一組/拿取全部",
|
||||
"midnightcontrols.action.place": "放置方塊",
|
||||
"midnightcontrols.action.player_list": "玩家列表",
|
||||
"midnightcontrols.action.quick_move": "快速移動物品",
|
||||
"midnightcontrols.action.right": "往右",
|
||||
"midnightcontrols.action.screenshot": "截圖",
|
||||
"midnightcontrols.action.slot_up": "上移物品欄",
|
||||
"midnightcontrols.action.slot_down": "下移物品欄",
|
||||
"midnightcontrols.action.slot_left": "左移物品欄",
|
||||
"midnightcontrols.action.slot_right": "右移物品欄",
|
||||
"midnightcontrols.action.sneak": "潛行",
|
||||
"midnightcontrols.action.sprint": "跑步",
|
||||
"midnightcontrols.action.swap_hands": "與副手交換",
|
||||
"midnightcontrols.action.toggle_perspective": "切換視角",
|
||||
"midnightcontrols.action.toggle_smooth_camera": "切換電影視角",
|
||||
"midnightcontrols.action.page_back": "上一頁",
|
||||
"midnightcontrols.action.page_next": "下一頁",
|
||||
"midnightcontrols.action.tab_back": "上一個頁籤",
|
||||
"midnightcontrols.action.tab_next": "下一個頁籤",
|
||||
"midnightcontrols.action.take": "拿取物品",
|
||||
"midnightcontrols.action.take_all": "拿取全部",
|
||||
"midnightcontrols.action.use": "使用物品/放置方塊",
|
||||
"midnightcontrols.action.zoom": "視野縮放",
|
||||
"midnightcontrols.action.zoom_in": "縮放時將視野推近",
|
||||
"midnightcontrols.action.zoom_out": "縮放時將視野拉遠",
|
||||
"midnightcontrols.action.zoom_reset": "縮放時重置縮放距離",
|
||||
"midnightcontrols.action.emi_page_left": "上一頁",
|
||||
"midnightcontrols.action.emi_page_right": "下一頁",
|
||||
"midnightcontrols.category.emi": "EMI",
|
||||
"midnightcontrols.button.a": "A",
|
||||
"midnightcontrols.button.b": "B",
|
||||
"midnightcontrols.button.x": "X",
|
||||
"midnightcontrols.button.y": "Y",
|
||||
"midnightcontrols.button.left_bumper": "LB 鍵",
|
||||
"midnightcontrols.button.right_bumper": "RB 鍵",
|
||||
"midnightcontrols.button.back": "選擇鍵",
|
||||
"midnightcontrols.button.start": "開始鍵",
|
||||
"midnightcontrols.button.guide": "功能鍵",
|
||||
"midnightcontrols.button.left_thumb": "左搖桿(按壓)",
|
||||
"midnightcontrols.button.right_thumb": "右搖桿(按壓)",
|
||||
"midnightcontrols.button.dpad_up": "十字鍵上",
|
||||
"midnightcontrols.button.dpad_right": "十字鍵右",
|
||||
"midnightcontrols.button.dpad_down": "十字鍵下",
|
||||
"midnightcontrols.button.dpad_left": "十字鍵左",
|
||||
"midnightcontrols.button.l4": "L4",
|
||||
"midnightcontrols.button.l5": "L5",
|
||||
"midnightcontrols.button.r4": "R4",
|
||||
"midnightcontrols.button.r5": "L5",
|
||||
"midnightcontrols.axis.left_x+": "左 X+",
|
||||
"midnightcontrols.axis.left_y+": "左搖桿上(Y 軸正向)",
|
||||
"midnightcontrols.axis.right_x+": "右搖桿右(X 軸正向)",
|
||||
"midnightcontrols.axis.right_y+": "右搖桿上(Y 軸正向)",
|
||||
"midnightcontrols.axis.left_trigger": "左扳機鍵",
|
||||
"midnightcontrols.axis.right_trigger": "右扳機鍵",
|
||||
"midnightcontrols.axis.left_x-": "左搖桿左(X 軸負向)",
|
||||
"midnightcontrols.axis.left_y-": "左搖桿下(Y 軸負向)",
|
||||
"midnightcontrols.axis.right_x-": "右搖桿左(X 軸負向)",
|
||||
"midnightcontrols.axis.right_y-": "右搖桿下(Y 軸負向)",
|
||||
"midnightcontrols.button.unknown": "未知(%d)",
|
||||
"midnightcontrols.controller.tutorial.title": "使用手把玩遊戲!",
|
||||
"midnightcontrols.controller.tutorial.description": "前往 %s -> %s -> %s",
|
||||
"midnightcontrols.controller.connected": "搖桿 %d 已連接。",
|
||||
"midnightcontrols.controller.disconnected": "搖桿 %d 已斷開。",
|
||||
"midnightcontrols.controller.mappings.1": "請使用 %s 設定搖桿按鍵映射",
|
||||
"midnightcontrols.controller.mappings.3": "並將按鍵映射檔案放入此路徑:「%s.minecraft/config/gamecontrollerdb.txt%s」。",
|
||||
"midnightcontrols.controller.mappings.error": "發生錯誤,無法讀取按鍵映射檔案。",
|
||||
"midnightcontrols.controller.mappings.error.write": "發生錯誤,無法保存按鍵映射檔案。",
|
||||
"midnightcontrols.controller.mappings.updated": "按鍵映射已更新!",
|
||||
"midnightcontrols.controller_type.default": "預設",
|
||||
"midnightcontrols.controller_type.dualshock": "DualShock",
|
||||
"midnightcontrols.controller_type.dualsense": "DualSense",
|
||||
"midnightcontrols.controller_type.switch": "Switch/Wii 手把",
|
||||
"midnightcontrols.controller_type.xbox": "Xbox One/Series 手把",
|
||||
"midnightcontrols.controller_type.xbox_360": "Xbox 360 手把",
|
||||
"midnightcontrols.controller_type.steam_controller": "Steam 手把",
|
||||
"midnightcontrols.controller_type.steam_deck": "Steam Deck",
|
||||
"midnightcontrols.controller_type.ouya": "OUYA",
|
||||
"midnightcontrols.controller_type.numbered": "Numbered 手把",
|
||||
"midnightcontrols.controls_mode.default": "鍵鼠",
|
||||
"midnightcontrols.controls_mode.controller": "手把",
|
||||
"midnightcontrols.controls_mode.touchscreen": "觸控螢幕",
|
||||
"midnightcontrols.hud_side.left": "左側",
|
||||
"midnightcontrols.hud_side.right": "右側",
|
||||
"midnightcontrols.menu.analog_movement": "識別搖桿輸入的精確值",
|
||||
"midnightcontrols.menu.analog_movement.tooltip": "若遊戲機制允許,則可根據推動搖桿的力度與幅度決定移動的速度。",
|
||||
"midnightcontrols.menu.auto_switch_mode": "自動切換模式",
|
||||
"midnightcontrols.menu.auto_switch_mode.tooltip": "如果已有搖桿連接,則自動切換為搖桿操作模式。",
|
||||
"midnightcontrols.menu.controller": "搖桿",
|
||||
"midnightcontrols.menu.controller2": "額外搖桿",
|
||||
"midnightcontrols.menu.controller2.tooltip": "使用額外的搖桿,例如將左右兩個的 Joy-Con 合為一個功能完全的搖桿。",
|
||||
"midnightcontrols.menu.controller_toggle_sneak": "搖桿潛行切換",
|
||||
"midnightcontrols.menu.controller_toggle_sprint": "搖桿衝刺切換",
|
||||
"midnightcontrols.menu.controller_type": "搖桿類型",
|
||||
"midnightcontrols.menu.controller_type.tooltip": "你正在使用的搖桿類型(需要以顯示正確的按鈕)",
|
||||
"midnightcontrols.menu.controls_mode": "模式",
|
||||
"midnightcontrols.menu.controls_mode.tooltip": "操作模式。",
|
||||
"midnightcontrols.menu.double_tap_to_sprint": "雙擊以奔跑",
|
||||
"midnightcontrols.menu.double_tap_to_sprint.tooltip": "切換是否啟用向前行走按鍵,快速按兩次走路讓玩家奔跑",
|
||||
"midnightcontrols.menu.fast_block_placing": "快速放置方塊",
|
||||
"midnightcontrols.menu.fast_block_placing.tooltip": "在創造模式中處於飛行狀態時,可以根據你飛行的速度快速放置方塊。\n§c在部分伺服器可能會被認定為作弊。",
|
||||
"midnightcontrols.menu.fly_drifting": "水平方向飛行慣性",
|
||||
"midnightcontrols.menu.fly_drifting.tooltip": "處於飛行狀態時,啟用原版的水平方向飛行慣性(緩停滑行)。",
|
||||
"midnightcontrols.menu.fly_drifting_vertical": "垂直方向飛行慣性",
|
||||
"midnightcontrols.menu.fly_drifting_vertical.tooltip": "處於飛行狀態時,啟用原版的垂直方向飛行慣性(緩停滑行)。",
|
||||
"midnightcontrols.menu.hud_enable": "啟用 HUD",
|
||||
"midnightcontrols.menu.hud_enable.tooltip": "顯示搖桿按鍵操作提示。",
|
||||
"midnightcontrols.menu.hud_side": "HUD 位置",
|
||||
"midnightcontrols.menu.hud_side.tooltip": "HUD 的位置位於畫面的哪一側。",
|
||||
"midnightcontrols.menu.invert_right_x_axis": "反轉右搖桿 X 軸",
|
||||
"midnightcontrols.menu.invert_right_y_axis": "反轉右搖桿 Y 軸",
|
||||
"midnightcontrols.menu.joystick_as_mouse": "總是將左搖桿作為滑鼠",
|
||||
"midnightcontrols.menu.joystick_as_mouse.tooltip": "讓左搖桿在每個選單的像滑鼠一樣。",
|
||||
"midnightcontrols.menu.keyboard_controls": "鍵盤控制...",
|
||||
"midnightcontrols.menu.left_dead_zone": "左搖桿死區",
|
||||
"midnightcontrols.menu.left_dead_zone.tooltip": "左搖桿設定的死區。",
|
||||
"midnightcontrols.menu.mappings.open_input_str": "編輯按鍵映射檔案",
|
||||
"midnightcontrols.menu.max_left_x_value": "左搖桿 X 軸最大值識別範圍",
|
||||
"midnightcontrols.menu.max_left_x_value.tooltip": "更改左搖桿 X 軸最大值的識別範圍。若感覺即便推滿搖桿也未達到最大的輸入值,導致在識別搖桿輸入的精確值的情況下,左右移動較為緩慢等問題,本項可能會有所幫助。",
|
||||
"midnightcontrols.menu.max_left_y_value": "左搖桿 Y 軸最大值識別範圍",
|
||||
"midnightcontrols.menu.max_left_y_value.tooltip": "更改左搖桿 Y 軸最大值的識別範圍。若感覺即便推滿搖桿也未達到最大的輸入值,導致在識別搖桿輸入的精確值的情況下,前後移動較為緩慢等問題,本項可能會有所幫助。",
|
||||
"midnightcontrols.menu.max_right_x_value": "右搖桿 X 軸最大值識別範圍",
|
||||
"midnightcontrols.menu.max_right_x_value.tooltip": "更改右搖桿 X 軸最大值的識別範圍。若感覺即便推滿搖桿也未達到最大的輸入值,導致鏡頭左右旋轉較為緩慢等問題,本項可能會有所幫助。",
|
||||
"midnightcontrols.menu.max_right_y_value": "右搖桿 Y 軸最大值識別範圍",
|
||||
"midnightcontrols.menu.max_right_y_value.tooltip": "更改右搖桿 Y 軸最大值的識別範圍。若感覺即便推滿搖桿也未達到最大的輸入值,導致鏡頭上下旋轉較為緩慢等問題,本項可能會有所幫助。",
|
||||
"midnightcontrols.menu.mouse_speed": "游標移動速度",
|
||||
"midnightcontrols.menu.mouse_speed.tooltip": "搖桿模擬的游標的移動速度。",
|
||||
"midnightcontrols.menu.move_chat": "將聊天輸入框移至頂部",
|
||||
"midnightcontrols.menu.move_chat.tooltip": "將聊天輸入欄位移至頂部,以便在使用虛擬鍵盤的裝置上更好地輸入。",
|
||||
"midnightcontrols.menu.reacharound.horizontal": "水平方向方塊放置輔助",
|
||||
"midnightcontrols.menu.reacharound.horizontal.tooltip": "啟用水平方向方塊放置輔助,可在腳下方塊的前方放置方塊。§c在部分伺服器可能會被認定為作弊§r。",
|
||||
"midnightcontrols.menu.reacharound.vertical": "垂直方向方塊放置輔助",
|
||||
"midnightcontrols.menu.reacharound.vertical.tooltip": "啟用垂直方向方塊放置輔助,可在腳下方塊的下方放置方塊。§c在部分伺服器可能會被認定為作弊§r。",
|
||||
"midnightcontrols.menu.reload_controller_mappings": "重新載入搖桿按鍵映射",
|
||||
"midnightcontrols.menu.reload_controller_mappings.tooltip": "重新載入搖桿的按鍵映射檔案。",
|
||||
"midnightcontrols.menu.right_dead_zone": "右搖桿死區",
|
||||
"midnightcontrols.menu.right_dead_zone.tooltip": "右搖桿設定的死區。",
|
||||
"midnightcontrols.menu.rotation_speed": "X 軸鏡頭旋轉速度",
|
||||
"midnightcontrols.menu.rotation_speed.tooltip": "搖桿操作模式下的鏡頭旋轉速度。(X)",
|
||||
"midnightcontrols.menu.y_axis_rotation_speed": "Y 軸鏡頭旋轉速度",
|
||||
"midnightcontrols.menu.y_axis_rotation_speed.tooltip": "搖桿操作模式下的鏡頭旋轉速度。(Y)",
|
||||
"midnightcontrols.menu.separate_controller_profile": "搖桿設定檔",
|
||||
"midnightcontrols.menu.separator.controller": "搖桿",
|
||||
"midnightcontrols.menu.separator.general": "一般",
|
||||
"midnightcontrols.menu.title": "MidnightControls - 設定",
|
||||
"midnightcontrols.menu.title.controller": "搖桿選項",
|
||||
"midnightcontrols.menu.title.controller_controls": "搖桿控制",
|
||||
"midnightcontrols.menu.title.gameplay": "遊戲內容選項",
|
||||
"midnightcontrols.menu.title.general": "一般選項",
|
||||
"midnightcontrols.menu.title.hud": "HUD 選項",
|
||||
"midnightcontrols.menu.title.mappings.string": "編輯按鍵映射檔案",
|
||||
"midnightcontrols.menu.title.visual": "界面選項",
|
||||
"midnightcontrols.menu.unfocused_input": "非活動狀態輸入",
|
||||
"midnightcontrols.menu.unfocused_input.tooltip": "即使遊戲窗口處於非活動狀態,也允許搖桿進行按鍵輸入。",
|
||||
"midnightcontrols.menu.virtual_mouse": "虛擬游標",
|
||||
"midnightcontrols.menu.virtual_mouse.tooltip": "啟用虛擬游標,在分屏的情況下很有用。",
|
||||
"midnightcontrols.menu.virtual_mouse.skin": "虛擬游標樣式",
|
||||
"midnightcontrols.menu.hide_cursor": "隱藏正常游標",
|
||||
"midnightcontrols.menu.hide_cursor.tooltip": "隱藏正常游標",
|
||||
"midnightcontrols.narrator.unbound": "取消綁定 %s",
|
||||
"midnightcontrols.not_bound": "未綁定",
|
||||
"midnightcontrols.virtual_mouse.skin.default_light": "預設樣式(白色)",
|
||||
"midnightcontrols.virtual_mouse.skin.default_dark": "預設樣式(黑色)",
|
||||
"midnightcontrols.virtual_mouse.skin.second_light": "額外樣式(白色)",
|
||||
"midnightcontrols.virtual_mouse.skin.second_dark": "額外樣式(黑色)",
|
||||
"midnightcontrols.midnightconfig.category.controller": "手把",
|
||||
"midnightcontrols.midnightconfig.category.misc": "雜項",
|
||||
"midnightcontrols.midnightconfig.category.screens": "螢幕",
|
||||
"midnightcontrols.midnightconfig.category.gameplay": "遊戲內容",
|
||||
"midnightcontrols.midnightconfig.category.visual": "界面",
|
||||
"modmenu.descriptionTranslation.midnightcontrols": "增加控制器支援和整體增強控制。\n此版本是從 LambdaControls 分支而來,可惜的是 LambdaControls 已經停止維護。"
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 479 B |
|
Before Width: | Height: | Size: 182 B |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 168 B |
|
Before Width: | Height: | Size: 197 B |
|
Before Width: | Height: | Size: 68 B |
|
Before Width: | Height: | Size: 132 B |
@@ -1,3 +0,0 @@
|
||||
accessWidener v1 named
|
||||
|
||||
#accessible class net/minecraft/client/gui/widget/EntryListWidget$MoveDirection
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"pack": {
|
||||
"pack_format": 15,
|
||||
"supported_formats": [15, 999],
|
||||
"description": "Makes controller icons look similar to Legacy Console Edit."
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
plugins {
|
||||
id 'com.github.johnrengelman.shadow'
|
||||
id "me.shedaniel.unified-publishing"
|
||||
}
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
fabric()
|
||||
}
|
||||
|
||||
loom {
|
||||
}
|
||||
|
||||
configurations {
|
||||
common
|
||||
shadowCommon // Don't use shadow from the shadow plugin since it *excludes* files.
|
||||
compileClasspath.extendsFrom common
|
||||
runtimeClasspath.extendsFrom common
|
||||
developmentFabric.extendsFrom common
|
||||
archivesBaseName = rootProject.archives_base_name + "-fabric"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
|
||||
modImplementation include ("maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric")
|
||||
modImplementation include ("maven.modrinth:obsidianui:${rootProject.obsidianui_version}-fabric") {}
|
||||
include 'org.aperlambda:lambdajcommon:1.8.1'
|
||||
modCompileOnly "maven.modrinth:emi:${project.emi_version}"
|
||||
|
||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand "version": project.version
|
||||
}
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
exclude "architectury.common.json"
|
||||
|
||||
configurations = [project.configurations.shadowCommon]
|
||||
archiveClassifier = "dev-shadow"
|
||||
}
|
||||
|
||||
remapJar {
|
||||
input.set shadowJar.archiveFile
|
||||
dependsOn shadowJar
|
||||
}
|
||||
|
||||
sourcesJar {
|
||||
def commonSources = project(":common").sourcesJar
|
||||
dependsOn commonSources
|
||||
from commonSources.archiveFile.map { zipTree(it) }
|
||||
}
|
||||
|
||||
components.java {
|
||||
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
|
||||
skip()
|
||||
}
|
||||
}
|
||||
|
||||
unifiedPublishing {
|
||||
project {
|
||||
displayName = "MidnightControls $project.version - Fabric $project.minecraft_version"
|
||||
releaseType = "$project.release_type"
|
||||
changelog = releaseChangelog()
|
||||
gameVersions = []
|
||||
gameLoaders = ["fabric","quilt"]
|
||||
mainPublication remapJar
|
||||
relations {
|
||||
depends {
|
||||
curseforge = "fabric-api"
|
||||
modrinth = "fabric-api"
|
||||
}
|
||||
includes {
|
||||
curseforge = "midnightlib"
|
||||
modrinth = "midnightlib"
|
||||
}
|
||||
includes {
|
||||
curseforge = "obsidianui"
|
||||
modrinth = "obsidianui"
|
||||
}
|
||||
}
|
||||
|
||||
var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN")
|
||||
if (CURSEFORGE_TOKEN != null) {
|
||||
curseforge {
|
||||
token = CURSEFORGE_TOKEN
|
||||
id = rootProject.curseforge_id
|
||||
gameVersions.addAll "Java 21", project.minecraft_version, project.supported_versions
|
||||
}
|
||||
}
|
||||
|
||||
var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
|
||||
if (MODRINTH_TOKEN != null) {
|
||||
modrinth {
|
||||
token = MODRINTH_TOKEN
|
||||
id = rootProject.modrinth_id
|
||||
version = "$project.version-$project.name"
|
||||
gameVersions.addAll project.minecraft_version, project.supported_versions
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.util.platform.fabric;
|
||||
|
||||
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Implementation of fabric methods for
|
||||
* @see eu.midnightdust.midnightcontrols.client.util.platform.ItemGroupUtil
|
||||
*/
|
||||
public class ItemGroupUtilImpl {
|
||||
public static List<ItemGroup> getVisibleGroups(CreativeInventoryScreen screen) {
|
||||
return (screen.getItemGroupsOnPage(screen.getCurrentPage()));
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.util.platform.fabric;
|
||||
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.network.packet.CustomPayload;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.c2s.common.CustomPayloadC2SPacket;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.client;
|
||||
|
||||
/**
|
||||
* Implementation of fabric methods for
|
||||
* @see eu.midnightdust.midnightcontrols.client.util.platform.NetworkUtil
|
||||
*/
|
||||
public class NetworkUtilImpl {
|
||||
private static final ClientPlayNetworkHandler handler = client.getNetworkHandler();
|
||||
|
||||
public static void sendPacketC2S(Packet<?> packet) {
|
||||
if (handler != null)
|
||||
handler.sendPacket(packet);
|
||||
}
|
||||
public static void sendPayloadC2S(CustomPayload payload) {
|
||||
if (handler != null && client.world != null)
|
||||
handler.sendPacket(new CustomPayloadC2SPacket(payload));
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.fabric;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||
import eu.midnightdust.midnightcontrols.packet.ControlsModePayload;
|
||||
import eu.midnightdust.midnightcontrols.packet.FeaturePayload;
|
||||
import eu.midnightdust.midnightcontrols.packet.HelloPayload;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
|
||||
import net.fabricmc.fabric.api.resource.ResourcePackActivationType;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.fabricmc.loader.api.ModContainer;
|
||||
import org.thinkingstudio.obsidianui.fabric.event.OpenScreenCallback;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import static eu.midnightdust.midnightcontrols.MidnightControls.id;
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.BINDING_LOOK_DOWN;
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.BINDING_LOOK_LEFT;
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.BINDING_LOOK_RIGHT;
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.BINDING_LOOK_UP;
|
||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.BINDING_RING;
|
||||
|
||||
public class MidnightControlsClientFabric implements ClientModInitializer {
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
KeyBindingHelper.registerKeyBinding(BINDING_LOOK_UP);
|
||||
KeyBindingHelper.registerKeyBinding(BINDING_LOOK_RIGHT);
|
||||
KeyBindingHelper.registerKeyBinding(BINDING_LOOK_DOWN);
|
||||
KeyBindingHelper.registerKeyBinding(BINDING_LOOK_LEFT);
|
||||
KeyBindingHelper.registerKeyBinding(BINDING_RING);
|
||||
ClientPlayNetworking.registerGlobalReceiver(ControlsModePayload.PACKET_ID, (payload, context) ->
|
||||
context.responseSender().sendPacket(new ControlsModePayload(MidnightControlsConfig.controlsMode.getName())));
|
||||
ClientPlayNetworking.registerGlobalReceiver(FeaturePayload.PACKET_ID, ((payload, context) -> {}));
|
||||
|
||||
ClientPlayConnectionEvents.JOIN.register((handler, sender, client) -> {
|
||||
var version = "";
|
||||
Optional<ModContainer> container;
|
||||
if ((container = FabricLoader.getInstance().getModContainer(MidnightControlsConstants.NAMESPACE)).isPresent()) {
|
||||
version = container.get().getMetadata().getVersion().getFriendlyString();
|
||||
}
|
||||
var controlsMode = MidnightControlsConfig.controlsMode.getName();
|
||||
sender.sendPacket(new HelloPayload(version, controlsMode));
|
||||
sender.sendPacket(new ControlsModePayload(controlsMode));
|
||||
});
|
||||
ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> MidnightControlsClient.onLeave());
|
||||
|
||||
ClientTickEvents.START_CLIENT_TICK.register(MidnightControlsClient::onTick);
|
||||
|
||||
FabricLoader.getInstance().getModContainer(MidnightControlsConstants.NAMESPACE).ifPresent(modContainer -> {
|
||||
ResourceManagerHelper.registerBuiltinResourcePack(id("bedrock"), modContainer, ResourcePackActivationType.NORMAL);
|
||||
ResourceManagerHelper.registerBuiltinResourcePack(id("legacy"), modContainer, ResourcePackActivationType.NORMAL);
|
||||
});
|
||||
MidnightControlsClient.initClient();
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.fabric;
|
||||
|
||||
import eu.midnightdust.midnightcontrols.ControlsMode;
|
||||
import eu.midnightdust.midnightcontrols.MidnightControls;
|
||||
import eu.midnightdust.midnightcontrols.MidnightControlsFeature;
|
||||
import eu.midnightdust.midnightcontrols.fabric.event.PlayerChangeControlsModeCallback;
|
||||
import eu.midnightdust.midnightcontrols.packet.ControlsModePayload;
|
||||
import eu.midnightdust.midnightcontrols.packet.FeaturePayload;
|
||||
import eu.midnightdust.midnightcontrols.packet.HelloPayload;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
||||
|
||||
public class MidnightControlsFabric implements ModInitializer {
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
MidnightControls.init();
|
||||
PayloadTypeRegistry.playC2S().register(HelloPayload.PACKET_ID, HelloPayload.codec);
|
||||
PayloadTypeRegistry.playC2S().register(ControlsModePayload.PACKET_ID, ControlsModePayload.codec);
|
||||
PayloadTypeRegistry.playS2C().register(ControlsModePayload.PACKET_ID, ControlsModePayload.codec);
|
||||
PayloadTypeRegistry.playS2C().register(FeaturePayload.PACKET_ID, FeaturePayload.codec);
|
||||
|
||||
ServerPlayNetworking.registerGlobalReceiver(HelloPayload.PACKET_ID, (payload, context) -> {
|
||||
ControlsMode.byId(payload.controlsMode()).ifPresent(controlsMode -> PlayerChangeControlsModeCallback.EVENT.invoker().apply(context.player(), controlsMode));
|
||||
context.responseSender().sendPacket(new FeaturePayload(MidnightControlsFeature.HORIZONTAL_REACHAROUND));
|
||||
});
|
||||
ServerPlayNetworking.registerGlobalReceiver(ControlsModePayload.PACKET_ID, (payload, context) -> {
|
||||
ControlsMode.byId(payload.controlsMode()).ifPresent(controlsMode -> PlayerChangeControlsModeCallback.EVENT.invoker().apply(context.player(), controlsMode));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,39 +1,30 @@
|
||||
# Makes things faster
|
||||
org.gradle.parallel=true
|
||||
org.gradle.jvmargs=-Xmx2048M
|
||||
# Done to increase the memory available to gradle.
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
|
||||
minecraft_version=1.21.3
|
||||
supported_versions=1.21.2
|
||||
yarn_mappings=1.21.3+build.2
|
||||
enabled_platforms=fabric,neoforge
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/use
|
||||
minecraft_version=1.18.2
|
||||
yarn_mappings=1.18.2+build.3
|
||||
loader_version=0.14.8
|
||||
|
||||
archives_base_name=midnightcontrols
|
||||
mod_version=1.10.1
|
||||
maven_group=eu.midnightdust
|
||||
release_type=beta
|
||||
modrinth_id = bXX9h73M
|
||||
curseforge_id = 621768
|
||||
# Configure the IDs here after creating the projects on the websites
|
||||
# Mod Properties
|
||||
mod_version = 1.5.0
|
||||
maven_group = eu.midnightdust
|
||||
archives_base_name = midnightcontrols
|
||||
modrinth_id=bXX9h73M
|
||||
|
||||
midnightlib_version=1.6.4
|
||||
|
||||
fabric_loader_version=0.16.9
|
||||
fabric_api_version=0.107.3+1.21.3
|
||||
|
||||
neoforge_version=21.3.28-beta
|
||||
yarn_mappings_patch_neoforge_version = 1.21+build.4
|
||||
|
||||
quilt_loader_version=0.19.0-beta.18
|
||||
quilt_fabric_api_version=7.0.1+0.83.0-1.20
|
||||
|
||||
sodium_version=mc1.21-0.6.0-beta.1
|
||||
obsidianui_version=0.2.10+mc1.21.3
|
||||
modmenu_version=10.0.0-beta.1
|
||||
emotecraft_version=2.1.3-SNAPSHOT-build.29-MC1.19-fabric
|
||||
# Dependencies
|
||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||
fabric_version=0.57.0+1.18.2
|
||||
sodium_version=mc1.18.2-0.4.1
|
||||
spruceui_version=3.3.2+1.17
|
||||
midnightlib_version=0.4.4
|
||||
modmenu_version=2.0.2
|
||||
emotecraft_version=2.1-MC1.18.1-fabric
|
||||
bendylib_version=2.0.+
|
||||
emi_version=1.1.10+1.21+fabric
|
||||
libgui_version=6.0.0+1.19
|
||||
inventorytabs_version=inventorytabs-0.9.beta-1.19.x
|
||||
clothconfig_version=7.0.72
|
||||
yacl_version=2.2.0
|
||||
bedrockify_version=1.9+mc1.20
|
||||
libgui_version=5.4.2+1.18.2
|
||||
emi_version=0.2.0+1.18.2
|
||||
|
||||
# Ok Zoomer and LibZoomer are temporarily disabled for the time being, as we are currently using Reflection at runtime instead in OkZoomerCompat due to there being two major, completely incompatible API versions.
|
||||
# ok_zoomer_version=5.0.0-beta.3+1.17.1
|
||||
# libzoomer_version=0.3.0+1.17.1
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,7 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
41
gradlew
vendored
@@ -55,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -80,11 +80,13 @@ do
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -131,29 +133,22 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -198,15 +193,11 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
@@ -214,12 +205,6 @@ set -- \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
|
||||
15
gradlew.bat
vendored
@@ -14,7 +14,7 @@
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@@ -25,8 +25,7 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@@ -41,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -76,15 +75,13 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
plugins {
|
||||
id 'com.github.johnrengelman.shadow'
|
||||
id "me.shedaniel.unified-publishing"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = 'NeoForged'
|
||||
url = 'https://maven.neoforged.net/releases'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
neoForge()
|
||||
}
|
||||
|
||||
loom {
|
||||
accessWidenerPath = project(":common").loom.accessWidenerPath
|
||||
}
|
||||
|
||||
configurations {
|
||||
common {
|
||||
canBeResolved = true
|
||||
canBeConsumed = false
|
||||
}
|
||||
compileClasspath.extendsFrom common
|
||||
runtimeClasspath.extendsFrom common
|
||||
developmentNeoForge.extendsFrom common
|
||||
|
||||
// Files in this configuration will be bundled into your mod using the Shadow plugin.
|
||||
// Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files.
|
||||
shadowBundle {
|
||||
canBeResolved = true
|
||||
canBeConsumed = false
|
||||
}
|
||||
archivesBaseName = rootProject.archives_base_name + "-neoforge"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
neoForge "net.neoforged:neoforge:$rootProject.neoforge_version"
|
||||
modImplementation include ("maven.modrinth:midnightlib:${rootProject.midnightlib_version}-neoforge")
|
||||
modImplementation include ("maven.modrinth:obsidianui:${rootProject.obsidianui_version}-neoforge") {}
|
||||
shadowBundle('org.aperlambda:lambdajcommon:1.8.1') {
|
||||
exclude group: 'com.google.code.gson'
|
||||
exclude group: 'com.google.guava'
|
||||
}
|
||||
|
||||
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
|
||||
shadowBundle project(path: ':common', configuration: 'transformProductionNeoForge')
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property 'version', project.version
|
||||
|
||||
filesMatching('META-INF/neoforge.mods.toml') {
|
||||
expand version: project.version
|
||||
}
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
configurations = [project.configurations.shadowBundle]
|
||||
archiveClassifier = 'dev-shadow'
|
||||
}
|
||||
|
||||
remapJar {
|
||||
input.set shadowJar.archiveFile
|
||||
}
|
||||
|
||||
sourcesJar {
|
||||
def commonSources = project(":common").sourcesJar
|
||||
dependsOn commonSources
|
||||
from commonSources.archiveFile.map { zipTree(it) }
|
||||
}
|
||||
|
||||
components.java {
|
||||
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
|
||||
skip()
|
||||
}
|
||||
}
|
||||
|
||||
unifiedPublishing {
|
||||
project {
|
||||
displayName = "MidnightControls $project.version - NeoForge $project.minecraft_version"
|
||||
releaseType = "$project.release_type"
|
||||
changelog = releaseChangelog()
|
||||
gameVersions = []
|
||||
gameLoaders = ["neoforge"]
|
||||
mainPublication remapJar
|
||||
relations {
|
||||
includes {
|
||||
curseforge = "midnightlib"
|
||||
modrinth = "midnightlib"
|
||||
}
|
||||
includes {
|
||||
curseforge = "obsidianui"
|
||||
modrinth = "obsidianui"
|
||||
}
|
||||
}
|
||||
|
||||
var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN")
|
||||
if (CURSEFORGE_TOKEN != null) {
|
||||
curseforge {
|
||||
token = CURSEFORGE_TOKEN
|
||||
id = rootProject.curseforge_id
|
||||
gameVersions.addAll "Java 21", project.minecraft_version, project.supported_versions
|
||||
}
|
||||
}
|
||||
|
||||
var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
|
||||
if (MODRINTH_TOKEN != null) {
|
||||
modrinth {
|
||||
token = MODRINTH_TOKEN
|
||||
id = rootProject.modrinth_id
|
||||
version = "$project.version-$project.name"
|
||||
gameVersions.addAll project.minecraft_version, project.supported_versions
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
loom.platform=neoforge
|
||||
@@ -1,16 +0,0 @@
|
||||
package eu.midnightdust.midnightcontrols.client.util.platform.neoforge;
|
||||
|
||||
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Implementation of neoforge methods for
|
||||
* @see eu.midnightdust.midnightcontrols.client.util.platform.ItemGroupUtil
|
||||
*/
|
||||
public class ItemGroupUtilImpl {
|
||||
public static List<ItemGroup> getVisibleGroups(CreativeInventoryScreen screen) {
|
||||
return (screen.getCurrentPage().getVisibleTabs());
|
||||
}
|
||||
}
|
||||