mirror of
https://github.com/TeamMidnightDust/MidnightControls.git
synced 2025-12-13 23:25:10 +01:00
Compare commits
71 Commits
v1.10.0-al
...
architectu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e50128d75d | ||
|
|
837ead55fb | ||
|
|
c00d5893e9 | ||
|
|
af4b40e88a | ||
|
|
994cd0d155 | ||
|
|
9e4686be32 | ||
|
|
b472503ec4 | ||
|
|
54a43d41c0 | ||
|
|
c86df8714c | ||
|
|
ccad5e1d44 | ||
|
|
58fa3b5bc1 | ||
|
|
0f407ac245 | ||
|
|
7375e5ad20 | ||
|
|
7b723513ae | ||
|
|
0dfd1994dc | ||
|
|
ecb7cfd888 | ||
|
|
18e69c1cb3 | ||
|
|
f5be8eb14e | ||
|
|
4a502730bf | ||
|
|
f263908f5f | ||
|
|
28de7312f8 | ||
|
|
1231c231a9 | ||
|
|
24e58027b2 | ||
|
|
33845e111b | ||
|
|
86622962f8 | ||
|
|
73c5fe1a82 | ||
|
|
70d923f959 | ||
|
|
0ef59057af | ||
|
|
9ebd1a9cea | ||
|
|
bb5c6976c0 | ||
|
|
041eeb29aa | ||
|
|
662bac3053 | ||
|
|
50103ce4cf | ||
|
|
9e12381471 | ||
|
|
945b01a8d6 | ||
|
|
8aa006429d | ||
|
|
114a72cdde | ||
|
|
25e9c9afe3 | ||
|
|
d313115388 | ||
|
|
e46e855961 | ||
|
|
38229bc827 | ||
|
|
f004f0a32d | ||
|
|
c07f3d94dd | ||
|
|
6007ef315d | ||
|
|
1e2dd30e3a | ||
|
|
1c26eeed5e | ||
|
|
f14387b6b4 | ||
|
|
1344a949cd | ||
|
|
65a0b1cf1f | ||
|
|
23f7b2e199 | ||
|
|
e35850c5d5 | ||
|
|
78900ac83e | ||
|
|
7d791fac89 | ||
|
|
bf60595c12 | ||
|
|
b96547dafb | ||
|
|
ab869f4f76 | ||
|
|
84df412162 | ||
|
|
afb80fd89c | ||
|
|
b835a6c4ca | ||
|
|
3eec0dda4a | ||
|
|
a23e8b8975 | ||
|
|
1aa449b5bd | ||
|
|
35ab81f696 | ||
|
|
e08547a641 | ||
|
|
c93cc729f4 | ||
|
|
1595fffc2c | ||
|
|
953df7a8c4 | ||
|
|
a3b8d7cbb5 | ||
|
|
929639c081 | ||
|
|
abcfd4c98c | ||
|
|
24d169b4c2 |
29
.github/workflows/build.yml
vendored
Normal file
29
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
name: Build with Gradle
|
||||||
|
|
||||||
|
on: [ push, pull_request ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- name: Set up Gradle
|
||||||
|
uses: gradle/actions/setup-gradle@v4
|
||||||
|
- 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: |
|
||||||
|
fabric/build/libs/
|
||||||
|
neoforge/build/libs/
|
||||||
23
.github/workflows/gradlebuild.yml
vendored
23
.github/workflows/gradlebuild.yml
vendored
@@ -1,23 +0,0 @@
|
|||||||
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/
|
|
||||||
23
.github/workflows/modrinth_update.yml
vendored
23
.github/workflows/modrinth_update.yml
vendored
@@ -1,23 +0,0 @@
|
|||||||
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
|
|
||||||
40
.github/workflows/gradlepublish.yml → .github/workflows/publish.yml
vendored
Executable file → Normal file
40
.github/workflows/gradlepublish.yml → .github/workflows/publish.yml
vendored
Executable file → Normal file
@@ -1,30 +1,26 @@
|
|||||||
name: Gradle Package
|
name: Publish to Modrinth
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
release:
|
||||||
tags:
|
types:
|
||||||
- '*'
|
- published
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Checkout Repository
|
||||||
- name: Set up JDK 16
|
uses: actions/checkout@v4
|
||||||
uses: actions/setup-java@v1
|
|
||||||
with:
|
with:
|
||||||
java-version: 16
|
persist-credentials: false
|
||||||
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
- name: Set up Gradle
|
||||||
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
uses: gradle/actions/setup-gradle@v4
|
||||||
|
- name: Set up JDK 21
|
||||||
- name: Build with Gradle
|
uses: actions/setup-java@v4
|
||||||
run: ./gradlew build
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v2
|
|
||||||
with:
|
with:
|
||||||
name: Artifacts
|
distribution: 'temurin'
|
||||||
path: ./build/libs/
|
java-version: 21
|
||||||
|
check-latest: true
|
||||||
# The USERNAME and PASSWORD need to correspond to the credentials environment variables used in
|
# The USERNAME and PASSWORD need to correspond to the credentials environment variables used in
|
||||||
# the publishing section of your build.gradle
|
# the publishing section of your build.gradle
|
||||||
- name: Publish to GitHub Packages and other Mavens
|
- name: Publish to GitHub Packages and other Mavens
|
||||||
@@ -38,3 +34,7 @@ jobs:
|
|||||||
midnightcontrols_MAVEN: ${{ secrets.MAVEN_URL }}
|
midnightcontrols_MAVEN: ${{ secrets.MAVEN_URL }}
|
||||||
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
|
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
|
||||||
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
|
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
|
||||||
|
- name: Publish to Modrinth
|
||||||
|
env:
|
||||||
|
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
|
||||||
|
run: ./gradlew publishModrinth
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
[](https://github.com/TeamMidnightDust/MidnightControls/releases)
|
[](https://github.com/TeamMidnightDust/MidnightControls/releases)
|
||||||

|

|
||||||
[![Mod loader: Quilt/Fabric]][Quilt]
|
[![Mod loader: Quilt/Fabric]][Quilt]
|
||||||
[](https://www.oracle.com/java/technologies/downloads/#java17)
|
[](https://www.oracle.com/java/technologies/downloads/#java21)
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
|
|
||||||
A Fabric Minecraft mod which adds better controls, reach-around and controller support.
|
A Fabric Minecraft mod which adds better controls, reach-around and controller support.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
id "architectury-plugin" version "3.4-SNAPSHOT"
|
||||||
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
|
id "dev.architectury.loom" version "1.10-SNAPSHOT" apply false
|
||||||
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
|
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
|
||||||
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,9 @@ repositories {
|
|||||||
maven {
|
maven {
|
||||||
url = "https://api.modrinth.com/maven"
|
url = "https://api.modrinth.com/maven"
|
||||||
}
|
}
|
||||||
|
flatDir {
|
||||||
|
dirs("localMaven")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
@@ -22,6 +25,9 @@ subprojects {
|
|||||||
url = "https://api.modrinth.com/maven"
|
url = "https://api.modrinth.com/maven"
|
||||||
}
|
}
|
||||||
maven { url 'https://jitpack.io' }
|
maven { url 'https://jitpack.io' }
|
||||||
|
flatDir {
|
||||||
|
dirs("../localMaven")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ dependencies {
|
|||||||
// Compatibility mods
|
// Compatibility mods
|
||||||
modCompileOnlyApi "io.github.cottonmc:LibGui:${project.libgui_version}"
|
modCompileOnlyApi "io.github.cottonmc:LibGui:${project.libgui_version}"
|
||||||
modCompileOnlyApi "org.quiltmc:quilt-json5:1.0.0"
|
modCompileOnlyApi "org.quiltmc:quilt-json5:1.0.0"
|
||||||
modCompileOnly "maven.modrinth:sodium:${project.sodium_version}"
|
modImplementation "maven.modrinth:sodium:${project.sodium_version}-fabric"
|
||||||
modCompileOnlyApi "maven.modrinth:emi:${project.emi_version}"
|
modCompileOnlyApi "maven.modrinth:emi:${project.emi_version}"
|
||||||
modCompileOnlyApi "maven.modrinth:emotecraft:${project.emotecraft_version}"
|
modImplementation "maven.modrinth:emotecraft:${project.emotecraft_version}"
|
||||||
modCompileOnlyApi "io.github.kosmx:bendy-lib:${project.bendylib_version}"
|
modCompileOnlyApi "io.github.kosmx:bendy-lib:${project.bendylib_version}"
|
||||||
modCompileOnlyApi "dev.isxander:yet-another-config-lib:${project.yacl_version}"
|
modCompileOnlyApi "dev.isxander:yet-another-config-lib:${project.yacl_version}"
|
||||||
modCompileOnlyApi "maven.modrinth:inventory-tabs-updated:${project.inventorytabs_version}"
|
modCompileOnlyApi "maven.modrinth:inventory-tabs-updated:${project.inventorytabs_version}"
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import eu.midnightdust.midnightcontrols.client.mixin.KeyBindingIDAccessor;
|
|||||||
import eu.midnightdust.midnightcontrols.client.ring.ButtonBindingRingAction;
|
import eu.midnightdust.midnightcontrols.client.ring.ButtonBindingRingAction;
|
||||||
import eu.midnightdust.midnightcontrols.client.ring.MidnightRing;
|
import eu.midnightdust.midnightcontrols.client.ring.MidnightRing;
|
||||||
import eu.midnightdust.midnightcontrols.client.util.platform.NetworkUtil;
|
import eu.midnightdust.midnightcontrols.client.util.platform.NetworkUtil;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.virtualkeyboard.MouseClickInterceptor;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import org.thinkingstudio.obsidianui.hud.HudManager;
|
import org.thinkingstudio.obsidianui.hud.HudManager;
|
||||||
import eu.midnightdust.midnightcontrols.client.touch.TouchInput;
|
import eu.midnightdust.midnightcontrols.client.touch.TouchInput;
|
||||||
@@ -71,27 +72,35 @@ public class MidnightControlsClient extends MidnightControls {
|
|||||||
public static final Identifier WAYLAND_CURSOR_TEXTURE_LIGHT = id("cursor/light/mouse_pointer");
|
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 Identifier WAYLAND_CURSOR_TEXTURE_DARK = id("cursor/dark/mouse_pointer");
|
||||||
public static final File MAPPINGS_FILE = new File("config/gamecontrollercustommappings.txt");
|
public static final File MAPPINGS_FILE = new File("config/gamecontrollercustommappings.txt");
|
||||||
public static final MinecraftClient client = MinecraftClient.getInstance();
|
public static MinecraftClient client = MinecraftClient.getInstance();
|
||||||
public static final MidnightInput input = new MidnightInput();
|
public static final MidnightInput input = new MidnightInput();
|
||||||
public static final MidnightRing ring = new MidnightRing();
|
public static final MidnightRing ring = new MidnightRing();
|
||||||
public static final MidnightReacharound reacharound = new MidnightReacharound();
|
public static final MidnightReacharound reacharound = new MidnightReacharound();
|
||||||
|
public static final MouseClickInterceptor clickInterceptor = new MouseClickInterceptor();
|
||||||
public static boolean isWayland;
|
public static boolean isWayland;
|
||||||
private static MidnightControlsHud hud;
|
private static MidnightControlsHud hud;
|
||||||
private static ControlsMode previousControlsMode;
|
private static ControlsMode previousControlsMode;
|
||||||
|
|
||||||
public static void initClient() {
|
public static void initClient() {
|
||||||
|
client = MinecraftClient.getInstance();
|
||||||
ring.registerAction("buttonbinding", ButtonBindingRingAction.FACTORY);
|
ring.registerAction("buttonbinding", ButtonBindingRingAction.FACTORY);
|
||||||
|
|
||||||
int delay = 0; // delay for 0 sec.
|
int delay = 0; // delay for 0 sec.
|
||||||
int period = 1; // repeat every 0.001 sec. (1000 times a second)
|
int period = 1; // repeat every 0.001 sec. (1000 times a second)
|
||||||
Timer timer = new Timer();
|
Timer timer = new Timer();
|
||||||
timer.scheduleAtFixedRate(new TimerTask() {
|
timer.scheduleAtFixedRate(new TimerTask() {
|
||||||
public void run() { // TODO: Add a try/catch here after the alpha testing period
|
public void run() {
|
||||||
|
try {
|
||||||
if (lateInitDone && client.isRunning()) {
|
if (lateInitDone && client.isRunning()) {
|
||||||
input.tickJoysticks();
|
if (MidnightControlsConfig.controlsMode != ControlsMode.DEFAULT && (client.isWindowFocused() || MidnightControlsConfig.unfocusedInput)) {
|
||||||
|
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER) input.tickCameraStick();
|
||||||
input.updateCamera();
|
input.updateCamera();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception | Error e) {
|
||||||
|
MidnightControls.logger.error("Exception encountered in camera loop: ",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}, delay, period);
|
}, delay, period);
|
||||||
|
|
||||||
HudManager.register(hud = new MidnightControlsHud());
|
HudManager.register(hud = new MidnightControlsHud());
|
||||||
@@ -145,11 +154,11 @@ public class MidnightControlsClient extends MidnightControls {
|
|||||||
if (!keyBinding.getTranslationKey().contains(MidnightControlsConstants.NAMESPACE)) {
|
if (!keyBinding.getTranslationKey().contains(MidnightControlsConstants.NAMESPACE)) {
|
||||||
AtomicReference<ButtonCategory> category = new AtomicReference<>();
|
AtomicReference<ButtonCategory> category = new AtomicReference<>();
|
||||||
InputManager.streamCategories().forEach(buttonCategory -> {
|
InputManager.streamCategories().forEach(buttonCategory -> {
|
||||||
if (buttonCategory.getIdentifier().equals(Identifier.ofVanilla(keyBinding.getCategory())))
|
if (buttonCategory.getIdentifier().equals(validVanillaId(keyBinding.getCategory())))
|
||||||
category.set(buttonCategory);
|
category.set(buttonCategory);
|
||||||
});
|
});
|
||||||
if (category.get() == null) {
|
if (category.get() == null) {
|
||||||
category.set(new ButtonCategory(Identifier.ofVanilla(keyBinding.getCategory())));
|
category.set(new ButtonCategory(validVanillaId(keyBinding.getCategory())));
|
||||||
InputManager.registerCategory(category.get());
|
InputManager.registerCategory(category.get());
|
||||||
}
|
}
|
||||||
ButtonBinding buttonBinding = new ButtonBinding.Builder(keyBinding.getTranslationKey()).category(category.get()).linkKeybind(keyBinding).register();
|
ButtonBinding buttonBinding = new ButtonBinding.Builder(keyBinding.getTranslationKey()).category(category.get()).linkKeybind(keyBinding).register();
|
||||||
@@ -163,6 +172,14 @@ public class MidnightControlsClient extends MidnightControls {
|
|||||||
InputManager.loadButtonBindings();
|
InputManager.loadButtonBindings();
|
||||||
lateInitDone = true;
|
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.
|
* This method is called every Minecraft tick.
|
||||||
@@ -190,10 +207,12 @@ public class MidnightControlsClient extends MidnightControls {
|
|||||||
RainbowColor.tick();
|
RainbowColor.tick();
|
||||||
TouchInput.tick();
|
TouchInput.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when opening a screen.
|
* Called when opening a screen.
|
||||||
*/
|
*/
|
||||||
public static void onScreenOpen(Screen screen) {
|
public static void onScreenOpen(Screen screen) {
|
||||||
|
client = MinecraftClient.getInstance();
|
||||||
if (screen == null && MidnightControlsConfig.controlsMode == ControlsMode.TOUCHSCREEN) {
|
if (screen == null && MidnightControlsConfig.controlsMode == ControlsMode.TOUCHSCREEN) {
|
||||||
screen = new TouchscreenOverlay();
|
screen = new TouchscreenOverlay();
|
||||||
screen.init(client, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight());
|
screen.init(client, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight());
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ package eu.midnightdust.midnightcontrols.client;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.mojang.blaze3d.platform.GlDebugInfo;
|
import com.mojang.blaze3d.platform.GLX;
|
||||||
import eu.midnightdust.lib.config.MidnightConfig;
|
import eu.midnightdust.lib.config.MidnightConfig;
|
||||||
import eu.midnightdust.midnightcontrols.ControlsMode;
|
import eu.midnightdust.midnightcontrols.ControlsMode;
|
||||||
import eu.midnightdust.midnightcontrols.MidnightControls;
|
import eu.midnightdust.midnightcontrols.MidnightControls;
|
||||||
@@ -52,79 +52,108 @@ public class MidnightControlsConfig extends MidnightConfig {
|
|||||||
public static boolean isEditing = false;
|
public static boolean isEditing = false;
|
||||||
@Hidden @Entry public static int configVersion = 2;
|
@Hidden @Entry public static int configVersion = 2;
|
||||||
// General
|
// General
|
||||||
|
@Comment(category = CONTROLLER, centered = true, name="\uD83C\uDFAE General") public static Comment _general;
|
||||||
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.controls_mode") public static ControlsMode controlsMode = ControlsMode.DEFAULT;
|
@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 = CONTROLLER, name = "midnightcontrols.menu.auto_switch_mode") public static boolean autoSwitchMode = true;
|
||||||
@Entry(category = MISC, name = "Debug") public static boolean debug = false;
|
|
||||||
// HUD
|
// HUD
|
||||||
|
@Comment(category = VISUAL, centered = true, name="\uD83D\uDDB9 Hud") public static Comment _hud;
|
||||||
@Entry(category = VISUAL, name = "midnightcontrols.menu.hud_enable") public static boolean hudEnable = true;
|
@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 = 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;
|
@Entry(category = VISUAL, name = "midnightcontrols.menu.controller_type") public static ControllerType controllerType = ControllerType.DEFAULT;
|
||||||
// Gameplay
|
// Gameplay
|
||||||
|
@Comment(category = GAMEPLAY, centered = true, name="\uD83D\uDECB Comfort") public static Comment _comfort;
|
||||||
|
@Entry(category = GAMEPLAY, name = "Enable Hints") public static boolean enableHints = true;
|
||||||
@Entry(category = GAMEPLAY, name = "midnightcontrols.menu.analog_movement") public static boolean analogMovement = true;
|
@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.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_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.controller_toggle_sprint") public static boolean controllerToggleSprint = MinecraftClient.getInstance().options.getSprintToggled().getValue();
|
||||||
|
|
||||||
|
@Condition(requiredModId = "midnightcontrols-extra")
|
||||||
|
@Comment(category = GAMEPLAY, centered = true, name="✨ Extras") public static Comment _extras;
|
||||||
|
@Condition(requiredModId = "midnightcontrols-extra")
|
||||||
@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.fast_block_placing") public static boolean fastBlockPlacing = false; // Disabled by default as this behaviour can be considered cheating on multiplayer servers.
|
||||||
|
@Condition(requiredModId = "midnightcontrols-extra")
|
||||||
@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") 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.
|
||||||
|
@Condition(requiredModId = "midnightcontrols-extra")
|
||||||
@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.fly_drifting_vertical") public static boolean verticalFlyDrifting = true; // Enabled by default as disabling this behaviour can be considered cheating on multiplayer servers.
|
||||||
|
@Condition(requiredModId = "midnightcontrols-extra")
|
||||||
@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.horizontal") public static boolean horizontalReacharound = false; // Disabled by default as this behaviour can be considered cheating on multiplayer servers.
|
||||||
|
@Condition(requiredModId = "midnightcontrols-extra")
|
||||||
@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 = GAMEPLAY, name = "midnightcontrols.menu.reacharound.vertical") public static boolean verticalReacharound = false; // Disabled by default as this behaviour can be considered cheating on multiplayer servers.
|
||||||
|
@Condition(requiredModId = "midnightcontrols-extra")
|
||||||
|
@Comment(category = VISUAL, centered = true, name="⊽ Reacharound") public static Comment _reacharoundOutline;
|
||||||
|
@Condition(requiredModId = "midnightcontrols-extra")
|
||||||
@Entry(category = VISUAL, name = "Reacharound Outline") public static boolean shouldRenderReacharoundOutline = true;
|
@Entry(category = VISUAL, name = "Reacharound Outline") public static boolean shouldRenderReacharoundOutline = true;
|
||||||
|
@Condition(requiredModId = "midnightcontrols-extra", requiredOption = "shouldRenderReacharoundOutline")
|
||||||
@Entry(category = VISUAL, name = "Reacharound Outline Color", isColor = true) public static String reacharoundOutlineColorHex = "#ffffff";
|
@Entry(category = VISUAL, name = "Reacharound Outline Color", isColor = true) public static String reacharoundOutlineColorHex = "#ffffff";
|
||||||
|
@Condition(requiredModId = "midnightcontrols-extra", requiredOption = "shouldRenderReacharoundOutline")
|
||||||
@Entry(category = VISUAL, name = "Reacharound Outline Alpha", isSlider = true, min = 0, max = 255) public static int reacharoundOutlineColorAlpha = 102;
|
@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;
|
@Comment(category = CONTROLLER, centered = true, name="\uD83D\uDCF7 Camera Settings") public static Comment _cameraSettings;
|
||||||
@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 = "midnightcontrols.menu.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_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.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.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.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 = CONTROLLER, name = "midnightcontrols.menu.camera_mode") public static CameraMode cameraMode = CameraMode.FLAT;
|
||||||
|
@Comment(category = SCREENS, centered = true, name="\uD83D\uDDB1 Mouse Behaviour") public static Comment _mouseBehaviour;
|
||||||
@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.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.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",
|
@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",
|
"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",
|
"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");
|
"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 = "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 = 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());
|
@Comment(category = CONTROLLER, centered = true, name="\uD83D\uDC40 Eye Tracking") public static Comment _eyeTracker;
|
||||||
|
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.eye_tracker_as_mouse") public static boolean eyeTrackerAsMouse = false;
|
||||||
|
@Entry(category = CONTROLLER, 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;
|
||||||
|
@Comment(category = SCREENS, centered = true, name="\uD83D\uDC46 Virtual Mouse") public static Comment _virtualMouse;
|
||||||
|
@Entry(category = SCREENS, name = "midnightcontrols.menu.virtual_mouse") public static boolean virtualMouse = false;
|
||||||
|
@Condition(requiredOption = "virtualMouse", visibleButLocked = true)
|
||||||
|
@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 = SCREENS, name = "midnightcontrols.menu.virtual_keyboard") public static boolean virtualKeyboard = 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;
|
||||||
|
@Comment(category = TOUCH, centered = true, name="\uD83E\uDE84 Behaviour") public static Comment _touchBehaviour;
|
||||||
@Entry(category = TOUCH, name = "midnightcontrols.menu.touch_with_controller") public static boolean touchInControllerMode = false;
|
@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.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.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_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_break_delay", isSlider = true, min = 50, max = 500) public static int touchBreakDelay = 120;
|
||||||
|
@Comment(category = TOUCH, centered = true, name="\uD83D\uDCA1 Visuals") public static Comment _visuals;
|
||||||
@Entry(category = TOUCH, name = "midnightcontrols.menu.touch_transparency", isSlider = true, min = 0, max = 100) public static int touchTransparency = 75;
|
@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 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 = "Touch Outline Alpha", isSlider = true, min = 0, max = 255) public static int touchOutlineColorAlpha = 150;
|
||||||
|
@Comment(category = TOUCH, centered = true, name="\uD83E\uDDEA Advanced") public static Comment _advanced;
|
||||||
|
@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 = "Left Touch button bindings") public static List<String> leftTouchBinds = Lists.newArrayList("debug_screen", "screenshot","toggle_perspective");
|
@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(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<>();
|
@Entry @Hidden public static Map<String, String> BINDING = new HashMap<>();
|
||||||
|
|
||||||
private static final Pattern BUTTON_BINDING_PATTERN = Pattern.compile("(-?\\d+)\\+?");
|
private static final Pattern BUTTON_BINDING_PATTERN = Pattern.compile("(-?\\d+)\\+?");
|
||||||
@Deprecated @Hidden @Entry public static double[] maxAnalogValues = new double[]{1, 1, 1, 1};
|
@Comment(category = CONTROLLER, centered = true, name="\uD83D\uDD79 Max Analog Stick Values") public static Comment _maxAnalogValues;
|
||||||
@Entry(category = CONTROLLER, name = "Max analog value: Left X", isSlider = true, min = .25f, max = 1.f) public static double maxAnalogValueLeftX = maxAnalogValues[0];
|
@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 = maxAnalogValues[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 = maxAnalogValues[2];
|
@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 = maxAnalogValues[3];
|
@Entry(category = CONTROLLER, name = "Max analog value: Right Y", isSlider = true, min = .25f, max = 1.f) public static double maxAnalogValueRightY = 1;
|
||||||
|
@Comment(category = CONTROLLER, centered = true, name="☠ Dead Zones") public static Comment _deadZones;
|
||||||
|
@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;
|
||||||
|
@Comment(category = CONTROLLER, centered = true, name="☆ Other Options") public static Comment _otherOptions;
|
||||||
@Entry(category = CONTROLLER, name = "Trigger button fix") public static boolean triggerFix = true;
|
@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 = CONTROLLER, name = "Excluded Controllers (Name Regex)") public static List<String> excludedControllers = Lists.newArrayList(".*(Keyboard)$", ".*(Touchpad)$", ".*(Pen)$", ".*(Finger)$");
|
||||||
|
@Comment(category = SCREENS, centered = true, name="\uD83D\uDD27 UI Modifications") public static Comment _uiMods;
|
||||||
|
@Entry(category = SCREENS, name = "midnightcontrols.menu.move_chat") public static boolean moveChat = false;
|
||||||
|
@Entry(category = SCREENS, name = "Enable Shortcut in Controls Options") public static boolean shortcutInControls = true;
|
||||||
|
@Entry(category = MISC, name = "midnightcontrols.menu.virtual_keyboard_layout") public static String keyboardLayout = "en_US:qwerty";
|
||||||
|
@Entry(category = MISC, name = "Debug") public static boolean debug = false;
|
||||||
@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",
|
@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.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");
|
"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 = MISC, name = "Ring Bindings (WIP)") @Hidden public static List<String> ringBindings = new ArrayList<>();
|
||||||
@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(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<>();
|
@Entry @Hidden public static Map<String, Map<String, String>> controllerBindingProfiles = new HashMap<>();
|
||||||
private static Map<String, String> currentBindingProfile = new HashMap<>();
|
private static Map<String, String> currentBindingProfile = new HashMap<>();
|
||||||
@@ -375,6 +404,7 @@ public class MidnightControlsConfig extends MidnightConfig {
|
|||||||
unfocusedInput = false;
|
unfocusedInput = false;
|
||||||
virtualMouse = false;
|
virtualMouse = false;
|
||||||
virtualMouseSkin = VirtualMouseSkin.DEFAULT_LIGHT;
|
virtualMouseSkin = VirtualMouseSkin.DEFAULT_LIGHT;
|
||||||
|
virtualKeyboard = false;
|
||||||
controllerID = 0;
|
controllerID = 0;
|
||||||
secondControllerID = -1;
|
secondControllerID = -1;
|
||||||
controllerType = ControllerType.DEFAULT;
|
controllerType = ControllerType.DEFAULT;
|
||||||
@@ -401,7 +431,7 @@ public class MidnightControlsConfig extends MidnightConfig {
|
|||||||
String controller = getController().getName().toLowerCase();
|
String controller = getController().getName().toLowerCase();
|
||||||
if (controller.contains("xbox 360")) return ControllerType.XBOX_360;
|
if (controller.contains("xbox 360")) return ControllerType.XBOX_360;
|
||||||
else if (controller.contains("xbox") || controller.contains("afterglow")) return ControllerType.XBOX;
|
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") && GLX._getCpuInfo().contains("AMD Custom APU")) return ControllerType.STEAM_DECK;
|
||||||
else if (controller.contains("steam")) return ControllerType.STEAM_CONTROLLER;
|
else if (controller.contains("steam")) return ControllerType.STEAM_CONTROLLER;
|
||||||
else if (controller.contains("dualsense") || controller.contains("ps5")) return ControllerType.DUALSENSE;
|
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("dualshock") || controller.contains("ps4") || controller.contains("sony")) return ControllerType.DUALSHOCK;
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client;
|
||||||
|
|
||||||
|
import eu.midnightdust.midnightcontrols.client.virtualkeyboard.KeyboardLayoutManager;
|
||||||
|
import net.minecraft.resource.ResourceManager;
|
||||||
|
import net.minecraft.resource.SynchronousResourceReloader;
|
||||||
|
|
||||||
|
public class MidnightControlsReloadListener implements SynchronousResourceReloader {
|
||||||
|
public static final MidnightControlsReloadListener INSTANCE = new MidnightControlsReloadListener();
|
||||||
|
|
||||||
|
private MidnightControlsReloadListener() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reload(ResourceManager manager) {
|
||||||
|
manager.findResources("keyboard_layouts", path -> path.toString().startsWith("midnightcontrols") && path.toString().endsWith(".json")).forEach(KeyboardLayoutManager::loadLayout);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -144,12 +144,14 @@ public class MidnightInput {
|
|||||||
var state = controller.getState();
|
var state = controller.getState();
|
||||||
this.fetchButtonInput(state, false);
|
this.fetchButtonInput(state, false);
|
||||||
this.fetchTriggerInput(state, false);
|
this.fetchTriggerInput(state, false);
|
||||||
|
this.fetchJoystickInput(state, false, false);
|
||||||
}
|
}
|
||||||
MidnightControlsConfig.getSecondController().filter(Controller::isConnected)
|
MidnightControlsConfig.getSecondController().filter(Controller::isConnected)
|
||||||
.ifPresent(joycon -> {
|
.ifPresent(joycon -> {
|
||||||
var state = joycon.getState();
|
var state = joycon.getState();
|
||||||
this.fetchButtonInput(state, true);
|
this.fetchButtonInput(state, true);
|
||||||
this.fetchTriggerInput(state, true);
|
this.fetchTriggerInput(state, true);
|
||||||
|
this.fetchJoystickInput(state, true, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
boolean allowInput = this.controlsInput == null || this.controlsInput.focusedBinding == null;
|
boolean allowInput = this.controlsInput == null || this.controlsInput.focusedBinding == null;
|
||||||
@@ -177,18 +179,16 @@ public class MidnightInput {
|
|||||||
this.inventoryInteractionCooldown--;
|
this.inventoryInteractionCooldown--;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* This method is called 1000 times a second for smooth joystick input
|
* This method is called 1000 times a second for smooth camera input
|
||||||
*/
|
*/
|
||||||
public void tickJoysticks() {
|
public void tickCameraStick() {
|
||||||
var controller = MidnightControlsConfig.getController();
|
var controller = MidnightControlsConfig.getController();
|
||||||
|
|
||||||
if (controller.isConnected()) {
|
if (controller.isConnected()) {
|
||||||
this.fetchJoystickInput(controller.getState(), false);
|
this.fetchJoystickInput(controller.getState(), false, true);
|
||||||
}
|
}
|
||||||
MidnightControlsConfig.getSecondController().filter(Controller::isConnected)
|
MidnightControlsConfig.getSecondController().filter(Controller::isConnected)
|
||||||
.ifPresent(joycon -> {
|
.ifPresent(joycon -> this.fetchJoystickInput(joycon.getState(), true, true));
|
||||||
this.fetchJoystickInput(joycon.getState(), true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -214,10 +214,10 @@ public class MidnightInput {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (this.targetYaw != 0.f || this.targetPitch != 0.f) {
|
if (this.targetYaw != 0.f || this.targetPitch != 0.f) {
|
||||||
float rotationYaw = (float) (client.player.prevYaw + (this.targetYaw * 0.175));
|
float rotationYaw = (float) (client.player.lastYaw + (this.targetYaw * 0.175));
|
||||||
float rotationPitch = (float) (client.player.prevPitch + (this.targetPitch * 0.175));
|
float rotationPitch = (float) (client.player.lastPitch + (this.targetPitch * 0.175));
|
||||||
client.player.prevYaw = rotationYaw;
|
client.player.lastYaw = rotationYaw;
|
||||||
client.player.prevPitch = MathHelper.clamp(rotationPitch, -90.f, 90.f);
|
client.player.lastPitch = MathHelper.clamp(rotationPitch, -90.f, 90.f);
|
||||||
client.player.setYaw(rotationYaw);
|
client.player.setYaw(rotationYaw);
|
||||||
client.player.setPitch(MathHelper.clamp(rotationPitch, -90.f, 90.f));
|
client.player.setPitch(MathHelper.clamp(rotationPitch, -90.f, 90.f));
|
||||||
if (client.player.isRiding() && client.player.getVehicle() != null) {
|
if (client.player.isRiding() && client.player.getVehicle() != null) {
|
||||||
@@ -278,7 +278,7 @@ public class MidnightInput {
|
|||||||
}
|
}
|
||||||
final MathUtil.PolarUtil polarUtil = new MathUtil.PolarUtil();
|
final MathUtil.PolarUtil polarUtil = new MathUtil.PolarUtil();
|
||||||
|
|
||||||
private void fetchJoystickInput(@NotNull GLFWGamepadState gamepadState, boolean leftJoycon) {
|
private void fetchJoystickInput(@NotNull GLFWGamepadState gamepadState, boolean leftJoycon, boolean cameraTick) {
|
||||||
var buffer = gamepadState.axes();
|
var buffer = gamepadState.axes();
|
||||||
|
|
||||||
polarUtil.calculate(buffer.get(GLFW_GAMEPAD_AXIS_LEFT_X), buffer.get(GLFW_GAMEPAD_AXIS_LEFT_Y), 1, MidnightControlsConfig.leftDeadZone);
|
polarUtil.calculate(buffer.get(GLFW_GAMEPAD_AXIS_LEFT_X), buffer.get(GLFW_GAMEPAD_AXIS_LEFT_Y), 1, MidnightControlsConfig.leftDeadZone);
|
||||||
@@ -291,7 +291,7 @@ public class MidnightInput {
|
|||||||
boolean isRadialMenu = client.currentScreen instanceof RingScreen || (PlatformFunctions.isModLoaded("emotecraft") && EmotecraftCompat.isEmotecraftScreen(client.currentScreen));
|
boolean isRadialMenu = client.currentScreen instanceof RingScreen || (PlatformFunctions.isModLoaded("emotecraft") && EmotecraftCompat.isEmotecraftScreen(client.currentScreen));
|
||||||
|
|
||||||
if (!isRadialMenu) {
|
if (!isRadialMenu) {
|
||||||
for (int i = 0; i < GLFW_GAMEPAD_AXIS_LEFT_TRIGGER; i++) {
|
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;
|
int axis = leftJoycon ? ButtonBinding.controller2Button(i) : i;
|
||||||
float value = buffer.get(i);
|
float value = buffer.get(i);
|
||||||
|
|
||||||
@@ -503,21 +503,22 @@ public class MidnightInput {
|
|||||||
axisValue /= (float) (1.0 - storage.deadZone);
|
axisValue /= (float) (1.0 - storage.deadZone);
|
||||||
axisValue *= (float) storage.deadZone;
|
axisValue *= (float) storage.deadZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
axisValue = (float) Math.min(axisValue / MidnightControlsConfig.getAxisMaxValue(storage.axis), 1);
|
axisValue = (float) Math.min(axisValue / MidnightControlsConfig.getAxisMaxValue(storage.axis), 1);
|
||||||
if (AxisStorage.isLeftAxis(storage.axis)) MidnightControlsCompat.handleMovement(storage, axisValue);
|
if (AxisStorage.isLeftAxis(storage.axis)) MidnightControlsCompat.handleMovement(storage, axisValue);
|
||||||
InputManager.BUTTON_VALUES.put(ButtonBinding.axisAsButton(storage.axis, true), storage.polarity == AxisStorage.Polarity.PLUS ? axisValue : 0.f);
|
InputManager.BUTTON_VALUES.put(storage.getButtonId(true), storage.polarity == AxisStorage.Polarity.PLUS ? axisValue : 0.f);
|
||||||
InputManager.BUTTON_VALUES.put(ButtonBinding.axisAsButton(storage.axis, false), storage.polarity == AxisStorage.Polarity.MINUS ? 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) {
|
private boolean handleScreenScrolling(Screen screen, AxisStorage storage) {
|
||||||
|
if (screen == null) return false;
|
||||||
// @TODO allow rebinding to left stick
|
// @TODO allow rebinding to left stick
|
||||||
int preferredAxis = true ? GLFW_GAMEPAD_AXIS_RIGHT_Y : GLFW_GAMEPAD_AXIS_LEFT_Y;
|
int preferredAxis = true ? GLFW_GAMEPAD_AXIS_RIGHT_Y : GLFW_GAMEPAD_AXIS_LEFT_Y;
|
||||||
|
|
||||||
if (this.controlsInput != null && this.controlsInput.focusedBinding != null) {
|
if (this.controlsInput != null && this.controlsInput.focusedBinding != null) {
|
||||||
if (storage.buttonState != ButtonState.NONE && !this.controlsInput.currentButtons.contains(ButtonBinding.axisAsButton(storage.axis, storage.buttonState == ButtonState.PRESS))) {
|
if (storage.buttonState != ButtonState.NONE && !this.controlsInput.currentButtons.contains(storage.getButtonId(storage.buttonState == ButtonState.PRESS))) {
|
||||||
|
|
||||||
this.controlsInput.currentButtons.add(ButtonBinding.axisAsButton(storage.axis, storage.buttonState == ButtonState.PRESS));
|
this.controlsInput.currentButtons.add(storage.getButtonId(storage.buttonState == ButtonState.PRESS));
|
||||||
|
|
||||||
int[] buttons = new int[this.controlsInput.currentButtons.size()];
|
int[] buttons = new int[this.controlsInput.currentButtons.size()];
|
||||||
for (int i = 0; i < this.controlsInput.currentButtons.size(); i++)
|
for (int i = 0; i < this.controlsInput.currentButtons.size(); i++)
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class MidnightReacharound {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static float getPlayerRange(@NotNull MinecraftClient client) {
|
public static float getPlayerRange(@NotNull MinecraftClient client) {
|
||||||
return client.player != null ? Double.valueOf(client.player.getAttributeValue(EntityAttributes.PLAYER_BLOCK_INTERACTION_RANGE)).floatValue() : 0.f;
|
return client.player != null ? Double.valueOf(client.player.getAttributeValue(EntityAttributes.BLOCK_INTERACTION_RANGE)).floatValue() : 0.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,36 +1,51 @@
|
|||||||
package eu.midnightdust.midnightcontrols.client.compat;
|
package eu.midnightdust.midnightcontrols.client.compat;
|
||||||
|
|
||||||
import eu.midnightdust.midnightcontrols.client.controller.InputManager;
|
import eu.midnightdust.midnightcontrols.client.controller.InputManager;
|
||||||
import io.github.kosmx.emotes.arch.gui.EmoteMenuImpl;
|
import eu.midnightdust.midnightcontrols.client.mixin.MouseAccessor;
|
||||||
import io.github.kosmx.emotes.arch.gui.screen.ingame.FastChosseScreen;
|
import io.github.kosmx.emotes.arch.screen.ingame.FastMenuScreen;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import org.joml.Vector2i;
|
||||||
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
public class EmotecraftCompat {
|
public class EmotecraftCompat {
|
||||||
private static final MinecraftClient client = MinecraftClient.getInstance();
|
private static final MinecraftClient client = MinecraftClient.getInstance();
|
||||||
|
|
||||||
public static void openEmotecraftScreen(Screen parent) {
|
public static void openEmotecraftScreen(Screen parent) {
|
||||||
client.setScreen(new EmoteMenuImpl(parent));
|
client.setScreen(new FastMenuScreen(parent));
|
||||||
}
|
}
|
||||||
public static boolean isEmotecraftScreen(Screen screen) {
|
public static boolean isEmotecraftScreen(Screen screen) {
|
||||||
return screen instanceof FastChosseScreen;
|
return screen instanceof FastMenuScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int prevIndex = -1;
|
||||||
public static void handleEmoteSelector(int index) {
|
public static void handleEmoteSelector(int index) {
|
||||||
if (client.currentScreen instanceof FastChosseScreen) {
|
try {
|
||||||
|
if (client.currentScreen instanceof FastMenuScreen) {
|
||||||
|
boolean stickReleased = index == -1 && prevIndex != -1;
|
||||||
|
var pos = calcMousePos(stickReleased ? prevIndex : index);
|
||||||
|
InputManager.queueMousePosition(pos.x, pos.y);
|
||||||
|
InputManager.INPUT_MANAGER.updateMousePosition(client);
|
||||||
|
|
||||||
|
if (stickReleased) {
|
||||||
|
((MouseAccessor) client.mouse).midnightcontrols$onMouseButton(client.getWindow().getHandle(), GLFW.GLFW_MOUSE_BUTTON_LEFT, GLFW.GLFW_PRESS, 0);
|
||||||
|
prevIndex = -1;
|
||||||
|
}
|
||||||
|
else prevIndex = index;
|
||||||
|
} else prevIndex = -1;
|
||||||
|
} catch (Exception ignored) {}
|
||||||
|
}
|
||||||
|
public static Vector2i calcMousePos(int index) {
|
||||||
int x = client.getWindow().getWidth() / 2;
|
int x = client.getWindow().getWidth() / 2;
|
||||||
int y = client.getWindow().getHeight() / 2;
|
int y = client.getWindow().getHeight() / 2;
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0, 3, 5 -> x -= 200;
|
case 0, 3, 5 -> x -= 275;
|
||||||
case 2, 4, 7 -> x += 200;
|
case 2, 4, 7 -> x += 275;
|
||||||
}
|
}
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0, 1, 2 -> y -= 200;
|
case 0, 1, 2 -> y -= 275;
|
||||||
case 5, 6, 7 -> y += 200;
|
case 5, 6, 7 -> y += 275;
|
||||||
}
|
|
||||||
InputManager.queueMousePosition(x, y);
|
|
||||||
|
|
||||||
InputManager.INPUT_MANAGER.updateMousePosition(client);
|
|
||||||
}
|
}
|
||||||
|
return new Vector2i(x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.cli
|
|||||||
* @since 1.1.0
|
* @since 1.1.0
|
||||||
*/
|
*/
|
||||||
public class MidnightControlsCompat {
|
public class MidnightControlsCompat {
|
||||||
private static final List<CompatHandler> HANDLERS = new ArrayList<>();
|
@Deprecated // INTERNAL -> PLEASE USE streamCompatHandlers() INSTEAD
|
||||||
|
public static final List<CompatHandler> HANDLERS = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes compatibility with other mods if needed.
|
* Initializes compatibility with other mods if needed.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package eu.midnightdust.midnightcontrols.client.compat;
|
package eu.midnightdust.midnightcontrols.client.compat;
|
||||||
|
|
||||||
import eu.midnightdust.midnightcontrols.client.compat.mixin.sodium.SodiumOptionsGUIAccessor;
|
import eu.midnightdust.midnightcontrols.client.compat.mixin.sodium.SodiumOptionsGUIAccessor;
|
||||||
import me.jellysquid.mods.sodium.client.gui.SodiumOptionsGUI;
|
import net.caffeinemc.mods.sodium.client.gui.SodiumOptionsGUI;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
|
||||||
public class SodiumCompat implements CompatHandler {
|
public class SodiumCompat implements CompatHandler {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package eu.midnightdust.midnightcontrols.client.compat.mixin.sodium;
|
package eu.midnightdust.midnightcontrols.client.compat.mixin.sodium;
|
||||||
|
|
||||||
import me.jellysquid.mods.sodium.client.gui.SodiumOptionsGUI;
|
import net.caffeinemc.mods.sodium.client.gui.SodiumOptionsGUI;
|
||||||
import me.jellysquid.mods.sodium.client.gui.options.OptionPage;
|
import net.caffeinemc.mods.sodium.client.gui.options.OptionPage;
|
||||||
import me.jellysquid.mods.sodium.client.gui.options.control.ControlElement;
|
import net.caffeinemc.mods.sodium.client.gui.options.control.ControlElement;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
|||||||
@@ -60,10 +60,11 @@ public class InputHandlers {
|
|||||||
// When in-game
|
// When in-game
|
||||||
if (client.currentScreen == null && client.player != null) {
|
if (client.currentScreen == null && client.player != null) {
|
||||||
if (!client.player.isSpectator()) {
|
if (!client.player.isSpectator()) {
|
||||||
|
var inv = client.player.getInventory();
|
||||||
if (next)
|
if (next)
|
||||||
client.player.getInventory().scrollInHotbar(-1.0);
|
inv.setSelectedSlot(inv.getSelectedSlot() < 8 ? inv.getSelectedSlot() + 1 : inv.getSelectedSlot() - 8);
|
||||||
else
|
else
|
||||||
client.player.getInventory().scrollInHotbar(1.0);
|
inv.setSelectedSlot(inv.getSelectedSlot() > 0 ? inv.getSelectedSlot() - 1 : inv.getSelectedSlot() + 8);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (client.inGameHud.getSpectatorHud().isOpen()) {
|
if (client.inGameHud.getSpectatorHud().isOpen()) {
|
||||||
@@ -79,11 +80,9 @@ public class InputHandlers {
|
|||||||
} else if (client.currentScreen instanceof CreativeInventoryScreenAccessor inventory) {
|
} else if (client.currentScreen instanceof CreativeInventoryScreenAccessor inventory) {
|
||||||
inventory.midnightcontrols$setSelectedTab(ItemGroupUtil.cycleTab(next, client));
|
inventory.midnightcontrols$setSelectedTab(ItemGroupUtil.cycleTab(next, client));
|
||||||
return true;
|
return true;
|
||||||
} else if (client.currentScreen instanceof InventoryScreen || client.currentScreen instanceof CraftingScreen || client.currentScreen instanceof AbstractFurnaceScreen<?>) {
|
} else if (client.currentScreen instanceof RecipeBookScreen<?> recipeBookScreen) {
|
||||||
RecipeBookWidget recipeBook;
|
RecipeBookWidget<?> recipeBook = ((RecipeBookScreenAccessor) recipeBookScreen).getRecipeBook();
|
||||||
if (client.currentScreen instanceof InventoryScreen inventoryScreen) recipeBook = inventoryScreen.getRecipeBookWidget();
|
|
||||||
else if (client.currentScreen instanceof CraftingScreen craftingScreen) recipeBook = craftingScreen.getRecipeBookWidget();
|
|
||||||
else recipeBook = ((AbstractFurnaceScreen<?>)client.currentScreen).getRecipeBookWidget();
|
|
||||||
var recipeBookAccessor = (RecipeBookWidgetAccessor) recipeBook;
|
var recipeBookAccessor = (RecipeBookWidgetAccessor) recipeBook;
|
||||||
var tabs = recipeBookAccessor.getTabButtons();
|
var tabs = recipeBookAccessor.getTabButtons();
|
||||||
var currentTab = recipeBookAccessor.getCurrentTab();
|
var currentTab = recipeBookAccessor.getCurrentTab();
|
||||||
@@ -98,7 +97,7 @@ public class InputHandlers {
|
|||||||
currentTab.setToggled(false);
|
currentTab.setToggled(false);
|
||||||
recipeBookAccessor.setCurrentTab(currentTab = tabs.get(nextTab));
|
recipeBookAccessor.setCurrentTab(currentTab = tabs.get(nextTab));
|
||||||
currentTab.setToggled(true);
|
currentTab.setToggled(true);
|
||||||
recipeBookAccessor.midnightcontrols$refreshResults(true);
|
recipeBookScreen.refreshRecipeBook();
|
||||||
return true;
|
return true;
|
||||||
} else if (client.currentScreen instanceof AdvancementsScreenAccessor screen) {
|
} else if (client.currentScreen instanceof AdvancementsScreenAccessor screen) {
|
||||||
var tabs = screen.getTabs().values().stream().distinct().toList();
|
var tabs = screen.getTabs().values().stream().distinct().toList();
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.cli
|
|||||||
*/
|
*/
|
||||||
public class InputManager {
|
public class InputManager {
|
||||||
public static final InputManager INPUT_MANAGER = new InputManager();
|
public static final InputManager INPUT_MANAGER = new InputManager();
|
||||||
private static final List<ButtonBinding> BINDINGS = new ArrayList<>();
|
private static final List<ButtonBinding> BINDINGS = Collections.synchronizedList(new ArrayList<>());
|
||||||
private static final List<ButtonCategory> CATEGORIES = new ArrayList<>();
|
private static final List<ButtonCategory> CATEGORIES = new ArrayList<>();
|
||||||
public static final Int2ObjectMap<ButtonState> STATES = new Int2ObjectOpenHashMap<>();
|
public static final Int2ObjectMap<ButtonState> STATES = new Int2ObjectOpenHashMap<>();
|
||||||
public static final Int2FloatMap BUTTON_VALUES = new Int2FloatOpenHashMap();
|
public static final Int2FloatMap BUTTON_VALUES = new Int2FloatOpenHashMap();
|
||||||
@@ -76,8 +76,8 @@ public class InputManager {
|
|||||||
public void updateMousePosition(@NotNull MinecraftClient client) {
|
public void updateMousePosition(@NotNull MinecraftClient client) {
|
||||||
Objects.requireNonNull(client, "Client instance cannot be null.");
|
Objects.requireNonNull(client, "Client instance cannot be null.");
|
||||||
if (this.prevTargetMouseX != this.targetMouseX || this.prevTargetMouseY != this.targetMouseY) {
|
if (this.prevTargetMouseX != this.targetMouseX || this.prevTargetMouseY != this.targetMouseY) {
|
||||||
double mouseX = this.prevTargetMouseX + (this.targetMouseX - this.prevTargetMouseX) * client.getRenderTickCounter().getTickDelta(true) + 0.5;
|
double mouseX = this.prevTargetMouseX + (this.targetMouseX - this.prevTargetMouseX) * client.getRenderTickCounter().getTickProgress(true) + 0.5;
|
||||||
double mouseY = this.prevTargetMouseY + (this.targetMouseY - this.prevTargetMouseY) * client.getRenderTickCounter().getTickDelta(true) + 0.5;
|
double mouseY = this.prevTargetMouseY + (this.targetMouseY - this.prevTargetMouseY) * client.getRenderTickCounter().getTickProgress(true) + 0.5;
|
||||||
if (!MidnightControlsConfig.virtualMouse)
|
if (!MidnightControlsConfig.virtualMouse)
|
||||||
GLFW.glfwSetCursorPos(client.getWindow().getHandle(), mouseX, mouseY);
|
GLFW.glfwSetCursorPos(client.getWindow().getHandle(), mouseX, mouseY);
|
||||||
((MouseAccessor) client.mouse).midnightcontrols$onCursorPos(client.getWindow().getHandle(), mouseX, mouseY);
|
((MouseAccessor) client.mouse).midnightcontrols$onCursorPos(client.getWindow().getHandle(), mouseX, mouseY);
|
||||||
@@ -109,8 +109,10 @@ public class InputManager {
|
|||||||
* @return true if the binding is registered, else false
|
* @return true if the binding is registered, else false
|
||||||
*/
|
*/
|
||||||
public static boolean hasBinding(@NotNull ButtonBinding binding) {
|
public static boolean hasBinding(@NotNull ButtonBinding binding) {
|
||||||
|
synchronized (BINDINGS) {
|
||||||
return BINDINGS.contains(binding);
|
return BINDINGS.contains(binding);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the specified binding is registered or not.
|
* Returns whether the specified binding is registered or not.
|
||||||
@@ -119,8 +121,10 @@ public class InputManager {
|
|||||||
* @return true if the binding is registered, else false
|
* @return true if the binding is registered, else false
|
||||||
*/
|
*/
|
||||||
public static boolean hasBinding(@NotNull String name) {
|
public static boolean hasBinding(@NotNull String name) {
|
||||||
|
synchronized (BINDINGS) {
|
||||||
return BINDINGS.parallelStream().map(ButtonBinding::getName).anyMatch(binding -> binding.equalsIgnoreCase(name));
|
return BINDINGS.parallelStream().map(ButtonBinding::getName).anyMatch(binding -> binding.equalsIgnoreCase(name));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the specified binding is registered or not.
|
* Returns whether the specified binding is registered or not.
|
||||||
@@ -139,18 +143,22 @@ public class InputManager {
|
|||||||
* @return true if the binding is registered, else false
|
* @return true if the binding is registered, else false
|
||||||
*/
|
*/
|
||||||
public static ButtonBinding getBinding(@NotNull String name) {
|
public static ButtonBinding getBinding(@NotNull String name) {
|
||||||
|
synchronized (BINDINGS) {
|
||||||
if (BINDINGS.parallelStream().map(ButtonBinding::getName).anyMatch(binding -> binding.equalsIgnoreCase(name)))
|
if (BINDINGS.parallelStream().map(ButtonBinding::getName).anyMatch(binding -> binding.equalsIgnoreCase(name)))
|
||||||
BINDINGS.forEach(binding -> {
|
BINDINGS.forEach(binding -> {
|
||||||
if (binding.getName().equalsIgnoreCase(name)) InputManager.tempBinding = binding;
|
if (binding.getName().equalsIgnoreCase(name)) InputManager.tempBinding = binding;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
return tempBinding;
|
return tempBinding;
|
||||||
}
|
}
|
||||||
private static List<ButtonBinding> unboundBindings;
|
private static List<ButtonBinding> unboundBindings;
|
||||||
public static List<ButtonBinding> getUnboundBindings() {
|
public static List<ButtonBinding> getUnboundBindings() {
|
||||||
unboundBindings = new ArrayList<>();
|
unboundBindings = new ArrayList<>();
|
||||||
|
synchronized (BINDINGS) {
|
||||||
BINDINGS.forEach(binding -> {
|
BINDINGS.forEach(binding -> {
|
||||||
if (binding.isNotBound() && !MidnightControlsConfig.ignoredUnboundKeys.contains(binding.getTranslationKey())) unboundBindings.add(binding);
|
if (binding.isNotBound() && !MidnightControlsConfig.ignoredUnboundKeys.contains(binding.getTranslationKey())) unboundBindings.add(binding);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
unboundBindings.sort(Comparator.comparing(s -> I18n.translate(s.getTranslationKey())));
|
unboundBindings.sort(Comparator.comparing(s -> I18n.translate(s.getTranslationKey())));
|
||||||
return unboundBindings;
|
return unboundBindings;
|
||||||
}
|
}
|
||||||
@@ -162,9 +170,11 @@ public class InputManager {
|
|||||||
* @return the registered binding
|
* @return the registered binding
|
||||||
*/
|
*/
|
||||||
public static @NotNull ButtonBinding registerBinding(@NotNull ButtonBinding binding) {
|
public static @NotNull ButtonBinding registerBinding(@NotNull ButtonBinding binding) {
|
||||||
if (hasBinding(binding))
|
synchronized (BINDINGS) {
|
||||||
|
if (BINDINGS.contains(binding))
|
||||||
throw new IllegalStateException("Cannot register twice a button binding in the registry.");
|
throw new IllegalStateException("Cannot register twice a button binding in the registry.");
|
||||||
BINDINGS.add(binding);
|
BINDINGS.add(binding);
|
||||||
|
}
|
||||||
return binding;
|
return binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,8 +294,10 @@ public class InputManager {
|
|||||||
* @return true if the button has duplicated bindings, else false
|
* @return true if the button has duplicated bindings, else false
|
||||||
*/
|
*/
|
||||||
public static boolean hasDuplicatedBindings(int[] button) {
|
public static boolean hasDuplicatedBindings(int[] button) {
|
||||||
|
synchronized (BINDINGS) {
|
||||||
return BINDINGS.parallelStream().filter(binding -> areButtonsEquivalent(binding.getButton(), button)).count() > 1;
|
return BINDINGS.parallelStream().filter(binding -> areButtonsEquivalent(binding.getButton(), button)).count() > 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the button has duplicated bindings.
|
* Returns whether the button has duplicated bindings.
|
||||||
@@ -294,8 +306,10 @@ public class InputManager {
|
|||||||
* @return true if the button has duplicated bindings, else false
|
* @return true if the button has duplicated bindings, else false
|
||||||
*/
|
*/
|
||||||
public static boolean hasDuplicatedBindings(ButtonBinding binding) {
|
public static boolean hasDuplicatedBindings(ButtonBinding binding) {
|
||||||
|
synchronized (BINDINGS) {
|
||||||
return BINDINGS.parallelStream().filter(other -> areButtonsEquivalent(other.getButton(), binding.getButton()) && other.filter.equals(binding.filter)).count() > 1;
|
return BINDINGS.parallelStream().filter(other -> areButtonsEquivalent(other.getButton(), binding.getButton()) && other.filter.equals(binding.filter)).count() > 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the specified buttons are equivalent or not.
|
* Returns whether the specified buttons are equivalent or not.
|
||||||
@@ -347,6 +361,7 @@ public class InputManager {
|
|||||||
record ButtonStateValue(ButtonState state, float value) {
|
record ButtonStateValue(ButtonState state, float value) {
|
||||||
}
|
}
|
||||||
var states = new Object2ObjectOpenHashMap<ButtonBinding, ButtonStateValue>();
|
var states = new Object2ObjectOpenHashMap<ButtonBinding, ButtonStateValue>();
|
||||||
|
synchronized (BINDINGS) {
|
||||||
for (var binding : BINDINGS) {
|
for (var binding : BINDINGS) {
|
||||||
var state = binding.isAvailable() ? getBindingState(binding) : ButtonState.NONE;
|
var state = binding.isAvailable() ? getBindingState(binding) : ButtonState.NONE;
|
||||||
if (skipButtons.intStream().anyMatch(btn -> containsButton(binding.getButton(), btn))) {
|
if (skipButtons.intStream().anyMatch(btn -> containsButton(binding.getButton(), btn))) {
|
||||||
@@ -369,6 +384,7 @@ public class InputManager {
|
|||||||
|
|
||||||
states.put(binding, new ButtonStateValue(state, value));
|
states.put(binding, new ButtonStateValue(state, value));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
states.forEach((binding, state) -> {
|
states.forEach((binding, state) -> {
|
||||||
if (state.state() != ButtonState.NONE) {
|
if (state.state() != ButtonState.NONE) {
|
||||||
@@ -387,8 +403,10 @@ public class InputManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static @NotNull Stream<ButtonBinding> streamBindings() {
|
public static @NotNull Stream<ButtonBinding> streamBindings() {
|
||||||
|
synchronized (BINDINGS) {
|
||||||
return BINDINGS.stream();
|
return BINDINGS.stream();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static @NotNull Stream<ButtonCategory> streamCategories() {
|
public static @NotNull Stream<ButtonCategory> streamCategories() {
|
||||||
return CATEGORIES.stream();
|
return CATEGORIES.stream();
|
||||||
|
|||||||
@@ -11,11 +11,14 @@ package eu.midnightdust.midnightcontrols.client.controller;
|
|||||||
|
|
||||||
import eu.midnightdust.midnightcontrols.client.enums.ButtonState;
|
import eu.midnightdust.midnightcontrols.client.enums.ButtonState;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.mixin.InputAccessor;
|
||||||
import eu.midnightdust.midnightcontrols.client.util.MathUtil;
|
import eu.midnightdust.midnightcontrols.client.util.MathUtil;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.network.ClientPlayerEntity;
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
import net.minecraft.entity.attribute.EntityAttributes;
|
import net.minecraft.entity.attribute.EntityAttributes;
|
||||||
|
import net.minecraft.util.PlayerInput;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.math.Vec2f;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,14 +51,12 @@ public final class MovementHandler implements PressAction {
|
|||||||
public void applyMovement(@NotNull ClientPlayerEntity player) {
|
public void applyMovement(@NotNull ClientPlayerEntity player) {
|
||||||
if (!this.shouldOverrideMovement)
|
if (!this.shouldOverrideMovement)
|
||||||
return;
|
return;
|
||||||
player.input.pressingForward = this.pressingForward;
|
player.input.playerInput = new PlayerInput(this.pressingForward, this.pressingBack, this.pressingLeft, this.pressingRight,
|
||||||
player.input.pressingBack = this.pressingBack;
|
player.input.playerInput.jump(), player.input.playerInput.sneak(), player.input.playerInput.sprint());
|
||||||
player.input.pressingLeft = this.pressingLeft;
|
|
||||||
player.input.pressingRight = this.pressingRight;
|
|
||||||
|
|
||||||
polarUtil.calculate(this.movementSideways, this.movementForward, this.slowdownFactor);
|
polarUtil.calculate(this.movementSideways, this.movementForward, this.slowdownFactor);
|
||||||
player.input.movementForward = polarUtil.polarY;
|
Vec2f inputVector = new Vec2f(polarUtil.polarX, polarUtil.polarY);
|
||||||
player.input.movementSideways = polarUtil.polarX;
|
((InputAccessor)player.input).setMovementVector(inputVector);
|
||||||
|
|
||||||
this.shouldOverrideMovement = false;
|
this.shouldOverrideMovement = false;
|
||||||
}
|
}
|
||||||
@@ -81,7 +82,7 @@ public final class MovementHandler implements PressAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.slowdownFactor = client.player.shouldSlowDown() ? (MathHelper.clamp(
|
this.slowdownFactor = client.player.shouldSlowDown() ? (MathHelper.clamp(
|
||||||
0.3F + (float) client.player.getAttributeValue(EntityAttributes.PLAYER_SNEAKING_SPEED),
|
0.3F + (float) client.player.getAttributeValue(EntityAttributes.SNEAKING_SPEED),
|
||||||
0.0F,
|
0.0F,
|
||||||
1.0F
|
1.0F
|
||||||
)) : 1.f;
|
)) : 1.f;
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class MappingsStringInputWidget extends SpruceContainerWidget {
|
|||||||
@Override
|
@Override
|
||||||
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
|
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||||
super.renderWidget(context, mouseX, mouseY, delta);
|
super.renderWidget(context, mouseX, mouseY, delta);
|
||||||
context.drawCenteredTextWithShadow(this.client.textRenderer, Text.translatable("midnightcontrols.menu.multiple_mapping_tip"), this.textArea.getX() + this.textArea.getWidth() / 2, this.textArea.getY() + this.textArea.getHeight() - 12, 0x888888);
|
context.drawCenteredTextWithShadow(this.client.textRenderer, Text.translatable("midnightcontrols.menu.multiple_mapping_tip"), this.textArea.getX() + this.textArea.getWidth() / 2, this.textArea.getY() + this.textArea.getHeight() - 12, 0xFF888888);
|
||||||
context.drawCenteredTextWithShadow(this.client.textRenderer, Text.translatable("midnightcontrols.menu.current_controller_guid", MidnightControlsConfig.getController().getGuid()), this.textArea.getX() + this.textArea.getWidth() / 2, this.height - 21, 0xFFFFFF);
|
context.drawCenteredTextWithShadow(this.client.textRenderer, Text.translatable("midnightcontrols.menu.current_controller_guid", MidnightControlsConfig.getController().getGuid()), this.textArea.getX() + this.textArea.getWidth() / 2, this.height - 21, 0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,21 +10,19 @@
|
|||||||
package eu.midnightdust.midnightcontrols.client.gui;
|
package eu.midnightdust.midnightcontrols.client.gui;
|
||||||
|
|
||||||
import eu.midnightdust.midnightcontrols.ControlsMode;
|
import eu.midnightdust.midnightcontrols.ControlsMode;
|
||||||
import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
|
|
||||||
import eu.midnightdust.midnightcontrols.client.enums.HudSide;
|
import eu.midnightdust.midnightcontrols.client.enums.HudSide;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||||
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
|
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
|
||||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
||||||
import net.minecraft.client.render.RenderTickCounter;
|
import net.minecraft.client.render.RenderTickCounter;
|
||||||
|
import org.joml.Matrix3x2fStack;
|
||||||
import org.thinkingstudio.obsidianui.hud.Hud;
|
import org.thinkingstudio.obsidianui.hud.Hud;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.resource.language.I18n;
|
import net.minecraft.client.resource.language.I18n;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import net.minecraft.util.hit.BlockHitResult;
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
import net.minecraft.util.hit.HitResult;
|
import net.minecraft.util.hit.HitResult;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -40,7 +38,7 @@ import static eu.midnightdust.midnightcontrols.MidnightControls.id;
|
|||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public class MidnightControlsHud extends Hud {
|
public class MidnightControlsHud extends Hud {
|
||||||
private final MinecraftClient client = MinecraftClient.getInstance();
|
private MinecraftClient client = MinecraftClient.getInstance();
|
||||||
private int attackWidth = 0;
|
private int attackWidth = 0;
|
||||||
private int attackButtonWidth = 0;
|
private int attackButtonWidth = 0;
|
||||||
private int dropItemWidth = 0;
|
private int dropItemWidth = 0;
|
||||||
@@ -63,6 +61,7 @@ public class MidnightControlsHud extends Hud {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(@NotNull MinecraftClient client, int screenWidth, int screenHeight) {
|
public void init(@NotNull MinecraftClient client, int screenWidth, int screenHeight) {
|
||||||
|
this.client = MinecraftClient.getInstance();
|
||||||
super.init(client, screenWidth, screenHeight);
|
super.init(client, screenWidth, screenHeight);
|
||||||
this.inventoryWidth = this.width(ButtonBinding.INVENTORY);
|
this.inventoryWidth = this.width(ButtonBinding.INVENTORY);
|
||||||
this.inventoryButtonWidth = MidnightControlsRenderer.getBindingIconWidth(ButtonBinding.INVENTORY);
|
this.inventoryButtonWidth = MidnightControlsRenderer.getBindingIconWidth(ButtonBinding.INVENTORY);
|
||||||
@@ -84,13 +83,13 @@ public class MidnightControlsHud extends Hud {
|
|||||||
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && this.client.currentScreen == null) {
|
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && this.client.currentScreen == null) {
|
||||||
isCrammed = client.getWindow().getScaledWidth() < 520;
|
isCrammed = client.getWindow().getScaledWidth() < 520;
|
||||||
int y = bottom(2);
|
int y = bottom(2);
|
||||||
MatrixStack matrices = context.getMatrices();
|
Matrix3x2fStack matrices = context.getMatrices();
|
||||||
matrices.push();
|
matrices.pushMatrix();
|
||||||
this.renderFirstIcons(context, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : client.getWindow().getScaledWidth() - 2, y);
|
this.renderFirstIcons(context, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : client.getWindow().getScaledWidth() - 2, y);
|
||||||
this.renderSecondIcons(context, MidnightControlsConfig.hudSide == HudSide.RIGHT ? 2 : client.getWindow().getScaledWidth() - 2, y);
|
this.renderSecondIcons(context, MidnightControlsConfig.hudSide == HudSide.RIGHT ? 2 : client.getWindow().getScaledWidth() - 2, y);
|
||||||
this.renderFirstSection(context, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : client.getWindow().getScaledWidth() - 2, y);
|
this.renderFirstSection(context, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : client.getWindow().getScaledWidth() - 2, y);
|
||||||
this.renderSecondSection(context, MidnightControlsConfig.hudSide == HudSide.RIGHT ? 2 : client.getWindow().getScaledWidth() - 2, y);
|
this.renderSecondSection(context, MidnightControlsConfig.hudSide == HudSide.RIGHT ? 2 : client.getWindow().getScaledWidth() - 2, y);
|
||||||
matrices.pop();
|
matrices.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MidnightControlsClient.reacharound.isLastReacharoundVertical()) {
|
if (MidnightControlsClient.reacharound.isLastReacharoundVertical()) {
|
||||||
@@ -98,12 +97,12 @@ public class MidnightControlsHud extends Hud {
|
|||||||
var window = this.client.getWindow();
|
var window = this.client.getWindow();
|
||||||
var text = "[ ]";
|
var text = "[ ]";
|
||||||
|
|
||||||
float scale = Math.min(5, this.ticksDisplayedCrosshair + tickCounter.getTickDelta(true)) / 5F;
|
float scale = Math.min(5, this.ticksDisplayedCrosshair + tickCounter.getTickProgress(true)) / 5F;
|
||||||
scale *= scale;
|
scale *= scale;
|
||||||
int opacity = ((int) (255 * scale)) << 24;
|
int opacity = ((int) (255 * scale)) << 24;
|
||||||
|
|
||||||
context.drawText(client.textRenderer, text, (int) (window.getScaledWidth() / 2.f - this.client.textRenderer.getWidth(text) / 2.f),
|
context.drawText(client.textRenderer, text, (int) (window.getScaledWidth() / 2.f - this.client.textRenderer.getWidth(text) / 2.f),
|
||||||
(int) (window.getScaledHeight() / 2.f - 4), 0xCCCCCC | opacity, false);
|
(int) (window.getScaledHeight() / 2.f - 4), 0xFFCCCCCC | opacity, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,6 +298,6 @@ public class MidnightControlsHud extends Hud {
|
|||||||
return;
|
return;
|
||||||
var translatedAction = I18n.translate(action);
|
var translatedAction = I18n.translate(action);
|
||||||
int textY = (MidnightControlsRenderer.ICON_SIZE / 2 - this.client.textRenderer.fontHeight / 2) + 1;
|
int textY = (MidnightControlsRenderer.ICON_SIZE / 2 - this.client.textRenderer.fontHeight / 2) + 1;
|
||||||
context.drawText(this.client.textRenderer, translatedAction, x, (y + textY), 14737632, false);
|
context.drawText(this.client.textRenderer, translatedAction, x, (y + textY), 0xFFFFFFFF, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,9 @@
|
|||||||
|
|
||||||
package eu.midnightdust.midnightcontrols.client.gui;
|
package eu.midnightdust.midnightcontrols.client.gui;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
import com.mojang.blaze3d.textures.GpuTextureView;
|
||||||
import eu.midnightdust.midnightcontrols.ControlsMode;
|
import eu.midnightdust.midnightcontrols.ControlsMode;
|
||||||
import eu.midnightdust.midnightcontrols.client.enums.ControllerType;
|
import eu.midnightdust.midnightcontrols.client.enums.ControllerType;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||||
@@ -18,25 +20,31 @@ import eu.midnightdust.midnightcontrols.client.MidnightInput;
|
|||||||
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
|
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
|
||||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
||||||
import eu.midnightdust.midnightcontrols.client.enums.VirtualMouseSkin;
|
import eu.midnightdust.midnightcontrols.client.enums.VirtualMouseSkin;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.gui.render.UnalignedTexturedQuadGuiElementRenderState;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.mixin.DrawContextAccessor;
|
||||||
import eu.midnightdust.midnightcontrols.client.util.HandledScreenAccessor;
|
import eu.midnightdust.midnightcontrols.client.util.HandledScreenAccessor;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.font.TextRenderer;
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import net.minecraft.client.gl.RenderPipelines;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.render.BufferBuilder;
|
import net.minecraft.client.gui.render.state.TexturedQuadGuiElementRenderState;
|
||||||
import net.minecraft.client.render.BufferRenderer;
|
import net.minecraft.client.render.*;
|
||||||
import net.minecraft.client.render.GameRenderer;
|
|
||||||
import net.minecraft.client.render.Tessellator;
|
|
||||||
import net.minecraft.client.render.VertexFormat;
|
|
||||||
import net.minecraft.client.render.VertexFormats;
|
|
||||||
import net.minecraft.client.resource.language.I18n;
|
import net.minecraft.client.resource.language.I18n;
|
||||||
import net.minecraft.client.texture.Sprite;
|
import net.minecraft.client.texture.Sprite;
|
||||||
|
import net.minecraft.client.texture.TextureSetup;
|
||||||
import net.minecraft.screen.slot.Slot;
|
import net.minecraft.screen.slot.Slot;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.math.ColorHelper;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.joml.Matrix3x2f;
|
||||||
import org.joml.Matrix4f;
|
import org.joml.Matrix4f;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
import static eu.midnightdust.midnightcontrols.MidnightControls.id;
|
import static eu.midnightdust.midnightcontrols.MidnightControls.id;
|
||||||
|
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the midnightcontrols renderer.
|
* Represents the midnightcontrols renderer.
|
||||||
@@ -170,17 +178,14 @@ public class MidnightControlsRenderer {
|
|||||||
case GLFW.GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER + 100, GLFW.GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER + 200 -> buttonOffset = 10 * 15;
|
case GLFW.GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER + 100, GLFW.GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER + 200 -> buttonOffset = 10 * 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.disableDepthTest();
|
|
||||||
|
|
||||||
int assetSize = axis || (button >= 15 && button <= 18) ? AXIS_SIZE : BUTTON_SIZE;
|
int assetSize = axis || (button >= 15 && button <= 18) ? AXIS_SIZE : BUTTON_SIZE;
|
||||||
|
|
||||||
RenderSystem.setShaderColor(1.f, second ? 0.f : 1.f, 1.f, 1.f);
|
//RenderSystem.setShaderColor(1.f, second ? 0.f : 1.f, 1.f, 1.f);
|
||||||
context.drawTexture(axis ? MidnightControlsClient.CONTROLLER_AXIS : button >= 15 && button <= 19 ? MidnightControlsClient.CONTROLLER_EXPANDED :MidnightControlsClient.CONTROLLER_BUTTONS
|
context.drawTexture(RenderPipelines.GUI_TEXTURED, axis ? MidnightControlsClient.CONTROLLER_AXIS : button >= 15 && button <= 19 ? MidnightControlsClient.CONTROLLER_EXPANDED :MidnightControlsClient.CONTROLLER_BUTTONS
|
||||||
, x + (ICON_SIZE / 2 - assetSize / 2), y + (ICON_SIZE / 2 - assetSize / 2),
|
, x + (ICON_SIZE / 2 - assetSize / 2), y + (ICON_SIZE / 2 - assetSize / 2),
|
||||||
(float) buttonOffset, (float) (controllerType * assetSize),
|
(float) buttonOffset, (float) (controllerType * assetSize),
|
||||||
assetSize, assetSize,
|
assetSize, assetSize,
|
||||||
256, 256);
|
256, 256);
|
||||||
RenderSystem.enableDepthTest();
|
|
||||||
|
|
||||||
return ICON_SIZE;
|
return ICON_SIZE;
|
||||||
}
|
}
|
||||||
@@ -196,7 +201,8 @@ public class MidnightControlsRenderer {
|
|||||||
var translatedAction = I18n.translate(action);
|
var translatedAction = I18n.translate(action);
|
||||||
int textY = (MidnightControlsRenderer.ICON_SIZE / 2 - client.textRenderer.fontHeight / 2) + 1;
|
int textY = (MidnightControlsRenderer.ICON_SIZE / 2 - client.textRenderer.fontHeight / 2) + 1;
|
||||||
|
|
||||||
return context.drawTextWithShadow(client.textRenderer, translatedAction, (x + buttonWidth + 2), (y + textY), 14737632);
|
context.drawTextWithShadow(client.textRenderer, translatedAction, (x + buttonWidth + 2), (y + textY), 0xFFFFFFFF);
|
||||||
|
return (x + buttonWidth + 2) + client.textRenderer.getWidth(translatedAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -10;
|
return -10;
|
||||||
@@ -216,7 +222,7 @@ public class MidnightControlsRenderer {
|
|||||||
if (MidnightControlsConfig.virtualMouseSkin == VirtualMouseSkin.DEFAULT_DARK || MidnightControlsConfig.virtualMouseSkin == VirtualMouseSkin.SECOND_DARK)
|
if (MidnightControlsConfig.virtualMouseSkin == VirtualMouseSkin.DEFAULT_DARK || MidnightControlsConfig.virtualMouseSkin == VirtualMouseSkin.SECOND_DARK)
|
||||||
spritePath = MidnightControlsClient.WAYLAND_CURSOR_TEXTURE_DARK;
|
spritePath = MidnightControlsClient.WAYLAND_CURSOR_TEXTURE_DARK;
|
||||||
Sprite sprite = client.getGuiAtlasManager().getSprite(spritePath);
|
Sprite sprite = client.getGuiAtlasManager().getSprite(spritePath);
|
||||||
drawUnalignedTexturedQuad(sprite.getAtlasId(), context, mouseX, mouseX + 8, mouseY, mouseY + 8, 999, sprite.getMinU(), sprite.getMaxU(), sprite.getMinV(), sprite.getMaxV());
|
drawUnalignedTexturedQuad(RenderPipelines.GUI_TEXTURED, sprite.getAtlasId(), context, mouseX, mouseX + 8, mouseY, mouseY + 8, sprite.getMinU(), sprite.getMaxU(), sprite.getMinV(), sprite.getMaxV());
|
||||||
} catch (IllegalStateException ignored) {}
|
} catch (IllegalStateException ignored) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,19 +266,12 @@ public class MidnightControlsRenderer {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Sprite sprite = client.getGuiAtlasManager().getSprite(id(MidnightControlsConfig.virtualMouseSkin.getSpritePath() + (hoverSlot ? "_slot" : "")));
|
Sprite sprite = client.getGuiAtlasManager().getSprite(id(MidnightControlsConfig.virtualMouseSkin.getSpritePath() + (hoverSlot ? "_slot" : "")));
|
||||||
drawUnalignedTexturedQuad(sprite.getAtlasId(), context, mouseX, mouseX + 16, mouseY, mouseY + 16, 999, sprite.getMinU(), sprite.getMaxU(), sprite.getMinV(), sprite.getMaxV());
|
drawUnalignedTexturedQuad(RenderPipelines.GUI_TEXTURED, sprite.getAtlasId(), context, mouseX, mouseX + 16, mouseY, mouseY + 16, sprite.getMinU(), sprite.getMaxU(), sprite.getMinV(), sprite.getMaxV());
|
||||||
} catch (IllegalStateException ignored) {}
|
} catch (IllegalStateException ignored) {}
|
||||||
}
|
}
|
||||||
private static void drawUnalignedTexturedQuad(Identifier texture, DrawContext context, float x1, float x2, float y1, float y2, float z, float u1, float u2, float v1, float v2) {
|
private static void drawUnalignedTexturedQuad(RenderPipeline pipeline, Identifier texture, DrawContext context, float x1, float x2, float y1, float y2, float u1, float u2, float v1, float v2) {
|
||||||
RenderSystem.setShaderTexture(0, texture);
|
DrawContextAccessor accessor = (DrawContextAccessor) context;
|
||||||
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
|
accessor.getState().addSimpleElement(new UnalignedTexturedQuadGuiElementRenderState(pipeline, TextureSetup.withoutGlTexture(client.getTextureManager().getTexture(texture).getGlTextureView()), new Matrix3x2f(context.getMatrices()), x1, y1, x2, y2, u1, u2, v1, v2, 0xffffffff, accessor.getScissorStack().peekLast()));
|
||||||
Matrix4f matrix4f = context.getMatrices().peek().getPositionMatrix();
|
|
||||||
BufferBuilder bufferBuilder = Tessellator.getInstance().begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE);
|
|
||||||
bufferBuilder.vertex(matrix4f, x1, y1, z).texture(u1, v1);
|
|
||||||
bufferBuilder.vertex(matrix4f, x1, y2, z).texture(u1, v2);
|
|
||||||
bufferBuilder.vertex(matrix4f, x2, y2, z).texture(u2, v2);
|
|
||||||
bufferBuilder.vertex(matrix4f, x2, y1, z).texture(u2, v1);
|
|
||||||
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public record ButtonSize(int length, int height) {
|
public record ButtonSize(int length, int height) {
|
||||||
|
|||||||
@@ -9,13 +9,13 @@
|
|||||||
|
|
||||||
package eu.midnightdust.midnightcontrols.client.gui;
|
package eu.midnightdust.midnightcontrols.client.gui;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
|
||||||
import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
|
import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||||
import eu.midnightdust.midnightcontrols.client.util.platform.NetworkUtil;
|
import eu.midnightdust.midnightcontrols.client.util.platform.NetworkUtil;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.virtualkeyboard.KeyboardLayoutManager;
|
||||||
|
import net.minecraft.util.math.ColorHelper;
|
||||||
import org.thinkingstudio.obsidianui.background.Background;
|
import org.thinkingstudio.obsidianui.background.Background;
|
||||||
import org.thinkingstudio.obsidianui.widget.SpruceWidget;
|
import org.thinkingstudio.obsidianui.widget.SpruceWidget;
|
||||||
import eu.midnightdust.lib.util.MidnightColorUtil;
|
|
||||||
import eu.midnightdust.midnightcontrols.MidnightControls;
|
import eu.midnightdust.midnightcontrols.MidnightControls;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||||
import eu.midnightdust.midnightcontrols.client.controller.Controller;
|
import eu.midnightdust.midnightcontrols.client.controller.Controller;
|
||||||
@@ -34,18 +34,13 @@ import net.minecraft.client.MinecraftClient;
|
|||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||||
import net.minecraft.client.render.*;
|
|
||||||
import net.minecraft.client.resource.language.I18n;
|
import net.minecraft.client.resource.language.I18n;
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
|
||||||
import net.minecraft.text.MutableText;
|
import net.minecraft.text.MutableText;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.Formatting;
|
import net.minecraft.util.Formatting;
|
||||||
import net.minecraft.util.Util;
|
import net.minecraft.util.Util;
|
||||||
import org.joml.Matrix4f;
|
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the midnightcontrols settings screen.
|
* Represents the midnightcontrols settings screen.
|
||||||
*/
|
*/
|
||||||
@@ -63,6 +58,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
private final SpruceOption eyeTrackingAsMouseOption;
|
private final SpruceOption eyeTrackingAsMouseOption;
|
||||||
private final SpruceOption eyeTrackingDeadzone;
|
private final SpruceOption eyeTrackingDeadzone;
|
||||||
private final SpruceOption virtualMouseOption;
|
private final SpruceOption virtualMouseOption;
|
||||||
|
private final SpruceOption virtualKeyboardOption;
|
||||||
private final SpruceOption hideCursorOption;
|
private final SpruceOption hideCursorOption;
|
||||||
private final SpruceOption resetOption;
|
private final SpruceOption resetOption;
|
||||||
private final SpruceOption advancedConfigOption;
|
private final SpruceOption advancedConfigOption;
|
||||||
@@ -137,6 +133,15 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
maxAnalogValueOption("midnightcontrols.menu.max_right_x_value", GLFW.GLFW_GAMEPAD_AXIS_RIGHT_X),
|
maxAnalogValueOption("midnightcontrols.menu.max_right_x_value", GLFW.GLFW_GAMEPAD_AXIS_RIGHT_X),
|
||||||
maxAnalogValueOption("midnightcontrols.menu.max_right_y_value", GLFW.GLFW_GAMEPAD_AXIS_RIGHT_Y)
|
maxAnalogValueOption("midnightcontrols.menu.max_right_y_value", GLFW.GLFW_GAMEPAD_AXIS_RIGHT_Y)
|
||||||
};
|
};
|
||||||
|
// Controller options
|
||||||
|
public final static SpruceOption virtualKeyboardLayoutOption =
|
||||||
|
new SpruceCyclingOption("midnightcontrols.menu.virtual_keyboard_layout",
|
||||||
|
amount -> {
|
||||||
|
MidnightControlsConfig.keyboardLayout = KeyboardLayoutManager.getNext(KeyboardLayoutManager.getById(MidnightControlsConfig.keyboardLayout)).getId();
|
||||||
|
},
|
||||||
|
option -> {
|
||||||
|
return option.getDisplayText(Text.translatable(KeyboardLayoutManager.getById(MidnightControlsConfig.keyboardLayout).getTranslationKey()));
|
||||||
|
}, null);
|
||||||
|
|
||||||
private static SpruceOption maxAnalogValueOption(String key, int axis) {
|
private static SpruceOption maxAnalogValueOption(String key, int axis) {
|
||||||
return new SpruceDoubleOption(key, .25f, 1.f, 0.05f,
|
return new SpruceDoubleOption(key, .25f, 1.f, 0.05f,
|
||||||
@@ -298,6 +303,8 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
value -> MidnightControlsConfig.unfocusedInput = value, Text.translatable("midnightcontrols.menu.unfocused_input.tooltip"));
|
value -> MidnightControlsConfig.unfocusedInput = value, Text.translatable("midnightcontrols.menu.unfocused_input.tooltip"));
|
||||||
this.virtualMouseOption = new SpruceToggleBooleanOption("midnightcontrols.menu.virtual_mouse", () -> MidnightControlsConfig.virtualMouse,
|
this.virtualMouseOption = new SpruceToggleBooleanOption("midnightcontrols.menu.virtual_mouse", () -> MidnightControlsConfig.virtualMouse,
|
||||||
value -> MidnightControlsConfig.virtualMouse = value, Text.translatable("midnightcontrols.menu.virtual_mouse.tooltip"));
|
value -> MidnightControlsConfig.virtualMouse = value, Text.translatable("midnightcontrols.menu.virtual_mouse.tooltip"));
|
||||||
|
this.virtualKeyboardOption = new SpruceToggleBooleanOption("midnightcontrols.menu.virtual_keyboard", () -> MidnightControlsConfig.virtualMouse,
|
||||||
|
value -> MidnightControlsConfig.virtualKeyboard = value, Text.translatable("midnightcontrols.menu.virtual_keyboard.tooltip"));
|
||||||
this.hideCursorOption = new SpruceToggleBooleanOption("midnightcontrols.menu.hide_cursor", () -> MidnightControlsConfig.hideNormalMouse,
|
this.hideCursorOption = new SpruceToggleBooleanOption("midnightcontrols.menu.hide_cursor", () -> MidnightControlsConfig.hideNormalMouse,
|
||||||
value -> MidnightControlsConfig.hideNormalMouse = value, Text.translatable("midnightcontrols.menu.hide_cursor.tooltip"));
|
value -> MidnightControlsConfig.hideNormalMouse = value, Text.translatable("midnightcontrols.menu.hide_cursor.tooltip"));
|
||||||
// Touch options
|
// Touch options
|
||||||
@@ -389,6 +396,8 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
list.addSingleOptionEntry(this.yAxisRotationSpeedOption);
|
list.addSingleOptionEntry(this.yAxisRotationSpeedOption);
|
||||||
list.addSingleOptionEntry(this.mouseSpeedOption);
|
list.addSingleOptionEntry(this.mouseSpeedOption);
|
||||||
list.addSingleOptionEntry(this.virtualMouseOption);
|
list.addSingleOptionEntry(this.virtualMouseOption);
|
||||||
|
list.addSingleOptionEntry(this.virtualKeyboardOption);
|
||||||
|
list.addSingleOptionEntry(this.virtualKeyboardLayoutOption);
|
||||||
list.addSingleOptionEntry(this.hideCursorOption);
|
list.addSingleOptionEntry(this.hideCursorOption);
|
||||||
list.addSingleOptionEntry(this.joystickAsMouseOption);
|
list.addSingleOptionEntry(this.joystickAsMouseOption);
|
||||||
list.addSingleOptionEntry(this.eyeTrackingAsMouseOption);
|
list.addSingleOptionEntry(this.eyeTrackingAsMouseOption);
|
||||||
@@ -490,7 +499,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTitle(DrawContext context, int mouseX, int mouseY, float delta) {
|
public void renderTitle(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||||
context.drawCenteredTextWithShadow(this.textRenderer, I18n.translate("midnightcontrols.menu.title"), this.width / 2, 8, 16777215);
|
context.drawCenteredTextWithShadow(this.textRenderer, I18n.translate("midnightcontrols.menu.title"), this.width / 2, 8, 0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MidnightControlsBackground implements Background {
|
public static class MidnightControlsBackground implements Background {
|
||||||
@@ -501,27 +510,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void render(DrawContext context, SpruceWidget widget, int vOffset, int mouseX, int mouseY, float delta) {
|
public void render(DrawContext context, SpruceWidget widget, int vOffset, int mouseX, int mouseY, float delta) {
|
||||||
fill(context.getMatrices(), widget.getX(), widget.getY(), widget.getX() + widget.getWidth(), widget.getY() + widget.getHeight(), MidnightColorUtil.hex2Rgb("#000000"));
|
context.fill(widget.getX(), widget.getY(), widget.getX() + widget.getWidth(), widget.getY() + widget.getHeight(), ColorHelper.getArgb(transparency, 0, 0, 0));
|
||||||
}
|
|
||||||
private static void fill(MatrixStack matrixStack, int x2, int y2, int x1, int y1, Color color) {
|
|
||||||
matrixStack.push();
|
|
||||||
|
|
||||||
Matrix4f matrix = matrixStack.peek().getPositionMatrix();
|
|
||||||
float r = (float)(color.getRed()) / 255.0F;
|
|
||||||
float g = (float)(color.getGreen()) / 255.0F;
|
|
||||||
float b = (float)(color.getBlue()) / 255.0F;
|
|
||||||
float t = (float)(transparency) / 255.0F;
|
|
||||||
BufferBuilder bufferBuilder = Tessellator.getInstance().begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
|
|
||||||
RenderSystem.enableBlend();
|
|
||||||
RenderSystem.defaultBlendFunc();
|
|
||||||
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
|
|
||||||
bufferBuilder.vertex(matrix, (float)x1, (float)y2, 0.0F).color(r, g, b, t);
|
|
||||||
bufferBuilder.vertex(matrix, (float)x2, (float)y2, 0.0F).color(r, g, b, t);
|
|
||||||
bufferBuilder.vertex(matrix, (float)x2, (float)y1, 0.0F).color(r, g, b, t);
|
|
||||||
bufferBuilder.vertex(matrix, (float)x1, (float)y1, 0.0F).color(r, g, b, t);
|
|
||||||
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
|
|
||||||
RenderSystem.disableBlend();
|
|
||||||
matrixStack.pop();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.gui.render;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||||
|
import net.fabricmc.api.EnvType;
|
||||||
|
import net.fabricmc.api.Environment;
|
||||||
|
import net.minecraft.client.gui.ScreenRect;
|
||||||
|
import net.minecraft.client.gui.render.state.SimpleGuiElementRenderState;
|
||||||
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
|
import net.minecraft.client.texture.TextureSetup;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
import org.joml.Matrix3x2f;
|
||||||
|
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
public record UnalignedTexturedQuadGuiElementRenderState(RenderPipeline pipeline, TextureSetup textureSetup, Matrix3x2f pose, float x1, float y1, float x2, float y2, float u1, float u2, float v1, float v2, int color, @Nullable ScreenRect scissorArea, @Nullable ScreenRect bounds) implements SimpleGuiElementRenderState {
|
||||||
|
public UnalignedTexturedQuadGuiElementRenderState(RenderPipeline pipeline, TextureSetup textureSetup, Matrix3x2f pose, float x1, float y1, float x2, float y2, float u1, float u2, float v1, float v2, int color, @Nullable ScreenRect scissorArea) {
|
||||||
|
this(pipeline, textureSetup, pose, x1, y1, x2, y2, u1, u2, v1, v2, color, scissorArea, createBounds(x1, y1, x2, y2, pose, scissorArea));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setupVertices(VertexConsumer vertices, float depth) {
|
||||||
|
vertices.vertex(pose(), x1(), y1(), depth).texture(u1(), v1()).color(color());
|
||||||
|
vertices.vertex(pose(), x1(), y2(), depth).texture(u1(), v2()).color(color());
|
||||||
|
vertices.vertex(pose(), x2(), y2(), depth).texture(u2(), v2()).color(color());
|
||||||
|
vertices.vertex(pose(), x2(), y1(), depth).texture(u2(), v1()).color(color());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private static ScreenRect createBounds(float x1, float y1, float x2, float y2, Matrix3x2f pose, @Nullable ScreenRect scissorArea) {
|
||||||
|
ScreenRect screenRect = (new ScreenRect((int) x1, (int) y1, (int) (x2 - x1), (int) (y2 - y1))).transformEachVertex(pose);
|
||||||
|
return scissorArea != null ? scissorArea.intersection(screenRect) : screenRect;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -56,7 +56,7 @@ public class ControllerControlsWidget extends SpruceContainerWidget {
|
|||||||
@Override
|
@Override
|
||||||
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
|
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||||
context.drawCenteredTextWithShadow(this.client.textRenderer, Text.translatable("midnightcontrols.menu.title.controller_controls"),
|
context.drawCenteredTextWithShadow(this.client.textRenderer, Text.translatable("midnightcontrols.menu.title.controller_controls"),
|
||||||
this.getX() + this.width / 2, this.getY() + 4, 16777215);
|
this.getX() + this.width / 2, this.getY() + 4, 0xFFFFFFFF);
|
||||||
this.resetButton.setActive(InputManager.streamBindings().anyMatch(Predicates.not(ButtonBinding::isDefault)));
|
this.resetButton.setActive(InputManager.streamBindings().anyMatch(Predicates.not(ButtonBinding::isDefault)));
|
||||||
super.renderWidget(context, mouseX, mouseY, delta);
|
super.renderWidget(context, mouseX, mouseY, delta);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,11 +14,15 @@ import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
|||||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
|
||||||
import eu.midnightdust.midnightcontrols.client.controller.ButtonCategory;
|
import eu.midnightdust.midnightcontrols.client.controller.ButtonCategory;
|
||||||
import eu.midnightdust.midnightcontrols.client.controller.InputManager;
|
import eu.midnightdust.midnightcontrols.client.controller.InputManager;
|
||||||
|
import net.minecraft.client.gl.RenderPipelines;
|
||||||
|
import net.minecraft.client.render.RenderLayer;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
import org.thinkingstudio.obsidianui.Position;
|
import org.thinkingstudio.obsidianui.Position;
|
||||||
import org.thinkingstudio.obsidianui.SpruceTexts;
|
import org.thinkingstudio.obsidianui.SpruceTexts;
|
||||||
import org.thinkingstudio.obsidianui.navigation.NavigationDirection;
|
import org.thinkingstudio.obsidianui.navigation.NavigationDirection;
|
||||||
import org.thinkingstudio.obsidianui.navigation.NavigationUtils;
|
import org.thinkingstudio.obsidianui.navigation.NavigationUtils;
|
||||||
import org.thinkingstudio.obsidianui.widget.SpruceButtonWidget;
|
import org.thinkingstudio.obsidianui.widget.SpruceButtonWidget;
|
||||||
|
import org.thinkingstudio.obsidianui.widget.SpruceIconButtonWidget;
|
||||||
import org.thinkingstudio.obsidianui.widget.SpruceSeparatorWidget;
|
import org.thinkingstudio.obsidianui.widget.SpruceSeparatorWidget;
|
||||||
import org.thinkingstudio.obsidianui.widget.SpruceWidget;
|
import org.thinkingstudio.obsidianui.widget.SpruceWidget;
|
||||||
import org.thinkingstudio.obsidianui.widget.container.SpruceEntryListWidget;
|
import org.thinkingstudio.obsidianui.widget.container.SpruceEntryListWidget;
|
||||||
@@ -86,7 +90,7 @@ public class ControlsListWidget extends SpruceEntryListWidget<ControlsListWidget
|
|||||||
super(parent);
|
super(parent);
|
||||||
this.binding = binding;
|
this.binding = binding;
|
||||||
this.bindingName = I18n.translate(this.binding.getTranslationKey());
|
this.bindingName = I18n.translate(this.binding.getTranslationKey());
|
||||||
this.editButton = new ControllerButtonWidget(Position.of(this, parent.getWidth() / 2 - 8, 0), 110, this.binding, btn -> {
|
this.editButton = new ControllerButtonWidget(Position.of(this, parent.getWidth() / 2 - 8, 0), 120, this.binding, btn -> {
|
||||||
gui.focusedBinding = binding;
|
gui.focusedBinding = binding;
|
||||||
MidnightControlsClient.input.beginControlsInput(gui);
|
MidnightControlsClient.input.beginControlsInput(gui);
|
||||||
}) {
|
}) {
|
||||||
@@ -96,13 +100,24 @@ public class ControlsListWidget extends SpruceEntryListWidget<ControlsListWidget
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.children.add(editButton);
|
this.children.add(editButton);
|
||||||
this.resetButton = new SpruceButtonWidget(Position.of(this,
|
this.resetButton = new SpruceIconButtonWidget(Position.of(this,
|
||||||
this.editButton.getPosition().getRelativeX() + this.editButton.getWidth() + 2, 0),
|
this.editButton.getPosition().getRelativeX() + this.editButton.getWidth() + 2, 0),
|
||||||
44, 20, Text.translatable("controls.reset"),
|
37, 20, Text.empty(),
|
||||||
btn -> MidnightControlsConfig.setButtonBinding(binding, binding.getDefaultButton())) {
|
btn -> MidnightControlsConfig.setButtonBinding(binding, binding.getDefaultButton())) {
|
||||||
protected Text getNarrationMessage() {
|
protected Text getNarrationMessage() {
|
||||||
return Text.translatable("narrator.controls.reset", bindingName);
|
return Text.translatable("narrator.controls.reset", bindingName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final Identifier resetTexture = Identifier.of("midnightlib","icon/reset");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int renderIcon(DrawContext drawContext, int mouseX, int mouseY, float delta) {
|
||||||
|
int size = 12;
|
||||||
|
int x = this.getX() + this.getWidth() / 2 - size / 2;
|
||||||
|
int y = this.getY() + this.getHeight() / 2 - size / 2;
|
||||||
|
drawContext.drawGuiTexture(RenderPipelines.GUI_TEXTURED, resetTexture, x, y, size, size);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
this.children.add(this.resetButton);
|
this.children.add(this.resetButton);
|
||||||
this.unbindButton = new SpruceButtonWidget(Position.of(this,
|
this.unbindButton = new SpruceButtonWidget(Position.of(this,
|
||||||
@@ -233,7 +248,7 @@ public class ControlsListWidget extends SpruceEntryListWidget<ControlsListWidget
|
|||||||
int height = this.getHeight();
|
int height = this.getHeight();
|
||||||
//float textX = (float) (this.getX() + 70 - ControlsListWidget.this.maxTextLength);
|
//float textX = (float) (this.getX() + 70 - ControlsListWidget.this.maxTextLength);
|
||||||
int textY = this.getY() + height / 2;
|
int textY = this.getY() + height / 2;
|
||||||
context.drawText(textRenderer, this.bindingName, this.getX(), (textY - 9 / 2), 16777215, true);
|
context.drawText(textRenderer, this.bindingName, this.getX(), (textY - 9 / 2), 0xFFFFFFFF, true);
|
||||||
|
|
||||||
this.resetButton.setVisible(!focused);
|
this.resetButton.setVisible(!focused);
|
||||||
this.unbindButton.setVisible(focused);
|
this.unbindButton.setVisible(focused);
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.block.AbstractBlock;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.WorldView;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
|
||||||
|
@Mixin(AbstractBlock.class)
|
||||||
|
public interface AbstractBlockAccessor {
|
||||||
|
@Invoker("canPlaceAt")
|
||||||
|
boolean midnightcontrols$canPlaceAt(BlockState state, WorldView world, BlockPos pos);
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||||
|
|
||||||
|
import eu.midnightdust.midnightcontrols.client.util.AbstractSignEditScreenAccessor;
|
||||||
|
import net.minecraft.block.entity.SignBlockEntity;
|
||||||
|
import net.minecraft.block.entity.SignText;
|
||||||
|
import net.minecraft.client.gui.screen.ingame.AbstractSignEditScreen;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
|
@Mixin(AbstractSignEditScreen.class)
|
||||||
|
public class AbstractSignEditScreenMixin implements AbstractSignEditScreenAccessor {
|
||||||
|
@Shadow @Final private String[] messages;
|
||||||
|
@Shadow private SignText text;
|
||||||
|
@Shadow @Final protected SignBlockEntity blockEntity;
|
||||||
|
@Shadow @Final private boolean front;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] midnightcontrols$getMessages() {
|
||||||
|
return messages;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void midnightcontrols$setMessage(int line, String text) {
|
||||||
|
this.messages[line] = text;
|
||||||
|
this.text = this.text.withMessage(line, Text.literal(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void midnightcontrols$writeToBlockEntity() {
|
||||||
|
this.blockEntity.setText(this.text, this.front);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.screen.ingame.BookEditScreen;
|
||||||
|
import net.minecraft.client.gui.widget.EditBoxWidget;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
@Mixin(BookEditScreen.class)
|
||||||
|
public interface BookEditScreenAccessor {
|
||||||
|
@Accessor("editBox")
|
||||||
|
EditBoxWidget midnightcontrols$getEditBox();
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.screen.ingame.BookSigningScreen;
|
||||||
|
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
@Mixin(BookSigningScreen.class)
|
||||||
|
public interface BookSigningScreenAccessor {
|
||||||
|
@Accessor("bookTitleTextField")
|
||||||
|
TextFieldWidget midnightcontrols$getBookTitleTextField();
|
||||||
|
}
|
||||||
@@ -26,10 +26,10 @@ public abstract class ChatScreenMixin extends Screen {
|
|||||||
}
|
}
|
||||||
@Inject(method = "render", at = @At("HEAD"))
|
@Inject(method = "render", at = @At("HEAD"))
|
||||||
private void midnightcontrols$moveInputFieldBackground(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
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);
|
if (MidnightControlsConfig.moveChat) context.getMatrices().translate(0f, -this.height + 16);
|
||||||
}
|
}
|
||||||
@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))
|
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;fill(IIIII)V", shift = At.Shift.AFTER))
|
||||||
private void midnightcontrols$dontMoveOtherStuff(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
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);
|
if (MidnightControlsConfig.moveChat) context.getMatrices().translate(0f, this.height - 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/input/Input;tick(ZF)V", shift = At.Shift.AFTER))
|
@Inject(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/input/Input;tick()V", shift = At.Shift.AFTER))
|
||||||
public void onInputUpdate(CallbackInfo ci) {
|
public void onInputUpdate(CallbackInfo ci) {
|
||||||
MovementHandler.HANDLER.applyMovement((ClientPlayerEntity) (Object) this);
|
MovementHandler.HANDLER.applyMovement((ClientPlayerEntity) (Object) this);
|
||||||
}
|
}
|
||||||
@@ -88,11 +88,11 @@ public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity
|
|||||||
if (MidnightControlsConfig.verticalFlyDrifting || !MidnightControls.isExtrasLoaded)
|
if (MidnightControlsConfig.verticalFlyDrifting || !MidnightControls.isExtrasLoaded)
|
||||||
return;
|
return;
|
||||||
int moving = 0;
|
int moving = 0;
|
||||||
if (this.input.sneaking) {
|
if (this.input.playerInput.sneak()) {
|
||||||
--moving;
|
--moving;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.input.jumping) {
|
if (this.input.playerInput.jump()) {
|
||||||
++moving;
|
++moving;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,4 +58,10 @@ public interface CreativeInventoryScreenAccessor {
|
|||||||
*/
|
*/
|
||||||
@Invoker("hasScrollbar")
|
@Invoker("hasScrollbar")
|
||||||
boolean midnightcontrols$hasScrollbar();
|
boolean midnightcontrols$hasScrollbar();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triggers searching the creative inventory from the current value of the internal {@link net.minecraft.client.gui.widget.TextFieldWidget}
|
||||||
|
*/
|
||||||
|
@Invoker("search")
|
||||||
|
void midnightcontrols$search();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* 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.gui.render.state.GuiRenderState;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
@Mixin(DrawContext.class)
|
||||||
|
public interface DrawContextAccessor {
|
||||||
|
@Accessor("state")
|
||||||
|
GuiRenderState getState();
|
||||||
|
|
||||||
|
@Accessor("scissorStack")
|
||||||
|
DrawContext.ScissorStack getScissorStack();
|
||||||
|
}
|
||||||
@@ -33,29 +33,36 @@ import static eu.midnightdust.midnightcontrols.MidnightControls.id;
|
|||||||
@Mixin(GameOptionsScreen.class)
|
@Mixin(GameOptionsScreen.class)
|
||||||
public abstract class GameOptionsScreenMixin extends Screen {
|
public abstract class GameOptionsScreenMixin extends Screen {
|
||||||
@Shadow @Nullable protected OptionListWidget body;
|
@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)
|
@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();
|
.dimension(20,20).texture(id("icon/controller"), 20, 20).build();
|
||||||
|
|
||||||
protected GameOptionsScreenMixin(Text title) {
|
protected GameOptionsScreenMixin(Text title) {
|
||||||
super(title);
|
super(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "initTabNavigation", at = @At("TAIL"))
|
@Inject(method = "initBody", at = @At("TAIL"))
|
||||||
public void addMidnightButton(CallbackInfo ci) {
|
public void midnightcontrols$addMCButton(CallbackInfo ci) {
|
||||||
|
if (this.getClass().toString().equals(ControlsOptionsScreen.class.toString())) {
|
||||||
|
this.midnightcontrols$setButtonPos();
|
||||||
|
this.addSelectableChild(midnightcontrols$button);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Inject(method = "init", at = @At("TAIL"))
|
||||||
|
public void midnightcontrols$drawMCButton(CallbackInfo ci) {
|
||||||
if (this.getClass().toString().equals(ControlsOptionsScreen.class.toString())) {
|
if (this.getClass().toString().equals(ControlsOptionsScreen.class.toString())) {
|
||||||
this.midnightcontrols$setupButton();
|
|
||||||
this.addDrawableChild(midnightcontrols$button);
|
this.addDrawableChild(midnightcontrols$button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Inject(method = "refreshWidgetPositions", at = @At("TAIL"))
|
||||||
public void resize(MinecraftClient client, int width, int height) {
|
public void midnightcontrols$onResize(CallbackInfo ci) {
|
||||||
super.resize(client, width, height);
|
this.midnightcontrols$setButtonPos();
|
||||||
this.midnightcontrols$setupButton();
|
|
||||||
}
|
}
|
||||||
@Unique
|
@Unique
|
||||||
public void midnightcontrols$setupButton() {
|
public void midnightcontrols$setButtonPos() {
|
||||||
assert body != null;
|
if (body != null) {
|
||||||
midnightcontrols$button.setPosition(body.getWidth() / 2 + 158, body.getY() + 4);
|
midnightcontrols$button.setPosition(body.getWidth() / 2 + 158, body.getY() + 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -30,23 +30,23 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
|
|
||||||
@Mixin(GameRenderer.class)
|
@Mixin(GameRenderer.class)
|
||||||
public abstract class GameRendererMixin {
|
public abstract class GameRendererMixin {
|
||||||
@Shadow @Final MinecraftClient client;
|
@Shadow @Final private MinecraftClient client;
|
||||||
|
|
||||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Mouse;getX()D", shift = At.Shift.BEFORE))
|
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Mouse;getScaledX(Lnet/minecraft/client/util/Window;)D", shift = At.Shift.BEFORE))
|
||||||
private void midnightcontrols$onRender(RenderTickCounter tickCounter, boolean tick, CallbackInfo ci) {
|
private void midnightcontrols$onRender(RenderTickCounter tickCounter, boolean tick, CallbackInfo ci) {
|
||||||
if (this.client.currentScreen != null && MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER)
|
if (this.client.currentScreen != null && MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER)
|
||||||
MidnightControlsClient.input.onPreRenderScreen(this.client.currentScreen);
|
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))
|
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;renderWithTooltip(Lnet/minecraft/client/gui/DrawContext;IIF)V", shift = At.Shift.AFTER))
|
||||||
private void midnightcontrols$renderVirtualCursor(RenderTickCounter tickCounter, boolean tick, CallbackInfo ci, @Local DrawContext drawContext) {
|
private void midnightcontrols$renderVirtualCursor(RenderTickCounter tickCounter, boolean tick, CallbackInfo ci, @Local DrawContext drawContext) {
|
||||||
MidnightControlsRenderer.renderVirtualCursor(drawContext, client);
|
MidnightControlsRenderer.renderVirtualCursor(drawContext, client);
|
||||||
if (MidnightControlsClient.isWayland) MidnightControlsRenderer.renderWaylandCursor(drawContext, client);
|
if (MidnightControlsClient.isWayland) MidnightControlsRenderer.renderWaylandCursor(drawContext, client);
|
||||||
drawContext.draw();
|
//drawContext.draw();
|
||||||
}
|
}
|
||||||
@Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/GameRenderer;renderHand:Z"), method = "renderWorld")
|
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;renderHand(FZLorg/joml/Matrix4f;)V"), method = "renderWorld")
|
||||||
private void midnigtcontrols$captureMatrices(RenderTickCounter tickCounter, CallbackInfo ci, @Local(ordinal = 1) Matrix4f matrices) {
|
private void midnigtcontrols$captureMatrices(RenderTickCounter tickCounter, CallbackInfo ci, @Local(ordinal = 1) Matrix4f projectionMatrix, @Local(ordinal = 2) Matrix4f worldSpaceMatrix) {
|
||||||
TouchUtils.lastProjMat.set(RenderSystem.getProjectionMatrix());
|
TouchUtils.lastProjMat.set(projectionMatrix);
|
||||||
TouchUtils.lastModMat.set(RenderSystem.getModelViewMatrix());
|
TouchUtils.lastModMat.set(RenderSystem.getModelViewMatrix());
|
||||||
TouchUtils.lastWorldSpaceMatrix.set(matrices);
|
TouchUtils.lastWorldSpaceMatrix.set(worldSpaceMatrix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||||
|
|
||||||
|
import net.minecraft.client.input.Input;
|
||||||
|
import net.minecraft.util.math.Vec2f;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
@Mixin(Input.class)
|
||||||
|
public interface InputAccessor {
|
||||||
|
@Accessor
|
||||||
|
void setMovementVector(Vec2f input);
|
||||||
|
}
|
||||||
@@ -28,6 +28,7 @@ import net.minecraft.util.hit.HitResult;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.util.profiler.Profiler;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
@@ -38,6 +39,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.client;
|
||||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.reacharound;
|
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.reacharound;
|
||||||
|
|
||||||
@Mixin(MinecraftClient.class)
|
@Mixin(MinecraftClient.class)
|
||||||
@@ -54,6 +56,10 @@ public abstract class MinecraftClientMixin {
|
|||||||
|
|
||||||
@Shadow public abstract void setScreen(Screen screen);
|
@Shadow public abstract void setScreen(Screen screen);
|
||||||
|
|
||||||
|
@Shadow public int attackCooldown;
|
||||||
|
|
||||||
|
@Shadow protected abstract void handleInputEvents();
|
||||||
|
|
||||||
@Unique private BlockPos midnightcontrols$lastTargetPos;
|
@Unique private BlockPos midnightcontrols$lastTargetPos;
|
||||||
@Unique private Vec3d midnightcontrols$lastPos;
|
@Unique private Vec3d midnightcontrols$lastPos;
|
||||||
@Unique private Direction midnightcontrols$lastTargetSide;
|
@Unique private Direction midnightcontrols$lastTargetSide;
|
||||||
@@ -81,7 +87,7 @@ public abstract class MinecraftClientMixin {
|
|||||||
var side = hitResult.getSide();
|
var side = hitResult.getSide();
|
||||||
|
|
||||||
boolean sidewaysBlockPlacing = this.midnightcontrols$lastTargetPos == null || !targetPos.equals(this.midnightcontrols$lastTargetPos.offset(this.midnightcontrols$lastTargetSide));
|
boolean sidewaysBlockPlacing = this.midnightcontrols$lastTargetPos == null || !targetPos.equals(this.midnightcontrols$lastTargetPos.offset(this.midnightcontrols$lastTargetSide));
|
||||||
boolean backwardsBlockPlacing = this.player.input.movementForward < 0.0f && (this.midnightcontrols$lastTargetPos == null || targetPos.equals(this.midnightcontrols$lastTargetPos.offset(this.midnightcontrols$lastTargetSide)));
|
boolean backwardsBlockPlacing = this.player.input.getMovementInput().y < 0.0f && (this.midnightcontrols$lastTargetPos == null || targetPos.equals(this.midnightcontrols$lastTargetPos.offset(this.midnightcontrols$lastTargetSide)));
|
||||||
|
|
||||||
if (cooldown > 1
|
if (cooldown > 1
|
||||||
&& !targetPos.equals(this.midnightcontrols$lastTargetPos)
|
&& !targetPos.equals(this.midnightcontrols$lastTargetPos)
|
||||||
@@ -127,12 +133,12 @@ public abstract class MinecraftClientMixin {
|
|||||||
int previousStackCount = stackInHand.getCount();
|
int previousStackCount = stackInHand.getCount();
|
||||||
var result = this.interactionManager.interactBlock(this.player, hand, hitResult);
|
var result = this.interactionManager.interactBlock(this.player, hand, hitResult);
|
||||||
if (result.isAccepted()) {
|
if (result.isAccepted()) {
|
||||||
if (result.shouldSwingHand()) {
|
//if (result.shouldSwingHand()) {
|
||||||
this.player.swingHand(hand);
|
this.player.swingHand(hand);
|
||||||
if (!stackInHand.isEmpty() && (stackInHand.getCount() != previousStackCount || this.interactionManager.hasCreativeInventory())) {
|
if (!stackInHand.isEmpty() && (stackInHand.getCount() != previousStackCount || this.player.isInCreativeMode())) {
|
||||||
this.gameRenderer.firstPersonRenderer.resetEquipProgress(hand);
|
this.gameRenderer.firstPersonRenderer.resetEquipProgress(hand);
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
|
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
@@ -144,10 +150,21 @@ public abstract class MinecraftClientMixin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// This is always supposed to be located at before the line 'this.profiler.swap("Keybindings");'
|
// TODO: Replace this with MixinExtras' Expressions once that's officially released
|
||||||
// @Redirect(method = "tick", at = @At(value = "FIELD",target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;", ordinal = 6))
|
@Inject(method = "tick", at = @At(value = "INVOKE",target = "Lnet/minecraft/client/gui/hud/DebugHud;shouldShowDebugHud()Z"))
|
||||||
// private Screen midnightcontrols$ignoreTouchOverlay(MinecraftClient instance) {
|
private void midnightcontrols$handleKeybindsWithTouchOverlay(CallbackInfo ci, @Local Profiler profiler) {
|
||||||
// if (instance.currentScreen instanceof TouchscreenOverlay) return null;
|
if (client.currentScreen instanceof TouchscreenOverlay) {
|
||||||
// return instance.currentScreen;
|
profiler.swap("Keybindings");
|
||||||
// }
|
this.handleInputEvents();
|
||||||
|
if (this.attackCooldown > 0) {
|
||||||
|
--this.attackCooldown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Needed, as it will cause item actions not to work in touchscreen mode otherwise with the above method
|
||||||
|
@Inject(method = "handleInputEvents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isUsingItem()Z"), cancellable = true)
|
||||||
|
private void midnightcontrols$dontHandleItemAndBlockInteractions(CallbackInfo ci) {
|
||||||
|
if (client.currentScreen instanceof TouchscreenOverlay) ci.cancel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import net.minecraft.client.Mouse;
|
|||||||
import net.minecraft.client.util.GlfwUtil;
|
import net.minecraft.client.util.GlfwUtil;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.ThrowablePotionItem;
|
import net.minecraft.item.ThrowablePotionItem;
|
||||||
import net.minecraft.util.UseAction;
|
import net.minecraft.item.consume.UseAction;
|
||||||
import net.minecraft.util.math.Smoother;
|
import net.minecraft.util.math.Smoother;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
@@ -77,7 +77,8 @@ public abstract class MouseMixin implements MouseAccessor {
|
|||||||
for (int slot = 0; slot < 9; ++slot) {
|
for (int slot = 0; slot < 9; ++slot) {
|
||||||
int slotX = centerX - 90 + slot * 20 + 2;
|
int slotX = centerX - 90 + slot * 20 + 2;
|
||||||
if (mouseX >= (double) slotX && mouseX <= (double) (slotX + 20)) {
|
if (mouseX >= (double) slotX && mouseX <= (double) (slotX + 20)) {
|
||||||
client.player.getInventory().selectedSlot = slot;
|
client.player.getInventory().setSelectedSlot(slot);
|
||||||
|
TouchInput.clickStartTime = -1;
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* 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();
|
||||||
|
}
|
||||||
@@ -27,7 +27,4 @@ public interface RecipeBookWidgetAccessor {
|
|||||||
|
|
||||||
@Accessor("currentTab")
|
@Accessor("currentTab")
|
||||||
void setCurrentTab(RecipeGroupButtonWidget currentTab);
|
void setCurrentTab(RecipeGroupButtonWidget currentTab);
|
||||||
|
|
||||||
@Invoker("refreshResults")
|
|
||||||
void midnightcontrols$refreshResults(boolean resetCurrentPage);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,8 @@
|
|||||||
|
|
||||||
package eu.midnightdust.midnightcontrols.client.mixin;
|
package eu.midnightdust.midnightcontrols.client.mixin;
|
||||||
|
|
||||||
import com.llamalad7.mixinextras.sugar.Local;
|
|
||||||
import eu.midnightdust.lib.util.MidnightColorUtil;
|
import eu.midnightdust.lib.util.MidnightColorUtil;
|
||||||
import eu.midnightdust.midnightcontrols.ControlsMode;
|
import eu.midnightdust.midnightcontrols.ControlsMode;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||||
import eu.midnightdust.midnightcontrols.client.touch.TouchInput;
|
import eu.midnightdust.midnightcontrols.client.touch.TouchInput;
|
||||||
import eu.midnightdust.midnightcontrols.client.enums.TouchMode;
|
import eu.midnightdust.midnightcontrols.client.enums.TouchMode;
|
||||||
@@ -28,8 +26,7 @@ import net.minecraft.item.ItemUsageContext;
|
|||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.hit.BlockHitResult;
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
import net.minecraft.util.hit.HitResult;
|
import net.minecraft.util.hit.HitResult;
|
||||||
import net.minecraft.util.shape.VoxelShape;
|
import net.minecraft.util.math.ColorHelper;
|
||||||
import org.joml.Matrix4f;
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
@@ -61,12 +58,8 @@ public abstract class WorldRendererMixin {
|
|||||||
@Final
|
@Final
|
||||||
private BufferBuilderStorage bufferBuilders;
|
private BufferBuilderStorage bufferBuilders;
|
||||||
|
|
||||||
@Shadow
|
@Redirect(method = "renderTargetBlockOutline", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/hit/BlockHitResult;getType()Lnet/minecraft/util/hit/HitResult$Type;"))
|
||||||
private static void drawCuboidShapeOutline(MatrixStack matrices, VertexConsumer vertexConsumer, VoxelShape shape, double offsetX, double offsetY, double offsetZ, float red, float green, float blue, float alpha) {
|
private HitResult.Type dontRenderOutline(BlockHitResult instance) {
|
||||||
}
|
|
||||||
|
|
||||||
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/hit/HitResult;getType()Lnet/minecraft/util/hit/HitResult$Type;"))
|
|
||||||
private HitResult.Type dontRenderOutline(HitResult instance) {
|
|
||||||
if (MidnightControlsConfig.controlsMode == ControlsMode.TOUCHSCREEN && MidnightControlsConfig.touchMode == TouchMode.FINGER_POS) {
|
if (MidnightControlsConfig.controlsMode == ControlsMode.TOUCHSCREEN && MidnightControlsConfig.touchMode == TouchMode.FINGER_POS) {
|
||||||
return HitResult.Type.MISS;
|
return HitResult.Type.MISS;
|
||||||
}
|
}
|
||||||
@@ -74,15 +67,10 @@ public abstract class WorldRendererMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
method = "render",
|
method = "renderTargetBlockOutline",
|
||||||
at = @At(
|
at = @At("HEAD")
|
||||||
value = "FIELD",
|
|
||||||
target = "Lnet/minecraft/client/MinecraftClient;crosshairTarget:Lnet/minecraft/util/hit/HitResult;",
|
|
||||||
ordinal = 1,
|
|
||||||
shift = At.Shift.AFTER
|
|
||||||
)
|
)
|
||||||
)
|
private void onOutlineRender(Camera camera, VertexConsumerProvider.Immediate vertexConsumers, MatrixStack matrices, boolean translucent, CallbackInfo ci) {
|
||||||
private void onOutlineRender(RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci, @Local MatrixStack matrices) {
|
|
||||||
if (((MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && MidnightControlsConfig.touchInControllerMode) || MidnightControlsConfig.controlsMode == ControlsMode.TOUCHSCREEN)
|
if (((MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && MidnightControlsConfig.touchInControllerMode) || MidnightControlsConfig.controlsMode == ControlsMode.TOUCHSCREEN)
|
||||||
&& MidnightControlsConfig.touchMode == TouchMode.FINGER_POS) {
|
&& MidnightControlsConfig.touchMode == TouchMode.FINGER_POS) {
|
||||||
this.midnightcontrols$renderFingerOutline(matrices, camera);
|
this.midnightcontrols$renderFingerOutline(matrices, camera);
|
||||||
@@ -102,8 +90,8 @@ public abstract class WorldRendererMixin {
|
|||||||
var pos = camera.getPos();
|
var pos = camera.getPos();
|
||||||
matrices.push();
|
matrices.push();
|
||||||
var vertexConsumer = this.bufferBuilders.getEntityVertexConsumers().getBuffer(RenderLayer.getLines());
|
var vertexConsumer = this.bufferBuilders.getEntityVertexConsumers().getBuffer(RenderLayer.getLines());
|
||||||
drawCuboidShapeOutline(matrices, vertexConsumer, outlineShape, blockPos.getX() - pos.getX(), blockPos.getY() - pos.getY(), blockPos.getZ() - pos.getZ(),
|
VertexRendering.drawOutline(matrices, vertexConsumer, outlineShape, blockPos.getX() - pos.getX(), blockPos.getY() - pos.getY(), blockPos.getZ() - pos.getZ(),
|
||||||
rgb.getRed() / 255.f, rgb.getGreen() / 255.f, rgb.getBlue() / 255.f, MidnightControlsConfig.touchOutlineColorAlpha / 255.f);
|
ColorHelper.withAlpha(MidnightControlsConfig.touchOutlineColorAlpha, rgb.getRGB()));
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,9 +122,8 @@ public abstract class WorldRendererMixin {
|
|||||||
if (MidnightControlsConfig.reacharoundOutlineColorHex.isEmpty()) rgb = RainbowColor.radialRainbow(1,1);
|
if (MidnightControlsConfig.reacharoundOutlineColorHex.isEmpty()) rgb = RainbowColor.radialRainbow(1,1);
|
||||||
matrices.push();
|
matrices.push();
|
||||||
var vertexConsumer = this.bufferBuilders.getEntityVertexConsumers().getBuffer(RenderLayer.getLines());
|
var vertexConsumer = this.bufferBuilders.getEntityVertexConsumers().getBuffer(RenderLayer.getLines());
|
||||||
drawCuboidShapeOutline(matrices, vertexConsumer, outlineShape,
|
VertexRendering.drawOutline(matrices, vertexConsumer, outlineShape, blockPos.getX() - pos.getX(), blockPos.getY() - pos.getY(), blockPos.getZ() - pos.getZ(),
|
||||||
(double) blockPos.getX() - pos.getX(), (double) blockPos.getY() - pos.getY(), (double) blockPos.getZ() - pos.getZ(),
|
ColorHelper.withAlpha(MidnightControlsConfig.touchOutlineColorAlpha, rgb.getRGB()));
|
||||||
rgb.getRed() / 255.f, rgb.getGreen() / 255.f, rgb.getBlue() / 255.f, MidnightControlsConfig.reacharoundOutlineColorAlpha / 255.f);
|
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,12 +85,12 @@ public class TouchInput {
|
|||||||
int previousStackCount = stackInHand.getCount();
|
int previousStackCount = stackInHand.getCount();
|
||||||
var interaction = client.interactionManager.interactBlock(client.player, client.player.getActiveHand(), blockHit);
|
var interaction = client.interactionManager.interactBlock(client.player, client.player.getActiveHand(), blockHit);
|
||||||
if (interaction.isAccepted()) {
|
if (interaction.isAccepted()) {
|
||||||
if (interaction.shouldSwingHand()) {
|
//if (interaction.shouldSwingHand()) {
|
||||||
client.player.swingHand(client.player.preferredHand);
|
client.player.swingHand(client.player.preferredHand);
|
||||||
if (!stackInHand.isEmpty() && (stackInHand.getCount() != previousStackCount || client.interactionManager.hasCreativeInventory())) {
|
if (!stackInHand.isEmpty() && (stackInHand.getCount() != previousStackCount || client.player.isInCreativeMode())) {
|
||||||
client.gameRenderer.firstPersonRenderer.resetEquipProgress(client.player.preferredHand);
|
client.gameRenderer.firstPersonRenderer.resetEquipProgress(client.player.preferredHand);
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import net.minecraft.client.MinecraftClient;
|
|||||||
import net.minecraft.client.render.Camera;
|
import net.minecraft.client.render.Camera;
|
||||||
import net.minecraft.entity.projectile.ProjectileUtil;
|
import net.minecraft.entity.projectile.ProjectileUtil;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.UseAction;
|
import net.minecraft.item.consume.UseAction;
|
||||||
import net.minecraft.util.hit.BlockHitResult;
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
import net.minecraft.util.hit.EntityHitResult;
|
import net.minecraft.util.hit.EntityHitResult;
|
||||||
import net.minecraft.util.hit.HitResult;
|
import net.minecraft.util.hit.HitResult;
|
||||||
@@ -38,7 +38,7 @@ public class TouchUtils {
|
|||||||
|
|
||||||
if (entityCast != null && entityCast.getType() == HitResult.Type.ENTITY) return entityCast;
|
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));
|
BlockHitResult result = client.world.raycast(new RaycastContext(near, far, RaycastContext.ShapeType.OUTLINE, RaycastContext.FluidHandling.NONE, client.player));
|
||||||
|
|
||||||
if (client.player.getPos().distanceTo(result.getPos()) > playerRange) return null;
|
if (client.player.getPos().distanceTo(result.getPos()) > playerRange) return null;
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
package eu.midnightdust.midnightcontrols.client.touch.gui;
|
package eu.midnightdust.midnightcontrols.client.touch.gui;
|
||||||
|
|
||||||
|
import net.minecraft.component.DataComponentTypes;
|
||||||
|
import net.minecraft.item.consume.UseAction;
|
||||||
import org.thinkingstudio.obsidianui.Position;
|
import org.thinkingstudio.obsidianui.Position;
|
||||||
import org.thinkingstudio.obsidianui.widget.SpruceButtonWidget;
|
import org.thinkingstudio.obsidianui.widget.SpruceButtonWidget;
|
||||||
import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
|
import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||||
import net.minecraft.item.ArmorItem;
|
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.UseAction;
|
|
||||||
|
|
||||||
public class ItemUseButtonWidget extends SpruceButtonWidget {
|
public class ItemUseButtonWidget extends SpruceButtonWidget {
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ public class ItemUseButtonWidget extends SpruceButtonWidget {
|
|||||||
this.setMessage(Text.translatable(MidnightControlsConstants.NAMESPACE+".action.eat"));
|
this.setMessage(Text.translatable(MidnightControlsConstants.NAMESPACE+".action.eat"));
|
||||||
} else if (action == UseAction.DRINK) {
|
} else if (action == UseAction.DRINK) {
|
||||||
this.setMessage(Text.translatable(MidnightControlsConstants.NAMESPACE+".action.drink"));
|
this.setMessage(Text.translatable(MidnightControlsConstants.NAMESPACE+".action.drink"));
|
||||||
} else if (client.player.getMainHandStack().getItem() instanceof ArmorItem) {
|
} else if (client.player.getMainHandStack().getComponents().contains(DataComponentTypes.EQUIPPABLE)) {
|
||||||
this.setMessage(Text.translatable(MidnightControlsConstants.NAMESPACE+".action.equip"));
|
this.setMessage(Text.translatable(MidnightControlsConstants.NAMESPACE+".action.equip"));
|
||||||
} else if (!action.equals(UseAction.NONE)) {
|
} else if (!action.equals(UseAction.NONE)) {
|
||||||
this.setMessage(Text.translatable(MidnightControlsConstants.NAMESPACE+".action.use"));
|
this.setMessage(Text.translatable(MidnightControlsConstants.NAMESPACE+".action.use"));
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package eu.midnightdust.midnightcontrols.client.touch.gui;
|
package eu.midnightdust.midnightcontrols.client.touch.gui;
|
||||||
|
|
||||||
|
import eu.midnightdust.midnightcontrols.client.touch.TouchInput;
|
||||||
import org.thinkingstudio.obsidianui.Position;
|
import org.thinkingstudio.obsidianui.Position;
|
||||||
import org.thinkingstudio.obsidianui.widget.SpruceTexturedButtonWidget;
|
import org.thinkingstudio.obsidianui.widget.SpruceTexturedButtonWidget;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
@@ -34,6 +35,7 @@ public class SilentTexturedButtonWidget extends SpruceTexturedButtonWidget {
|
|||||||
public void onClick(double mouseX, double mouseY) {
|
public void onClick(double mouseX, double mouseY) {
|
||||||
this.setActive(true);
|
this.setActive(true);
|
||||||
super.onClick(mouseX, mouseY);
|
super.onClick(mouseX, mouseY);
|
||||||
|
TouchInput.clickStartTime = -1;
|
||||||
this.setActive(false);
|
this.setActive(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,11 +14,11 @@ import eu.midnightdust.midnightcontrols.client.util.storage.AxisStorage;
|
|||||||
import net.minecraft.client.gui.screen.ChatScreen;
|
import net.minecraft.client.gui.screen.ChatScreen;
|
||||||
import net.minecraft.client.gui.screen.GameMenuScreen;
|
import net.minecraft.client.gui.screen.GameMenuScreen;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.item.ArmorItem;
|
import net.minecraft.component.DataComponentTypes;
|
||||||
|
import net.minecraft.item.consume.UseAction;
|
||||||
import net.minecraft.util.Arm;
|
import net.minecraft.util.Arm;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.UseAction;
|
|
||||||
import org.thinkingstudio.obsidianui.Position;
|
import org.thinkingstudio.obsidianui.Position;
|
||||||
import org.thinkingstudio.obsidianui.widget.SpruceButtonWidget;
|
import org.thinkingstudio.obsidianui.widget.SpruceButtonWidget;
|
||||||
import eu.midnightdust.lib.util.PlatformFunctions;
|
import eu.midnightdust.lib.util.PlatformFunctions;
|
||||||
@@ -34,10 +34,8 @@ import eu.midnightdust.midnightcontrols.client.util.KeyBindingAccessor;
|
|||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
|
||||||
import net.minecraft.client.gui.widget.TextIconButtonWidget;
|
import net.minecraft.client.gui.widget.TextIconButtonWidget;
|
||||||
import net.minecraft.client.option.KeyBinding;
|
|
||||||
import net.minecraft.client.texture.MissingSprite;
|
import net.minecraft.client.texture.MissingSprite;
|
||||||
import net.minecraft.client.texture.Sprite;
|
import net.minecraft.client.texture.Sprite;
|
||||||
import net.minecraft.client.util.InputUtil;
|
|
||||||
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
|
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@@ -92,7 +90,7 @@ public class TouchscreenOverlay extends Screen {
|
|||||||
assert this.client != null;
|
assert this.client != null;
|
||||||
this.client.setScreen(new GameMenuScreen(true));
|
this.client.setScreen(new GameMenuScreen(true));
|
||||||
if (this.client.isIntegratedServerRunning() && !Objects.requireNonNull(this.client.getServer()).isRemote()) {
|
if (this.client.isIntegratedServerRunning() && !Objects.requireNonNull(this.client.getServer()).isRemote()) {
|
||||||
this.client.getSoundManager().pauseAll();
|
this.client.getSoundManager().pauseAllExcept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,7 +296,13 @@ public class TouchscreenOverlay extends Screen {
|
|||||||
if (binding == null) continue;
|
if (binding == null) continue;
|
||||||
boolean hasTexture = client.getGuiAtlasManager().getSprite(id("binding/"+bindName)) != missingSprite;
|
boolean hasTexture = client.getGuiAtlasManager().getSprite(id("binding/"+bindName)) != missingSprite;
|
||||||
if (MidnightControlsConfig.debug) System.out.println(left +" "+id("binding/"+bindName)+" "+ hasTexture);
|
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)
|
var button = TextIconButtonWidget.builder(Text.translatable(binding.getTranslationKey()), b -> {
|
||||||
|
binding.handle(client, 1.0f, ButtonState.PRESS);
|
||||||
|
if (binding.asKeyBinding().isPresent()) {
|
||||||
|
binding.asKeyBinding().get().setPressed(true);
|
||||||
|
((KeyBindingAccessor)binding.asKeyBinding().get()).midnightcontrols$press();
|
||||||
|
}
|
||||||
|
}, hasTexture)
|
||||||
.texture(hasTexture ? id("binding/"+bindName) : emptySprite, 20, 20).dimension(20, 20).build();
|
.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.setPosition(left ? (3+(i*23)) : this.width-(23+(i*23)), 3);
|
||||||
button.setAlpha(MidnightControlsConfig.touchTransparency / 100f);
|
button.setAlpha(MidnightControlsConfig.touchTransparency / 100f);
|
||||||
@@ -340,7 +344,7 @@ public class TouchscreenOverlay extends Screen {
|
|||||||
this.forwardLeftButton.setVisible(false);
|
this.forwardLeftButton.setVisible(false);
|
||||||
this.forwardRightButton.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.useButton.setVisible(client.player.getMainHandStack() != null && (client.player.getMainHandStack().getUseAction() != UseAction.NONE || client.player.getMainHandStack().getComponents().contains(DataComponentTypes.EQUIPPABLE)) && !TouchUtils.hasInWorldUseAction(client.player.getMainHandStack()));
|
||||||
this.updateJumpButtons();
|
this.updateJumpButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,10 +363,4 @@ public class TouchscreenOverlay extends Screen {
|
|||||||
}
|
}
|
||||||
return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.util;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
|
|
||||||
|
public interface AbstractSignEditScreenAccessor {
|
||||||
|
@Unique
|
||||||
|
String[] midnightcontrols$getMessages();
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
void midnightcontrols$setMessage(int line, String text);
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
void midnightcontrols$writeToBlockEntity();
|
||||||
|
}
|
||||||
@@ -91,7 +91,7 @@ public class InventoryUtil {
|
|||||||
|
|
||||||
if (closestSlot.isPresent() && client.player != null) {
|
if (closestSlot.isPresent() && client.player != null) {
|
||||||
var slot = closestSlot.get().getLeft();
|
var slot = closestSlot.get().getLeft();
|
||||||
if (slot.hasStack() || !client.player.getInventory().getMainHandStack().isEmpty()) {
|
if (slot.hasStack() || !client.player.getInventory().getSelectedStack().isEmpty()) {
|
||||||
int slotCenterXScaled = guiLeft + slot.x + 8;
|
int slotCenterXScaled = guiLeft + slot.x + 8;
|
||||||
int slotCenterYScaled = guiTop + slot.y + 8;
|
int slotCenterYScaled = guiTop + slot.y + 8;
|
||||||
int slotCenterX = (int) (slotCenterXScaled / ((double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth()));
|
int slotCenterX = (int) (slotCenterXScaled / ((double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth()));
|
||||||
|
|||||||
@@ -58,10 +58,19 @@ public class AxisStorage {
|
|||||||
}
|
}
|
||||||
this.polarity = currentPlusState ? AxisStorage.Polarity.PLUS : currentMinusState ? AxisStorage.Polarity.MINUS : AxisStorage.Polarity.ZERO;
|
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() {
|
public void setupButtonStates() {
|
||||||
var posButton = ButtonBinding.axisAsButton(axis, true);
|
var posButton = getButtonId(true);
|
||||||
var negButton = ButtonBinding.axisAsButton(axis, false);
|
var negButton = getButtonId(false);
|
||||||
var previousPlusState = STATES.getOrDefault(posButton, ButtonState.NONE);
|
var previousPlusState = STATES.getOrDefault(posButton, ButtonState.NONE);
|
||||||
var previousMinusState = STATES.getOrDefault(negButton, ButtonState.NONE);
|
var previousMinusState = STATES.getOrDefault(negButton, ButtonState.NONE);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,102 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.virtualkeyboard;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class KeyboardLayout {
|
||||||
|
|
||||||
|
public static KeyboardLayout QWERTY = new KeyboardLayout("en_US:qwerty", createQwertyLetterLayout(), createSymbolLayout());
|
||||||
|
|
||||||
|
private final String id;
|
||||||
|
private final List<List<String>> letters;
|
||||||
|
private final List<List<String>> symbols;
|
||||||
|
|
||||||
|
private KeyboardLayout(String id, List<List<String>> letters, List<List<String>> symbols) {
|
||||||
|
this.id = id;
|
||||||
|
this.letters = letters;
|
||||||
|
this.symbols = symbols;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static KeyboardLayout fromJson(JsonObject json) {
|
||||||
|
try {
|
||||||
|
return new KeyboardLayout(json.get("id").getAsString(), getFromJson(json, true), getFromJson(json, false));
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("Error loading keyboard definition: %s".formatted(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static List<List<String>> getFromJson(JsonObject json, boolean letters) {
|
||||||
|
String type = letters ? "letters" : "symbols";
|
||||||
|
List<List<String>> arr = new ArrayList<>();
|
||||||
|
if (json.has(type)) {
|
||||||
|
JsonObject lettersJson = json.get(type).getAsJsonObject();
|
||||||
|
for (int i = 0; ; i++) {
|
||||||
|
if (!lettersJson.has("row"+i)) break;
|
||||||
|
var rowJson = lettersJson.get("row%s".formatted(i)).getAsJsonArray();
|
||||||
|
List<String> row = new ArrayList<>();
|
||||||
|
for (int j = 0; j < rowJson.size(); j++) {
|
||||||
|
row.add(rowJson.get(j).getAsString());
|
||||||
|
}
|
||||||
|
arr.add(row);
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return letters ? createQwertyLetterLayout() : createSymbolLayout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTranslationKey() {
|
||||||
|
String[] identifier = id.split(":");
|
||||||
|
if (identifier.length != 2) return "Invalid Keyboard ID: %s".formatted(id);
|
||||||
|
return "midnightcontrols.virtual_keyboard.layout.%s.%s".formatted(identifier[0], identifier[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<List<String>> getLetters() {
|
||||||
|
return letters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<List<String>> getSymbols() {
|
||||||
|
return symbols;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<List<String>> createQwertyLetterLayout() {
|
||||||
|
List<List<String>> letters = new ArrayList<>();
|
||||||
|
letters.add(Arrays.asList(
|
||||||
|
"q", "w", "e", "r", "t",
|
||||||
|
"y", "u", "i", "o", "p"
|
||||||
|
));
|
||||||
|
letters.add(Arrays.asList(
|
||||||
|
"a", "s", "d", "f", "g",
|
||||||
|
"h", "j", "k", "l"
|
||||||
|
));
|
||||||
|
letters.add(Arrays.asList(
|
||||||
|
"z", "x", "c", "v",
|
||||||
|
"b", "n", "m"
|
||||||
|
));
|
||||||
|
return letters;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<List<String>> createSymbolLayout() {
|
||||||
|
List<List<String>> symbols = new ArrayList<>();
|
||||||
|
symbols.add(Arrays.asList(
|
||||||
|
"1", "2", "3", "4", "5",
|
||||||
|
"6", "7", "8", "9", "0"
|
||||||
|
));
|
||||||
|
symbols.add(Arrays.asList(
|
||||||
|
"@", "#", "$", "%", "&",
|
||||||
|
"*", "-", "+", "(", ")"
|
||||||
|
));
|
||||||
|
symbols.add(Arrays.asList(
|
||||||
|
"!", "\"", "'", ":", ";",
|
||||||
|
",", ".", "?", "/"
|
||||||
|
));
|
||||||
|
return symbols;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.virtualkeyboard;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||||
|
import net.minecraft.resource.Resource;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class KeyboardLayoutManager {
|
||||||
|
private static final Map<String, KeyboardLayout> KEYBOARD_LAYOUTS = new HashMap<>();
|
||||||
|
|
||||||
|
public static void loadLayout(Identifier id, Resource resource) {
|
||||||
|
try {
|
||||||
|
JsonObject json = JsonParser.parseReader(resource.getReader()).getAsJsonObject();
|
||||||
|
KeyboardLayout layout = KeyboardLayout.fromJson(json);
|
||||||
|
KEYBOARD_LAYOUTS.put(layout.getId(), layout);
|
||||||
|
if (MidnightControlsConfig.debug) System.out.printf("Loaded keyboard layout: %s\n", layout.getId());
|
||||||
|
} catch (IOException e) { throw new RuntimeException(e); }
|
||||||
|
}
|
||||||
|
public static KeyboardLayout getById(String id) {
|
||||||
|
return KEYBOARD_LAYOUTS.get(id) == null ? KeyboardLayout.QWERTY : KEYBOARD_LAYOUTS.get(id);
|
||||||
|
}
|
||||||
|
public static KeyboardLayout getNext(KeyboardLayout current) {
|
||||||
|
KeyboardLayout[] layouts = KEYBOARD_LAYOUTS.values().toArray(KeyboardLayout[]::new);
|
||||||
|
int currentIndex = -1;
|
||||||
|
for (int i = 0; i < layouts.length; i++) {
|
||||||
|
if (layouts[i] == current) currentIndex = i;
|
||||||
|
}
|
||||||
|
currentIndex = currentIndex+1 >= layouts.length ? 0 : currentIndex + 1;
|
||||||
|
return layouts[currentIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.virtualkeyboard;
|
||||||
|
|
||||||
|
import eu.midnightdust.midnightcontrols.client.virtualkeyboard.clickhandler.AbstractScreenClickHandler;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.virtualkeyboard.clickhandler.BookEditScreenClickHandler;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.virtualkeyboard.clickhandler.DefaultScreenClickHandler;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.virtualkeyboard.clickhandler.SignEditScreenClickHandler;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.client.gui.screen.ingame.BookEditScreen;
|
||||||
|
import net.minecraft.client.gui.screen.ingame.BookSigningScreen;
|
||||||
|
import net.minecraft.client.gui.screen.ingame.SignEditScreen;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
public class MouseClickInterceptor {
|
||||||
|
|
||||||
|
private final Map<Class<?>, AbstractScreenClickHandler<?>> clickHandlers;
|
||||||
|
|
||||||
|
public MouseClickInterceptor() {
|
||||||
|
this.clickHandlers = new HashMap<>();
|
||||||
|
this.clickHandlers.put(BookSigningScreen.class, new BookEditScreenClickHandler.Signing());
|
||||||
|
this.clickHandlers.put(BookEditScreen.class, new BookEditScreenClickHandler());
|
||||||
|
this.clickHandlers.put(SignEditScreen.class, new SignEditScreenClickHandler());
|
||||||
|
this.clickHandlers.put(Screen.class, new DefaultScreenClickHandler());
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public <T extends Screen> void intercept(T screen, double mouseX, double mouseY) {
|
||||||
|
AbstractScreenClickHandler<T> handler = (AbstractScreenClickHandler<T>) clickHandlers.get(screen.getClass());
|
||||||
|
|
||||||
|
if (handler == null) {
|
||||||
|
handler = (AbstractScreenClickHandler<T>) clickHandlers.get(Screen.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
handler.handle(screen, mouseX, mouseY);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.virtualkeyboard.clickhandler;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
|
||||||
|
public abstract class AbstractScreenClickHandler<T extends Screen> {
|
||||||
|
public abstract void handle(T screen, double mouseX, double mouseY);
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.virtualkeyboard.clickhandler;
|
||||||
|
|
||||||
|
import eu.midnightdust.midnightcontrols.client.mixin.BookEditScreenAccessor;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.mixin.BookSigningScreenAccessor;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.virtualkeyboard.gui.VirtualKeyboardScreen;
|
||||||
|
import net.minecraft.client.gui.screen.ingame.BookEditScreen;
|
||||||
|
import net.minecraft.client.gui.screen.ingame.BookSigningScreen;
|
||||||
|
import net.minecraft.client.gui.widget.EditBoxWidget;
|
||||||
|
|
||||||
|
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.client;
|
||||||
|
|
||||||
|
public class BookEditScreenClickHandler extends AbstractScreenClickHandler<BookEditScreen> {
|
||||||
|
@Override
|
||||||
|
public void handle(BookEditScreen screen, double mouseX, double mouseY) {
|
||||||
|
// don't open the keyboard if a UI element was clicked
|
||||||
|
if(screen.hoveredElement(mouseX, mouseY).isPresent() && !(screen.hoveredElement(mouseX, mouseY).get() instanceof EditBoxWidget)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var accessor = (BookEditScreenAccessor) screen;
|
||||||
|
|
||||||
|
VirtualKeyboardScreen virtualKeyboardScreen = new VirtualKeyboardScreen(accessor.midnightcontrols$getEditBox().getText(), (text) -> {
|
||||||
|
client.setScreen(screen);
|
||||||
|
accessor.midnightcontrols$getEditBox().setText(text);
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
client.setScreen(virtualKeyboardScreen);
|
||||||
|
}
|
||||||
|
public static class Signing extends AbstractScreenClickHandler<BookSigningScreen> {
|
||||||
|
@Override
|
||||||
|
public void handle(BookSigningScreen screen, double mouseX, double mouseY) {
|
||||||
|
// don't open the keyboard if a UI element was clicked
|
||||||
|
if(screen.hoveredElement(mouseX, mouseY).isPresent()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var accessor = (BookSigningScreenAccessor) screen;
|
||||||
|
|
||||||
|
VirtualKeyboardScreen virtualKeyboardScreen = new VirtualKeyboardScreen(accessor.midnightcontrols$getBookTitleTextField().getText(), (text) -> {
|
||||||
|
client.setScreen(screen);
|
||||||
|
accessor.midnightcontrols$getBookTitleTextField().setText(text);
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
client.setScreen(virtualKeyboardScreen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.virtualkeyboard.clickhandler;
|
||||||
|
|
||||||
|
import eu.midnightdust.midnightcontrols.client.mixin.CreativeInventoryScreenAccessor;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.virtualkeyboard.gui.VirtualKeyboardScreen;
|
||||||
|
import net.minecraft.client.gui.Element;
|
||||||
|
import net.minecraft.client.gui.ParentElement;
|
||||||
|
import net.minecraft.client.gui.screen.ChatScreen;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
|
||||||
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.client;
|
||||||
|
|
||||||
|
public class DefaultScreenClickHandler extends AbstractScreenClickHandler<Screen> {
|
||||||
|
|
||||||
|
private Screen parentScreen;
|
||||||
|
private List<Integer> textFieldElementPath;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(Screen screen, double mouseX, double mouseY) {
|
||||||
|
var textField = findClickedTextField(screen.children(), mouseX, mouseY);
|
||||||
|
if (textField == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.parentScreen = screen;
|
||||||
|
this.textFieldElementPath = calculatePathToElement(screen, textField.asElement());
|
||||||
|
|
||||||
|
var virtualKeyboardScreen = new VirtualKeyboardScreen(textField.getText(), this::handleKeyboardClose, false);
|
||||||
|
client.setScreen(virtualKeyboardScreen);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleKeyboardClose(String newText) {
|
||||||
|
if (this.parentScreen == null || this.textFieldElementPath == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
client.setScreen(this.parentScreen);
|
||||||
|
TextFieldWrapper textField = findTextFieldByPath(this.parentScreen, this.textFieldElementPath);
|
||||||
|
if (textField == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
textField.setText(newText);
|
||||||
|
|
||||||
|
switch (this.parentScreen) {
|
||||||
|
case CreativeInventoryScreen creativeInventoryScreen -> {
|
||||||
|
var accessor = (CreativeInventoryScreenAccessor) creativeInventoryScreen;
|
||||||
|
accessor.midnightcontrols$search();
|
||||||
|
}
|
||||||
|
case ChatScreen chatScreen -> {
|
||||||
|
// send the chat message
|
||||||
|
chatScreen.keyPressed(GLFW.GLFW_KEY_ENTER, 0, 0);
|
||||||
|
}
|
||||||
|
default -> {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private TextFieldWrapper findClickedTextField(List<? extends Element> elements, double mouseX, double mouseY) {
|
||||||
|
for (Element element : elements) {
|
||||||
|
if (TextFieldWrapper.isValidTextField(element)) {
|
||||||
|
TextFieldWrapper textField = new TextFieldWrapper(element);
|
||||||
|
if (textField.isMouseOver(mouseX, mouseY) && textField.isFocused()) {
|
||||||
|
return textField;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element instanceof ParentElement parentElement) {
|
||||||
|
TextFieldWrapper found = findClickedTextField(parentElement.children(), mouseX, mouseY);
|
||||||
|
if (found != null) {
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculates the path between a parent and a target in the UI hierarchy
|
||||||
|
*/
|
||||||
|
protected List<Integer> calculatePathToElement(Element parent, Element target) {
|
||||||
|
if (!(parent instanceof ParentElement parentElement)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<? extends Element> children = parentElement.children();
|
||||||
|
|
||||||
|
for (int i = 0; i < children.size(); i++) {
|
||||||
|
Element child = children.get(i);
|
||||||
|
|
||||||
|
if (child == target) {
|
||||||
|
return Collections.singletonList(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (child instanceof ParentElement) {
|
||||||
|
List<Integer> subPath = calculatePathToElement(child, target);
|
||||||
|
if (subPath != null) {
|
||||||
|
List<Integer> fullPath = new ArrayList<>(subPath.size() + 1);
|
||||||
|
fullPath.add(i);
|
||||||
|
fullPath.addAll(subPath);
|
||||||
|
return fullPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected TextFieldWrapper findTextFieldByPath(Element parent, List<Integer> path) {
|
||||||
|
if (path == null || path.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(parent instanceof ParentElement parentElement)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<? extends Element> children = parentElement.children();
|
||||||
|
int index = path.get(0);
|
||||||
|
|
||||||
|
if (index < 0 || index >= children.size()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Element child = children.get(index);
|
||||||
|
|
||||||
|
if (path.size() == 1) {
|
||||||
|
return TextFieldWrapper.isValidTextField(child) ? new TextFieldWrapper(child) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (child instanceof ParentElement) {
|
||||||
|
return findTextFieldByPath(child, path.subList(1, path.size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.virtualkeyboard.clickhandler;
|
||||||
|
|
||||||
|
import eu.midnightdust.midnightcontrols.client.util.AbstractSignEditScreenAccessor;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.virtualkeyboard.gui.VirtualKeyboardScreen;
|
||||||
|
import net.minecraft.client.gui.screen.ingame.SignEditScreen;
|
||||||
|
|
||||||
|
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.client;
|
||||||
|
|
||||||
|
public class SignEditScreenClickHandler extends AbstractScreenClickHandler<SignEditScreen> {
|
||||||
|
@Override
|
||||||
|
public void handle(SignEditScreen screen, double mouseX, double mouseY) {
|
||||||
|
// don't open the keyboard if a UI element was clicked
|
||||||
|
if(screen.hoveredElement(mouseX, mouseY).isPresent()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var accessor = (AbstractSignEditScreenAccessor) screen;
|
||||||
|
|
||||||
|
StringBuilder linesToString = new StringBuilder();
|
||||||
|
String[] messages = accessor.midnightcontrols$getMessages();
|
||||||
|
for (int i = 0; i < Math.min(4, messages.length); i++) {
|
||||||
|
String line = messages[i];
|
||||||
|
linesToString.append(line);
|
||||||
|
if (!line.isEmpty() && i < 3) linesToString.append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
VirtualKeyboardScreen virtualKeyboardScreen = new VirtualKeyboardScreen(linesToString.toString(), (text) -> {
|
||||||
|
client.setScreen(screen);
|
||||||
|
String[] lines = text.split("\n");
|
||||||
|
for (int i = 0; i < 4; i++) accessor.midnightcontrols$setMessage(i, lines.length > i ? lines[i] : "");
|
||||||
|
accessor.midnightcontrols$writeToBlockEntity();
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
client.setScreen(virtualKeyboardScreen);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.virtualkeyboard.clickhandler;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.Element;
|
||||||
|
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||||
|
import org.thinkingstudio.obsidianui.widget.text.SpruceTextFieldWidget;
|
||||||
|
|
||||||
|
public record TextFieldWrapper(Object textField) {
|
||||||
|
|
||||||
|
public TextFieldWrapper {
|
||||||
|
if (!isValidTextField(textField)) {
|
||||||
|
throw new IllegalArgumentException("Type " + textField.getClass() + " is not marked as a valid text field");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Element asElement() {
|
||||||
|
return (Element) textField;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getText() {
|
||||||
|
switch (textField) {
|
||||||
|
case SpruceTextFieldWidget spruceTextField -> {
|
||||||
|
return spruceTextField.getText();
|
||||||
|
}
|
||||||
|
case TextFieldWidget vanillaTextField -> {
|
||||||
|
return vanillaTextField.getText();
|
||||||
|
}
|
||||||
|
default -> {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setText(String text) {
|
||||||
|
switch (textField) {
|
||||||
|
case SpruceTextFieldWidget spruceTextField -> {
|
||||||
|
spruceTextField.setText(text);
|
||||||
|
}
|
||||||
|
case TextFieldWidget vanillaTextField -> {
|
||||||
|
vanillaTextField.setText(text);
|
||||||
|
}
|
||||||
|
default -> {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isMouseOver(double mouseX, double mouseY) {
|
||||||
|
switch (textField) {
|
||||||
|
case SpruceTextFieldWidget spruceTextField -> {
|
||||||
|
return spruceTextField.isMouseOver(mouseX, mouseY);
|
||||||
|
}
|
||||||
|
case TextFieldWidget vanillaTextField -> {
|
||||||
|
return vanillaTextField.isMouseOver(mouseX, mouseY);
|
||||||
|
}
|
||||||
|
default -> {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isFocused() {
|
||||||
|
switch (textField) {
|
||||||
|
case SpruceTextFieldWidget spruceTextField -> {
|
||||||
|
return spruceTextField.isFocused();
|
||||||
|
}
|
||||||
|
case TextFieldWidget vanillaTextField -> {
|
||||||
|
return vanillaTextField.isFocused();
|
||||||
|
}
|
||||||
|
default -> {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean isValidTextField(Object textField) {
|
||||||
|
return textField instanceof TextFieldWidget || textField instanceof SpruceTextFieldWidget;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,296 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.client.virtualkeyboard.gui;
|
||||||
|
|
||||||
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.virtualkeyboard.KeyboardLayout;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.virtualkeyboard.KeyboardLayoutManager;
|
||||||
|
import net.minecraft.client.gui.DrawContext;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import org.thinkingstudio.obsidianui.Position;
|
||||||
|
import org.thinkingstudio.obsidianui.SpruceTexts;
|
||||||
|
import org.thinkingstudio.obsidianui.screen.SpruceScreen;
|
||||||
|
import org.thinkingstudio.obsidianui.widget.SpruceButtonWidget;
|
||||||
|
import org.thinkingstudio.obsidianui.widget.container.SpruceContainerWidget;
|
||||||
|
import org.thinkingstudio.obsidianui.widget.text.SpruceTextAreaWidget;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class VirtualKeyboardScreen extends SpruceScreen {
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface CloseCallback {
|
||||||
|
void onClose(String text);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final int STANDARD_KEY_WIDTH = 20;
|
||||||
|
private static final int SPECIAL_KEY_WIDTH = (int) (STANDARD_KEY_WIDTH * 1.5);
|
||||||
|
private static final int KEY_HEIGHT = 20;
|
||||||
|
private static final int HORIZONTAL_SPACING = 2;
|
||||||
|
private static final int VERTICAL_SPACING = 4;
|
||||||
|
private static final int CONTAINER_PADDING = 10;
|
||||||
|
|
||||||
|
// Key symbols
|
||||||
|
private static final String BACKSPACE_SYMBOL = "\b";
|
||||||
|
private static final String NEWLINE_SYMBOL = "\n";
|
||||||
|
private static final String SPACE_SYMBOL = " ";
|
||||||
|
|
||||||
|
private final StringBuilder buffer;
|
||||||
|
private final CloseCallback closeCallback;
|
||||||
|
private final KeyboardLayout layout;
|
||||||
|
private final boolean newLineSupport;
|
||||||
|
|
||||||
|
private boolean capsMode;
|
||||||
|
private boolean symbolMode;
|
||||||
|
private SpruceTextAreaWidget bufferDisplayArea;
|
||||||
|
private SpruceContainerWidget keyboardContainer;
|
||||||
|
|
||||||
|
public VirtualKeyboardScreen(String initialText, CloseCallback closeCallback, boolean newLineSupport) {
|
||||||
|
super(Text.translatable("midnightcontrols.virtual_keyboard.screen"));
|
||||||
|
this.buffer = new StringBuilder(initialText);
|
||||||
|
this.closeCallback = closeCallback;
|
||||||
|
this.layout = KeyboardLayoutManager.getById(MidnightControlsConfig.keyboardLayout);
|
||||||
|
this.capsMode = false;
|
||||||
|
this.symbolMode = false;
|
||||||
|
this.newLineSupport = newLineSupport;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
this.bufferDisplayArea = createBufferDisplayArea();
|
||||||
|
this.addDrawableChild(this.bufferDisplayArea);
|
||||||
|
|
||||||
|
rebuildKeyboard();
|
||||||
|
|
||||||
|
int doneButtonY = this.keyboardContainer.getY() + this.keyboardContainer.getHeight() + VERTICAL_SPACING * 2;
|
||||||
|
this.addDrawableChild(
|
||||||
|
new SpruceButtonWidget(
|
||||||
|
Position.of(this, this.width / 2 - 50, doneButtonY),
|
||||||
|
100,
|
||||||
|
20,
|
||||||
|
SpruceTexts.GUI_DONE,
|
||||||
|
btn -> this.close()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldPause() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() {
|
||||||
|
super.close();
|
||||||
|
if (this.closeCallback != null) {
|
||||||
|
this.closeCallback.onClose(this.buffer.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void rebuildKeyboard() {
|
||||||
|
if (this.keyboardContainer != null) {
|
||||||
|
this.remove(this.keyboardContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
var layoutKeys = getActiveKeyLayout();
|
||||||
|
var keyboardContainer = createKeyboardContainer(layoutKeys);
|
||||||
|
|
||||||
|
addLayoutRows(keyboardContainer, layoutKeys);
|
||||||
|
addFunctionKeys(keyboardContainer);
|
||||||
|
addBottomRow(keyboardContainer);
|
||||||
|
|
||||||
|
this.keyboardContainer = keyboardContainer;
|
||||||
|
this.addDrawableChild(this.keyboardContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SpruceContainerWidget createKeyboardContainer(List<List<String>> layoutKeys) {
|
||||||
|
int containerWidth = this.width;
|
||||||
|
int totalKeyboardHeight = calculateKeyboardHeight(layoutKeys);
|
||||||
|
int keyboardY = this.bufferDisplayArea.getY() + this.bufferDisplayArea.getHeight() + VERTICAL_SPACING * 2;
|
||||||
|
|
||||||
|
return new SpruceContainerWidget(
|
||||||
|
Position.of(0, keyboardY),
|
||||||
|
containerWidth,
|
||||||
|
totalKeyboardHeight
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SpruceTextAreaWidget createBufferDisplayArea() {
|
||||||
|
int lineCount = this.newLineSupport ? 4 : 1;
|
||||||
|
int bufferX = this.width / 2 - 100;
|
||||||
|
int bufferY = this.height / 4 - VERTICAL_SPACING * 5 - 5;
|
||||||
|
int bufferWidth = 200;
|
||||||
|
int desiredHeight = (this.textRenderer.fontHeight + 2) * lineCount + 6;
|
||||||
|
|
||||||
|
var bufferDisplay = new SpruceTextAreaWidget(
|
||||||
|
Position.of(bufferX, bufferY),
|
||||||
|
bufferWidth,
|
||||||
|
desiredHeight,
|
||||||
|
Text.literal("Buffer Display")
|
||||||
|
);
|
||||||
|
bufferDisplay.setText(this.buffer.toString());
|
||||||
|
bufferDisplay.setEditable(false);
|
||||||
|
bufferDisplay.setUneditableColor(0xFFFFFFFF);
|
||||||
|
bufferDisplay.setDisplayedLines(lineCount);
|
||||||
|
bufferDisplay.setCursorToEnd();
|
||||||
|
|
||||||
|
return bufferDisplay;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int calculateKeyboardHeight(List<List<String>> keyRows) {
|
||||||
|
return keyRows.size() * (KEY_HEIGHT + VERTICAL_SPACING) +
|
||||||
|
(KEY_HEIGHT + VERTICAL_SPACING) + // space for bottom row
|
||||||
|
CONTAINER_PADDING * 2; // top and bottom padding
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addLayoutRows(SpruceContainerWidget container, List<List<String>> keyLayoutRows) {
|
||||||
|
int currentY = CONTAINER_PADDING;
|
||||||
|
|
||||||
|
for (List<String> row : keyLayoutRows) {
|
||||||
|
int rowWidth = calculateRowWidth(row);
|
||||||
|
// center row
|
||||||
|
int currentX = (container.getWidth() - rowWidth) / 2;
|
||||||
|
|
||||||
|
for (String key : row) {
|
||||||
|
String displayText = (this.capsMode && !this.symbolMode) ? key.toUpperCase() : key;
|
||||||
|
container.addChild(
|
||||||
|
new SpruceButtonWidget(
|
||||||
|
Position.of(currentX, currentY),
|
||||||
|
STANDARD_KEY_WIDTH,
|
||||||
|
KEY_HEIGHT,
|
||||||
|
Text.literal(displayText),
|
||||||
|
btn -> handleKeyPress(displayText)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
currentX += STANDARD_KEY_WIDTH + HORIZONTAL_SPACING;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentY += KEY_HEIGHT + VERTICAL_SPACING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int calculateRowWidth(List<String> row) {
|
||||||
|
int rowWidth = 0;
|
||||||
|
for (int i = 0; i < row.size(); i++) {
|
||||||
|
rowWidth += STANDARD_KEY_WIDTH;
|
||||||
|
// padding
|
||||||
|
if (i < row.size() - 1) {
|
||||||
|
rowWidth += HORIZONTAL_SPACING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rowWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addFunctionKeys(SpruceContainerWidget container) {
|
||||||
|
List<String> firstRow = getActiveKeyLayout().getFirst();
|
||||||
|
int firstRowWidth = calculateRowWidth(firstRow);
|
||||||
|
|
||||||
|
// position backspace at the right of the first row
|
||||||
|
int backspaceWidth = (int) (STANDARD_KEY_WIDTH * 1.5);
|
||||||
|
int backspaceX = (container.getWidth() + firstRowWidth) / 2 + HORIZONTAL_SPACING;
|
||||||
|
|
||||||
|
container.addChild(
|
||||||
|
new SpruceButtonWidget(
|
||||||
|
Position.of(backspaceX, CONTAINER_PADDING),
|
||||||
|
backspaceWidth,
|
||||||
|
KEY_HEIGHT,
|
||||||
|
Text.literal("←"),
|
||||||
|
btn -> handleKeyPress(BACKSPACE_SYMBOL)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
if (this.newLineSupport) {
|
||||||
|
// position newline at the right of the second row
|
||||||
|
List<String> secondRow = getActiveKeyLayout().get(1);
|
||||||
|
int newlineWidth = (int) (STANDARD_KEY_WIDTH * 1.5);
|
||||||
|
int secondRowWidth = calculateRowWidth(secondRow);
|
||||||
|
int newlineX = (container.getWidth() + secondRowWidth) / 2 + HORIZONTAL_SPACING;
|
||||||
|
int newlineY = CONTAINER_PADDING + (KEY_HEIGHT + VERTICAL_SPACING);
|
||||||
|
|
||||||
|
container.addChild(
|
||||||
|
new SpruceButtonWidget(
|
||||||
|
Position.of(newlineX, newlineY),
|
||||||
|
newlineWidth,
|
||||||
|
KEY_HEIGHT,
|
||||||
|
Text.literal("⏎"),
|
||||||
|
btn -> handleKeyPress(NEWLINE_SYMBOL)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addBottomRow(SpruceContainerWidget container) {
|
||||||
|
// calculate positions for bottom row
|
||||||
|
int rowY = CONTAINER_PADDING + getActiveKeyLayout().size() * (KEY_HEIGHT + VERTICAL_SPACING);
|
||||||
|
|
||||||
|
// space bar - wide key in the middle
|
||||||
|
double spaceWidthFactor = 5.0;
|
||||||
|
int spaceKeyWidth = (int) (STANDARD_KEY_WIDTH * spaceWidthFactor);
|
||||||
|
int spaceX = (container.getWidth() - spaceKeyWidth) / 2;
|
||||||
|
|
||||||
|
container.addChild(
|
||||||
|
new SpruceButtonWidget(
|
||||||
|
Position.of(spaceX, rowY),
|
||||||
|
spaceKeyWidth,
|
||||||
|
KEY_HEIGHT,
|
||||||
|
Text.translatable("midnightcontrols.virtual_keyboard.keyboard.space"),
|
||||||
|
btn -> handleKeyPress(SPACE_SYMBOL)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// caps key - left of space
|
||||||
|
if (!this.symbolMode) {
|
||||||
|
int capsX = spaceX - SPECIAL_KEY_WIDTH - HORIZONTAL_SPACING * 2;
|
||||||
|
var capsModeButton = new SpruceButtonWidget(
|
||||||
|
Position.of(capsX, rowY),
|
||||||
|
SPECIAL_KEY_WIDTH,
|
||||||
|
KEY_HEIGHT,
|
||||||
|
Text.literal(this.capsMode ? "caps" : "CAPS"),
|
||||||
|
btn -> toggleCapsMode());
|
||||||
|
|
||||||
|
container.addChild(capsModeButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
// symbols key - right of space
|
||||||
|
int symbolsX = spaceX + spaceKeyWidth + HORIZONTAL_SPACING * 2;
|
||||||
|
var symbolModeButton = new SpruceButtonWidget(
|
||||||
|
Position.of(symbolsX, rowY),
|
||||||
|
SPECIAL_KEY_WIDTH,
|
||||||
|
KEY_HEIGHT,
|
||||||
|
Text.literal(this.symbolMode ? "ABC" : "123?!"),
|
||||||
|
btn -> toggleSymbolMode()
|
||||||
|
);
|
||||||
|
container.addChild(symbolModeButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleKeyPress(String key) {
|
||||||
|
if (key.equals(BACKSPACE_SYMBOL)) {
|
||||||
|
if (!this.buffer.isEmpty()) {
|
||||||
|
this.buffer.deleteCharAt(buffer.length() - 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.buffer.append(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.bufferDisplayArea != null) {
|
||||||
|
this.bufferDisplayArea.setText(this.buffer.toString());
|
||||||
|
this.bufferDisplayArea.setCursorToEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<List<String>> getActiveKeyLayout() {
|
||||||
|
return this.symbolMode ? this.layout.getSymbols() : this.layout.getLetters();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void toggleCapsMode() {
|
||||||
|
this.capsMode = !this.capsMode;
|
||||||
|
rebuildKeyboard();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void toggleSymbolMode() {
|
||||||
|
this.symbolMode = !this.symbolMode;
|
||||||
|
rebuildKeyboard();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"id": "de_DE:qwertz",
|
||||||
|
|
||||||
|
"letters": {
|
||||||
|
"row0": ["q", "w", "e", "r", "t", "z", "u", "i", "o", "p", "ü"],
|
||||||
|
"row1": ["a", "s", "d", "f", "g", "h", "j", "k", "l", "ö", "ä"],
|
||||||
|
"row2": ["y", "x", "c", "v", "b", "n", "m", "ß"]
|
||||||
|
},
|
||||||
|
"symbols": {
|
||||||
|
"row0": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"],
|
||||||
|
"row1": ["@", "#", "$", "%", "&", "*", "-", "+", "(", ")"],
|
||||||
|
"row2": ["!", "\"", "'", ":", ";", ",", ".", "?", "/"]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"id": "en_US:qwerty",
|
||||||
|
|
||||||
|
"letters": {
|
||||||
|
"row0": ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
|
||||||
|
"row1": ["a", "s", "d", "f", "g", "h", "j", "k", "l"],
|
||||||
|
"row2": ["z", "x", "c", "v", "b", "n", "m"]
|
||||||
|
},
|
||||||
|
"symbols": {
|
||||||
|
"row0": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"],
|
||||||
|
"row1": ["@", "#", "$", "%", "&", "*", "-", "+", "(", ")"],
|
||||||
|
"row2": ["!", "\"", "'", ":", ";", ",", ".", "?", "/"]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,239 @@
|
|||||||
|
{
|
||||||
|
"midnightcontrols.midnightconfig.title": "Pokročilá konfigurace MidnightControls",
|
||||||
|
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.DEFAULT_LIGHT": "Výchozí světlá",
|
||||||
|
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.DEFAULT_DARK": "Výchozí tmavá",
|
||||||
|
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.SECOND_LIGHT": "Druhá světlá",
|
||||||
|
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.SECOND_DARK": "Druhá tmavá",
|
||||||
|
"midnightcontrols.midnightconfig.enum.ControllerType.DEFAULT": "Výchozí",
|
||||||
|
"midnightcontrols.midnightconfig.enum.ControllerType.DUALSHOCK": "DualShock",
|
||||||
|
"midnightcontrols.midnightconfig.enum.ControllerType.DUALSENSE": "DualSense",
|
||||||
|
"midnightcontrols.midnightconfig.enum.ControllerType.SWITCH": "Switch/Wii ovladač",
|
||||||
|
"midnightcontrols.midnightconfig.enum.ControllerType.XBOX": "Xbox One/Series ovladač",
|
||||||
|
"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 ovladač",
|
||||||
|
"midnightcontrols.midnightconfig.enum.ControllerType.NUMBERED": "Ovladač s číslicemi",
|
||||||
|
"midnightcontrols.midnightconfig.enum.ControlsMode.DEFAULT": "Klávesnice/Myš",
|
||||||
|
"midnightcontrols.midnightconfig.enum.ControlsMode.CONTROLLER": "Ovladač",
|
||||||
|
"midnightcontrols.midnightconfig.enum.ControlsMode.TOUCHSCREEN": "Dotyk (Beta)",
|
||||||
|
"midnightcontrols.midnightconfig.enum.HudSide.LEFT": "Levá",
|
||||||
|
"midnightcontrols.midnightconfig.enum.HudSide.RIGHT": "Pravá",
|
||||||
|
"midnightcontrols.midnightconfig.enum.TouchMode.CROSSHAIR": "Crosshair režim",
|
||||||
|
"midnightcontrols.midnightconfig.enum.TouchMode.FINGER_POS": "Pozice prstu",
|
||||||
|
"midnightcontrols.midnightconfig.enum.CameraMode.FLAT": "Plochá",
|
||||||
|
"midnightcontrols.midnightconfig.enum.CameraMode.ADAPTIVE": "Adaptivní",
|
||||||
|
"key.categories.midnightcontrols": "MidnightControls",
|
||||||
|
"key.midnightcontrols.look_down": "Podívat se dolů",
|
||||||
|
"key.midnightcontrols.look_left": "Podívat se doleva",
|
||||||
|
"key.midnightcontrols.look_right": "Podívat se doprava",
|
||||||
|
"key.midnightcontrols.look_up": "Podívat se nahoru",
|
||||||
|
"key.midnightcontrols.ring": "Otevřít ovládací kroužek",
|
||||||
|
"midnightcontrols.action.attack": "Útok",
|
||||||
|
"midnightcontrols.action.back": "Zpět",
|
||||||
|
"midnightcontrols.action.chat": "Otevřít chat",
|
||||||
|
"midnightcontrols.action.controls_ring": "Otevřít ovládací kroužek",
|
||||||
|
"midnightcontrols.action.debug_screen": "Otevřít debugovací HUD (F3)",
|
||||||
|
"midnightcontrols.action.drop_item": "Odhodit věc",
|
||||||
|
"midnightcontrols.action.drink": "Napít se",
|
||||||
|
"midnightcontrols.action.eat": "Najíst se",
|
||||||
|
"midnightcontrols.action.equip": "Vybavit se",
|
||||||
|
"midnightcontrols.action.exit": "Ukončit",
|
||||||
|
"midnightcontrols.action.forward": "Dopředu",
|
||||||
|
"midnightcontrols.action.hit": "Útok",
|
||||||
|
"midnightcontrols.action.hotbar_left": "Hotbar doleva",
|
||||||
|
"midnightcontrols.action.hotbar_right": "Hotbar doprava",
|
||||||
|
"midnightcontrols.action.inventory": "Inventář",
|
||||||
|
"midnightcontrols.action.jump": "Skok",
|
||||||
|
"midnightcontrols.action.left": "Doleva",
|
||||||
|
"midnightcontrols.action.pause_game": "Pozastavit hru",
|
||||||
|
"midnightcontrols.action.pick_block": "Vybrat blok",
|
||||||
|
"midnightcontrols.action.pickup": "Vzít",
|
||||||
|
"midnightcontrols.action.pickup_all": "Vzít vše",
|
||||||
|
"midnightcontrols.action.place": "Položit",
|
||||||
|
"midnightcontrols.action.player_list": "Seznam hráčů",
|
||||||
|
"midnightcontrols.action.quick_move": "Rychlý přesun",
|
||||||
|
"midnightcontrols.action.right": "Doprava",
|
||||||
|
"midnightcontrols.action.screenshot": "Vyfotit snímek obrazovky",
|
||||||
|
"midnightcontrols.action.slot_up": "Přesunout slot nahoru",
|
||||||
|
"midnightcontrols.action.slot_down": "Přesunout slot dolů",
|
||||||
|
"midnightcontrols.action.slot_left": "Přesunout slot doleva",
|
||||||
|
"midnightcontrols.action.slot_right": "Přesunout slot doprava",
|
||||||
|
"midnightcontrols.action.sneak": "Plížit se",
|
||||||
|
"midnightcontrols.action.sprint": "Sprintovat",
|
||||||
|
"midnightcontrols.action.swap_hands": "Vyměnit si ruce",
|
||||||
|
"midnightcontrols.action.toggle_perspective": "Změnit perspektivu",
|
||||||
|
"midnightcontrols.action.toggle_smooth_camera": "Nastavit kinematografickou kameru",
|
||||||
|
"midnightcontrols.action.page_back": "Předchozí stránka",
|
||||||
|
"midnightcontrols.action.page_next": "Následující stránka",
|
||||||
|
"midnightcontrols.action.tab_back": "Předchozí karta",
|
||||||
|
"midnightcontrols.action.tab_next": "Následující karta",
|
||||||
|
"midnightcontrols.action.take": "Vzít věc",
|
||||||
|
"midnightcontrols.action.take_all": "Vzít stack",
|
||||||
|
"midnightcontrols.action.use": "Použít",
|
||||||
|
"midnightcontrols.action.zoom": "Přiblížit",
|
||||||
|
"midnightcontrols.action.zoom_in": "Zvýšit přiblížení",
|
||||||
|
"midnightcontrols.action.zoom_out": "Snížit příblížení",
|
||||||
|
"midnightcontrols.action.zoom_reset": "Resetovat Přiblížení",
|
||||||
|
"midnightcontrols.action.emi_page_left": "Předchozí stránka",
|
||||||
|
"midnightcontrols.action.emi_page_right": "Následující stránka",
|
||||||
|
"midnightcontrols.category.emi": "EMI",
|
||||||
|
"midnightcontrols.button.a": "A",
|
||||||
|
"midnightcontrols.button.b": "B",
|
||||||
|
"midnightcontrols.button.x": "X",
|
||||||
|
"midnightcontrols.button.y": "Y",
|
||||||
|
"midnightcontrols.button.left_bumper": "Levý bumper",
|
||||||
|
"midnightcontrols.button.right_bumper": "Pravý bumper",
|
||||||
|
"midnightcontrols.button.back": "Zpět",
|
||||||
|
"midnightcontrols.button.start": "Start",
|
||||||
|
"midnightcontrols.button.guide": "Guide",
|
||||||
|
"midnightcontrols.button.left_thumb": "Levá páčka",
|
||||||
|
"midnightcontrols.button.right_thumb": "Pravá páčka",
|
||||||
|
"midnightcontrols.button.dpad_up": "DPAD nahoru",
|
||||||
|
"midnightcontrols.button.dpad_right": "DPAD doprava",
|
||||||
|
"midnightcontrols.button.dpad_down": "DPAD dolů",
|
||||||
|
"midnightcontrols.button.dpad_left": "DPAD doleva",
|
||||||
|
"midnightcontrols.button.l4": "L4",
|
||||||
|
"midnightcontrols.button.l5": "L5",
|
||||||
|
"midnightcontrols.button.r4": "R4",
|
||||||
|
"midnightcontrols.button.r5": "L5",
|
||||||
|
"midnightcontrols.axis.left_x+": "Levý X+",
|
||||||
|
"midnightcontrols.axis.left_y+": "Levý Y+",
|
||||||
|
"midnightcontrols.axis.right_x+": "Pravý X+",
|
||||||
|
"midnightcontrols.axis.right_y+": "Pravý Y+",
|
||||||
|
"midnightcontrols.axis.left_trigger": "Levý trigger",
|
||||||
|
"midnightcontrols.axis.right_trigger": "Pravý trigger",
|
||||||
|
"midnightcontrols.axis.left_x-": "Levý X-",
|
||||||
|
"midnightcontrols.axis.left_y-": "Levý Y-",
|
||||||
|
"midnightcontrols.axis.right_x-": "Pravý X-",
|
||||||
|
"midnightcontrols.axis.right_y-": "Pravý Y-",
|
||||||
|
"midnightcontrols.button.unknown": "Neznámý (%d)",
|
||||||
|
"midnightcontrols.controller.tutorial.title": "Hrajte hru s ovladačem!",
|
||||||
|
"midnightcontrols.controller.tutorial.description": "jděte do %s -> %s -> %s",
|
||||||
|
"midnightcontrols.controller.connected": "Ovladač %d připojen.",
|
||||||
|
"midnightcontrols.controller.disconnected": "Ovladač %d odpojen.",
|
||||||
|
"midnightcontrols.controller.mappings.1": "Chcete-li nakonfigurovat mapování ovladače, použijte %s",
|
||||||
|
"midnightcontrols.controller.mappings.3": "a vložte mapování do editoru souboru mapování.",
|
||||||
|
"midnightcontrols.controller.mappings.error": "Chyba při načítání mapování.",
|
||||||
|
"midnightcontrols.controller.mappings.error.write": "Chyba při zápisu mapování do souboru.",
|
||||||
|
"midnightcontrols.controller.mappings.updated": "Aktualizované mapování!",
|
||||||
|
"midnightcontrols.controller_type.default": "Výchozí",
|
||||||
|
"midnightcontrols.controller_type.dualshock": "DualShock",
|
||||||
|
"midnightcontrols.controller_type.dualsense": "DualSense",
|
||||||
|
"midnightcontrols.controller_type.switch": "Switch/Wii ovladač",
|
||||||
|
"midnightcontrols.controller_type.xbox": "Xbox One/Series ovladač",
|
||||||
|
"midnightcontrols.controller_type.xbox_360": "Xbox 360 ovladač",
|
||||||
|
"midnightcontrols.controller_type.steam_controller": "Steam ovladač",
|
||||||
|
"midnightcontrols.controller_type.steam_deck": "Steam Deck",
|
||||||
|
"midnightcontrols.controller_type.ouya": "OUYA ovladač",
|
||||||
|
"midnightcontrols.controller_type.numbered": "Ovladač s číslicemi",
|
||||||
|
"midnightcontrols.controls_mode.default": "Klávesnice/Myš",
|
||||||
|
"midnightcontrols.controls_mode.controller": "Ovladač",
|
||||||
|
"midnightcontrols.controls_mode.touchscreen": "Dotyk (Beta)",
|
||||||
|
"midnightcontrols.hud_side.LEFT": "Levý",
|
||||||
|
"midnightcontrols.hud_side.RIGHT": "Pravý",
|
||||||
|
"midnightcontrols.menu.analog_movement": "Analogový pohyb",
|
||||||
|
"midnightcontrols.menu.analog_movement.tooltip": "Pokud je to možné, umožňuje analogový pohyb.",
|
||||||
|
"midnightcontrols.menu.auto_switch_mode": "Režim automatického přepínání",
|
||||||
|
"midnightcontrols.menu.auto_switch_mode.tooltip": "Zda se má režim ovládání automaticky přepnout na ovladač, pokud je připojen.",
|
||||||
|
"midnightcontrols.menu.camera_mode": "Režim kamery",
|
||||||
|
"midnightcontrols.menu.controller": "Ovladač",
|
||||||
|
"midnightcontrols.menu.controller2": "Druhý ovladač",
|
||||||
|
"midnightcontrols.menu.controller2.tooltip": "Použije druhý ovladač, který umožňuje (například) podporu Joy-Conů.",
|
||||||
|
"midnightcontrols.menu.controller_toggle_sneak": "Přepnutí plížení na ovladači",
|
||||||
|
"midnightcontrols.menu.controller_toggle_sprint": "Přepnutí sprintování na ovladačí",
|
||||||
|
"midnightcontrols.menu.controller_type": "Typ ovladače",
|
||||||
|
"midnightcontrols.menu.controller_type.tooltip": "Typ používaného ovladače (potřebné pro zobrazení správných tlačítek).",
|
||||||
|
"midnightcontrols.menu.controls_mode": "Režim",
|
||||||
|
"midnightcontrols.menu.controls_mode.tooltip": "Režim ovládání.",
|
||||||
|
"midnightcontrols.menu.copy_controller_guid": "Zkopírovat GUID",
|
||||||
|
"midnightcontrols.menu.current_controller_guid": "GUID aktuálního ovladače: %s",
|
||||||
|
"midnightcontrols.menu.double_tap_to_sprint": "Dvojité klepnutí na sprintování",
|
||||||
|
"midnightcontrols.menu.double_tap_to_sprint.tooltip": "Přepíná, zda klávesa chůze vpřed při dvojitém rychlém poklepání umožní hráči sprintovat.",
|
||||||
|
"midnightcontrols.menu.fast_block_placing": "Rychlé pokládání bloků",
|
||||||
|
"midnightcontrols.menu.fast_block_placing.tooltip": "Při letu v kreativním režimu umožňuje rychlé pokládání bloků v závislosti na vaší rychlosti. §cNa některých serverech to může být považováno za podvádění§r.",
|
||||||
|
"midnightcontrols.menu.fly_drifting": "Fly Drifting",
|
||||||
|
"midnightcontrols.menu.fly_drifting.tooltip": "Za letu umožňuje Vanilla driftování/setrvačnost.",
|
||||||
|
"midnightcontrols.menu.fly_drifting_vertical": "Vertikální Fly Drifting",
|
||||||
|
"midnightcontrols.menu.fly_drifting_vertical.tooltip": "Za letu umožňuje Vanilla vertikální driftování/setrvačnost.",
|
||||||
|
"midnightcontrols.menu.hud_enable": "Zapnout HUD",
|
||||||
|
"midnightcontrols.menu.hud_enable.tooltip": "Přepíná indikátor tlačítek ovladače na obrazovce.",
|
||||||
|
"midnightcontrols.menu.hud_side": "Strana HUD",
|
||||||
|
"midnightcontrols.menu.hud_side.tooltip": "Pozice HUD.",
|
||||||
|
"midnightcontrols.menu.invert_right_x_axis": "Invertovat pravý X",
|
||||||
|
"midnightcontrols.menu.invert_right_y_axis": "Invertovat pravý Y",
|
||||||
|
"midnightcontrols.menu.joystick_as_mouse": "Vždy použít levou páčku jako myš",
|
||||||
|
"midnightcontrols.menu.joystick_as_mouse.tooltip": "V každém menu se páčka chová jako myš.",
|
||||||
|
"midnightcontrols.menu.eye_tracker_as_mouse": "Použití eye trackeru jako myši"
|
||||||
|
"midnightcontrols.menu.eye_tracker_as_mouse.tooltip": "Nahraďte myš zařízením pro sledování očí (například Tobii 5).",
|
||||||
|
"midnightcontrols.menu.eye_tracker_deadzone": "Velikost mrtvé zóny eye trackeru",
|
||||||
|
"midnightcontrols.menu.eye_tracker_deadzone.tooltip": "Zastaví pohyb kamery při pohledu do blízkosti crosshair",
|
||||||
|
"midnightcontrols.menu.keyboard_controls": "Ovládání klávesnice...",
|
||||||
|
"midnightcontrols.menu.left_dead_zone": "Mrtvá zóna levé páčky",
|
||||||
|
"midnightcontrols.menu.left_dead_zone.tooltip": "Mrtvá zóna levé analogové páčky ovladače.",
|
||||||
|
"midnightcontrols.menu.mappings.open_input_str": "Otevřít editor souborů mapování",
|
||||||
|
"midnightcontrols.menu.max_left_x_value": "Maximální hodnota levé osy X",
|
||||||
|
"midnightcontrols.menu.max_left_x_value.tooltip": "Změní hodnotu, kterou mod považuje za nejvyšší pro levou osu X. Užitečné, pokud osa nevyužívá celý rozsah a zdá se pomalá.",
|
||||||
|
"midnightcontrols.menu.max_left_y_value": "Maximální hodnota levé osy Y",
|
||||||
|
"midnightcontrols.menu.max_left_y_value.tooltip": "Změní hodnotu, kterou mod považuje za nejvyšší pro levou osu Y. Užitečné, pokud osa nevyužívá celý rozsah a zdá se pomalá.",
|
||||||
|
"midnightcontrols.menu.max_right_x_value": "Maximální hodnota pravé osy X",
|
||||||
|
"midnightcontrols.menu.max_right_x_value.tooltip": "Změní hodnotu, kterou mod považuje za nejvyšší pro pravou osu X. Užitečné, pokud osa nevyužívá celý rozsah a zdá se pomalá.",
|
||||||
|
"midnightcontrols.menu.max_right_y_value": "Maximální hodnota pravé osy Y",
|
||||||
|
"midnightcontrols.menu.max_right_y_value.tooltip": "Změní hodnotu, kterou mod považuje za nejvyšší pro pravou osu Y. Užitečné, pokud osa nevyužívá celý rozsah a zdá se pomalá.",
|
||||||
|
"midnightcontrols.menu.mouse_speed": "Rychlost myši",
|
||||||
|
"midnightcontrols.menu.mouse_speed.tooltip": "Rychlost emulované myši ovladače.",
|
||||||
|
"midnightcontrols.menu.move_chat": "Přesunutí vstupního pole chatu nahoru",
|
||||||
|
"midnightcontrols.menu.move_chat.tooltip": "Přesune pole pro zadávání chatu nahoru, aby se lépe zadávalo na zařízeních s klávesnicí na obrazovce.",
|
||||||
|
"midnightcontrols.menu.multiple_mapping_tip": "(Tip: Můžete také vložit více mapování najednou.)",
|
||||||
|
"midnightcontrols.menu.reacharound.horizontal": "Pokládání předního bloku",
|
||||||
|
"midnightcontrols.menu.reacharound.horizontal.tooltip": "Umožňuje umístění předního bloku, §ccož může být na některých serverech považováno za podvod.§r",
|
||||||
|
"midnightcontrols.menu.reacharound.vertical": "Vertikální dosah",
|
||||||
|
"midnightcontrols.menu.reacharound.vertical.tooltip": "Zapiná vertikální dosah, §ccož může být na některých serverech považováno za podvod.§r",
|
||||||
|
"midnightcontrols.menu.reload_controller_mappings": "Opětovné načíst mapování ovladače",
|
||||||
|
"midnightcontrols.menu.reload_controller_mappings.tooltip": "Znovu načte soubor mapování ovladače.",
|
||||||
|
"midnightcontrols.menu.right_dead_zone": "Mrtvá zóna pravé páčky",
|
||||||
|
"midnightcontrols.menu.right_dead_zone.tooltip": "Mrtvá zóna pravé analogové páčky ovladače.",
|
||||||
|
"midnightcontrols.menu.rotation_speed": "Rychlost otáčení osy X",
|
||||||
|
"midnightcontrols.menu.rotation_speed.tooltip": "Rychlost otáčení osy X v režimu ovladače.",
|
||||||
|
"midnightcontrols.menu.y_axis_rotation_speed": "Rychlost otáčení osy Y",
|
||||||
|
"midnightcontrols.menu.y_axis_rotation_speed.tooltip": "Rychlost otáčení osy Y v režimu ovladače.",
|
||||||
|
"midnightcontrols.menu.separate_controller_profile": "Samostatný profil ovladače",
|
||||||
|
"midnightcontrols.menu.separator.controller": "Ovladač",
|
||||||
|
"midnightcontrols.menu.separator.general": "Obecné",
|
||||||
|
"midnightcontrols.menu.title": "MidnightControls - Nastavení",
|
||||||
|
"midnightcontrols.menu.title.controller": "Nastavení ovladače",
|
||||||
|
"midnightcontrols.menu.title.controller_controls": "Vazby ovladače",
|
||||||
|
"midnightcontrols.menu.title.gameplay": "Herní možnosti",
|
||||||
|
"midnightcontrols.menu.title.general": "Obecné možnosti",
|
||||||
|
"midnightcontrols.menu.title.hud": "Možnosti HUD",
|
||||||
|
"midnightcontrols.menu.title.mappings.string": "Editor souborů mapování",
|
||||||
|
"midnightcontrols.menu.title.touch": "Možnosti dotyku",
|
||||||
|
"midnightcontrols.menu.title.visual": "Možnosti vzhledu",
|
||||||
|
"midnightcontrols.menu.touch_break_delay": "Zpoždění přerušení dotyku",
|
||||||
|
"midnightcontrols.menu.touch_speed": "Rychlost dotyku",
|
||||||
|
"midnightcontrols.menu.invert_touch": "Invertování směru dotyku",
|
||||||
|
"midnightcontrols.menu.touch_mode": "Režim dotykové interakce",
|
||||||
|
"midnightcontrols.menu.touch_transparency": "Průhlednost dotykového HUD",
|
||||||
|
"midnightcontrols.menu.touch_with_controller": "Dotyk v režimu ovladače",
|
||||||
|
"midnightcontrols.menu.unfocused_input": "Nezaostřený vstup",
|
||||||
|
"midnightcontrols.menu.unfocused_input.tooltip": "Umožňuje vstup do ovladače, když okno není zaostřené.",
|
||||||
|
"midnightcontrols.menu.virtual_mouse": "Virtuální myš",
|
||||||
|
"midnightcontrols.menu.virtual_mouse.tooltip": "Povoluje virtuální myš, která je užitečná při rozdělené obrazovce.",
|
||||||
|
"midnightcontrols.menu.virtual_mouse.skin": "Skin virtuální myši",
|
||||||
|
"midnightcontrols.menu.hide_cursor": "Skrytí normálního kurzoru myši",
|
||||||
|
"midnightcontrols.menu.hide_cursor.tooltip": "Skryje normální kurzor myši a ponechá viditelný pouze virtuální kurzor myši.",
|
||||||
|
"midnightcontrols.narrator.unbound": "Zrušení vazby na tlačítko %s",
|
||||||
|
"midnightcontrols.not_bound": "Není vázano",
|
||||||
|
"midnightcontrols.virtual_mouse.skin.default_light": "Výchozí světlá",
|
||||||
|
"midnightcontrols.virtual_mouse.skin.default_dark": "Výchozí tmavá",
|
||||||
|
"midnightcontrols.virtual_mouse.skin.second_light": "Druhá světlá",
|
||||||
|
"midnightcontrols.virtual_mouse.skin.second_dark": "Druhá tmavá",
|
||||||
|
"midnightcontrols.midnightconfig.category.controller": "Ovladač",
|
||||||
|
"midnightcontrols.midnightconfig.category.misc": "Různé",
|
||||||
|
"midnightcontrols.midnightconfig.category.screens": "Obrazovky",
|
||||||
|
"midnightcontrols.midnightconfig.category.gameplay": "Hra",
|
||||||
|
"midnightcontrols.midnightconfig.category.touch": "Dotyk",
|
||||||
|
"midnightcontrols.midnightconfig.category.visual": "Vizuál",
|
||||||
|
"modmenu.descriptionTranslation.midnightcontrols": "Přidává podporu ovladačů a celkově vylepšuje ovládání.\nPřevzato z LambdaControls, jehož vývoj byl ukončen."
|
||||||
|
}
|
||||||
|
|
||||||
@@ -146,6 +146,10 @@
|
|||||||
"midnightcontrols.menu.title.visual": "Visuelle Optionen",
|
"midnightcontrols.menu.title.visual": "Visuelle Optionen",
|
||||||
"midnightcontrols.menu.unfocused_input": "Unfokussierte Eingabe",
|
"midnightcontrols.menu.unfocused_input": "Unfokussierte Eingabe",
|
||||||
"midnightcontrols.menu.unfocused_input.tooltip": "Erlaube Controllereingabe auch wenn das Fenster nicht fokussiert ist.",
|
"midnightcontrols.menu.unfocused_input.tooltip": "Erlaube Controllereingabe auch wenn das Fenster nicht fokussiert ist.",
|
||||||
|
"midnightcontrols.virtual_keyboard.screen": "Virtuelle Tastatur",
|
||||||
|
"midnightcontrols.virtual_keyboard.keyboard.space": "Leertaste",
|
||||||
|
"midnightcontrols.virtual_keyboard.layout.en_US.qwerty": "Englisch (Qwerty)",
|
||||||
|
"midnightcontrols.virtual_keyboard.layout.de_DE.qwertz": "Deutsch (Qwertz)",
|
||||||
"midnightcontrols.menu.virtual_mouse": "Virtuelle Maus",
|
"midnightcontrols.menu.virtual_mouse": "Virtuelle Maus",
|
||||||
"midnightcontrols.menu.virtual_mouse.tooltip": "Aktiviere die virtuelle Maus.",
|
"midnightcontrols.menu.virtual_mouse.tooltip": "Aktiviere die virtuelle Maus.",
|
||||||
"midnightcontrols.menu.virtual_mouse.skin": "Aussehen der Virtuellen Maus",
|
"midnightcontrols.menu.virtual_mouse.skin": "Aussehen der Virtuellen Maus",
|
||||||
|
|||||||
@@ -130,8 +130,8 @@
|
|||||||
"midnightcontrols.controls_mode.default": "Keyboard/Mouse",
|
"midnightcontrols.controls_mode.default": "Keyboard/Mouse",
|
||||||
"midnightcontrols.controls_mode.controller": "Controller",
|
"midnightcontrols.controls_mode.controller": "Controller",
|
||||||
"midnightcontrols.controls_mode.touchscreen": "Touchscreen (Beta)",
|
"midnightcontrols.controls_mode.touchscreen": "Touchscreen (Beta)",
|
||||||
"midnightcontrols.hud_side.left": "Left",
|
"midnightcontrols.hud_side.LEFT": "Left",
|
||||||
"midnightcontrols.hud_side.right": "Right",
|
"midnightcontrols.hud_side.RIGHT": "Right",
|
||||||
"midnightcontrols.menu.analog_movement": "Analog Movement",
|
"midnightcontrols.menu.analog_movement": "Analog Movement",
|
||||||
"midnightcontrols.menu.analog_movement.tooltip": "When possible, enables 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": "Auto Switch Mode",
|
||||||
@@ -217,6 +217,10 @@
|
|||||||
"midnightcontrols.menu.touch_with_controller": "Touch in Controller mode",
|
"midnightcontrols.menu.touch_with_controller": "Touch in Controller mode",
|
||||||
"midnightcontrols.menu.unfocused_input": "Unfocused Input",
|
"midnightcontrols.menu.unfocused_input": "Unfocused Input",
|
||||||
"midnightcontrols.menu.unfocused_input.tooltip": "Allows controller input when the window is not focused.",
|
"midnightcontrols.menu.unfocused_input.tooltip": "Allows controller input when the window is not focused.",
|
||||||
|
"midnightcontrols.menu.virtual_keyboard": "Virtual Keyboard",
|
||||||
|
"midnightcontrols.menu.virtual_keyboard.tooltip": "Enables a virtual on-screen keyboard",
|
||||||
|
"midnightcontrols.menu.virtual_keyboard_layout": "Virtual Keyboard Layout",
|
||||||
|
"midnightcontrols.menu.virtual_keyboard_layout.tooltip": "Defines which layout the on-screen keyboard will follow.",
|
||||||
"midnightcontrols.menu.virtual_mouse": "Virtual Mouse",
|
"midnightcontrols.menu.virtual_mouse": "Virtual Mouse",
|
||||||
"midnightcontrols.menu.virtual_mouse.tooltip": "Enables the virtual mouse, which is useful during splitscreen.",
|
"midnightcontrols.menu.virtual_mouse.tooltip": "Enables the virtual mouse, which is useful during splitscreen.",
|
||||||
"midnightcontrols.menu.virtual_mouse.skin": "Virtual Mouse Skin",
|
"midnightcontrols.menu.virtual_mouse.skin": "Virtual Mouse Skin",
|
||||||
@@ -224,6 +228,10 @@
|
|||||||
"midnightcontrols.menu.hide_cursor.tooltip": "Hides the normal mouse cursor, leaving only the virtual mouse visible.",
|
"midnightcontrols.menu.hide_cursor.tooltip": "Hides the normal mouse cursor, leaving only the virtual mouse visible.",
|
||||||
"midnightcontrols.narrator.unbound": "Unbound %s",
|
"midnightcontrols.narrator.unbound": "Unbound %s",
|
||||||
"midnightcontrols.not_bound": "Not bound",
|
"midnightcontrols.not_bound": "Not bound",
|
||||||
|
"midnightcontrols.virtual_keyboard.screen": "Virtual Keyboard",
|
||||||
|
"midnightcontrols.virtual_keyboard.keyboard.space": "Space",
|
||||||
|
"midnightcontrols.virtual_keyboard.layout.en_US.qwerty": "English (Qwerty)",
|
||||||
|
"midnightcontrols.virtual_keyboard.layout.de_DE.qwertz": "German (Qwertz)",
|
||||||
"midnightcontrols.virtual_mouse.skin.default_light": "Default Light",
|
"midnightcontrols.virtual_mouse.skin.default_light": "Default Light",
|
||||||
"midnightcontrols.virtual_mouse.skin.default_dark": "Default Dark",
|
"midnightcontrols.virtual_mouse.skin.default_dark": "Default Dark",
|
||||||
"midnightcontrols.virtual_mouse.skin.second_light": "Second Light",
|
"midnightcontrols.virtual_mouse.skin.second_light": "Second Light",
|
||||||
|
|||||||
@@ -0,0 +1,238 @@
|
|||||||
|
{
|
||||||
|
"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,3 +1,3 @@
|
|||||||
accessWidener v1 named
|
accessWidener v1 named
|
||||||
|
|
||||||
#accessible class net/minecraft/client/gui/widget/EntryListWidget$MoveDirection
|
accessible class net/minecraft/client/gui/DrawContext$ScissorStack
|
||||||
@@ -1,27 +1,34 @@
|
|||||||
{
|
{
|
||||||
"required": true,
|
"required": true,
|
||||||
"package": "eu.midnightdust.midnightcontrols.client.mixin",
|
"package": "eu.midnightdust.midnightcontrols.client.mixin",
|
||||||
"compatibilityLevel": "JAVA_16",
|
"compatibilityLevel": "JAVA_21",
|
||||||
"client": [
|
"client": [
|
||||||
"ClickableWidgetAccessor",
|
"AbstractBlockAccessor",
|
||||||
|
"AbstractSignEditScreenMixin",
|
||||||
"AdvancementsScreenAccessor",
|
"AdvancementsScreenAccessor",
|
||||||
|
"BookEditScreenAccessor",
|
||||||
|
"BookSigningScreenAccessor",
|
||||||
|
"ChatScreenMixin",
|
||||||
|
"ClickableWidgetAccessor",
|
||||||
"ClientPlayerEntityMixin",
|
"ClientPlayerEntityMixin",
|
||||||
"GameOptionsScreenMixin",
|
|
||||||
"CreativeInventoryScreenAccessor",
|
"CreativeInventoryScreenAccessor",
|
||||||
|
"DrawContextAccessor",
|
||||||
|
"GameOptionsScreenMixin",
|
||||||
"GameRendererMixin",
|
"GameRendererMixin",
|
||||||
"HandledScreenMixin",
|
"HandledScreenMixin",
|
||||||
"KeyBindingMixin",
|
"InputAccessor",
|
||||||
"InputUtilMixin",
|
"InputUtilMixin",
|
||||||
"MinecraftClientMixin",
|
|
||||||
"MouseMixin",
|
|
||||||
"MouseAccessor",
|
|
||||||
"ChatScreenMixin",
|
|
||||||
"RecipeBookWidgetAccessor",
|
|
||||||
"WorldRendererMixin",
|
|
||||||
"KeyBindingIDAccessor",
|
"KeyBindingIDAccessor",
|
||||||
"TabNavigationWidgetAccessor",
|
"KeyBindingMixin",
|
||||||
|
"KeyboardMixin",
|
||||||
|
"MinecraftClientMixin",
|
||||||
|
"MouseAccessor",
|
||||||
|
"MouseMixin",
|
||||||
|
"RecipeBookScreenAccessor",
|
||||||
|
"RecipeBookWidgetAccessor",
|
||||||
"ScreenMixin",
|
"ScreenMixin",
|
||||||
"KeyboardMixin"
|
"TabNavigationWidgetAccessor",
|
||||||
|
"WorldRendererMixin"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"package": "eu.midnightdust.midnightcontrols.client.compat.mixin",
|
"package": "eu.midnightdust.midnightcontrols.client.compat.mixin",
|
||||||
"plugin": "eu.midnightdust.midnightcontrols.client.compat.MidnightControlsMixinPlugin",
|
"plugin": "eu.midnightdust.midnightcontrols.client.compat.MidnightControlsMixinPlugin",
|
||||||
"compatibilityLevel": "JAVA_16",
|
"compatibilityLevel": "JAVA_21",
|
||||||
"client": [
|
"client": [
|
||||||
"sodium.SodiumOptionsGUIAccessor"
|
"sodium.SodiumOptionsGUIAccessor"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ dependencies {
|
|||||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||||
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_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:midnightlib:${rootProject.midnightlib_version}-fabric")
|
||||||
modImplementation include ("maven.modrinth:obsidianui:${rootProject.obsidianui_version}-fabric") {}
|
modImplementation include ("maven.modrinth:obsidianui:${rootProject.obsidianui_version}-fabric")
|
||||||
include 'org.aperlambda:lambdajcommon:1.8.1'
|
include 'org.aperlambda:lambdajcommon:1.8.1'
|
||||||
modImplementation "maven.modrinth:emi:${project.emi_version}"
|
modCompileOnly "maven.modrinth:emi:${project.emi_version}"
|
||||||
|
|
||||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||||
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
|
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
|
||||||
@@ -93,6 +93,7 @@ unifiedPublishing {
|
|||||||
token = CURSEFORGE_TOKEN
|
token = CURSEFORGE_TOKEN
|
||||||
id = rootProject.curseforge_id
|
id = rootProject.curseforge_id
|
||||||
gameVersions.addAll "Java 21", project.minecraft_version
|
gameVersions.addAll "Java 21", project.minecraft_version
|
||||||
|
if (project.supported_versions != "") gameVersions.addAll project.supported_versions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,6 +104,7 @@ unifiedPublishing {
|
|||||||
id = rootProject.modrinth_id
|
id = rootProject.modrinth_id
|
||||||
version = "$project.version-$project.name"
|
version = "$project.version-$project.name"
|
||||||
gameVersions.addAll project.minecraft_version
|
gameVersions.addAll project.minecraft_version
|
||||||
|
if (project.supported_versions != "") gameVersions.addAll project.supported_versions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package eu.midnightdust.midnightcontrols.fabric;
|
|||||||
import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
|
import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsReloadListener;
|
||||||
|
import eu.midnightdust.midnightcontrols.fabric.event.MouseClickListener;
|
||||||
import eu.midnightdust.midnightcontrols.packet.ControlsModePayload;
|
import eu.midnightdust.midnightcontrols.packet.ControlsModePayload;
|
||||||
import eu.midnightdust.midnightcontrols.packet.FeaturePayload;
|
import eu.midnightdust.midnightcontrols.packet.FeaturePayload;
|
||||||
import eu.midnightdust.midnightcontrols.packet.HelloPayload;
|
import eu.midnightdust.midnightcontrols.packet.HelloPayload;
|
||||||
@@ -11,11 +13,16 @@ 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.keybinding.v1.KeyBindingHelper;
|
||||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
|
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
|
||||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
|
||||||
|
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents;
|
||||||
|
import net.fabricmc.fabric.api.client.screen.v1.ScreenMouseEvents;
|
||||||
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
|
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
|
||||||
import net.fabricmc.fabric.api.resource.ResourcePackActivationType;
|
import net.fabricmc.fabric.api.resource.ResourcePackActivationType;
|
||||||
|
import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener;
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.fabricmc.loader.api.ModContainer;
|
import net.fabricmc.loader.api.ModContainer;
|
||||||
import org.thinkingstudio.obsidianui.fabric.event.OpenScreenCallback;
|
import net.minecraft.resource.ResourceManager;
|
||||||
|
import net.minecraft.resource.ResourceType;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@@ -51,11 +58,25 @@ public class MidnightControlsClientFabric implements ClientModInitializer {
|
|||||||
ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> MidnightControlsClient.onLeave());
|
ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> MidnightControlsClient.onLeave());
|
||||||
|
|
||||||
ClientTickEvents.START_CLIENT_TICK.register(MidnightControlsClient::onTick);
|
ClientTickEvents.START_CLIENT_TICK.register(MidnightControlsClient::onTick);
|
||||||
|
ScreenEvents.AFTER_INIT.register((client, screen, scaledWidth, scaledHeight) -> {
|
||||||
|
ScreenMouseEvents.allowMouseClick(screen).register(new MouseClickListener(screen));
|
||||||
|
});
|
||||||
|
|
||||||
FabricLoader.getInstance().getModContainer(MidnightControlsConstants.NAMESPACE).ifPresent(modContainer -> {
|
FabricLoader.getInstance().getModContainer(MidnightControlsConstants.NAMESPACE).ifPresent(modContainer -> {
|
||||||
ResourceManagerHelper.registerBuiltinResourcePack(id("bedrock"), modContainer, ResourcePackActivationType.NORMAL);
|
ResourceManagerHelper.registerBuiltinResourcePack(id("bedrock"), modContainer, ResourcePackActivationType.NORMAL);
|
||||||
ResourceManagerHelper.registerBuiltinResourcePack(id("legacy"), modContainer, ResourcePackActivationType.NORMAL);
|
ResourceManagerHelper.registerBuiltinResourcePack(id("legacy"), modContainer, ResourcePackActivationType.NORMAL);
|
||||||
});
|
});
|
||||||
MidnightControlsClient.initClient();
|
MidnightControlsClient.initClient();
|
||||||
|
|
||||||
|
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(new SimpleSynchronousResourceReloadListener() {
|
||||||
|
@Override
|
||||||
|
public Identifier getFabricId() {
|
||||||
|
return id("keyboard_layouts");
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void reload(ResourceManager manager) {
|
||||||
|
MidnightControlsReloadListener.INSTANCE.reload(manager);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package eu.midnightdust.midnightcontrols.fabric.event;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||||
|
import net.fabricmc.fabric.api.client.screen.v1.ScreenMouseEvents;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
|
||||||
|
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.clickInterceptor;
|
||||||
|
|
||||||
|
public class MouseClickListener implements ScreenMouseEvents.AllowMouseClick {
|
||||||
|
private final Screen screen;
|
||||||
|
|
||||||
|
public MouseClickListener(Screen screen) {
|
||||||
|
this.screen = screen;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean allowMouseClick(Screen screen, double mouseX, double mouseY, int button) {
|
||||||
|
if(MidnightControlsConfig.virtualKeyboard) {
|
||||||
|
clickInterceptor.intercept(screen, mouseX, mouseY);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add equals and hashCode to prevent duplicate registrations
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (obj instanceof MouseClickListener) {
|
||||||
|
return ((MouseClickListener) obj).screen == this.screen;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return screen.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -54,13 +54,14 @@
|
|||||||
"fabric": ">=0.71.0",
|
"fabric": ">=0.71.0",
|
||||||
"minecraft": ">=1.20.5",
|
"minecraft": ">=1.20.5",
|
||||||
"obsidianui": ">=0.2.5",
|
"obsidianui": ">=0.2.5",
|
||||||
"java": ">=17"
|
"java": ">=21"
|
||||||
},
|
},
|
||||||
"suggests": {
|
"suggests": {
|
||||||
"kontrolo": "*"
|
"kontrolo": "*"
|
||||||
},
|
},
|
||||||
"breaks": {
|
"breaks": {
|
||||||
"lambdacontrols": "*",
|
"lambdacontrols": "*",
|
||||||
"modmenu": "<1.12.2"
|
"modmenu": "<1.12.2",
|
||||||
|
"sodium": "<=0.5.11"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,33 +2,34 @@
|
|||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.jvmargs=-Xmx2048M
|
org.gradle.jvmargs=-Xmx2048M
|
||||||
|
|
||||||
minecraft_version=1.21
|
minecraft_version=1.21.6
|
||||||
yarn_mappings=1.21+build.2
|
supported_versions=1.21.8
|
||||||
|
yarn_mappings=1.21.6+build.1
|
||||||
enabled_platforms=fabric,neoforge
|
enabled_platforms=fabric,neoforge
|
||||||
|
|
||||||
archives_base_name=midnightcontrols
|
archives_base_name=midnightcontrols
|
||||||
mod_version=1.10.0-alpha.1
|
mod_version=1.11.2
|
||||||
maven_group=eu.midnightdust
|
maven_group=eu.midnightdust
|
||||||
release_type=release
|
release_type=release
|
||||||
modrinth_id = bXX9h73M
|
modrinth_id = bXX9h73M
|
||||||
curseforge_id = 621768
|
curseforge_id = 621768
|
||||||
# Configure the IDs here after creating the projects on the websites
|
# Configure the IDs here after creating the projects on the websites
|
||||||
|
|
||||||
midnightlib_version=1.5.7
|
midnightlib_version=1.7.5+1.21.6
|
||||||
|
|
||||||
fabric_loader_version=0.15.11
|
fabric_loader_version=0.16.14
|
||||||
fabric_api_version=0.100.1+1.21
|
fabric_api_version=0.127.0+1.21.6
|
||||||
|
|
||||||
neoforge_version=21.0.14-beta
|
neoforge_version=21.6.0-beta
|
||||||
yarn_mappings_patch_neoforge_version = 1.21+build.4
|
yarn_mappings_patch_neoforge_version = 1.21+build.4
|
||||||
|
|
||||||
quilt_loader_version=0.19.0-beta.18
|
quilt_loader_version=0.19.0-beta.18
|
||||||
quilt_fabric_api_version=7.0.1+0.83.0-1.20
|
quilt_fabric_api_version=7.0.1+0.83.0-1.20
|
||||||
|
|
||||||
sodium_version=mc1.21-0.5.11
|
sodium_version=mc1.21-0.6.0-beta.1
|
||||||
obsidianui_version=0.2.7+mc1.21
|
obsidianui_version=0.2.12+mc1.21.6
|
||||||
modmenu_version=10.0.0-beta.1
|
modmenu_version=10.0.0-beta.1
|
||||||
emotecraft_version=2.1.3-SNAPSHOT-build.29-MC1.19-fabric
|
emotecraft_version=2.5.5+1.21.4-fabric
|
||||||
bendylib_version=2.0.+
|
bendylib_version=2.0.+
|
||||||
emi_version=1.1.10+1.21+fabric
|
emi_version=1.1.10+1.21+fabric
|
||||||
libgui_version=6.0.0+1.19
|
libgui_version=6.0.0+1.19
|
||||||
|
|||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
10
gradlew
vendored
10
gradlew
vendored
@@ -15,6 +15,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
@@ -55,7 +57,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
@@ -84,7 +86,7 @@ done
|
|||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
# 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
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
@@ -200,10 +202,10 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# 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"'
|
DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Collect all arguments for the java command:
|
# Collect all arguments for the java command:
|
||||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
# and any embedded shellness will be escaped.
|
# 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
|
# * 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.
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|||||||
24
gradlew.bat
vendored
24
gradlew.bat
vendored
@@ -13,6 +13,8 @@
|
|||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%"=="" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@@ -34,7 +36,7 @@ set APP_HOME=%DIRNAME%
|
|||||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
|
|||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if %ERRORLEVEL% equ 0 goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
@@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ configurations {
|
|||||||
dependencies {
|
dependencies {
|
||||||
neoForge "net.neoforged:neoforge:$rootProject.neoforge_version"
|
neoForge "net.neoforged:neoforge:$rootProject.neoforge_version"
|
||||||
modImplementation include ("maven.modrinth:midnightlib:${rootProject.midnightlib_version}-neoforge")
|
modImplementation include ("maven.modrinth:midnightlib:${rootProject.midnightlib_version}-neoforge")
|
||||||
modImplementation include ("maven.modrinth:obsidianui:${rootProject.obsidianui_version}-neoforge") {}
|
modImplementation include ("maven.modrinth:obsidianui:${rootProject.obsidianui_version}-neoforge")
|
||||||
shadowBundle('org.aperlambda:lambdajcommon:1.8.1') {
|
shadowBundle('org.aperlambda:lambdajcommon:1.8.1') {
|
||||||
exclude group: 'com.google.code.gson'
|
exclude group: 'com.google.code.gson'
|
||||||
exclude group: 'com.google.guava'
|
exclude group: 'com.google.guava'
|
||||||
@@ -105,6 +105,7 @@ unifiedPublishing {
|
|||||||
token = CURSEFORGE_TOKEN
|
token = CURSEFORGE_TOKEN
|
||||||
id = rootProject.curseforge_id
|
id = rootProject.curseforge_id
|
||||||
gameVersions.addAll "Java 21", project.minecraft_version
|
gameVersions.addAll "Java 21", project.minecraft_version
|
||||||
|
if (project.supported_versions != "") gameVersions.addAll project.supported_versions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,6 +116,7 @@ unifiedPublishing {
|
|||||||
id = rootProject.modrinth_id
|
id = rootProject.modrinth_id
|
||||||
version = "$project.version-$project.name"
|
version = "$project.version-$project.name"
|
||||||
gameVersions.addAll project.minecraft_version
|
gameVersions.addAll project.minecraft_version
|
||||||
|
if (project.supported_versions != "") gameVersions.addAll project.supported_versions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,12 @@ public class NetworkUtilImpl {
|
|||||||
handler.send(packet);
|
handler.send(packet);
|
||||||
}
|
}
|
||||||
public static void sendPayloadC2S(CustomPayload payload) {
|
public static void sendPayloadC2S(CustomPayload payload) {
|
||||||
if (handler != null && client.world != null)
|
if (handler != null && client.world != null) {
|
||||||
|
try {
|
||||||
handler.send(new CustomPayloadC2SPacket(payload));
|
handler.send(new CustomPayloadC2SPacket(payload));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.fillInStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,9 +2,11 @@ package eu.midnightdust.midnightcontrols.neoforge;
|
|||||||
|
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
|
||||||
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
|
||||||
|
import eu.midnightdust.midnightcontrols.client.MidnightControlsReloadListener;
|
||||||
import eu.midnightdust.midnightcontrols.client.util.platform.NetworkUtil;
|
import eu.midnightdust.midnightcontrols.client.util.platform.NetworkUtil;
|
||||||
import eu.midnightdust.midnightcontrols.packet.ControlsModePayload;
|
import eu.midnightdust.midnightcontrols.packet.ControlsModePayload;
|
||||||
import eu.midnightdust.midnightcontrols.packet.HelloPayload;
|
import eu.midnightdust.midnightcontrols.packet.HelloPayload;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.resource.DirectoryResourcePack;
|
import net.minecraft.resource.DirectoryResourcePack;
|
||||||
import net.minecraft.resource.ResourcePackInfo;
|
import net.minecraft.resource.ResourcePackInfo;
|
||||||
import net.minecraft.resource.ResourcePackPosition;
|
import net.minecraft.resource.ResourcePackPosition;
|
||||||
@@ -18,9 +20,7 @@ import net.neoforged.bus.api.SubscribeEvent;
|
|||||||
import net.neoforged.fml.ModList;
|
import net.neoforged.fml.ModList;
|
||||||
import net.neoforged.fml.common.EventBusSubscriber;
|
import net.neoforged.fml.common.EventBusSubscriber;
|
||||||
import net.neoforged.fml.common.Mod;
|
import net.neoforged.fml.common.Mod;
|
||||||
import net.neoforged.neoforge.client.event.ClientPlayerNetworkEvent;
|
import net.neoforged.neoforge.client.event.*;
|
||||||
import net.neoforged.neoforge.client.event.ClientTickEvent;
|
|
||||||
import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent;
|
|
||||||
import net.neoforged.neoforge.event.AddPackFindersEvent;
|
import net.neoforged.neoforge.event.AddPackFindersEvent;
|
||||||
import net.neoforged.neoforgespi.locating.IModFile;
|
import net.neoforged.neoforgespi.locating.IModFile;
|
||||||
|
|
||||||
@@ -34,6 +34,8 @@ import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.BIN
|
|||||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.BINDING_LOOK_UP;
|
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.BINDING_LOOK_UP;
|
||||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.BINDING_RING;
|
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.BINDING_RING;
|
||||||
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.client;
|
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.client;
|
||||||
|
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.clickInterceptor;
|
||||||
|
|
||||||
|
|
||||||
@Mod(value = NAMESPACE, dist = Dist.CLIENT)
|
@Mod(value = NAMESPACE, dist = Dist.CLIENT)
|
||||||
public class MidnightControlsClientNeoforge {
|
public class MidnightControlsClientNeoforge {
|
||||||
@@ -71,6 +73,10 @@ public class MidnightControlsClientNeoforge {
|
|||||||
} catch (NullPointerException e) {e.fillInStackTrace();}
|
} catch (NullPointerException e) {e.fillInStackTrace();}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onResourceReload(AddClientReloadListenersEvent event) {
|
||||||
|
event.addListener(id("keyboard-layouts"), MidnightControlsReloadListener.INSTANCE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusSubscriber(modid = NAMESPACE, bus = EventBusSubscriber.Bus.GAME, value = Dist.CLIENT)
|
@EventBusSubscriber(modid = NAMESPACE, bus = EventBusSubscriber.Bus.GAME, value = Dist.CLIENT)
|
||||||
@@ -90,5 +96,15 @@ public class MidnightControlsClientNeoforge {
|
|||||||
public static void startClientTick(ClientTickEvent.Pre event) {
|
public static void startClientTick(ClientTickEvent.Pre event) {
|
||||||
MidnightControlsClient.onTick(client);
|
MidnightControlsClient.onTick(client);
|
||||||
}
|
}
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onMouseButtonPressed(ScreenEvent.MouseButtonPressed.Pre event) {
|
||||||
|
if (MidnightControlsConfig.virtualKeyboard && !event.isCanceled()) {
|
||||||
|
Screen screen = event.getScreen();
|
||||||
|
double mouseX = event.getMouseX();
|
||||||
|
double mouseY = event.getMouseY();
|
||||||
|
|
||||||
|
clickInterceptor.intercept(screen, mouseX, mouseY);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class MidnightControlsNeoforge {
|
|||||||
public class CommonEvents {
|
public class CommonEvents {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void registerPayloads(RegisterPayloadHandlersEvent event) {
|
public static void registerPayloads(RegisterPayloadHandlersEvent event) {
|
||||||
PayloadRegistrar registrar = event.registrar("1");
|
PayloadRegistrar registrar = event.registrar("1").optional();
|
||||||
registrar.playToServer(HelloPayload.PACKET_ID, HelloPayload.codec, (payload, context) -> {
|
registrar.playToServer(HelloPayload.PACKET_ID, HelloPayload.codec, (payload, context) -> {
|
||||||
ControlsMode.byId(payload.controlsMode()).ifPresent(controlsMode -> new PlayerChangeControlsModeEvent(context.player(), controlsMode));
|
ControlsMode.byId(payload.controlsMode()).ifPresent(controlsMode -> new PlayerChangeControlsModeEvent(context.player(), controlsMode));
|
||||||
context.connection().send(new CustomPayloadS2CPacket(new FeaturePayload(MidnightControlsFeature.HORIZONTAL_REACHAROUND)));
|
context.connection().send(new CustomPayloadS2CPacket(new FeaturePayload(MidnightControlsFeature.HORIZONTAL_REACHAROUND)));
|
||||||
|
|||||||
Reference in New Issue
Block a user