Compare commits

...

31 Commits

Author SHA1 Message Date
Motschen
c086ecfcef MidnightControls 1.8.1 - Bugfix and Ukrainian Translation
- Fixes #185 (Left joystick not working like a mouse when it's supposed to)
- Includes Ukrainian translation by @forditt (from #170)
2023-03-18 18:53:21 +01:00
Motschen
66cdca30fe MidnightControls 1.8.0 - 1.19.4, New GUI handling, Better reacharound
- Port to 1.19.4
- Drastically improve GUI handling
  - Directions are now respected instead of acting like the Tab key (possible thanks to 1.19.4)
  - The new tabs can be navigated using the shoulder buttons
- Sodium and Iris now have way better controller navigation thanks to isXander's PRs to them
- Improved reacharound thanks to MonstoBusta
- Cleaner advanced options screen
- Better auto-detection of the Steam Deck
2023-03-15 19:14:48 +01:00
Martin Prokoph
6e49667ada Merge pull request #178 from MonstoBusta/1.19.4-Atlas
Partially Rewrite Horizontal Reacharound
2023-03-15 14:21:53 +01:00
Martin Prokoph
d4c3208cee Merge branch '1.19.4' into 1.19.4-Atlas 2023-03-15 14:18:44 +01:00
Motschen
35a4fbee1b Many improvements for new GUI handling 2023-03-09 19:49:21 +01:00
MonstoBusta
2aac2ad4e7 Partially Rewrite Horizontal Reacharound
Replace use of BlockPos with Vec3d to allow double increased clamp on vector instead of integer.
2023-02-27 01:16:24 -06:00
Motschen
4b2919bfca Disable access widener 2023-02-15 11:13:21 +01:00
Motschen
1c999137ba Experimental port to 23w06a
Some stuff is still broken, but I managed to implement directional movement in screens
2023-02-15 11:11:39 +01:00
Motschen
d48952fec9 Fix YACL category switching with bumpers 2023-01-03 18:47:41 +01:00
Martin Prokoph
9deab7228d Merge pull request #144 from isXander/compat/yacl
YACL compatibility.
2023-01-03 17:25:21 +00:00
Martin Prokoph
b4d82a7230 Merge branch '1.19.3' into compat/yacl 2023-01-03 17:23:48 +00:00
Motschen
36e241e438 MidnightControls 1.7.3 - FAPI 0.71 hotfix 2023-01-03 18:18:21 +01:00
Martin Prokoph
bdbee99fe2 Merge pull request #155 from HttpRafa/1.19.3
Fixed error with Fabric API version 0.71.0+1.19.3
2023-01-03 17:02:12 +00:00
Martin Prokoph
439cd0858e Merge pull request #149 from glaav/patch-1
it_it.json (italian translations)
2023-01-03 17:01:08 +00:00
HttpRafa
617648cf57 Fixed error with Fabric API version 0.71.0+1.19.3 2023-01-03 03:11:44 +01:00
glaav
89914a1b6e Italian Translations 2022-12-15 19:51:03 +01:00
isXander
c272fb457f YACL compat (WIP) 2022-12-09 22:50:51 +00:00
Motschen
308b41094f MidnightControls 1.7.2 - Port to 1.19.3, various new options
- Update to 1.19.3 (Tabbing through creative tabs behaves the same as before, that was hard)
- Add an option to move the chat input field to the top of the screen for better input on devices using an on-screen keyboard
- Add an option to make the left joystick behave like a mouse in every screen
- Add a button to more easily access the Advanced Config
2022-12-09 20:02:59 +01:00
Martin Prokoph
bf7209083a Merge pull request #140 from eric122804/patch-1
Create zh_tw
2022-12-09 13:19:55 +00:00
Martin Prokoph
187844db2b Merge pull request #142 from eric122805/patch-1
Create zh_tw
2022-12-09 13:19:19 +00:00
eric122805
24ced76d06 Create zh_tw 2022-12-08 20:30:20 +08:00
eric122804
aa75a58a4d Create zh_tw 2022-12-07 20:30:51 +08:00
Motschen
1f675622f0 Use MidnightLib 22w43a version from Modrinth 2022-10-27 20:51:17 +02:00
Motschen
2d902bbf3c Port to 22w43a 2022-10-27 20:25:26 +02:00
Motschen
9cc5393703 More mod compatibility & Add missing contributor names 2022-10-27 20:00:14 +02:00
Motschen
8d08fdedf4 MidnightControls 1.7.0 - Fixes & Controller Profiles
- Fix diagonal movement speed (PR #113, thanks @dogtopus, closes #42)
- Toggle Sprint and Toggle Sneak can now be enabled separately just for controllers (closes #102)
- Added button binding profile support (closes #107)
- Fix button binding tooltips intersecting with chat on large GUI scales (closes #106)
- Add assets for non-licensed (numbered) PlayStation controllers (closes #110)
- Fix reacharound outline color
- Fix pixel error in legacy icons (closes #84)
- Fix creative flight being slow with Bedrockify installed (just disables the "disableFlyingMomentum" option on launch)
2022-10-16 15:53:03 +02:00
Martin Prokoph
cdafde01f3 Merge pull request #113 from dogtopus/preserve-speed-when-moving-diagonally
Preserve speed when moving diagonally
2022-10-13 15:26:53 +02:00
dogtopus
c07c4200f7 Clamp the speed to 1 so using dpad will not double the speed 2022-10-12 19:17:27 -03:00
dogtopus
c70da21df6 Preserve speed when moving diagonally
The original algorithm squares both X and Y separately, which cause the movement speed to drop by up to half when not moving perfectly along the axes. The new algorithm converts the XY speed vector into a speed and a moving angle vector and only square the speed instead. This prevents the slowdown issue present in the original algorithm.
2022-10-12 18:55:53 -03:00
Motschen
f5d5d93c19 Lowered value at which the HUD is considered as crammed 2022-09-23 21:06:21 +02:00
Motschen
429b4ca607 Add controller profiles, Fix HUD issues, Fix Reacharound Outline Color
Addresses #107 and #106
2022-09-23 20:48:32 +02:00
49 changed files with 1377 additions and 361 deletions

View File

@@ -1,5 +1,5 @@
plugins { plugins {
id 'fabric-loom' version '0.12-SNAPSHOT' id 'fabric-loom' version '1.1-SNAPSHOT'
id 'java-library' id 'java-library'
id 'maven-publish' id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '7.0.0' id 'com.github.johnrengelman.shadow' version '7.0.0'
@@ -32,7 +32,7 @@ boolean isMCVersionNonRelease() {
} }
String getMCVersionString() { String getMCVersionString() {
if (isMCVersionNonRelease()) { if (isMCVersionNonRelease() || project.minecraft_version == "1.19.4") {
return project.minecraft_version return project.minecraft_version
} }
def version = project.minecraft_version.split('\\.') def version = project.minecraft_version.split('\\.')
@@ -94,7 +94,9 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway. // Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "dev.lambdaurora:spruceui:${project.spruceui_version}" modImplementation ("dev.lambdaurora:spruceui:${project.spruceui_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
include "dev.lambdaurora:spruceui:${project.spruceui_version}" include "dev.lambdaurora:spruceui:${project.spruceui_version}"
api('org.aperlambda:lambdajcommon:1.8.1') { api('org.aperlambda:lambdajcommon:1.8.1') {
exclude group: 'com.google.code.gson' exclude group: 'com.google.code.gson'
@@ -102,7 +104,9 @@ dependencies {
} }
include 'org.aperlambda:lambdajcommon:1.8.1' include 'org.aperlambda:lambdajcommon:1.8.1'
modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}" modCompileOnlyApi ("com.terraformersmc:modmenu:${project.modmenu_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
// Compatibility mods // Compatibility mods
@@ -110,16 +114,17 @@ dependencies {
// modImplementation("maven.modrinth:ok-zoomer:${project.ok_zoomer_version}") // modImplementation("maven.modrinth:ok-zoomer:${project.ok_zoomer_version}")
// modImplementation "io.github.ennuil:LibZoomer:${project.libzoomer_version}" // modImplementation "io.github.ennuil:LibZoomer:${project.libzoomer_version}"
modImplementation "io.github.cottonmc:LibGui:${project.libgui_version}" modCompileOnlyApi "io.github.cottonmc:LibGui:${project.libgui_version}"
modImplementation "org.quiltmc:quilt-json5:1.0.0" modCompileOnlyApi "org.quiltmc:quilt-json5:1.0.0"
modCompileOnly "maven.modrinth:sodium:${project.sodium_version}" modCompileOnly "maven.modrinth:sodium:${project.sodium_version}"
modImplementation("maven.modrinth:emi:${project.emi_version}") modCompileOnlyApi "maven.modrinth:emi:${project.emi_version}"
modImplementation "maven.modrinth:emotecraft:${project.emotecraft_version}" modCompileOnlyApi "maven.modrinth:emotecraft:${project.emotecraft_version}"
modImplementation "io.github.kosmx:bendy-lib:${project.bendylib_version}" modCompileOnlyApi "io.github.kosmx:bendy-lib:${project.bendylib_version}"
modImplementation "dev.isxander:yet-another-config-lib:${project.yacl_version}" modCompileOnlyApi "dev.isxander:yet-another-config-lib:${project.yacl_version}"
modImplementation "maven.modrinth:inventory-tabs-updated:${project.inventorytabs_version}" modCompileOnlyApi "maven.modrinth:inventory-tabs-updated:${project.inventorytabs_version}"
modCompileOnlyApi "maven.modrinth:bedrockify:${project.bedrockify_version}"
// Required for Inventory Tabs // Required for Inventory Tabs
modApi("me.shedaniel.cloth:cloth-config-fabric:${project.clothconfig_version}") { modCompileOnlyApi("me.shedaniel.cloth:cloth-config-fabric:${project.clothconfig_version}") {
exclude(group: "net.fabricmc.fabric-api") exclude(group: "net.fabricmc.fabric-api")
} }

View File

@@ -3,30 +3,31 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
minecraft_version=1.19.2 minecraft_version=1.19.4
yarn_mappings=1.19.2+build.9 yarn_mappings=1.19.4+build.1
loader_version=0.14.9 loader_version=0.14.17
# Mod Properties # Mod Properties
mod_version = 1.6.0 mod_version = 1.8.1
maven_group = eu.midnightdust maven_group = eu.midnightdust
archives_base_name = midnightcontrols archives_base_name = midnightcontrols
modrinth_id=bXX9h73M modrinth_id=bXX9h73M
# Dependencies # Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.60.0+1.19.2 fabric_version=0.75.3+1.19.4
sodium_version=mc1.19.2-0.4.4 sodium_version=mc1.19.2-0.4.4
spruceui_version=4.0.0+1.19 spruceui_version=4.2.0+1.19.4
midnightlib_version=0.6.1 midnightlib_version=1.2.1-fabric
modmenu_version=4.0.6 modmenu_version=5.0.1
emotecraft_version=2.1.3-SNAPSHOT-build.29-MC1.19-fabric emotecraft_version=2.1.3-SNAPSHOT-build.29-MC1.19-fabric
bendylib_version=2.0.+ bendylib_version=2.0.+
emi_version=0.4.0+1.19 emi_version=0.5.0+1.19.3
libgui_version=6.0.0+1.19 libgui_version=6.0.0+1.19
inventorytabs_version=inventorytabs-0.9.beta-1.19.x inventorytabs_version=inventorytabs-0.9.beta-1.19.x
clothconfig_version=7.0.72 clothconfig_version=7.0.72
yacl_version=0.1.2 yacl_version=2.2.0
bedrockify_version=1.5+mc1.19.1-2
# Ok Zoomer and LibZoomer are temporarily disabled for the time being, as we are currently using Reflection at runtime instead in OkZoomerCompat due to there being two major, completely incompatible API versions. # Ok Zoomer and LibZoomer are temporarily disabled for the time being, as we are currently using Reflection at runtime instead in OkZoomerCompat due to there being two major, completely incompatible API versions.
# ok_zoomer_version=5.0.0-beta.3+1.17.1 # ok_zoomer_version=5.0.0-beta.3+1.17.1

View File

@@ -32,7 +32,8 @@ public enum ControllerType implements Nameable {
XBOX(5), XBOX(5),
STEAM_DECK(6), STEAM_DECK(6),
STEAM_CONTROLLER(7), STEAM_CONTROLLER(7),
OUYA(8); OUYA(8),
NUMBERED(9);
private final int id; private final int id;
private final Text text; private final Text text;

View File

@@ -15,6 +15,7 @@ import eu.midnightdust.midnightcontrols.MidnightControls;
import eu.midnightdust.midnightcontrols.MidnightControlsConstants; import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
import eu.midnightdust.midnightcontrols.MidnightControlsFeature; import eu.midnightdust.midnightcontrols.MidnightControlsFeature;
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat; import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
import eu.midnightdust.midnightcontrols.client.compat.VoxelMapCompat;
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.Controller; import eu.midnightdust.midnightcontrols.client.controller.Controller;
@@ -22,6 +23,7 @@ import eu.midnightdust.midnightcontrols.client.controller.InputManager;
import eu.midnightdust.midnightcontrols.client.gui.MidnightControlsHud; import eu.midnightdust.midnightcontrols.client.gui.MidnightControlsHud;
import eu.midnightdust.midnightcontrols.client.gui.RingScreen; import eu.midnightdust.midnightcontrols.client.gui.RingScreen;
import eu.midnightdust.midnightcontrols.client.gui.TouchscreenOverlay; import eu.midnightdust.midnightcontrols.client.gui.TouchscreenOverlay;
import eu.midnightdust.midnightcontrols.client.mixin.KeyBindingIDAccessor;
import eu.midnightdust.midnightcontrols.client.mixin.KeyBindingRegistryImplAccessor; import eu.midnightdust.midnightcontrols.client.mixin.KeyBindingRegistryImplAccessor;
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;
@@ -57,6 +59,7 @@ import java.util.TimerTask;
*/ */
public class MidnightControlsClient extends MidnightControls implements ClientModInitializer { public class MidnightControlsClient extends MidnightControls implements ClientModInitializer {
public static boolean lateInitDone = false; public static boolean lateInitDone = false;
public static boolean voxelmapInitDone = false;
private static MidnightControlsClient INSTANCE; private static MidnightControlsClient INSTANCE;
public static final KeyBinding BINDING_LOOK_UP = InputManager.makeKeyBinding(new Identifier(MidnightControlsConstants.NAMESPACE, "look_up"), public static final KeyBinding BINDING_LOOK_UP = InputManager.makeKeyBinding(new Identifier(MidnightControlsConstants.NAMESPACE, "look_up"),
InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_8, "key.categories.movement"); InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_KP_8, "key.categories.movement");
@@ -141,6 +144,14 @@ public class MidnightControlsClient extends MidnightControls implements ClientMo
public void onMcInit(@NotNull MinecraftClient client) { public void onMcInit(@NotNull MinecraftClient client) {
ButtonBinding.init(client.options); ButtonBinding.init(client.options);
MidnightControlsConfig.load(); MidnightControlsConfig.load();
if (MidnightControlsConfig.configVersion < 2) {
MidnightControlsConfig.mouseScreens.remove("me.jellysquid.mods.sodium.client.gui");
MidnightControlsConfig.mouseScreens.remove("net.coderbot.iris.gui");
MidnightControlsConfig.mouseScreens.remove("net.minecraft.class_5375");
MidnightControlsConfig.mouseScreens.remove("net.minecraft.client.gui.screen.pack.PackScreen");
MidnightControlsConfig.configVersion = 2;
MidnightControlsConfig.write("midnightcontrols");
}
this.hud.setVisible(MidnightControlsConfig.hudEnable); this.hud.setVisible(MidnightControlsConfig.hudEnable);
Controller.updateMappings(); Controller.updateMappings();
GLFW.glfwSetJoystickCallback((jid, event) -> { GLFW.glfwSetJoystickCallback((jid, event) -> {
@@ -163,10 +174,16 @@ public class MidnightControlsClient extends MidnightControls implements ClientMo
* This method is called to initialize keybindings * This method is called to initialize keybindings
*/ */
public void initKeybindings() { public void initKeybindings() {
if (!voxelmapInitDone && FabricLoader.getInstance().isModLoaded("voxelmap") && KeyBindingIDAccessor.getKEYS_BY_ID().containsKey("key.minimap.toggleingamewaypoints")) {
this.log("Adding VoxelMap compatibility...");
new VoxelMapCompat().handle(this);
InputManager.loadButtonBindings();
voxelmapInitDone = true;
}
if (lateInitDone) return; if (lateInitDone) return;
if (KeyBindingRegistryImplAccessor.getModdedKeyBindings() == null || KeyBindingRegistryImplAccessor.getModdedKeyBindings().isEmpty()) return; if (KeyBindingRegistryImplAccessor.getMODDED_KEY_BINDINGS() == null || KeyBindingRegistryImplAccessor.getMODDED_KEY_BINDINGS().isEmpty()) return;
for (int i = 0; i < KeyBindingRegistryImplAccessor.getModdedKeyBindings().size(); ++i) { for (int i = 0; i < KeyBindingRegistryImplAccessor.getMODDED_KEY_BINDINGS().size(); ++i) {
KeyBinding keyBinding = KeyBindingRegistryImplAccessor.getModdedKeyBindings().get(i); KeyBinding keyBinding = KeyBindingRegistryImplAccessor.getMODDED_KEY_BINDINGS().get(i);
if (!keyBinding.getTranslationKey().contains("midnightcontrols") && !keyBinding.getTranslationKey().contains("ok_zoomer") && !keyBinding.getTranslationKey().contains("okzoomer")) { if (!keyBinding.getTranslationKey().contains("midnightcontrols") && !keyBinding.getTranslationKey().contains("ok_zoomer") && !keyBinding.getTranslationKey().contains("okzoomer")) {
category = null; category = null;
InputManager.streamCategories().forEach(buttonCategory -> { InputManager.streamCategories().forEach(buttonCategory -> {

View File

@@ -10,6 +10,8 @@
package eu.midnightdust.midnightcontrols.client; 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.mojang.blaze3d.platform.GlDebugInfo;
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.MidnightControlsFeature; import eu.midnightdust.midnightcontrols.MidnightControlsFeature;
@@ -17,6 +19,7 @@ import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
import eu.midnightdust.midnightcontrols.client.controller.Controller; import eu.midnightdust.midnightcontrols.client.controller.Controller;
import eu.midnightdust.midnightcontrols.client.controller.InputManager; import eu.midnightdust.midnightcontrols.client.controller.InputManager;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ChatScreen;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
@@ -31,51 +34,64 @@ import static org.lwjgl.glfw.GLFW.*;
*/ */
public class MidnightControlsConfig extends MidnightConfig { public class MidnightControlsConfig extends MidnightConfig {
public static boolean isEditing = false; public static boolean isEditing = false;
@Hidden @Entry public static int configVersion = 1; @Hidden @Entry public static int configVersion = 2;
// General // General
@Entry(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(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(name = "Debug") public static boolean debug = false; @Entry(category = "misc", name = "Debug") public static boolean debug = false;
// HUD // HUD
@Entry(name = "midnightcontrols.menu.hud_enable") public static boolean hudEnable = true; @Entry(category = "visual", name = "midnightcontrols.menu.hud_enable") public static boolean hudEnable = true;
@Entry(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;
// Gameplay // Gameplay
@Entry(name = "midnightcontrols.menu.analog_movement") public static boolean analogMovement = true; @Entry(category = "gameplay", name = "midnightcontrols.menu.analog_movement") public static boolean analogMovement = true;
@Entry(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(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.controller_toggle_sneak") public static boolean controllerToggleSneak = MinecraftClient.getInstance().options.getSneakToggled().getValue();
@Entry(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.controller_toggle_sprint") public static boolean controllerToggleSprint = MinecraftClient.getInstance().options.getSprintToggled().getValue();
@Entry(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.fast_block_placing") public static boolean fastBlockPlacing = false; // Disabled by default as this behaviour can be considered cheating on multiplayer servers.
@Entry(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.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(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.fly_drifting_vertical") public static boolean verticalFlyDrifting = true; // Enabled by default as disabling this behaviour can be considered cheating on multiplayer servers.
@Entry(name = "Reacharound Outline") public static boolean shouldRenderReacharoundOutline = true; @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(name = "Reacharound Outline Color (WIP)", isColor = true) public static String reacharoundOutlineColorHex = "#ffffff"; @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(name = "Reacharound Outline Alpha", min = 0, max = 255) public static int reacharoundOutlineColorAlpha = 102; @Entry(category = "visual", name = "Reacharound Outline") public static boolean shouldRenderReacharoundOutline = true;
@Entry(name = "midnightcontrols.menu.right_dead_zone") public static double rightDeadZone = 0.25; @Entry(category = "visual", name = "Reacharound Outline Color", isColor = true) public static String reacharoundOutlineColorHex = "#ffffff";
@Entry(name = "midnightcontrols.menu.left_dead_zone") public static double leftDeadZone = 0.25; @Entry(category = "visual", name = "Reacharound Outline Alpha", isSlider = true, min = 0, max = 255) public static int reacharoundOutlineColorAlpha = 102;
@Entry(name = "midnightcontrols.menu.invert_right_y_axis") public static boolean invertRightYAxis = false; @Entry(category = "controller", name = "midnightcontrols.menu.right_dead_zone", isSlider = true, min = 0.05, max = 1) public static double rightDeadZone = 0.25;
@Entry(name = "midnightcontrols.menu.invert_right_x_axis") public static boolean invertRightXAxis = false; @Entry(category = "controller", name = "midnightcontrols.menu.left_dead_zone", isSlider = true, min = 0.05, max = 1) public static double leftDeadZone = 0.25;
@Entry(name = "midnightcontrols.menu.rotation_speed") public static double rotationSpeed = 40.0; //used for x-axis, name kept for compatability @Entry(category = "controller", name = "midnightcontrols.menu.invert_right_y_axis") public static boolean invertRightYAxis = false;
@Entry(name = "midnightcontrols.menu.y_axis_rotation_speed") public static double yAxisRotationSpeed = rotationSpeed; @Entry(category = "controller", name = "midnightcontrols.menu.invert_right_x_axis") public static boolean invertRightXAxis = false;
@Entry(name = "midnightcontrols.menu.mouse_speed") public static double mouseSpeed = 25.0; @Entry(category = "controller", name = "midnightcontrols.menu.rotation_speed", isSlider = true, min = 0, max = 100, precision = 10) public static double rotationSpeed = 40.0; //used for x-axis, name kept for compatibility
@Entry(name = "midnightcontrols.menu.unfocused_input") public static boolean unfocusedInput = false; @Entry(category = "controller", name = "midnightcontrols.menu.y_axis_rotation_speed", isSlider = true, min = 0, max = 100, precision = 10) public static double yAxisRotationSpeed = rotationSpeed;
@Entry(name = "midnightcontrols.menu.virtual_mouse") public static boolean virtualMouse = false; @Entry(category = "screens", name = "midnightcontrols.menu.mouse_speed", isSlider = true, min = 0, max = 150, precision = 10) public static double mouseSpeed = 25.0;
@Entry(name = "midnightcontrols.menu.virtual_mouse.skin") public static VirtualMouseSkin virtualMouseSkin = VirtualMouseSkin.DEFAULT_LIGHT; @Entry(category = "screens", name = "midnightcontrols.menu.joystick_as_mouse") public static boolean joystickAsMouse = false;
@Entry(name = "Controller ID") public static Object controllerID = 0; @Entry(category = "controller", name = "midnightcontrols.menu.unfocused_input") public static boolean unfocusedInput = false;
@Entry(name = "2nd Controller ID") public static Object secondControllerID = -1; @Entry(category = "screens", name = "midnightcontrols.menu.virtual_mouse") public static boolean virtualMouse = false;
@Entry(name = "midnightcontrols.menu.controller_type") public static ControllerType controllerType = ControllerType.DEFAULT; @Entry(category = "screens", name = "midnightcontrols.menu.virtual_mouse.skin") public static VirtualMouseSkin virtualMouseSkin = VirtualMouseSkin.DEFAULT_LIGHT;
@Entry(name = "Mouse screens") public static List<String> mouseScreens = Lists.newArrayList("me.jellysquid.mods.sodium.client.gui", @Entry(category = "controller", name = "Controller ID") @Hidden public static Object controllerID = 0;
"net.coderbot.iris.gui", "net.minecraft.client.gui.screen.advancement", "net.minecraft.client.gui.screen.pack.PackScreen", "net.minecraft.class_5375", @Entry(category = "controller", name = "2nd Controller ID") @Hidden public static Object secondControllerID = -1;
"net.minecraft.class_457", "net.minecraft.class_408", "me.flashyreese.mods.reeses_sodium_options.client.gui", "dev.emi.emi.screen", @Entry(category = "visual", name = "midnightcontrols.menu.controller_type") public static ControllerType controllerType = ControllerType.DEFAULT;
"hardcorequesting.client.interfaces.GuiQuestBook", "hardcorequesting.client.interfaces.GuiReward", "hardcorequesting.client.interfaces.EditTrackerScreen"); @Entry(category = "screens", name = "Mouse screens") public static List<String> mouseScreens = Lists.newArrayList("net.minecraft.client.gui.screen.advancement",
@Entry(name = "Keybindings") public static Map<String, String> BINDINGS = new HashMap<>(); "net.minecraft.class_457", "net.minecraft.class_408", "net.minecraft.class_3872", "me.flashyreese.mods.reeses_sodium_options.client.gui", "dev.emi.emi.screen",
"hardcorequesting.client.interfaces.GuiQuestBook", "hardcorequesting.client.interfaces.GuiReward", "hardcorequesting.client.interfaces.EditTrackerScreen",
"me.shedaniel.clothconfig2.gui.ClothConfigScreen", "com.mamiyaotaru.voxelmap.gui.GuiWaypoints", "com.mamiyaotaru.voxelmap.gui.GuiPersistentMap");
@Entry(category = "screens", name = "Arrow screens") public static List<String> arrowScreens = Lists.newArrayList(ChatScreen.class.getCanonicalName());
@Entry(category = "screens", name = "WASD screens") public static List<String> wasdScreens = Lists.newArrayList("com.ultreon.devices.core.Laptop");
@Entry @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+)\\+?");
@Entry(name = "Max analog values") public static double[] maxAnalogValues = new double[]{1, 1, 1, 1}; @Deprecated @Hidden @Entry public static double[] maxAnalogValues = new double[]{1, 1, 1, 1};
@Entry(name = "Trigger button fix") public static boolean triggerFix = true; @Entry(category = "controller", name = "Max analog value: Left X", isSlider = true, min = .25f, max = 1.f) public static double maxAnalogValueLeftX = maxAnalogValues[0];
@Entry(name = "Enable Hints") public static boolean enableHints = true; @Entry(category = "controller", name = "Max analog value: Left Y", isSlider = true, min = .25f, max = 1.f) public static double maxAnalogValueLeftY = maxAnalogValues[1];
@Entry(name = "Enable Shortcut in Controls Options") public static boolean shortcutInControls = true; @Entry(category = "controller", name = "Max analog value: Right X", isSlider = true, min = .25f, max = 1.f) public static double maxAnalogValueRightX = maxAnalogValues[2];
@Entry(name = "Ring Bindings (WIP)") public static List<String> ringBindings = new ArrayList<>(); @Entry(category = "controller", name = "Max analog value: Right Y", isSlider = true, min = .25f, max = 1.f) public static double maxAnalogValueRightY = maxAnalogValues[3];
@Entry(name = "Ignored Unbound Keys") public static List<String> ignoredUnboundKeys = Lists.newArrayList("inventorytabs.key.next_tab"); @Entry(category = "controller", name = "Trigger button fix") public static boolean triggerFix = true;
@Entry(category = "gameplay", name = "Enable Hints") public static boolean enableHints = true;
@Entry(category = "screens", name = "Enable Shortcut in Controls Options") public static boolean shortcutInControls = true;
@Entry(category = "misc", name = "Ring Bindings (WIP)") public static List<String> ringBindings = new ArrayList<>();
@Entry(category = "misc", name = "Ignored Unbound Keys") public static List<String> ignoredUnboundKeys = Lists.newArrayList("inventorytabs.key.next_tab");
@Entry @Hidden public static Map<String, Map<String, String>> controllerBindingProfiles = new HashMap<>();
private static Map<String, String> currentBindingProfile = new HashMap<>();
private static Controller prevController;
/** /**
* Loads the configuration * Loads the configuration
@@ -95,6 +111,15 @@ public class MidnightControlsConfig extends MidnightConfig {
MidnightControlsClient.get().log("Configuration saved."); MidnightControlsClient.get().log("Configuration saved.");
MidnightControlsFeature.refreshEnabled(); MidnightControlsFeature.refreshEnabled();
} }
public static void updateBindingsForController(Controller controller) {
if (controller.isConnected() && controller.isGamepad() && controllerBindingProfiles.containsKey(controller.getGuid()))
currentBindingProfile = controllerBindingProfiles.get(controller.getGuid());
else currentBindingProfile = Maps.newHashMap(BINDING);
InputManager.loadButtonBindings();
}
public static Map<String, String> getBindingsForController() {
return currentBindingProfile;
}
/** /**
* Gets the used controller. * Gets the used controller.
* *
@@ -118,6 +143,8 @@ public class MidnightControlsConfig extends MidnightConfig {
} }
} }
if (controller.isConnected() && controller.isGamepad() && MidnightControlsConfig.autoSwitchMode && !isEditing) MidnightControlsConfig.controlsMode = ControlsMode.CONTROLLER; if (controller.isConnected() && controller.isGamepad() && MidnightControlsConfig.autoSwitchMode && !isEditing) MidnightControlsConfig.controlsMode = ControlsMode.CONTROLLER;
if (prevController != controller) updateBindingsForController(controller);
prevController = controller;
return controller; return controller;
} }
@@ -175,14 +202,21 @@ public class MidnightControlsConfig extends MidnightConfig {
} }
public static double getAxisMaxValue(int axis) { public static double getAxisMaxValue(int axis) {
if (axis >= MidnightControlsConfig.maxAnalogValues.length) return switch (axis) {
return 1; case GLFW_GAMEPAD_AXIS_LEFT_X -> MidnightControlsConfig.maxAnalogValueLeftX;
return MidnightControlsConfig.maxAnalogValues[axis]; case GLFW_GAMEPAD_AXIS_LEFT_Y -> MidnightControlsConfig.maxAnalogValueLeftY;
case GLFW_GAMEPAD_AXIS_RIGHT_X -> MidnightControlsConfig.maxAnalogValueRightX;
default -> MidnightControlsConfig.maxAnalogValueRightY;
};
} }
public static void setAxisMaxValue(int axis, double value) { public static void setAxisMaxValue(int axis, double value) {
if (axis < MidnightControlsConfig.maxAnalogValues.length) switch (axis) {
MidnightControlsConfig.maxAnalogValues[axis] = value; case GLFW_GAMEPAD_AXIS_LEFT_X -> MidnightControlsConfig.maxAnalogValueLeftX = value;
case GLFW_GAMEPAD_AXIS_LEFT_Y -> MidnightControlsConfig.maxAnalogValueLeftY = value;
case GLFW_GAMEPAD_AXIS_RIGHT_X -> MidnightControlsConfig.maxAnalogValueRightX = value;
default -> MidnightControlsConfig.maxAnalogValueRightY = value;
};
} }
/** /**
@@ -192,7 +226,7 @@ public class MidnightControlsConfig extends MidnightConfig {
*/ */
public static void loadButtonBinding(@NotNull ButtonBinding button) { public static void loadButtonBinding(@NotNull ButtonBinding button) {
button.setButton(button.getDefaultButton()); button.setButton(button.getDefaultButton());
var code = MidnightControlsConfig.BINDINGS.getOrDefault("controller.controls." + button.getName(), button.getButtonCode()); var code = getBindingsForController().getOrDefault("controller.controls." + button.getName(), button.getButtonCode());
var matcher = BUTTON_BINDING_PATTERN.matcher(code); var matcher = BUTTON_BINDING_PATTERN.matcher(code);
@@ -216,14 +250,14 @@ public class MidnightControlsConfig extends MidnightConfig {
button.setButton(buttons); button.setButton(buttons);
} catch (Exception e) { } catch (Exception e) {
MidnightControlsClient.get().warn("Malformed config value \"" + code + "\" for binding \"" + button.getName() + "\"."); MidnightControlsClient.get().warn("Malformed config value \"" + code + "\" for binding \"" + button.getName() + "\".");
MidnightControlsConfig.BINDINGS.put("controller.controls." + button.getName(), button.getButtonCode()); setButtonBinding(button, button.getButton());
} }
} }
private static boolean checkValidity(@NotNull ButtonBinding binding, @NotNull String input, String group) { private static boolean checkValidity(@NotNull ButtonBinding binding, @NotNull String input, String group) {
if (group == null) { if (group == null) {
MidnightControlsClient.get().warn("Malformed config value \"" + input + "\" for binding \"" + binding.getName() + "\"."); MidnightControlsClient.get().warn("Malformed config value \"" + input + "\" for binding \"" + binding.getName() + "\".");
MidnightControlsConfig.BINDINGS.put("controller.controls." + binding.getName(), binding.getButtonCode()); setButtonBinding(binding, binding.getButton());
return false; return false;
} }
return true; return true;
@@ -237,7 +271,9 @@ public class MidnightControlsConfig extends MidnightConfig {
*/ */
public static void setButtonBinding(@NotNull ButtonBinding binding, int[] button) { public static void setButtonBinding(@NotNull ButtonBinding binding, int[] button) {
binding.setButton(button); binding.setButton(button);
MidnightControlsConfig.BINDINGS.put("controller.controls." + binding.getName(), binding.getButtonCode()); getBindingsForController().put("controller.controls." + binding.getName(), binding.getButtonCode());
if (controllerBindingProfiles.containsKey(getController().getGuid())) controllerBindingProfiles.get(getController().getGuid()).put("controller.controls." + binding.getName(), binding.getButtonCode());
else BINDING.put("controller.controls." + binding.getName(), binding.getButtonCode());
} }
public static boolean isBackButton(int btn, boolean isBtn, int state) { public static boolean isBackButton(int btn, boolean isBtn, int state) {
@@ -282,6 +318,8 @@ public class MidnightControlsConfig extends MidnightConfig {
hudSide = HudSide.LEFT; hudSide = HudSide.LEFT;
analogMovement = true; analogMovement = true;
doubleTapToSprint = true; doubleTapToSprint = true;
controllerToggleSneak = MinecraftClient.getInstance().options.getSneakToggled().getValue();
controllerToggleSprint = MinecraftClient.getInstance().options.getSprintToggled().getValue();
fastBlockPlacing = false; fastBlockPlacing = false;
flyDrifting = true; flyDrifting = true;
verticalFlyDrifting = true; verticalFlyDrifting = true;
@@ -303,14 +341,18 @@ public class MidnightControlsConfig extends MidnightConfig {
controllerID = 0; controllerID = 0;
secondControllerID = -1; secondControllerID = -1;
controllerType = ControllerType.DEFAULT; controllerType = ControllerType.DEFAULT;
mouseScreens = Lists.newArrayList("me.jellysquid.mods.sodium.client.gui", "net.coderbot.iris.gui", "net.minecraft.client.gui.screen.advancement", "net.minecraft.client.gui.screen.pack.PackScreen", "net.minecraft.class_5375", "net.minecraft.class_457", "net.minecraft.class_408", "me.flashyreese.mods.reeses_sodium_options.client.gui", "dev.emi.emi.screen"); mouseScreens = Lists.newArrayList("net.minecraft.client.gui.screen.advancement", "net.minecraft.class_457", "net.minecraft.class_408", "net.minecraft.class_3872", "me.flashyreese.mods.reeses_sodium_options.client.gui", "dev.emi.emi.screen", "me.shedaniel.clothconfig2.gui.ClothConfigScreen", "com.mamiyaotaru.voxelmap.gui.GuiWaypoints", "com.mamiyaotaru.voxelmap.gui.GuiPersistentMap");
BINDINGS = new HashMap<>(); BINDING = new HashMap<>();
maxAnalogValues = new double[]{1, 1, 1, 1}; maxAnalogValueLeftX = 1;
maxAnalogValueLeftY = 1;
maxAnalogValueRightX = 1;
maxAnalogValueRightY = 1;
triggerFix = true; triggerFix = true;
enableHints = true; enableHints = true;
shortcutInControls = true; shortcutInControls = true;
ringBindings = new ArrayList<>(); ringBindings = new ArrayList<>();
ignoredUnboundKeys = Lists.newArrayList("inventorytabs.key.next_tab"); ignoredUnboundKeys = Lists.newArrayList("inventorytabs.key.next_tab");
controllerBindingProfiles = new HashMap<>();
} }
/** /**
@@ -322,9 +364,9 @@ 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 deck")) return ControllerType.STEAM_DECK; else if (controller.contains("steam") && GlDebugInfo.getCpuInfo().contains("AMD Custom APU")) return ControllerType.STEAM_DECK;
else if (controller.contains("steam")) return ControllerType.STEAM_CONTROLLER; else if (controller.contains("steam")) return ControllerType.STEAM_CONTROLLER;
else if (controller.contains("dualsense")) 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;
else if (controller.contains("switch") || controller.contains("joy-con") || controller.contains("wii") || controller.contains("nintendo")) return ControllerType.SWITCH; else if (controller.contains("switch") || controller.contains("joy-con") || controller.contains("wii") || controller.contains("nintendo")) return ControllerType.SWITCH;
else if (controller.contains("ouya")) return ControllerType.OUYA; else if (controller.contains("ouya")) return ControllerType.OUYA;

View File

@@ -13,10 +13,7 @@ import com.google.common.collect.ImmutableSet;
import dev.lambdaurora.spruceui.widget.AbstractSpruceWidget; import dev.lambdaurora.spruceui.widget.AbstractSpruceWidget;
import dev.lambdaurora.spruceui.widget.container.SpruceEntryListWidget; import dev.lambdaurora.spruceui.widget.container.SpruceEntryListWidget;
import eu.midnightdust.midnightcontrols.MidnightControls; import eu.midnightdust.midnightcontrols.MidnightControls;
import eu.midnightdust.midnightcontrols.client.compat.EmotecraftCompat; import eu.midnightdust.midnightcontrols.client.compat.*;
import eu.midnightdust.midnightcontrols.client.compat.LibGuiCompat;
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
import eu.midnightdust.midnightcontrols.client.compat.SodiumCompat;
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding; import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
import eu.midnightdust.midnightcontrols.client.controller.Controller; import eu.midnightdust.midnightcontrols.client.controller.Controller;
import eu.midnightdust.midnightcontrols.client.controller.InputManager; import eu.midnightdust.midnightcontrols.client.controller.InputManager;
@@ -49,6 +46,8 @@ import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
import net.minecraft.client.gui.screen.multiplayer.MultiplayerServerListWidget; import net.minecraft.client.gui.screen.multiplayer.MultiplayerServerListWidget;
import net.minecraft.client.gui.screen.world.WorldListWidget; import net.minecraft.client.gui.screen.world.WorldListWidget;
import net.minecraft.client.gui.widget.*; import net.minecraft.client.gui.widget.*;
import net.minecraft.client.input.Input;
import net.minecraft.client.util.InputUtil;
import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.Slot;
import net.minecraft.text.TranslatableTextContent; import net.minecraft.text.TranslatableTextContent;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@@ -73,7 +72,9 @@ public class MidnightInput {
private static final Map<Integer, Integer> BUTTON_COOLDOWNS = new HashMap<>(); private static final Map<Integer, Integer> BUTTON_COOLDOWNS = new HashMap<>();
// Cooldowns // Cooldowns
public int actionGuiCooldown = 0; public int actionGuiCooldown = 0;
public int joystickCooldown = 0;
public boolean ignoreNextARelease = false; public boolean ignoreNextARelease = false;
public boolean ignoreNextXRelease = false;
private double targetYaw = 0.0; private double targetYaw = 0.0;
private double targetPitch = 0.0; private double targetPitch = 0.0;
private float prevXAxis = 0.f; private float prevXAxis = 0.f;
@@ -126,6 +127,8 @@ public class MidnightInput {
--this.actionGuiCooldown; --this.actionGuiCooldown;
if (this.screenCloseCooldown > 0) if (this.screenCloseCooldown > 0)
--this.screenCloseCooldown; --this.screenCloseCooldown;
if (this.joystickCooldown > 0)
--this.joystickCooldown;
InputManager.updateStates(); InputManager.updateStates();
@@ -317,16 +320,30 @@ public class MidnightInput {
return; return;
} }
if (action == 0 || action == 2) { if (client.currentScreen != null && (action == 0 || action == 2) && button == GLFW_GAMEPAD_BUTTON_Y &&
MidnightControlsConfig.arrowScreens.contains(client.currentScreen.getClass().getCanonicalName())) {
pressKeyboardKey(client, GLFW.GLFW_KEY_ENTER);
this.screenCloseCooldown = 5;
}
else if (action == 0 || action == 2) {
if (client.currentScreen != null if (client.currentScreen != null
&& (button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_UP || button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_DOWN && (button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_UP || button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_DOWN
|| button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_LEFT || button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_RIGHT)) { || button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_LEFT || button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_RIGHT)) {
if (this.actionGuiCooldown == 0) { if (this.actionGuiCooldown == 0) {
if (button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_UP) { switch (button) {
this.changeFocus(client.currentScreen, NavigationDirection.UP); case GLFW_GAMEPAD_BUTTON_DPAD_UP -> this.changeFocus(client.currentScreen, NavigationDirection.UP);
} else if (button == GLFW.GLFW_GAMEPAD_BUTTON_DPAD_DOWN) { case GLFW_GAMEPAD_BUTTON_DPAD_DOWN -> this.changeFocus(client.currentScreen, NavigationDirection.DOWN);
this.changeFocus(client.currentScreen, NavigationDirection.DOWN); case GLFW_GAMEPAD_BUTTON_DPAD_LEFT -> this.handleLeftRight(client.currentScreen, false);
} else this.handleLeftRight(client.currentScreen, button != GLFW.GLFW_GAMEPAD_BUTTON_DPAD_LEFT); case GLFW_GAMEPAD_BUTTON_DPAD_RIGHT -> this.handleLeftRight(client.currentScreen, true);
}
if (MidnightControlsConfig.wasdScreens.contains(client.currentScreen.getClass().getCanonicalName())) {
switch (button) {
case GLFW_GAMEPAD_BUTTON_DPAD_UP -> pressKeyboardKey(client, GLFW.GLFW_KEY_W);
case GLFW_GAMEPAD_BUTTON_DPAD_DOWN -> pressKeyboardKey(client, GLFW.GLFW_KEY_S);
case GLFW_GAMEPAD_BUTTON_DPAD_LEFT -> pressKeyboardKey(client, GLFW.GLFW_KEY_A);
case GLFW_GAMEPAD_BUTTON_DPAD_RIGHT -> pressKeyboardKey(client, GLFW.GLFW_KEY_D);
}
}
} }
return; return;
} }
@@ -356,17 +373,57 @@ public class MidnightInput {
double mouseX = client.mouse.getX() * (double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth(); double mouseX = client.mouse.getX() * (double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth();
double mouseY = client.mouse.getY() * (double) client.getWindow().getScaledHeight() / (double) client.getWindow().getHeight(); double mouseY = client.mouse.getY() * (double) client.getWindow().getScaledHeight() / (double) client.getWindow().getHeight();
if (action == 0) { if (action == 0) {
Screen.wrapScreenError(() -> client.currentScreen.mouseClicked(mouseX, mouseY, GLFW.GLFW_MOUSE_BUTTON_1), Screen.wrapScreenError(() -> {
((MouseAccessor) client.mouse).setLeftButtonClicked(false);
client.currentScreen.mouseClicked(mouseX, mouseY, GLFW.GLFW_MOUSE_BUTTON_1);
},
"mouseClicked event handler", client.currentScreen.getClass().getCanonicalName()); "mouseClicked event handler", client.currentScreen.getClass().getCanonicalName());
} else if (action == 1) { } else if (action == 1) {
Screen.wrapScreenError(() -> client.currentScreen.mouseReleased(mouseX, mouseY, GLFW.GLFW_MOUSE_BUTTON_1), Screen.wrapScreenError(() -> {
((MouseAccessor) client.mouse).setLeftButtonClicked(false);
client.currentScreen.mouseReleased(mouseX, mouseY, GLFW.GLFW_MOUSE_BUTTON_1);
},
"mouseReleased event handler", client.currentScreen.getClass().getCanonicalName()); "mouseReleased event handler", client.currentScreen.getClass().getCanonicalName());
} else if (action == 2) {
Screen.wrapScreenError(() -> {
client.currentScreen.setDragging(true);
((MouseAccessor) client.mouse).setLeftButtonClicked(true);
((MouseAccessor) client.mouse).midnightcontrols$onCursorPos(client.getWindow().getHandle(), client.mouse.getX(), client.mouse.getY());
client.currentScreen.setDragging(false);
},
"mouseClicked event handler", client.currentScreen.getClass().getCanonicalName());
} }
this.screenCloseCooldown = 5; this.screenCloseCooldown = 5;
} else { } else {
this.ignoreNextARelease = false; this.ignoreNextARelease = false;
} }
} }
else if (button == GLFW.GLFW_GAMEPAD_BUTTON_X && client.currentScreen != null && !isScreenInteractive(client.currentScreen)
&& this.actionGuiCooldown == 0) {
if (client.currentScreen instanceof HandledScreen<?> handledScreen && ((HandledScreenAccessor) handledScreen).midnightcontrols$getSlotAt(
client.mouse.getX() * (double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth(),
client.mouse.getY() * (double) client.getWindow().getScaledHeight() / (double) client.getWindow().getHeight()) != null) return;
if (!this.ignoreNextXRelease) {
double mouseX = client.mouse.getX() * (double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth();
double mouseY = client.mouse.getY() * (double) client.getWindow().getScaledHeight() / (double) client.getWindow().getHeight();
if (action == 0) {
Screen.wrapScreenError(() -> client.currentScreen.mouseClicked(mouseX, mouseY, GLFW.GLFW_MOUSE_BUTTON_2),
"mouseClicked event handler", client.currentScreen.getClass().getCanonicalName());
} else if (action == 1) {
Screen.wrapScreenError(() -> client.currentScreen.mouseReleased(mouseX, mouseY, GLFW.GLFW_MOUSE_BUTTON_2),
"mouseReleased event handler", client.currentScreen.getClass().getCanonicalName());
}
this.screenCloseCooldown = 5;
} else {
this.ignoreNextXRelease = false;
}
}
}
public void pressKeyboardKey(MinecraftClient client, int key) {
client.keyboard.onKey(client.getWindow().getHandle(), key, 0, 1, 0);
}
public void pressKeyboardKey(Screen screen, int key) {
screen.keyPressed(key, 0, 1);
} }
/** /**
@@ -513,9 +570,8 @@ public class MidnightInput {
return; return;
} }
} else if (client.currentScreen != null) { } else if (client.currentScreen != null) {
if (axis == GLFW_GAMEPAD_AXIS_RIGHT_Y && absValue >= deadZone) {
float finalValue = value; float finalValue = value;
if (client.currentScreen.children().stream().filter(element -> element instanceof SpruceEntryListWidget) if (axis == GLFW_GAMEPAD_AXIS_RIGHT_Y && absValue >= deadZone && client.currentScreen.children().stream().filter(element -> element instanceof SpruceEntryListWidget)
.map(element -> (SpruceEntryListWidget<?>) element) .map(element -> (SpruceEntryListWidget<?>) element)
.filter(AbstractSpruceWidget::isFocusedOrHovered) .filter(AbstractSpruceWidget::isFocusedOrHovered)
.noneMatch(element -> { .noneMatch(element -> {
@@ -533,7 +589,20 @@ public class MidnightInput {
{ {
client.currentScreen.mouseScrolled(0.0, 0.0, -(value * 1.5f)); client.currentScreen.mouseScrolled(0.0, 0.0, -(value * 1.5f));
} }
else if (isScreenInteractive(client.currentScreen) && absValue >= deadZone) {
if (value > 0 && joystickCooldown == 0) {
switch (axis) {
case GLFW_GAMEPAD_AXIS_LEFT_Y -> this.changeFocus(client.currentScreen, NavigationDirection.UP);
case GLFW_GAMEPAD_AXIS_LEFT_X -> this.handleLeftRight(client.currentScreen, true);
}
if (axis == GLFW_GAMEPAD_AXIS_LEFT_Y || axis == GLFW_GAMEPAD_AXIS_LEFT_X) joystickCooldown = 4;
} else if (value < 0 && joystickCooldown == 0) {
switch (axis) {
case GLFW_GAMEPAD_AXIS_LEFT_Y -> this.changeFocus(client.currentScreen, NavigationDirection.DOWN);
case GLFW_GAMEPAD_AXIS_LEFT_X -> this.handleLeftRight(client.currentScreen, false);
}
if (axis == GLFW_GAMEPAD_AXIS_LEFT_Y || axis == GLFW_GAMEPAD_AXIS_LEFT_X) joystickCooldown = 4;
}
return; return;
} }
} }
@@ -634,7 +703,10 @@ public class MidnightInput {
var childFocused = widget.getFocused(); var childFocused = widget.getFocused();
if (childFocused != null) if (childFocused != null)
return this.handleAButton(screen, childFocused); return this.handleAButton(screen, childFocused);
} else if (FabricLoader.getInstance().isModLoaded("yet-another-config-lib") && YACLCompat.handleAButton(screen, focused)) {
return true;
} }
else pressKeyboardKey(screen, GLFW_KEY_ENTER);
return false; return false;
} }
@@ -650,6 +722,10 @@ public class MidnightInput {
this.actionGuiCooldown = 5; this.actionGuiCooldown = 5;
return false; return false;
} }
if (FabricLoader.getInstance().isModLoaded("yet-another-config-lib") && YACLCompat.handleLeftRight(screen, right)) {
this.actionGuiCooldown = 5;
return false;
}
var focused = screen.getFocused(); var focused = screen.getFocused();
if (focused != null) if (focused != null)
if (this.handleRightLeftElement(focused, right)) if (this.handleRightLeftElement(focused, right))
@@ -664,11 +740,13 @@ public class MidnightInput {
return !spruceElement.onNavigation(right ? NavigationDirection.RIGHT : NavigationDirection.LEFT, false); return !spruceElement.onNavigation(right ? NavigationDirection.RIGHT : NavigationDirection.LEFT, false);
} }
if (element instanceof SliderWidget slider) { if (element instanceof SliderWidget slider) {
if (slider.active) {
slider.keyPressed(right ? 262 : 263, 0, 0); slider.keyPressed(right ? 262 : 263, 0, 0);
this.actionGuiCooldown = 2; // Prevent to press too quickly the focused element, so we have to skip 5 ticks. this.actionGuiCooldown = 2; // Prevent to press too quickly the focused element, so we have to skip 5 ticks.
return false; return true;
}
} else if (element instanceof AlwaysSelectedEntryListWidget) { } else if (element instanceof AlwaysSelectedEntryListWidget) {
((EntryListWidgetAccessor) element).midnightcontrols$moveSelection(right ? EntryListWidget.MoveDirection.DOWN : EntryListWidget.MoveDirection.UP); //TODO((EntryListWidgetAccessor) element).midnightcontrols$moveSelection(right ? EntryListWidget.MoveDirection.DOWN : EntryListWidget.MoveDirection.UP);
return false; return false;
} else if (element instanceof ParentElement entryList) { } else if (element instanceof ParentElement entryList) {
var focused = entryList.getFocused(); var focused = entryList.getFocused();
@@ -717,87 +795,20 @@ public class MidnightInput {
} }
return false; return false;
} }
if (FabricLoader.getInstance().isModLoaded("sodium")) switch (direction) {
SodiumCompat.handleInput(screen, direction.isLookingForward()); case UP -> pressKeyboardKey(screen, GLFW.GLFW_KEY_UP);
// This still needs some work case DOWN -> pressKeyboardKey(screen, GLFW.GLFW_KEY_DOWN);
// ScreenAccessor accessor = (ScreenAccessor) screen; case LEFT -> pressKeyboardKey(screen, GLFW.GLFW_KEY_LEFT);
// if (accessor.getSelected() != null && accessor.getSelected() instanceof ClickableWidget selected && accessor.getSelectables() != null) { case RIGHT -> pressKeyboardKey(screen, GLFW.GLFW_KEY_RIGHT);
// //System.out.println(direction); }
// if (accessor.getSelectables().size() >= 2) {
// //System.out.println(direction + " 2");
// int xDifference = Integer.MAX_VALUE;
// int yDifference = Integer.MAX_VALUE;
// ClickableWidget newWidget = null;
// for (int i = 0; i < accessor.getSelectables().size(); ++i) {
// if (accessor.getSelectables().get(i) instanceof ClickableWidget candidate) {
// if (!(candidate.x == selected.x && candidate.y == selected.y)) {
// int canXDifference = Math.abs(candidate.x - selected.x);
// int canYDifference = Math.abs(candidate.y - selected.y);
// if (direction.isHorizontal()) {
// if (direction.isLookingForward()) {
// if (candidate.x >= selected.x && canYDifference <= yDifference && canXDifference <= xDifference) {
// System.out.println(direction + " forward horizontal " + candidate);
// newWidget = candidate;
// xDifference = canXDifference;
// yDifference = canYDifference;
// }
// } else {
// if (candidate.x <= selected.x && canYDifference <= yDifference && canXDifference >= xDifference) {
// System.out.println(direction + " backward horizontal " + candidate);
// newWidget = candidate;
// xDifference = canXDifference;
// yDifference = canYDifference;
// }
// }
// } else {
// if (direction.isLookingForward()) {
// if (candidate.y >= selected.y && canYDifference <= yDifference && canXDifference <= xDifference) {
// System.out.println(direction + " forward vertical " + candidate);
// newWidget = candidate;
// xDifference = canXDifference;
// yDifference = canYDifference;
// }
// } else {
// if (candidate.y <= selected.y && canYDifference >= yDifference && canXDifference <= xDifference) {
// System.out.println(direction + " backward vertical " + candidate);
// newWidget = candidate;
// xDifference = canXDifference;
// yDifference = canYDifference;
// }
// }
// }
// }
// }
// }
// if (newWidget != null) {
// //selected.changeFocus(true);
// ((ClickableWidgetAccessor) selected).setFocused(false);
// ((ClickableWidgetAccessor) newWidget).setFocused(true);
// screen.setFocused(newWidget);
// screen.changeFocus(false);
// screen.changeFocus(true);
// this.actionGuiCooldown = 5;
// return true;
// }
//
// }
// }
if (!screen.changeFocus(direction.isLookingForward())) {
if (screen.changeFocus(direction.isLookingForward())) {
this.actionGuiCooldown = 5; this.actionGuiCooldown = 5;
return false; return false;
}
return true;
} else {
this.actionGuiCooldown = 5;
return false;
}
} catch (Exception exception) {MidnightControls.get().warn("Unknown exception encountered while trying to change focus: "+exception);} } catch (Exception exception) {MidnightControls.get().warn("Unknown exception encountered while trying to change focus: "+exception);}
return false; return false;
} }
public static boolean isScreenInteractive(@NotNull Screen screen) { public static boolean isScreenInteractive(@NotNull Screen screen) {
return !(screen instanceof HandledScreen || MidnightControlsConfig.mouseScreens.stream().anyMatch(a -> screen.getClass().toString().contains(a)) return !(screen instanceof HandledScreen || MidnightControlsConfig.joystickAsMouse || MidnightControlsConfig.mouseScreens.stream().anyMatch(a -> screen.getClass().toString().contains(a))
|| (screen instanceof SpruceScreen && ((SpruceScreen) screen).requiresCursor()) || (screen instanceof SpruceScreen && ((SpruceScreen) screen).requiresCursor())
|| MidnightControlsCompat.requireMouseOnScreen(screen)); || MidnightControlsCompat.requireMouseOnScreen(screen));
} }

View File

@@ -120,31 +120,39 @@ public class MidnightReacharound {
return null; return null;
if (client.player != null && client.crosshairTarget != null && client.crosshairTarget.getType() == HitResult.Type.MISS if (client.player != null && client.crosshairTarget != null && client.crosshairTarget.getType() == HitResult.Type.MISS
&& client.player.isOnGround() && client.player.getPitch(0.f) > 35.f) { && client.player.isOnGround() && client.player.getPitch(0.f) >= 35.f) {
if (client.player.isRiding()) if (client.player.isRiding())
return null; return null;
var playerPos = client.player.getBlockPos().down(); // Temporary pos, do not use
Vec3d playerPosi = client.player.getPos();
// Imitates var playerPos = client.player.getBlockPos().down();
Vec3d playerPos = new Vec3d(playerPosi.getX(), playerPosi.getY() - 1.0, playerPosi.getZ());
if (client.player.getY() - playerPos.getY() - 1.0 >= 0.25) { if (client.player.getY() - playerPos.getY() - 1.0 >= 0.25) {
playerPos = playerPos.up(); // Imitates playerPos = playerPos.up();
playerPos = playerPosi;
this.onSlab = true; this.onSlab = true;
} else { } else {
this.onSlab = false; this.onSlab = false;
} }
var targetPos = new BlockPos(client.crosshairTarget.getPos()).subtract(playerPos); var targetPos = new Vec3d(client.crosshairTarget.getPos().getX(), client.crosshairTarget.getPos().getY(), client.crosshairTarget.getPos().getZ()).subtract(playerPos);
var vector = new BlockPos.Mutable(MathHelper.clamp(targetPos.getX(), -1, 1), 0, MathHelper.clamp(targetPos.getZ(), -1, 1)); var vector = new Vec3d(MathHelper.clamp(targetPos.getX(), -1, 1), 0, MathHelper.clamp(targetPos.getZ(), -1, 1));
var blockPos = playerPos.add(vector); var blockPos = playerPos.add(vector);
// Some functions still need BlockPos, so this is here to let that happen
var blockyPos = BlockPos.ofFloored(blockPos);
var direction = client.player.getHorizontalFacing(); var direction = client.player.getHorizontalFacing();
var state = client.world.getBlockState(blockPos); var state = client.world.getBlockState(blockyPos);
if (!state.isAir()) if (!state.isAir())
return null; return null;
var adjacentBlockState = client.world.getBlockState(blockPos.offset(direction.getOpposite())); var adjacentBlockState = client.world.getBlockState(blockyPos.offset(direction.getOpposite()));
if (adjacentBlockState.isAir() || adjacentBlockState.getBlock() instanceof FluidBlock || (vector.getX() == 0 && vector.getZ() == 0)) { if (adjacentBlockState.isAir() || adjacentBlockState.getBlock() instanceof FluidBlock || (vector.getX() == 0 && vector.getZ() == 0)) {
return null; return null;
} }
return new BlockHitResult(new Vec3d(blockPos.getX(),blockPos.getY(),blockPos.getZ()), direction, blockPos, false); return new BlockHitResult(blockPos, direction, blockyPos, false);
} }
return null; return null;
} }

View File

@@ -0,0 +1,34 @@
/*
* Copyright © 2022 Motschen <motschen@midnightdust.eu>
*
* This file is part of midnightcontrols.
*
* Licensed under the MIT license. For more information,
* see the LICENSE file.
*/
package eu.midnightdust.midnightcontrols.client.compat;
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
import me.juancarloscp52.bedrockify.client.BedrockifyClient;
import me.juancarloscp52.bedrockify.client.BedrockifyClientSettings;
import net.minecraft.client.gui.screen.Screen;
import org.aperlambda.lambdacommon.utils.LambdaReflection;
import org.jetbrains.annotations.NotNull;
import java.util.Optional;
/**
* Represents HQM compatibility handler.
*
* @author Motschen
* @version 1.7.0
* @since 1.7.0
*/
public class BedrockifyCompat implements CompatHandler {
@Override
public void handle(@NotNull MidnightControlsClient mod) {
BedrockifyClient.getInstance().settings.disableFlyingMomentum = false;
}
}

View File

@@ -1,6 +1,6 @@
package eu.midnightdust.midnightcontrols.client.compat; package eu.midnightdust.midnightcontrols.client.compat;
import dev.emi.emi.EmiConfig; import dev.emi.emi.config.EmiConfig;
import dev.emi.emi.screen.EmiScreen; import dev.emi.emi.screen.EmiScreen;
import dev.emi.emi.screen.EmiScreenManager; import dev.emi.emi.screen.EmiScreenManager;
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient; import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
@@ -14,9 +14,9 @@ import org.lwjgl.glfw.GLFW;
public class EMICompat implements CompatHandler { public class EMICompat implements CompatHandler {
public static boolean handleTabs(boolean direction) { public static boolean handleTabs(boolean direction) {
if (isEMIEnabled() && MidnightControlsClient.get().input.actionGuiCooldown == 0 && EmiScreenManager.searchLeft != null && EmiScreenManager.searchRight != null) { if (isEMIEnabled() && MidnightControlsClient.get().input.actionGuiCooldown == 0 && EmiScreenManager.getSearchPanel() != null && EmiScreenManager.getSearchPanel().pageLeft != null && EmiScreenManager.getSearchPanel().pageRight != null) {
if (direction) EmiScreenManager.searchRight.onPress(); if (direction) EmiScreenManager.getSearchPanel().pageRight.onPress();
else EmiScreenManager.searchLeft.onPress(); else EmiScreenManager.getSearchPanel().pageLeft.onPress();
MidnightControlsClient.get().input.actionGuiCooldown = 5; MidnightControlsClient.get().input.actionGuiCooldown = 5;
return true; return true;
} }

View File

@@ -53,6 +53,10 @@ public class MidnightControlsCompat {
mod.log("Adding HQM compatibility..."); mod.log("Adding HQM compatibility...");
HANDLERS.add(new HQMCompat()); HANDLERS.add(new HQMCompat());
} }
if (FabricLoader.getInstance().isModLoaded("bedrockify")) {
mod.log("Adding Bedrockify compatibility...");
HANDLERS.add(new BedrockifyCompat());
}
HANDLERS.forEach(handler -> handler.handle(mod)); HANDLERS.forEach(handler -> handler.handle(mod));
InputManager.loadButtonBindings(); InputManager.loadButtonBindings();
} }

View File

@@ -30,7 +30,7 @@ public class MidnightControlsMixinPlugin implements IMixinConfigPlugin {
private final HashMap<String, Boolean> conditionalMixins = new HashMap<>(); private final HashMap<String, Boolean> conditionalMixins = new HashMap<>();
public MidnightControlsMixinPlugin() { public MidnightControlsMixinPlugin() {
this.putConditionalMixin("SodiumOptionsGUIAccessor", FabricLoader.getInstance().isModLoaded("sodium")); //this.putConditionalMixin("SodiumOptionsGUIAccessor", FabricLoader.getInstance().isModLoaded("sodium"));
} }
private void putConditionalMixin(@NotNull String path, boolean condition) { private void putConditionalMixin(@NotNull String path, boolean condition) {

View File

@@ -0,0 +1,95 @@
/*
* Copyright © 2022 Motschen <motschen@midnightdust.eu>
*
* This file is part of MidnightControls.
*
* Licensed under the MIT license. For more information,
* see the LICENSE file.
*/
package eu.midnightdust.midnightcontrols.client.compat;
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
import eu.midnightdust.midnightcontrols.client.controller.ButtonBinding;
import eu.midnightdust.midnightcontrols.client.controller.ButtonCategory;
import eu.midnightdust.midnightcontrols.client.controller.InputManager;
import eu.midnightdust.midnightcontrols.client.mixin.KeyBindingIDAccessor;
import net.minecraft.client.option.KeyBinding;
import org.aperlambda.lambdacommon.Identifier;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.glfw.GLFW;
/**
* Represents a compatibility handler for VoxelMap.
*
* @author Motschen
* @version 1.8.0
* @since 1.8.0
*/
public class VoxelMapCompat implements CompatHandler {
private final KeyBinding voxelMapZoomKey = KeyBindingIDAccessor.getKEYS_BY_ID().getOrDefault("key.minimap.zoom", null);
private final KeyBinding voxelmapFullscreenKey = KeyBindingIDAccessor.getKEYS_BY_ID().getOrDefault("key.minimap.togglefullscreen", null);
private final KeyBinding voxelmapMenuKey = KeyBindingIDAccessor.getKEYS_BY_ID().getOrDefault("key.minimap.voxelmapmenu", null);;
private final KeyBinding voxelmapWaypointMenuKey = KeyBindingIDAccessor.getKEYS_BY_ID().getOrDefault("key.minimap.waypointmenu", null);;
private final KeyBinding voxelmapWaypointKey = KeyBindingIDAccessor.getKEYS_BY_ID().getOrDefault("key.minimap.waypointhotkey", null);
private final KeyBinding voxelmapMobToggleKey = KeyBindingIDAccessor.getKEYS_BY_ID().getOrDefault("key.minimap.togglemobs", null);
private final KeyBinding voxelmapWaypointToggleKey = KeyBindingIDAccessor.getKEYS_BY_ID().getOrDefault("key.minimap.toggleingamewaypoints", null);
private static final ButtonCategory VOXELMAP_CATEGORY = InputManager.registerCategory(new Identifier("minecraft","controls.minimap.title"));
@Override
public void handle(@NotNull MidnightControlsClient mod) {
if (MidnightControlsConfig.debug && KeyBindingIDAccessor.getKEYS_BY_ID() != null) KeyBindingIDAccessor.getKEYS_BY_ID().forEach((a, b) -> System.out.println(a + " - " + b));
new ButtonBinding.Builder("key.minimap.zoom")
.buttons(GLFW.GLFW_GAMEPAD_BUTTON_DPAD_DOWN, GLFW.GLFW_GAMEPAD_BUTTON_X)
.onlyInGame()
.cooldown(true)
.category(VOXELMAP_CATEGORY)
.linkKeybind(voxelMapZoomKey)
.register();
new ButtonBinding.Builder("key.minimap.togglefullscreen")
.buttons(GLFW.GLFW_GAMEPAD_BUTTON_DPAD_DOWN, GLFW.GLFW_GAMEPAD_BUTTON_Y)
.onlyInGame()
.cooldown(true)
.category(VOXELMAP_CATEGORY)
.linkKeybind(voxelmapFullscreenKey)
.register();
new ButtonBinding.Builder("key.minimap.voxelmapmenu")
.buttons(GLFW.GLFW_GAMEPAD_BUTTON_DPAD_DOWN, GLFW.GLFW_GAMEPAD_BUTTON_START)
.onlyInGame()
.cooldown(true)
.category(VOXELMAP_CATEGORY)
.linkKeybind(voxelmapMenuKey)
.register();
new ButtonBinding.Builder("key.minimap.waypointmenu")
.buttons(GLFW.GLFW_GAMEPAD_BUTTON_DPAD_DOWN, GLFW.GLFW_GAMEPAD_BUTTON_GUIDE)
.onlyInGame()
.cooldown(true)
.category(VOXELMAP_CATEGORY)
.linkKeybind(voxelmapWaypointMenuKey)
.register();
new ButtonBinding.Builder("key.minimap.waypointhotkey")
.buttons(GLFW.GLFW_GAMEPAD_BUTTON_DPAD_DOWN, GLFW.GLFW_GAMEPAD_BUTTON_BACK)
.onlyInGame()
.cooldown(true)
.category(VOXELMAP_CATEGORY)
.linkKeybind(voxelmapWaypointKey)
.register();
new ButtonBinding.Builder("key.minimap.togglemobs")
.buttons(GLFW.GLFW_GAMEPAD_BUTTON_DPAD_DOWN, GLFW.GLFW_GAMEPAD_BUTTON_A)
.onlyInGame()
.cooldown(true)
.category(VOXELMAP_CATEGORY)
.linkKeybind(voxelmapMobToggleKey)
.register();
new ButtonBinding.Builder("key.minimap.toggleingamewaypoints")
.buttons(GLFW.GLFW_GAMEPAD_BUTTON_DPAD_DOWN, GLFW.GLFW_GAMEPAD_BUTTON_B)
.onlyInGame()
.cooldown(true)
.category(VOXELMAP_CATEGORY)
.linkKeybind(voxelmapWaypointToggleKey)
.register();
}
}

View File

@@ -0,0 +1,56 @@
package eu.midnightdust.midnightcontrols.client.compat;
import dev.isxander.yacl.gui.AbstractWidget;
import dev.isxander.yacl.gui.OptionListWidget;
import dev.isxander.yacl.gui.YACLScreen;
import dev.isxander.yacl.gui.controllers.ControllerWidget;
import dev.isxander.yacl.gui.controllers.slider.SliderControllerElement;
import net.minecraft.client.gui.Element;
import net.minecraft.client.gui.screen.Screen;
import org.lwjgl.glfw.GLFW;
public class YACLCompat {
public static boolean handleAButton(Screen screen, Element element) {
if (element instanceof AbstractWidget abstractWidget) {
// imitate ender key press
return abstractWidget.keyPressed(GLFW.GLFW_KEY_ENTER, 0, 0);
}
return false;
}
public static boolean handleLeftRight(Screen screen, boolean direction) {
if (screen instanceof YACLScreen yaclScreen) {
SliderControllerElement focusedSlider = yaclScreen.optionList.children().stream()
.filter(OptionListWidget.OptionEntry.class::isInstance)
.map(entry -> ((OptionListWidget.OptionEntry) entry).widget)
.filter(ControllerWidget.class::isInstance)
.map(ControllerWidget.class::cast)
.filter(SliderControllerElement.class::isInstance)
.map(SliderControllerElement.class::cast)
.filter(ControllerWidget::isHovered)
.findFirst()
.orElse(null);
if (focusedSlider == null)
return false;
focusedSlider.incrementValue(direction ? 1 : -1);
return true;
}
return false;
}
public static boolean handleCategories(Screen screen, boolean direction) {
if (screen instanceof YACLScreen yaclScreen) {
int categoryIdx = yaclScreen.getCurrentCategoryIdx();
if (direction) categoryIdx++; else categoryIdx--;
if (categoryIdx < 0) categoryIdx = yaclScreen.config.categories().size() - 1;
if (categoryIdx >= yaclScreen.config.categories().size()) categoryIdx = 0;
yaclScreen.changeCategory(categoryIdx);
return true;
}
return false;
}
}

View File

@@ -88,12 +88,13 @@ public class ButtonBinding {
.action(InputHandlers.handleInventorySlotPad(0)).onlyInInventory().cooldown().register(); .action(InputHandlers.handleInventorySlotPad(0)).onlyInInventory().cooldown().register();
public static final ButtonBinding SNEAK = new Builder("sneak").buttons(GLFW_GAMEPAD_BUTTON_RIGHT_THUMB) public static final ButtonBinding SNEAK = new Builder("sneak").buttons(GLFW_GAMEPAD_BUTTON_RIGHT_THUMB)
.actions(InputHandlers::handleToggleSneak).onlyInGame().cooldown().register(); .actions(InputHandlers::handleToggleSneak).onlyInGame().cooldown().register();
public static final ButtonBinding SPRINT = new Builder("sprint").buttons(GLFW_GAMEPAD_BUTTON_LEFT_THUMB).onlyInGame().register(); public static final ButtonBinding SPRINT = new Builder("sprint").buttons(GLFW_GAMEPAD_BUTTON_LEFT_THUMB)
.actions(InputHandlers::handleToggleSprint).onlyInGame().register();
public static final ButtonBinding SWAP_HANDS = new Builder("swap_hands").buttons(GLFW_GAMEPAD_BUTTON_X).onlyInGame().cooldown().register(); public static final ButtonBinding SWAP_HANDS = new Builder("swap_hands").buttons(GLFW_GAMEPAD_BUTTON_X).onlyInGame().cooldown().register();
public static final ButtonBinding TAB_LEFT = new Builder("tab_back").buttons(GLFW_GAMEPAD_BUTTON_LEFT_BUMPER) public static final ButtonBinding TAB_LEFT = new Builder("tab_back").buttons(GLFW_GAMEPAD_BUTTON_LEFT_BUMPER)
.action(InputHandlers.handleHotbar(false)).filter(Predicates.or(InputHandlers::inInventory, InputHandlers::inAdvancements).or((client, binding) -> client.currentScreen != null && client.currentScreen.getClass().toString().contains("sodium"))).cooldown().register(); .action(InputHandlers.handleHotbar(false)).filter(Predicates.or(InputHandlers::inInventory, InputHandlers::inAdvancements).or((client, binding) -> client.currentScreen != null)).cooldown().register();
public static final ButtonBinding TAB_RIGHT = new Builder("tab_next").buttons(GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER) public static final ButtonBinding TAB_RIGHT = new Builder("tab_next").buttons(GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER)
.action(InputHandlers.handleHotbar(true)).filter(Predicates.or(InputHandlers::inInventory, InputHandlers::inAdvancements).or((client, binding) -> client.currentScreen != null && client.currentScreen.getClass().toString().contains("sodium"))).cooldown().register(); .action(InputHandlers.handleHotbar(true)).filter(Predicates.or(InputHandlers::inInventory, InputHandlers::inAdvancements).or((client, binding) -> client.currentScreen != null)).cooldown().register();
public static final ButtonBinding PAGE_LEFT = new Builder("page_back").buttons(axisAsButton(GLFW_GAMEPAD_AXIS_LEFT_TRIGGER, true)) public static final ButtonBinding PAGE_LEFT = new Builder("page_back").buttons(axisAsButton(GLFW_GAMEPAD_AXIS_LEFT_TRIGGER, true))
.action(InputHandlers.handlePage(false)).filter(InputHandlers::inInventory).cooldown(30).register(); .action(InputHandlers.handlePage(false)).filter(InputHandlers::inInventory).cooldown(30).register();
public static final ButtonBinding PAGE_RIGHT = new Builder("page_next").buttons(axisAsButton(GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER, true)) public static final ButtonBinding PAGE_RIGHT = new Builder("page_next").buttons(axisAsButton(GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER, true))

View File

@@ -9,37 +9,49 @@
package eu.midnightdust.midnightcontrols.client.controller; package eu.midnightdust.midnightcontrols.client.controller;
import com.google.common.collect.Lists;
import eu.midnightdust.midnightcontrols.client.ButtonState; import eu.midnightdust.midnightcontrols.client.ButtonState;
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient; import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
import eu.midnightdust.midnightcontrols.client.MidnightInput; import eu.midnightdust.midnightcontrols.client.MidnightInput;
import eu.midnightdust.midnightcontrols.client.compat.InventoryTabsCompat; import eu.midnightdust.midnightcontrols.client.compat.InventoryTabsCompat;
import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat; import eu.midnightdust.midnightcontrols.client.compat.MidnightControlsCompat;
import eu.midnightdust.midnightcontrols.client.compat.SodiumCompat; import eu.midnightdust.midnightcontrols.client.compat.SodiumCompat;
import eu.midnightdust.midnightcontrols.client.compat.YACLCompat;
import eu.midnightdust.midnightcontrols.client.gui.RingScreen; import eu.midnightdust.midnightcontrols.client.gui.RingScreen;
import eu.midnightdust.midnightcontrols.client.mixin.AdvancementsScreenAccessor; import eu.midnightdust.midnightcontrols.client.mixin.AdvancementsScreenAccessor;
import eu.midnightdust.midnightcontrols.client.mixin.CreativeInventoryScreenAccessor; import eu.midnightdust.midnightcontrols.client.mixin.CreativeInventoryScreenAccessor;
import eu.midnightdust.midnightcontrols.client.mixin.RecipeBookWidgetAccessor; import eu.midnightdust.midnightcontrols.client.mixin.RecipeBookWidgetAccessor;
import eu.midnightdust.midnightcontrols.client.mixin.TabNavigationWidgetAccessor;
import eu.midnightdust.midnightcontrols.client.util.HandledScreenAccessor; import eu.midnightdust.midnightcontrols.client.util.HandledScreenAccessor;
import eu.midnightdust.midnightcontrols.client.util.MouseAccessor; import eu.midnightdust.midnightcontrols.client.util.MouseAccessor;
import net.fabricmc.fabric.impl.client.itemgroup.CreativeGuiExtensions;
import net.fabricmc.fabric.impl.client.itemgroup.FabricCreativeGuiComponents;
import net.fabricmc.fabric.impl.itemgroup.FabricItemGroup;
import net.fabricmc.fabric.impl.itemgroup.ItemGroupHelper;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.TitleScreen; import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.client.gui.screen.advancement.AdvancementsScreen; import net.minecraft.client.gui.screen.advancement.AdvancementsScreen;
import net.minecraft.client.gui.screen.ingame.*; import net.minecraft.client.gui.screen.ingame.*;
import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget; import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget;
import net.minecraft.client.gui.tab.TabManager;
import net.minecraft.client.gui.widget.PressableWidget; import net.minecraft.client.gui.widget.PressableWidget;
import net.minecraft.client.gui.widget.TabNavigationWidget;
import net.minecraft.client.util.ScreenshotRecorder; import net.minecraft.client.util.ScreenshotRecorder;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemGroups;
import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.Slot;
import net.minecraft.screen.slot.SlotActionType; import net.minecraft.screen.slot.SlotActionType;
import net.minecraft.util.math.MathHelper;
import org.aperlambda.lambdacommon.utils.Pair; import org.aperlambda.lambdacommon.utils.Pair;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
import java.util.Comparator; import java.util.Comparator;
import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.Collectors;
import static org.lwjgl.glfw.GLFW.*; import static org.lwjgl.glfw.GLFW.*;
import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_2; import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_2;
@@ -51,32 +63,68 @@ import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_2;
* @version 1.7.0 * @version 1.7.0
* @since 1.1.0 * @since 1.1.0
*/ */
@SuppressWarnings("UnstableApiUsage")
public class InputHandlers { public class InputHandlers {
private InputHandlers() { private InputHandlers() {
} }
private static List<ItemGroup> getVisibleGroups(CreativeInventoryScreen screen) {
return ItemGroupHelper.sortedGroups.stream()
.filter(itemGroup -> {
if (FabricCreativeGuiComponents.COMMON_GROUPS.contains(itemGroup)) return true;
return ((CreativeGuiExtensions)screen).fabric_currentPage() == ((FabricItemGroup)itemGroup).getPage() && itemGroup.shouldDisplay();
}).toList();
}
public static PressAction handleHotbar(boolean next) { public static PressAction handleHotbar(boolean next) {
return (client, button, value, action) -> { return (client, button, value, action) -> {
if (action == ButtonState.RELEASE) if (action == ButtonState.RELEASE)
return false; return false;
// When ingame // When in-game
if (client.currentScreen == null && client.player != null) { if (client.currentScreen == null && client.player != null) {
if (!client.player.isSpectator()) {
if (next) if (next)
client.player.getInventory().scrollInHotbar(-1.0); client.player.getInventory().scrollInHotbar(-1.0);
else else
client.player.getInventory().scrollInHotbar(1.0); client.player.getInventory().scrollInHotbar(1.0);
}
else {
if (client.inGameHud.getSpectatorHud().isOpen()) {
client.inGameHud.getSpectatorHud().cycleSlot(next ? -1 : 1);
} else {
float g = MathHelper.clamp(client.player.getAbilities().getFlySpeed() + (next ? 1 : -1) * 0.005F, 0.0F, 0.2F);
client.player.getAbilities().setFlySpeed(g);
}
}
return true; return true;
} else if (client.currentScreen instanceof RingScreen) { } else if (client.currentScreen instanceof RingScreen) {
MidnightControlsClient.get().ring.cyclePage(next); MidnightControlsClient.get().ring.cyclePage(next);
} else if (client.currentScreen instanceof CreativeInventoryScreenAccessor inventory) { } else if (client.currentScreen instanceof CreativeInventoryScreenAccessor inventory) {
int currentTab = CreativeInventoryScreenAccessor.getSelectedTab(); ItemGroup currentTab = CreativeInventoryScreenAccessor.getSelectedTab();
int nextTab = currentTab + (next ? 1 : -1); int currentColumn = currentTab.getColumn();
if (nextTab < 0) ItemGroup.Row currentRow = currentTab.getRow();
nextTab = ItemGroup.GROUPS.length - 1; ItemGroup newTab = null;
else if (nextTab >= ItemGroup.GROUPS.length) List<ItemGroup> visibleTabs = getVisibleGroups((CreativeInventoryScreen) client.currentScreen);
nextTab = 0; for (ItemGroup tab : visibleTabs) {
inventory.midnightcontrols$setSelectedTab(ItemGroup.GROUPS[nextTab]); if (tab.getRow().equals(currentRow) && ((newTab == null && ((next && tab.getColumn() > currentColumn) ||
(!next && tab.getColumn() < currentColumn))) || (newTab != null && ((next && tab.getColumn() > currentColumn && tab.getColumn() < newTab.getColumn()) ||
(!next && tab.getColumn() < currentColumn && tab.getColumn() > newTab.getColumn())))))
newTab = tab;
}
if (newTab == null)
for (ItemGroup tab : visibleTabs) {
if ((tab.getRow().compareTo(currentRow)) != 0 && ((next && newTab == null || next && newTab.getColumn() > tab.getColumn()) || (!next && newTab == null) || (!next && newTab.getColumn() < tab.getColumn())))
newTab = tab;
}
if (newTab == null) {
for (ItemGroup tab : visibleTabs) {
if ((next && tab.getRow() == ItemGroup.Row.TOP && tab.getColumn() == 0) ||
!next && tab.getRow() == ItemGroup.Row.BOTTOM && (newTab == null || tab.getColumn() > newTab.getColumn()))
newTab = tab;
}
}
if (newTab == null || newTab.equals(currentTab)) newTab = ItemGroups.getDefaultTab();
inventory.midnightcontrols$setSelectedTab(newTab);
return true; return true;
} else if (client.currentScreen instanceof InventoryScreen || client.currentScreen instanceof CraftingScreen || client.currentScreen instanceof AbstractFurnaceScreen<?>) { } else if (client.currentScreen instanceof InventoryScreen || client.currentScreen instanceof CraftingScreen || client.currentScreen instanceof AbstractFurnaceScreen<?>) {
RecipeBookWidget recipeBook; RecipeBookWidget recipeBook;
@@ -101,7 +149,7 @@ public class InputHandlers {
recipeBookAccessor.midnightcontrols$refreshResults(true); recipeBookAccessor.midnightcontrols$refreshResults(true);
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().collect(Collectors.toList()); var tabs = screen.getTabs().values().stream().distinct().toList();
var tab = screen.getSelectedTab(); var tab = screen.getSelectedTab();
if (tab == null) if (tab == null)
return false; return false;
@@ -117,8 +165,24 @@ public class InputHandlers {
} }
} }
return true; return true;
} else if (client.currentScreen != null && client.currentScreen.children().stream().anyMatch(e -> e instanceof TabNavigationWidget)) {
return Lists.newCopyOnWriteArrayList(client.currentScreen.children()).stream().anyMatch(e -> {
if (e instanceof TabNavigationWidget tabs) {
TabNavigationWidgetAccessor accessor = (TabNavigationWidgetAccessor) tabs;
int tabIndex = accessor.getTabs().indexOf(accessor.getTabManager().getCurrentTab());
if (next ? tabIndex+1 < accessor.getTabs().size() : tabIndex > 0) {
if (next) tabs.selectTab(tabIndex + 1, true);
else tabs.selectTab(tabIndex - 1, true);
return true;
}
}
return false;
});
} else { } else {
if (FabricLoader.getInstance().isModLoaded("sodium")) SodiumCompat.handleTabs(client.currentScreen, next); if (FabricLoader.getInstance().isModLoaded("sodium"))
SodiumCompat.handleTabs(client.currentScreen, next);
if (FabricLoader.getInstance().isModLoaded("yet-another-config-lib") && YACLCompat.handleCategories(client.currentScreen, next))
return true;
} }
if (MidnightControlsCompat.isInventoryTabsPresent()) InventoryTabsCompat.handleInventoryTabs(client.currentScreen, next); if (MidnightControlsCompat.isInventoryTabsPresent()) InventoryTabsCompat.handleInventoryTabs(client.currentScreen, next);
return false; return false;
@@ -127,34 +191,24 @@ public class InputHandlers {
public static PressAction handlePage(boolean next) { public static PressAction handlePage(boolean next) {
return (client, button, value, action) -> { return (client, button, value, action) -> {
if (client.currentScreen instanceof CreativeInventoryScreen) { if (client.currentScreen instanceof CreativeInventoryScreen) {
var screen = (HandledScreenAccessor) client.currentScreen;
try { try {
if (next) {
return client.currentScreen.children().stream().filter(element -> element instanceof PressableWidget) return client.currentScreen.children().stream().filter(element -> element instanceof PressableWidget)
.map(element -> (PressableWidget) element) .map(element -> (PressableWidget) element)
.filter(element -> element.getMessage() != null && element.getMessage().getContent() != null) .filter(element -> element.getMessage() != null && element.getMessage().getContent() != null)
.anyMatch(element -> { .anyMatch(element -> {
if (element.getMessage().getString().equals(">")) { if (next && element.getMessage().getString().equals(">")) {
element.onPress();
return true;
} else if (element.getMessage().getString().equals("<")) {
element.onPress(); element.onPress();
return true; return true;
} }
return false; return false;
}); });
} else {
return client.currentScreen.children().stream().filter(element -> element instanceof PressableWidget)
.map(element -> (PressableWidget) element)
.filter(element -> element.getMessage() != null && element.getMessage().getContent() != null)
.anyMatch(element -> {
if (element.getMessage().getString().equals("<")) {
element.onPress();
return true;
}
return false;
});
}
} catch (Exception ignored) {} } catch (Exception ignored) {}
} }
if (MidnightControlsCompat.isInventoryTabsPresent()) InventoryTabsCompat.handleInventoryPage(client.currentScreen, next); if (MidnightControlsCompat.isInventoryTabsPresent()) InventoryTabsCompat.handleInventoryPage(client.currentScreen, next);
return false; return false;
}; };
} }
@@ -198,24 +252,22 @@ public class InputHandlers {
MidnightControlsClient.get().input.inventoryInteractionCooldown = 5; MidnightControlsClient.get().input.inventoryInteractionCooldown = 5;
switch (button.getName()) { switch (button.getName()) {
case "take_all": { case "take_all" -> {
if (screen instanceof CreativeInventoryScreen) { if (screen instanceof CreativeInventoryScreen) {
if (slot != null && (((CreativeInventoryScreenAccessor) accessor).midnightcontrols$isCreativeInventorySlot(slot) || MidnightControlsCompat.streamCompatHandlers().anyMatch(handler -> handler.isCreativeSlot(screen, slot)))) if (slot != null && (((CreativeInventoryScreenAccessor) accessor).midnightcontrols$isCreativeInventorySlot(slot) || MidnightControlsCompat.streamCompatHandlers().anyMatch(handler -> handler.isCreativeSlot(screen, slot))))
actionType = SlotActionType.CLONE; actionType = SlotActionType.CLONE;
} }
break;
} }
case "take": { case "take" -> {
clickData = GLFW_MOUSE_BUTTON_2; clickData = GLFW_MOUSE_BUTTON_2;
break;
} }
case "quick_move": { case "quick_move" -> {
actionType = SlotActionType.QUICK_MOVE; actionType = SlotActionType.QUICK_MOVE;
break;
} }
default: default -> {
return false; return false;
} }
}
accessor.midnightcontrols$onMouseClick(slot, slotId, clickData, actionType); accessor.midnightcontrols$onMouseClick(slot, slotId, clickData, actionType);
return true; return true;
}; };
@@ -254,9 +306,28 @@ public class InputHandlers {
boolean sneakToggled = client.options.getSneakToggled().getValue(); boolean sneakToggled = client.options.getSneakToggled().getValue();
if (client.player.getAbilities().flying && sneakToggled) if (client.player.getAbilities().flying && sneakToggled)
client.options.getSneakToggled().setValue(false); client.options.getSneakToggled().setValue(false);
else if (MidnightControlsConfig.controllerToggleSneak != sneakToggled)
client.options.getSneakToggled().setValue(!sneakToggled);
binding.setPressed(button.pressed); binding.setPressed(button.pressed);
if (client.player.getAbilities().flying && sneakToggled) if (client.player.getAbilities().flying && sneakToggled)
client.options.getSneakToggled().setValue(true); client.options.getSneakToggled().setValue(true);
else if (MidnightControlsConfig.controllerToggleSneak != sneakToggled)
client.options.getSneakToggled().setValue(sneakToggled);
});
return true;
}
public static boolean handleToggleSprint(@NotNull MinecraftClient client, @NotNull ButtonBinding button, float value, @NotNull ButtonState action) {
button.asKeyBinding().ifPresent(binding -> {
boolean sprintToggled = client.options.getSprintToggled().getValue();
if (client.player.getAbilities().flying && sprintToggled)
client.options.getSprintToggled().setValue(false);
else if (MidnightControlsConfig.controllerToggleSneak != sprintToggled)
client.options.getSprintToggled().setValue(!sprintToggled);
binding.setPressed(button.pressed);
if (client.player.getAbilities().flying && sprintToggled)
client.options.getSprintToggled().setValue(true);
else if (MidnightControlsConfig.controllerToggleSneak != sprintToggled)
client.options.getSprintToggled().setValue(sprintToggled);
}); });
return true; return true;
} }

View File

@@ -40,6 +40,7 @@ public final class MovementHandler implements PressAction {
private boolean pressingBack = false; private boolean pressingBack = false;
private boolean pressingLeft = false; private boolean pressingLeft = false;
private boolean pressingRight = false; private boolean pressingRight = false;
private float slowdownFactor = 1.f;
private float movementForward = 0.f; private float movementForward = 0.f;
private float movementSideways = 0.f; private float movementSideways = 0.f;
@@ -52,14 +53,22 @@ public final class MovementHandler implements PressAction {
* @param player The client player. * @param player The client player.
*/ */
public void applyMovement(@NotNull ClientPlayerEntity player) { public void applyMovement(@NotNull ClientPlayerEntity player) {
double movementR, movementTheta;
if (!this.shouldOverrideMovement) if (!this.shouldOverrideMovement)
return; return;
player.input.pressingForward = this.pressingForward; player.input.pressingForward = this.pressingForward;
player.input.pressingBack = this.pressingBack; player.input.pressingBack = this.pressingBack;
player.input.pressingLeft = this.pressingLeft; player.input.pressingLeft = this.pressingLeft;
player.input.pressingRight = this.pressingRight; player.input.pressingRight = this.pressingRight;
player.input.movementForward = this.movementForward;
player.input.movementSideways = this.movementSideways; // Do an implicit square here
movementR = this.slowdownFactor * (Math.pow(this.movementSideways, 2) + Math.pow(this.movementForward, 2));
movementR = MathHelper.clamp(movementR, 0.f, 1.f);
movementTheta = Math.atan2(this.movementForward, this.movementSideways);
player.input.movementForward = (float) (movementR * Math.sin(movementTheta));
player.input.movementSideways = (float) (movementR * Math.cos(movementTheta));
this.shouldOverrideMovement = false; this.shouldOverrideMovement = false;
} }
@@ -79,30 +88,26 @@ public final class MovementHandler implements PressAction {
this.shouldOverrideMovement = direction != 0; this.shouldOverrideMovement = direction != 0;
if (MidnightControlsConfig.analogMovement) { if (!MidnightControlsConfig.analogMovement) {
value = (float) Math.pow(value, 2); value = 1.f;
} else value = 1.f; }
this.slowdownFactor = client.player.shouldSlowDown() ? (MathHelper.clamp(
0.3F + EnchantmentHelper.getSwiftSneakSpeedBoost(client.player),
0.0F,
1.0F
)) : 1.f;
if (button == ButtonBinding.FORWARD || button == ButtonBinding.BACK) { if (button == ButtonBinding.FORWARD || button == ButtonBinding.BACK) {
// Handle forward movement. // Handle forward movement.
this.pressingForward = direction > 0; this.pressingForward = direction > 0;
this.pressingBack = direction < 0; this.pressingBack = direction < 0;
this.movementForward = direction * value; this.movementForward = direction * value;
// Slowing down if sneaking or crawling.
if (client.player.shouldSlowDown()) {
this.movementForward *= MathHelper.clamp(0.3F + EnchantmentHelper.getSwiftSneakSpeedBoost(client.player), 0.0F, 1.0F);
}
} else { } else {
// Handle sideways movement. // Handle sideways movement.
this.pressingLeft = direction > 0; this.pressingLeft = direction > 0;
this.pressingRight = direction < 0; this.pressingRight = direction < 0;
this.movementSideways = direction * value; this.movementSideways = direction * value;
// Slowing down if sneaking or crawling.
if (client.player.shouldSlowDown()) {
this.movementSideways *= MathHelper.clamp(0.3F + EnchantmentHelper.getSwiftSneakSpeedBoost(client.player), 0.0F, 1.0F);
}
} }
return this.shouldOverrideMovement; return this.shouldOverrideMovement;

View File

@@ -46,6 +46,7 @@ public class MidnightControlsHud extends Hud {
private int inventoryButtonWidth = 0; private int inventoryButtonWidth = 0;
private int swapHandsWidth = 0; private int swapHandsWidth = 0;
private int swapHandsButtonWidth = 0; private int swapHandsButtonWidth = 0;
private boolean showSwapHandsAction = false;
private int useWidth = 0; private int useWidth = 0;
private int useButtonWidth = 0; private int useButtonWidth = 0;
private BlockHitResult placeHitResult; private BlockHitResult placeHitResult;
@@ -81,7 +82,7 @@ public class MidnightControlsHud extends Hud {
public void render(MatrixStack matrices, float tickDelta) { public void render(MatrixStack matrices, float tickDelta) {
if (this.client == null) return; if (this.client == null) return;
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && this.client.currentScreen == null) { if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && this.client.currentScreen == null) {
isCrammed = client.getWindow().getScaledWidth() < 560; isCrammed = client.getWindow().getScaledWidth() < 520;
int y = bottom(2); int y = bottom(2);
matrices.push(); matrices.push();
this.renderFirstIcons(matrices, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : client.getWindow().getScaledWidth() - 2, y); this.renderFirstIcons(matrices, MidnightControlsConfig.hudSide == HudSide.LEFT ? 2 : client.getWindow().getScaledWidth() - 2, y);
@@ -109,11 +110,7 @@ public class MidnightControlsHud extends Hud {
int offset = 2 + this.inventoryWidth + this.inventoryButtonWidth + 4; int offset = 2 + this.inventoryWidth + this.inventoryButtonWidth + 4;
int currentX = MidnightControlsConfig.hudSide == HudSide.LEFT ? x : x - this.inventoryButtonWidth; int currentX = MidnightControlsConfig.hudSide == HudSide.LEFT ? x : x - this.inventoryButtonWidth;
if (!ButtonBinding.INVENTORY.isNotBound()) this.drawButton(matrices, currentX, y, ButtonBinding.INVENTORY, true); if (!ButtonBinding.INVENTORY.isNotBound()) this.drawButton(matrices, currentX, y, ButtonBinding.INVENTORY, true);
if (isCrammed) { if (!ButtonBinding.SWAP_HANDS.isNotBound() && !isCrammed && showSwapHandsAction) this.drawButton(matrices, currentX += (MidnightControlsConfig.hudSide == HudSide.LEFT ? offset : -offset), y, ButtonBinding.SWAP_HANDS, true);
offset = 0;
y -= 20;
}
if (!ButtonBinding.SWAP_HANDS.isNotBound()) this.drawButton(matrices, currentX += (MidnightControlsConfig.hudSide == HudSide.LEFT ? offset : -offset), y, ButtonBinding.SWAP_HANDS, true);
offset = 2 + this.swapHandsWidth + this.dropItemButtonWidth + 4; offset = 2 + this.swapHandsWidth + this.dropItemButtonWidth + 4;
if (this.client.options.getShowSubtitles().getValue() && MidnightControlsConfig.hudSide == HudSide.RIGHT) { if (this.client.options.getShowSubtitles().getValue() && MidnightControlsConfig.hudSide == HudSide.RIGHT) {
currentX += -offset; currentX += -offset;
@@ -127,6 +124,13 @@ public class MidnightControlsHud extends Hud {
public void renderSecondIcons(MatrixStack matrices, int x, int y) { public void renderSecondIcons(MatrixStack matrices, int x, int y) {
int offset; int offset;
int currentX = x; int currentX = x;
if (isCrammed && showSwapHandsAction && !this.client.options.getShowSubtitles().getValue() && !ButtonBinding.SWAP_HANDS.isNotBound()) {
if (MidnightControlsConfig.hudSide == HudSide.LEFT)
currentX -= this.useButtonWidth;
this.drawButton(matrices, currentX, y, ButtonBinding.SWAP_HANDS, true);
currentX = x;
y -= 20;
}
if (!this.placeAction.isEmpty() && (!ButtonBinding.USE.isNotBound()) ) { if (!this.placeAction.isEmpty() && (!ButtonBinding.USE.isNotBound()) ) {
if (MidnightControlsConfig.hudSide == HudSide.LEFT) if (MidnightControlsConfig.hudSide == HudSide.LEFT)
currentX -= this.useButtonWidth; currentX -= this.useButtonWidth;
@@ -151,11 +155,7 @@ public class MidnightControlsHud extends Hud {
if (!ButtonBinding.INVENTORY.isNotBound()) this.drawTip(matrices, currentX, y, ButtonBinding.INVENTORY, true); if (!ButtonBinding.INVENTORY.isNotBound()) this.drawTip(matrices, currentX, y, ButtonBinding.INVENTORY, true);
currentX += MidnightControlsConfig.hudSide == HudSide.LEFT ? this.inventoryWidth + 4 + this.swapHandsButtonWidth + 2 currentX += MidnightControlsConfig.hudSide == HudSide.LEFT ? this.inventoryWidth + 4 + this.swapHandsButtonWidth + 2
: -this.swapHandsWidth - 2 - this.swapHandsButtonWidth - 4; : -this.swapHandsWidth - 2 - this.swapHandsButtonWidth - 4;
if (isCrammed) { if (!ButtonBinding.SWAP_HANDS.isNotBound() && !isCrammed && showSwapHandsAction) this.drawTip(matrices, currentX, y, ButtonBinding.SWAP_HANDS, true);
currentX = MidnightControlsConfig.hudSide == HudSide.LEFT ? x + this.inventoryButtonWidth + 2 : x - this.inventoryButtonWidth - 2 - this.inventoryWidth;
y -= 20;
}
if (!ButtonBinding.SWAP_HANDS.isNotBound()) this.drawTip(matrices, currentX, y, ButtonBinding.SWAP_HANDS, true);
if (this.client.options.getShowSubtitles().getValue() && MidnightControlsConfig.hudSide == HudSide.RIGHT) { if (this.client.options.getShowSubtitles().getValue() && MidnightControlsConfig.hudSide == HudSide.RIGHT) {
currentX += -this.dropItemWidth - 2 - this.dropItemButtonWidth - 4; currentX += -this.dropItemWidth - 2 - this.dropItemButtonWidth - 4;
} else { } else {
@@ -168,6 +168,14 @@ public class MidnightControlsHud extends Hud {
public void renderSecondSection(MatrixStack matrices, int x, int y) { public void renderSecondSection(MatrixStack matrices, int x, int y) {
int currentX = x; int currentX = x;
if (isCrammed && showSwapHandsAction && !this.client.options.getShowSubtitles().getValue() && !ButtonBinding.SWAP_HANDS.isNotBound()) {
currentX += MidnightControlsConfig.hudSide == HudSide.RIGHT ? this.swapHandsButtonWidth + 2 : -this.swapHandsButtonWidth - 2 - this.swapHandsWidth;
this.drawTip(matrices, currentX, y, ButtonBinding.SWAP_HANDS, true);
currentX = x;
y -= 20;
}
if (!this.placeAction.isEmpty()) { if (!this.placeAction.isEmpty()) {
currentX += MidnightControlsConfig.hudSide == HudSide.RIGHT ? this.useButtonWidth + 2 : -this.useButtonWidth - 2 - this.useWidth; currentX += MidnightControlsConfig.hudSide == HudSide.RIGHT ? this.useButtonWidth + 2 : -this.useButtonWidth - 2 - this.useWidth;
@@ -244,6 +252,7 @@ public class MidnightControlsHud extends Hud {
placeAction = customUseAction; placeAction = customUseAction;
this.placeAction = placeAction; this.placeAction = placeAction;
this.showSwapHandsAction = !this.client.player.getMainHandStack().isEmpty() || !this.client.player.getOffHandStack().isEmpty();
// Cache the "Use" tip width. // Cache the "Use" tip width.
if (this.placeAction.isEmpty()) if (this.placeAction.isEmpty())

View File

@@ -38,7 +38,7 @@ 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 net.minecraft.util.math.Matrix4f; import org.joml.Matrix4f;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
import java.awt.*; import java.awt.*;
@@ -57,12 +57,16 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
private final SpruceOption rotationSpeedOption; private final SpruceOption rotationSpeedOption;
private final SpruceOption yAxisRotationSpeedOption; private final SpruceOption yAxisRotationSpeedOption;
private final SpruceOption mouseSpeedOption; private final SpruceOption mouseSpeedOption;
private final SpruceOption joystickAsMouseOption;
private final SpruceOption virtualMouseOption; private final SpruceOption virtualMouseOption;
private final SpruceOption resetOption; private final SpruceOption resetOption;
private final SpruceOption advancedConfigOption;
// Gameplay options // Gameplay options
private final SpruceOption analogMovementOption; private final SpruceOption analogMovementOption;
private final SpruceOption doubleTapToSprintOption; private final SpruceOption doubleTapToSprintOption;
private final SpruceOption autoJumpOption; private final SpruceOption autoJumpOption;
private final SpruceOption controllerToggleSneakOption;
private final SpruceOption controllerToggleSprintOption;
private final SpruceOption fastBlockPlacingOption; private final SpruceOption fastBlockPlacingOption;
private final SpruceOption frontBlockPlacingOption; private final SpruceOption frontBlockPlacingOption;
private final SpruceOption verticalReacharoundOption; private final SpruceOption verticalReacharoundOption;
@@ -73,6 +77,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
private final SpruceOption virtualMouseSkinOption; private final SpruceOption virtualMouseSkinOption;
private final SpruceOption hudEnableOption; private final SpruceOption hudEnableOption;
private final SpruceOption hudSideOption; private final SpruceOption hudSideOption;
private final SpruceOption moveChatOption;
// Controller options // Controller options
private final SpruceOption controllerOption = private final SpruceOption controllerOption =
new SpruceCyclingOption("midnightcontrols.menu.controller", new SpruceCyclingOption("midnightcontrols.menu.controller",
@@ -116,6 +121,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
private final SpruceOption unfocusedInputOption; private final SpruceOption unfocusedInputOption;
private final SpruceOption invertsRightXAxis; private final SpruceOption invertsRightXAxis;
private final SpruceOption invertsRightYAxis; private final SpruceOption invertsRightYAxis;
private final SpruceOption toggleControllerProfileOption;
private final SpruceOption rightDeadZoneOption; private final SpruceOption rightDeadZoneOption;
private final SpruceOption leftDeadZoneOption; private final SpruceOption leftDeadZoneOption;
private final SpruceOption[] maxAnalogValueOptions = new SpruceOption[]{ private final SpruceOption[] maxAnalogValueOptions = new SpruceOption[]{
@@ -163,7 +169,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
MidnightControlsConfig.controlsMode = next; MidnightControlsConfig.controlsMode = next;
MidnightControlsConfig.save(); MidnightControlsConfig.save();
if (this.client.player != null) { if (this.client != null && this.client.player != null) {
ClientPlayNetworking.getSender().sendPacket(MidnightControls.CONTROLS_MODE_CHANNEL, this.mod.makeControlsModeBuffer(next)); ClientPlayNetworking.getSender().sendPacket(MidnightControls.CONTROLS_MODE_CHANNEL, this.mod.makeControlsModeBuffer(next));
} }
}, option -> option.getDisplayText(Text.translatable(MidnightControlsConfig.controlsMode.getTranslationKey())), }, option -> option.getDisplayText(Text.translatable(MidnightControlsConfig.controlsMode.getTranslationKey())),
@@ -181,13 +187,16 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
this.mouseSpeedOption = new SpruceDoubleOption("midnightcontrols.menu.mouse_speed", 0.0, 150.0, .5f, this.mouseSpeedOption = new SpruceDoubleOption("midnightcontrols.menu.mouse_speed", 0.0, 150.0, .5f,
() -> MidnightControlsConfig.mouseSpeed, () -> MidnightControlsConfig.mouseSpeed,
value -> MidnightControlsConfig.mouseSpeed = value, option -> option.getDisplayText(Text.literal(String.valueOf(option.get()))), value -> MidnightControlsConfig.mouseSpeed = value, option -> option.getDisplayText(Text.literal(String.valueOf(option.get()))),
Text.translatable("midnightcontrols.tooltip.mouse_speed")); Text.translatable("midnightcontrols.tooltip.joystick_as_mouse"));
this.joystickAsMouseOption = new SpruceToggleBooleanOption("midnightcontrols.menu.joystick_as_mouse",
() -> MidnightControlsConfig.joystickAsMouse, value -> MidnightControlsConfig.joystickAsMouse = value,
Text.translatable("midnightcontrols.tooltip.joystick_as_mouse"));
this.resetOption = SpruceSimpleActionOption.reset(btn -> { this.resetOption = SpruceSimpleActionOption.reset(btn -> {
// TODO
MidnightControlsConfig.reset(); MidnightControlsConfig.reset();
var client = MinecraftClient.getInstance(); var client = MinecraftClient.getInstance();
this.init(client, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight()); this.init(client, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight());
}); });
this.advancedConfigOption = SpruceSimpleActionOption.of("midnightcontrols.midnightconfig.title", button -> client.setScreen(MidnightControlsConfig.getScreen(this, "midnightcontrols")));
// Gameplay options // Gameplay options
this.analogMovementOption = new SpruceToggleBooleanOption("midnightcontrols.menu.analog_movement", this.analogMovementOption = new SpruceToggleBooleanOption("midnightcontrols.menu.analog_movement",
() -> MidnightControlsConfig.analogMovement, value -> MidnightControlsConfig.analogMovement = value, () -> MidnightControlsConfig.analogMovement, value -> MidnightControlsConfig.analogMovement = value,
@@ -199,6 +208,12 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
() -> this.client.options.getAutoJump().getValue(), () -> this.client.options.getAutoJump().getValue(),
newValue -> this.client.options.getAutoJump().setValue(newValue), newValue -> this.client.options.getAutoJump().setValue(newValue),
null); null);
this.controllerToggleSneakOption = new SpruceToggleBooleanOption("midnightcontrols.menu.controller_toggle_sneak",
() -> MidnightControlsConfig.controllerToggleSneak, value -> MidnightControlsConfig.controllerToggleSneak = value,
null);
this.controllerToggleSprintOption = new SpruceToggleBooleanOption("midnightcontrols.menu.controller_toggle_sprint",
() -> MidnightControlsConfig.controllerToggleSprint, value -> MidnightControlsConfig.controllerToggleSprint = value,
null);
this.fastBlockPlacingOption = new SpruceToggleBooleanOption("midnightcontrols.menu.fast_block_placing", () -> MidnightControlsConfig.fastBlockPlacing, this.fastBlockPlacingOption = new SpruceToggleBooleanOption("midnightcontrols.menu.fast_block_placing", () -> MidnightControlsConfig.fastBlockPlacing,
value -> MidnightControlsConfig.fastBlockPlacing = value, Text.translatable("midnightcontrols.tooltip.fast_block_placing")); value -> MidnightControlsConfig.fastBlockPlacing = value, Text.translatable("midnightcontrols.tooltip.fast_block_placing"));
this.frontBlockPlacingOption = new SpruceToggleBooleanOption("midnightcontrols.menu.reacharound.horizontal", () -> MidnightControlsConfig.horizontalReacharound, this.frontBlockPlacingOption = new SpruceToggleBooleanOption("midnightcontrols.menu.reacharound.horizontal", () -> MidnightControlsConfig.horizontalReacharound,
@@ -224,7 +239,19 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
amount -> MidnightControlsConfig.hudSide = MidnightControlsConfig.hudSide.next(), amount -> MidnightControlsConfig.hudSide = MidnightControlsConfig.hudSide.next(),
option -> option.getDisplayText(MidnightControlsConfig.hudSide.getTranslatedText()), option -> option.getDisplayText(MidnightControlsConfig.hudSide.getTranslatedText()),
Text.translatable("midnightcontrols.tooltip.hud_side")); Text.translatable("midnightcontrols.tooltip.hud_side"));
this.moveChatOption = new SpruceToggleBooleanOption("midnightcontrols.menu.move_chat", () -> MidnightControlsConfig.moveChat,
value -> MidnightControlsConfig.moveChat = value, Text.translatable("midnightcontrols.tooltip.move_chat"));
// Controller options // Controller options
this.toggleControllerProfileOption = new SpruceToggleBooleanOption("midnightcontrols.menu.separate_controller_profile", () -> MidnightControlsConfig.controllerBindingProfiles.containsKey(MidnightControlsConfig.getController().getGuid()), value -> {
if (value) {
MidnightControlsConfig.controllerBindingProfiles.put(MidnightControlsConfig.getController().getGuid(), MidnightControlsConfig.getBindingsForController());
MidnightControlsConfig.updateBindingsForController(MidnightControlsConfig.getController());
} else {
MidnightControlsConfig.controllerBindingProfiles.remove(MidnightControlsConfig.getController().getGuid());
MidnightControlsConfig.updateBindingsForController(MidnightControlsConfig.getController());
}
}, Text.translatable(""));
this.rightDeadZoneOption = new SpruceDoubleOption("midnightcontrols.menu.right_dead_zone", 0.05, 1.0, .05f, this.rightDeadZoneOption = new SpruceDoubleOption("midnightcontrols.menu.right_dead_zone", 0.05, 1.0, .05f,
() -> MidnightControlsConfig.rightDeadZone, () -> MidnightControlsConfig.rightDeadZone,
value -> MidnightControlsConfig.rightDeadZone = value, option -> { value -> MidnightControlsConfig.rightDeadZone = value, option -> {
@@ -272,8 +299,8 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
this.buildTabs(); this.buildTabs();
this.addDrawableChild(this.resetOption.createWidget(Position.of(this.width / 2 - 155, this.height - 29), 150)); this.addDrawableChild(this.resetOption.createWidget(Position.of(this.width / 2 - 155, this.height - 29), 150));
this.addDrawableChild(new ButtonWidget(this.width / 2 - 155 + 160, this.height - 29, 150, 20, SpruceTexts.GUI_DONE, this.addDrawableChild(ButtonWidget.builder(SpruceTexts.GUI_DONE, btn -> this.client.setScreen(this.parent))
btn -> this.client.setScreen(this.parent))); .dimensions(this.width / 2 - 155 + 160, this.height - 29, 150, 20).build());
} }
public void buildTabs() { public void buildTabs() {
@@ -311,6 +338,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.joystickAsMouseOption);
list.addSingleOptionEntry(this.advancedConfigOption);
return list; return list;
} }
@@ -319,6 +348,8 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
list.setBackground(new MidnightControlsBackground(130)); list.setBackground(new MidnightControlsBackground(130));
list.addSingleOptionEntry(this.analogMovementOption); list.addSingleOptionEntry(this.analogMovementOption);
list.addSingleOptionEntry(this.doubleTapToSprintOption); list.addSingleOptionEntry(this.doubleTapToSprintOption);
list.addSingleOptionEntry(this.controllerToggleSneakOption);
list.addSingleOptionEntry(this.controllerToggleSprintOption);
if (MidnightControls.isExtrasLoaded) list.addSingleOptionEntry(this.fastBlockPlacingOption); if (MidnightControls.isExtrasLoaded) list.addSingleOptionEntry(this.fastBlockPlacingOption);
if (MidnightControls.isExtrasLoaded) list.addSingleOptionEntry(this.frontBlockPlacingOption); if (MidnightControls.isExtrasLoaded) list.addSingleOptionEntry(this.frontBlockPlacingOption);
if (MidnightControls.isExtrasLoaded) list.addSingleOptionEntry(this.verticalReacharoundOption); if (MidnightControls.isExtrasLoaded) list.addSingleOptionEntry(this.verticalReacharoundOption);
@@ -336,6 +367,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
list.addSingleOptionEntry(new SpruceSeparatorOption("midnightcontrols.menu.title.hud", true, null)); list.addSingleOptionEntry(new SpruceSeparatorOption("midnightcontrols.menu.title.hud", true, null));
list.addSingleOptionEntry(this.hudEnableOption); list.addSingleOptionEntry(this.hudEnableOption);
list.addSingleOptionEntry(this.hudSideOption); list.addSingleOptionEntry(this.hudSideOption);
list.addSingleOptionEntry(this.moveChatOption);
return list; return list;
} }
@@ -372,6 +404,7 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
list.setBackground(new MidnightControlsBackground(130)); list.setBackground(new MidnightControlsBackground(130));
list.addSingleOptionEntry(this.controllerOption); list.addSingleOptionEntry(this.controllerOption);
list.addSingleOptionEntry(this.secondControllerOption); list.addSingleOptionEntry(this.secondControllerOption);
list.addSingleOptionEntry(this.toggleControllerProfileOption);
list.addSingleOptionEntry(this.unfocusedInputOption); list.addSingleOptionEntry(this.unfocusedInputOption);
list.addOptionEntry(this.invertsRightXAxis, this.invertsRightYAxis); list.addOptionEntry(this.invertsRightXAxis, this.invertsRightYAxis);
list.addSingleOptionEntry(this.rightDeadZoneOption); list.addSingleOptionEntry(this.rightDeadZoneOption);
@@ -391,20 +424,20 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
@Override @Override
public void renderTitle(MatrixStack matrices, int mouseX, int mouseY, float delta) { public void renderTitle(MatrixStack matrices, int mouseX, int mouseY, float delta) {
drawCenteredText(matrices, this.textRenderer, I18n.translate("midnightcontrols.menu.title"), this.width / 2, 8, 16777215); drawCenteredTextWithShadow(matrices, this.textRenderer, I18n.translate("midnightcontrols.menu.title"), this.width / 2, 8, 16777215);
} }
public static class MidnightControlsBackground implements Background { public static class MidnightControlsBackground implements Background {
private int transparency = 160; private static int transparency = 160;
public MidnightControlsBackground() {} public MidnightControlsBackground() {}
public MidnightControlsBackground(int transparency) { public MidnightControlsBackground(int transparency) {
this.transparency = transparency; MidnightControlsBackground.transparency = transparency;
} }
@Override @Override
public void render(MatrixStack matrixStack, SpruceWidget widget, int vOffset, int mouseX, int mouseY, float delta) { public void render(MatrixStack matrixStack, SpruceWidget widget, int vOffset, int mouseX, int mouseY, float delta) {
fill(matrixStack, widget.getX(), widget.getY(), widget.getX() + widget.getWidth(), widget.getY() + widget.getHeight(), MidnightColorUtil.hex2Rgb("#000000")); fill(matrixStack, widget.getX(), widget.getY(), widget.getX() + widget.getWidth(), widget.getY() + widget.getHeight(), MidnightColorUtil.hex2Rgb("#000000"));
} }
private void fill(MatrixStack matrixStack, int x2, int y2, int x1, int y1, Color color) { private static void fill(MatrixStack matrixStack, int x2, int y2, int x1, int y1, Color color) {
matrixStack.push(); matrixStack.push();
Matrix4f matrix = matrixStack.peek().getPositionMatrix(); Matrix4f matrix = matrixStack.peek().getPositionMatrix();
@@ -414,16 +447,14 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
float t = (float)(transparency) / 255.0F; float t = (float)(transparency) / 255.0F;
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer(); BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
RenderSystem.enableBlend(); RenderSystem.enableBlend();
RenderSystem.disableTexture();
RenderSystem.defaultBlendFunc(); RenderSystem.defaultBlendFunc();
RenderSystem.setShader(GameRenderer::getPositionColorShader); RenderSystem.setShader(GameRenderer::getPositionColorProgram);
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR); bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
bufferBuilder.vertex(matrix, (float)x1, (float)y2, 0.0F).color(r, g, b, t).next(); bufferBuilder.vertex(matrix, (float)x1, (float)y2, 0.0F).color(r, g, b, t).next();
bufferBuilder.vertex(matrix, (float)x2, (float)y2, 0.0F).color(r, g, b, t).next(); bufferBuilder.vertex(matrix, (float)x2, (float)y2, 0.0F).color(r, g, b, t).next();
bufferBuilder.vertex(matrix, (float)x2, (float)y1, 0.0F).color(r, g, b, t).next(); bufferBuilder.vertex(matrix, (float)x2, (float)y1, 0.0F).color(r, g, b, t).next();
bufferBuilder.vertex(matrix, (float)x1, (float)y1, 0.0F).color(r, g, b, t).next(); bufferBuilder.vertex(matrix, (float)x1, (float)y1, 0.0F).color(r, g, b, t).next();
BufferRenderer.drawWithShader(bufferBuilder.end()); BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
RenderSystem.enableTexture();
RenderSystem.disableBlend(); RenderSystem.disableBlend();
matrixStack.pop(); matrixStack.pop();
} }

View File

@@ -10,7 +10,6 @@
package eu.midnightdust.midnightcontrols.client.gui; package eu.midnightdust.midnightcontrols.client.gui;
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient; import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
import eu.midnightdust.midnightcontrols.client.ring.MidnightRing;
import eu.midnightdust.midnightcontrols.client.ring.RingButtonMode; import eu.midnightdust.midnightcontrols.client.ring.RingButtonMode;
import eu.midnightdust.midnightcontrols.client.ring.RingPage; import eu.midnightdust.midnightcontrols.client.ring.RingPage;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
@@ -37,8 +36,8 @@ public class RingScreen extends Screen {
protected void init() { protected void init() {
super.init(); super.init();
if (mod.ring.getMaxPages() > 1) { if (mod.ring.getMaxPages() > 1) {
this.addDrawableChild(new ButtonWidget(5, 5, 20, 20, Text.of(""), button -> this.mod.ring.cyclePage(false))); this.addDrawableChild(ButtonWidget.builder(Text.of(""), button -> this.mod.ring.cyclePage(false)).dimensions(5, 5, 20, 20).build());
this.addDrawableChild(new ButtonWidget(width - 25, 5, 20, 20, Text.of(""), button -> this.mod.ring.cyclePage(true))); this.addDrawableChild(ButtonWidget.builder(Text.of(""), button -> this.mod.ring.cyclePage(true)).dimensions(width - 25, 5, 20, 20).build());
} }
} }
@@ -66,18 +65,18 @@ public class RingScreen extends Screen {
RingPage.selected = -1; RingPage.selected = -1;
this.removed(); this.removed();
} }
@Override // @Override
public boolean changeFocus(boolean lookForwards) { // public boolean changeFocus(boolean lookForwards) {
if (lookForwards) { // if (lookForwards) {
if (RingPage.selected < 7) ++RingPage.selected; // if (RingPage.selected < 7) ++RingPage.selected;
else RingPage.selected = -1; // else RingPage.selected = -1;
} // }
else { // else {
if (RingPage.selected > -1) --RingPage.selected; // if (RingPage.selected > -1) --RingPage.selected;
else RingPage.selected = 7; // else RingPage.selected = 7;
} // }
return true; // return true;
} // }
@Override @Override
public boolean mouseReleased(double mouseX, double mouseY, int button) { public boolean mouseReleased(double mouseX, double mouseY, int button) {

View File

@@ -59,7 +59,7 @@ public class ControllerControlsWidget extends SpruceContainerWidget {
@Override @Override
public void renderWidget(MatrixStack matrices, int mouseX, int mouseY, float delta) { public void renderWidget(MatrixStack matrices, int mouseX, int mouseY, float delta) {
drawCenteredText(matrices, this.client.textRenderer, Text.translatable("midnightcontrols.menu.title.controller_controls"), drawCenteredTextWithShadow(matrices, 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, 16777215);
this.resetButton.setActive(InputManager.streamBindings().anyMatch(Predicates.not(ButtonBinding::isDefault))); this.resetButton.setActive(InputManager.streamBindings().anyMatch(Predicates.not(ButtonBinding::isDefault)));
super.renderWidget(matrices, mouseX, mouseY, delta); super.renderWidget(matrices, mouseX, mouseY, delta);

View File

@@ -0,0 +1,35 @@
package eu.midnightdust.midnightcontrols.client.mixin;
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ChatScreen.class)
public abstract class ChatScreenMixin extends Screen {
@Shadow protected TextFieldWidget chatField;
protected ChatScreenMixin(Text title) {
super(title);
}
@Inject(at = @At("TAIL"), method = "init")
private void midnightcontrols$moveInputField(CallbackInfo ci) {
if (MidnightControlsConfig.moveChat) chatField.setY(4);
}
@Inject(method = "render", at = @At("HEAD"))
private void midnightcontrols$moveInputFieldBackground(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
if (MidnightControlsConfig.moveChat) matrices.translate(0f, -this.height + 16, 0f);
}
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/TextFieldWidget;render(Lnet/minecraft/client/util/math/MatrixStack;IIF)V", shift = At.Shift.BEFORE))
private void midnightcontrols$dontMoveOtherStuff(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) {
if (MidnightControlsConfig.moveChat) matrices.translate(0f, this.height - 16, 0f);
}
}

View File

@@ -38,8 +38,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity { public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity {
private boolean midnightcontrols$driftingPrevented = false; private boolean midnightcontrols$driftingPrevented = false;
public ClientPlayerEntityMixin(ClientWorld world, GameProfile profile, @Nullable PlayerPublicKey publicKey) { public ClientPlayerEntityMixin(ClientWorld world, GameProfile profile) {
super(world, profile, publicKey); super(world, profile);
} }
@Shadow @Shadow

View File

@@ -11,16 +11,13 @@ package eu.midnightdust.midnightcontrols.client.mixin;
import eu.midnightdust.lib.util.screen.TexturedOverlayButtonWidget; import eu.midnightdust.lib.util.screen.TexturedOverlayButtonWidget;
import eu.midnightdust.midnightcontrols.client.gui.MidnightControlsSettingsScreen; import eu.midnightdust.midnightcontrols.client.gui.MidnightControlsSettingsScreen;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.option.ControlsOptionsScreen; import net.minecraft.client.gui.screen.option.ControlsOptionsScreen;
import net.minecraft.client.gui.screen.option.GameOptionsScreen; import net.minecraft.client.gui.screen.option.GameOptionsScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.option.GameOptions; import net.minecraft.client.option.GameOptions;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -30,27 +27,13 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
*/ */
@Mixin(ControlsOptionsScreen.class) @Mixin(ControlsOptionsScreen.class)
public abstract class ControlsOptionsScreenMixin extends GameOptionsScreen { public abstract class ControlsOptionsScreenMixin extends GameOptionsScreen {
@Unique private final boolean showAlternativeButton = FabricLoader.getInstance().isModLoaded("crawl");
public ControlsOptionsScreenMixin(Screen parent, GameOptions gameOptions, Text text) { public ControlsOptionsScreenMixin(Screen parent, GameOptions gameOptions, Text text) {
super(parent, gameOptions, text); super(parent, gameOptions, text);
} }
@Inject(method = "init", at = @At(value = "INVOKE", ordinal = 1, shift = At.Shift.AFTER, target = "Lnet/minecraft/client/gui/screen/option/ControlsOptionsScreen;addDrawableChild(Lnet/minecraft/client/gui/Element;)Lnet/minecraft/client/gui/Element;")) @Inject(method = "init", at = @At(value = "INVOKE", ordinal = 1, shift = At.Shift.AFTER, target = "Lnet/minecraft/client/gui/screen/option/ControlsOptionsScreen;addDrawableChild(Lnet/minecraft/client/gui/Element;)Lnet/minecraft/client/gui/Element;"))
private void addAlternativeControllerButton(CallbackInfo ci) { private void addControllerButton(CallbackInfo ci) {
if (showAlternativeButton) {
this.addDrawableChild(new TexturedOverlayButtonWidget(this.width / 2 + 158, this.height / 6 - 12, 20, 20,0,0,20, new Identifier("midnightcontrols", "textures/gui/midnightcontrols_button.png"), 32, 64, (button) -> { this.addDrawableChild(new TexturedOverlayButtonWidget(this.width / 2 + 158, this.height / 6 - 12, 20, 20,0,0,20, new Identifier("midnightcontrols", "textures/gui/midnightcontrols_button.png"), 32, 64, (button) -> {
this.client.setScreen(new MidnightControlsSettingsScreen(this, false)); this.client.setScreen(new MidnightControlsSettingsScreen(this, false));
}, Text.translatable("midnightcontrols.menu.title.controller"))); }, Text.translatable("midnightcontrols.menu.title.controller")));
} }
} }
@Inject(method = "init", at = @At(value = "INVOKE", ordinal = 4, shift = At.Shift.AFTER, target = "Lnet/minecraft/client/gui/screen/option/ControlsOptionsScreen;addDrawableChild(Lnet/minecraft/client/gui/Element;)Lnet/minecraft/client/gui/Element;"))
private void addControllerButton(CallbackInfo ci) {
if (!showAlternativeButton) {
int i = this.width / 2 - 155;
int j = i + 160;
int k = this.height / 6 - 12 + 48;
this.addDrawableChild(new ButtonWidget(j, k, 150, 20, Text.translatable("midnightcontrols.menu.title.controller").append("..."), (button) -> {
this.client.setScreen(new MidnightControlsSettingsScreen(this, false));
}));
}
}
}

View File

@@ -11,6 +11,7 @@ package eu.midnightdust.midnightcontrols.client.mixin;
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemGroups;
import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.Slot;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@@ -29,8 +30,8 @@ public interface CreativeInventoryScreenAccessor {
* @return the selected tab index * @return the selected tab index
*/ */
@Accessor("selectedTab") @Accessor("selectedTab")
static int getSelectedTab() { static ItemGroup getSelectedTab() {
return 0; return ItemGroups.getDefaultTab();
} }
/** /**

View File

@@ -9,12 +9,13 @@
package eu.midnightdust.midnightcontrols.client.mixin; package eu.midnightdust.midnightcontrols.client.mixin;
import net.minecraft.client.gui.navigation.NavigationDirection;
import net.minecraft.client.gui.widget.EntryListWidget; import net.minecraft.client.gui.widget.EntryListWidget;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker; import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin(EntryListWidget.class) @Mixin(EntryListWidget.class)
public interface EntryListWidgetAccessor { public interface EntryListWidgetAccessor {
@Invoker("moveSelection") //@Invoker("getNeighbouringEntry")
void midnightcontrols$moveSelection(EntryListWidget.MoveDirection direction); //void midnightcontrols$getNeighbouringEntry(NavigationDirection direction);
} }

View File

@@ -27,7 +27,7 @@ public class GameRendererMixin {
@Final @Final
private MinecraftClient client; private MinecraftClient client;
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Mouse;getX()D")) @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Mouse;getX()D", shift = At.Shift.BEFORE))
private void onRender(float tickDelta, long startTime, boolean fullRender, CallbackInfo ci) { private void onRender(float tickDelta, long startTime, boolean fullRender, CallbackInfo ci) {
if (this.client.currentScreen != null && MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER) if (this.client.currentScreen != null && MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER)
MidnightControlsClient.get().input.onPreRenderScreen(this.client, this.client.currentScreen); MidnightControlsClient.get().input.onPreRenderScreen(this.client, this.client.currentScreen);

View File

@@ -0,0 +1,14 @@
package eu.midnightdust.midnightcontrols.client.mixin;
import net.minecraft.client.option.KeyBinding;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import java.util.Map;
@Mixin(KeyBinding.class)
public interface KeyBindingIDAccessor {
@Accessor @Final
static Map<String, KeyBinding> getKEYS_BY_ID() {return null;};
}

View File

@@ -10,8 +10,10 @@ import java.util.List;
@Mixin(value = KeyBindingRegistryImpl.class, remap = false) @Mixin(value = KeyBindingRegistryImpl.class, remap = false)
public interface KeyBindingRegistryImplAccessor { public interface KeyBindingRegistryImplAccessor {
@Accessor @Final @Accessor @Final
static List<KeyBinding> getModdedKeyBindings() { static List<KeyBinding> getMODDED_KEY_BINDINGS() {
return null; return null;
} }
} }

View File

@@ -0,0 +1,16 @@
package eu.midnightdust.midnightcontrols.client.mixin;
import com.google.common.collect.ImmutableList;
import net.minecraft.client.gui.tab.Tab;
import net.minecraft.client.gui.tab.TabManager;
import net.minecraft.client.gui.widget.TabNavigationWidget;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(TabNavigationWidget.class)
public interface TabNavigationWidgetAccessor {
@Accessor
TabManager getTabManager();
@Accessor
ImmutableList<Tab> getTabs();
}

View File

@@ -9,7 +9,6 @@
package eu.midnightdust.midnightcontrols.client.mixin; package eu.midnightdust.midnightcontrols.client.mixin;
import com.mojang.blaze3d.systems.RenderSystem;
import eu.midnightdust.lib.util.MidnightColorUtil; import eu.midnightdust.lib.util.MidnightColorUtil;
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient; import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig; import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
@@ -23,8 +22,8 @@ import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemUsageContext; import net.minecraft.item.ItemUsageContext;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.hit.HitResult; import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.Matrix4f;
import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShape;
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;
@@ -53,7 +52,7 @@ public abstract class WorldRendererMixin {
private BufferBuilderStorage bufferBuilders; private BufferBuilderStorage bufferBuilders;
@Shadow @Shadow
public static void drawShapeOutline(MatrixStack matrixStack, VertexConsumer vertexConsumer, VoxelShape voxelShape, double d, double e, double f, float g, float h, float i, float j) { private static void drawCuboidShapeOutline(MatrixStack matrices, VertexConsumer vertexConsumer, VoxelShape shape, double offsetX, double offsetY, double offsetZ, float red, float green, float blue, float alpha) {
} }
@Inject( @Inject(
@@ -73,7 +72,7 @@ public abstract class WorldRendererMixin {
if (result == null) if (result == null)
return; return;
var blockPos = result.getBlockPos(); var blockPos = result.getBlockPos();
if (this.world.getWorldBorder().contains(blockPos)) { if (this.world.getWorldBorder().contains(blockPos) && this.client.player != null) {
var stack = this.client.player.getStackInHand(Hand.MAIN_HAND); var stack = this.client.player.getStackInHand(Hand.MAIN_HAND);
if (stack == null || !(stack.getItem() instanceof BlockItem)) if (stack == null || !(stack.getItem() instanceof BlockItem))
return; return;
@@ -92,15 +91,9 @@ public abstract class WorldRendererMixin {
var outlineShape = placementState.getOutlineShape(this.client.world, blockPos, ShapeContext.of(camera.getFocusedEntity())); var outlineShape = placementState.getOutlineShape(this.client.world, blockPos, ShapeContext.of(camera.getFocusedEntity()));
Color rgb = MidnightColorUtil.hex2Rgb(MidnightControlsConfig.reacharoundOutlineColorHex); Color rgb = MidnightColorUtil.hex2Rgb(MidnightControlsConfig.reacharoundOutlineColorHex);
if (MidnightControlsConfig.reacharoundOutlineColorHex.isEmpty()) rgb = MidnightColorUtil.radialRainbow(1,1); if (MidnightControlsConfig.reacharoundOutlineColorHex.isEmpty()) rgb = MidnightColorUtil.radialRainbow(1,1);
RenderSystem.defaultBlendFunc();
RenderSystem.disableTexture();
RenderSystem.disableBlend();
RenderSystem.setShader(GameRenderer::getPositionColorShader);
RenderSystem.setShaderColor(rgb.getRed(), rgb.getGreen(), rgb.getBlue(), MidnightControlsConfig.reacharoundOutlineColorAlpha);
matrices.push(); matrices.push();
var vertexConsumer = this.bufferBuilders.getOutlineVertexConsumers().getBuffer(RenderLayer.getLines()); var vertexConsumer = this.bufferBuilders.getEntityVertexConsumers().getBuffer(RenderLayer.getLines());
drawShapeOutline(matrices, vertexConsumer, outlineShape, drawCuboidShapeOutline(matrices, vertexConsumer, outlineShape,
(double) blockPos.getX() - pos.getX(), (double) blockPos.getY() - pos.getY(), (double) blockPos.getZ() - pos.getZ(), (double) blockPos.getX() - pos.getX(), (double) blockPos.getY() - pos.getY(), (double) blockPos.getZ() - pos.getZ(),
rgb.getRed() / 255.f, rgb.getGreen() / 255.f, rgb.getBlue() / 255.f, MidnightControlsConfig.reacharoundOutlineColorAlpha / 255.f); rgb.getRed() / 255.f, rgb.getGreen() / 255.f, rgb.getBlue() / 255.f, MidnightControlsConfig.reacharoundOutlineColorAlpha / 255.f);
matrices.pop(); matrices.pop();

View File

@@ -64,8 +64,8 @@ public final class MidnightRing {
for (String binding : configBindings) { for (String binding : configBindings) {
ButtonBinding buttonBinding = InputManager.getBinding(binding); ButtonBinding buttonBinding = InputManager.getBinding(binding);
if (buttonBinding != null) { if (buttonBinding != null) {
RingPage page = this.pages.get(MathHelper.fastFloor(bindingIndex / 8f)); RingPage page = this.pages.get(MathHelper.floor(bindingIndex / 8f));
page.actions[bindingIndex - 8 * (MathHelper.fastFloor(bindingIndex / 8f))] = (new ButtonBindingRingAction(buttonBinding)); page.actions[bindingIndex - 8 * (MathHelper.floor(bindingIndex / 8f))] = (new ButtonBindingRingAction(buttonBinding));
++bindingIndex; ++bindingIndex;
} }
} }
@@ -88,8 +88,8 @@ public final class MidnightRing {
for (ButtonBinding buttonBinding : unboundBindings) { for (ButtonBinding buttonBinding : unboundBindings) {
if (buttonBinding != null) { if (buttonBinding != null) {
RingPage page = this.pages.get(MathHelper.fastFloor(bindingIndex / 8f)); RingPage page = this.pages.get(MathHelper.floor(bindingIndex / 8f));
page.actions[bindingIndex - 8 * (MathHelper.fastFloor(bindingIndex / 8f))] = (new ButtonBindingRingAction(buttonBinding)); page.actions[bindingIndex - 8 * (MathHelper.floor(bindingIndex / 8f))] = (new ButtonBindingRingAction(buttonBinding));
++bindingIndex; ++bindingIndex;
} }
} }

View File

@@ -58,7 +58,7 @@ public class RingPage extends DrawableHelper {
public void render(@NotNull MatrixStack matrices, @NotNull TextRenderer textRenderer, int width, int height, int mouseX, int mouseY, float tickDelta) { public void render(@NotNull MatrixStack matrices, @NotNull TextRenderer textRenderer, int width, int height, int mouseX, int mouseY, float tickDelta) {
int centerX = width / 2; int centerX = width / 2;
int centerY = height / 2; int centerY = height / 2;
if (MidnightControlsClient.get().ring.getMaxPages() > 1) drawCenteredText(matrices, textRenderer, name, centerX, 5, 0xffffff); if (MidnightControlsClient.get().ring.getMaxPages() > 1) drawCenteredTextWithShadow(matrices, textRenderer, name, centerX, 5, 0xffffff);
int offset = MidnightRing.ELEMENT_SIZE + (MidnightRing.ELEMENT_SIZE / 2) + 5; int offset = MidnightRing.ELEMENT_SIZE + (MidnightRing.ELEMENT_SIZE / 2) + 5;

View File

@@ -77,6 +77,7 @@
"midnightcontrols.controller.mappings.error.write": "Fehler beim Schreiben der Controller Mappings.", "midnightcontrols.controller.mappings.error.write": "Fehler beim Schreiben der Controller Mappings.",
"midnightcontrols.controller.mappings.updated": "Mappings aktualisiert!", "midnightcontrols.controller.mappings.updated": "Mappings aktualisiert!",
"midnightcontrols.controller_type.default": "Standard", "midnightcontrols.controller_type.default": "Standard",
"midnightcontrols.controller_type.numbered": "Nummerierter Controller",
"midnightcontrols.controls_mode.default": "Tastatur/Maus", "midnightcontrols.controls_mode.default": "Tastatur/Maus",
"midnightcontrols.controls_mode.controller": "Controller", "midnightcontrols.controls_mode.controller": "Controller",
"midnightcontrols.controls_mode.touchscreen": "Touchscreen (In Arbeit)", "midnightcontrols.controls_mode.touchscreen": "Touchscreen (In Arbeit)",
@@ -110,6 +111,7 @@
"midnightcontrols.menu.right_dead_zone": "Tote Zone des rechten Sticks", "midnightcontrols.menu.right_dead_zone": "Tote Zone des rechten Sticks",
"midnightcontrols.menu.rotation_speed": "Rotationsgeschwindigkeit (X-Achse)", "midnightcontrols.menu.rotation_speed": "Rotationsgeschwindigkeit (X-Achse)",
"midnightcontrols.menu.y_axis_rotation_speed": "Rotationsgeschwindigkeit (Y-Achse)", "midnightcontrols.menu.y_axis_rotation_speed": "Rotationsgeschwindigkeit (Y-Achse)",
"midnightcontrols.menu.separate_controller_profile": "Separates Controller-Profil",
"midnightcontrols.menu.separator.controller": "Controller", "midnightcontrols.menu.separator.controller": "Controller",
"midnightcontrols.menu.separator.general": "Generell", "midnightcontrols.menu.separator.general": "Generell",
"midnightcontrols.menu.title": "MidnightControls - Einstellungen", "midnightcontrols.menu.title": "MidnightControls - Einstellungen",

View File

@@ -1,5 +1,24 @@
{ {
"midnightcontrols.midnightconfig.title": "MidnightControls Advanced Config", "midnightcontrols.midnightconfig.title": "MidnightControls Advanced Config",
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.DEFAULT_LIGHT": "Default Light",
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.DEFAULT_DARK": "Default Dark",
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.SECOND_LIGHT": "Second Light",
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.SECOND_DARK": "Second Dark",
"midnightcontrols.midnightconfig.enum.ControllerType.DEFAULT": "Default",
"midnightcontrols.midnightconfig.enum.ControllerType.DUALSHOCK": "DualShock",
"midnightcontrols.midnightconfig.enum.ControllerType.DUALSENSE": "DualSense",
"midnightcontrols.midnightconfig.enum.ControllerType.SWITCH": "Switch/Wii Controller",
"midnightcontrols.midnightconfig.enum.ControllerType.XBOX": "Xbox One/Series Controller",
"midnightcontrols.midnightconfig.enum.ControllerType.XBOX_360": "Xbox 360 Controller",
"midnightcontrols.midnightconfig.enum.ControllerType.STEAM_CONTROLLER": "Steam Controller",
"midnightcontrols.midnightconfig.enum.ControllerType.STEAM_DECK": "Steam Deck",
"midnightcontrols.midnightconfig.enum.ControllerType.OUYA": "OUYA Controller",
"midnightcontrols.midnightconfig.enum.ControllerType.NUMBERED": "Numbered Controller",
"midnightcontrols.midnightconfig.enum.ControlsMode.DEFAULT": "Keyboard/Mouse",
"midnightcontrols.midnightconfig.enum.ControlsMode.CONTROLLER": "Controller",
"midnightcontrols.midnightconfig.enum.ControlsMode.TOUCHSCREEN": "Touchscreen (WIP)",
"midnightcontrols.midnightconfig.enum.HudSide.LEFT": "Left",
"midnightcontrols.midnightconfig.enum.HudSide.RIGHT": "Right",
"key.midnightcontrols.look_down": "Look down", "key.midnightcontrols.look_down": "Look down",
"key.midnightcontrols.look_left": "Look left", "key.midnightcontrols.look_left": "Look left",
"key.midnightcontrols.look_right": "Look right", "key.midnightcontrols.look_right": "Look right",
@@ -99,6 +118,7 @@
"midnightcontrols.controller_type.steam_controller": "Steam Controller", "midnightcontrols.controller_type.steam_controller": "Steam Controller",
"midnightcontrols.controller_type.steam_deck": "Steam Deck", "midnightcontrols.controller_type.steam_deck": "Steam Deck",
"midnightcontrols.controller_type.ouya": "OUYA Controller", "midnightcontrols.controller_type.ouya": "OUYA Controller",
"midnightcontrols.controller_type.numbered": "Numbered Controller",
"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 (WIP)", "midnightcontrols.controls_mode.touchscreen": "Touchscreen (WIP)",
@@ -108,6 +128,8 @@
"midnightcontrols.menu.auto_switch_mode": "Auto Switch Mode", "midnightcontrols.menu.auto_switch_mode": "Auto Switch Mode",
"midnightcontrols.menu.controller": "Controller", "midnightcontrols.menu.controller": "Controller",
"midnightcontrols.menu.controller2": "Second Controller", "midnightcontrols.menu.controller2": "Second Controller",
"midnightcontrols.menu.controller_toggle_sneak": "Toggle Sneak on Controller",
"midnightcontrols.menu.controller_toggle_sprint": "Toggle Sprint on Controller",
"midnightcontrols.menu.controller_type": "Controller Type", "midnightcontrols.menu.controller_type": "Controller Type",
"midnightcontrols.menu.controls_mode": "Mode", "midnightcontrols.menu.controls_mode": "Mode",
"midnightcontrols.menu.double_tap_to_sprint": "Double-Tap to Sprint", "midnightcontrols.menu.double_tap_to_sprint": "Double-Tap to Sprint",
@@ -118,6 +140,7 @@
"midnightcontrols.menu.hud_side": "HUD Side", "midnightcontrols.menu.hud_side": "HUD Side",
"midnightcontrols.menu.invert_right_x_axis": "Invert Right X", "midnightcontrols.menu.invert_right_x_axis": "Invert Right X",
"midnightcontrols.menu.invert_right_y_axis": "Invert Right Y", "midnightcontrols.menu.invert_right_y_axis": "Invert Right Y",
"midnightcontrols.menu.joystick_as_mouse": "Always use left stick as mouse",
"midnightcontrols.menu.keyboard_controls": "Keyboard Controls...", "midnightcontrols.menu.keyboard_controls": "Keyboard Controls...",
"midnightcontrols.menu.left_dead_zone": "Left Stick Dead Zone", "midnightcontrols.menu.left_dead_zone": "Left Stick Dead Zone",
"midnightcontrols.menu.mappings.open_input_str": "Open Mappings File Editor", "midnightcontrols.menu.mappings.open_input_str": "Open Mappings File Editor",
@@ -126,12 +149,14 @@
"midnightcontrols.menu.max_right_x_value": "Right X Axis Max Value", "midnightcontrols.menu.max_right_x_value": "Right X Axis Max Value",
"midnightcontrols.menu.max_right_y_value": "Right Y Axis Max Value", "midnightcontrols.menu.max_right_y_value": "Right Y Axis Max Value",
"midnightcontrols.menu.mouse_speed": "Mouse Speed", "midnightcontrols.menu.mouse_speed": "Mouse Speed",
"midnightcontrols.menu.move_chat": "Move chat input box to top",
"midnightcontrols.menu.reacharound.horizontal": "Front Block Placing", "midnightcontrols.menu.reacharound.horizontal": "Front Block Placing",
"midnightcontrols.menu.reacharound.vertical": "Vertical Reacharound", "midnightcontrols.menu.reacharound.vertical": "Vertical Reacharound",
"midnightcontrols.menu.reload_controller_mappings": "Reload Controller Mappings", "midnightcontrols.menu.reload_controller_mappings": "Reload Controller Mappings",
"midnightcontrols.menu.right_dead_zone": "Right Stick Dead Zone", "midnightcontrols.menu.right_dead_zone": "Right Stick Dead Zone",
"midnightcontrols.menu.rotation_speed": "X Axis Rotation Speed", "midnightcontrols.menu.rotation_speed": "X Axis Rotation Speed",
"midnightcontrols.menu.y_axis_rotation_speed": "Y Axis Rotation Speed", "midnightcontrols.menu.y_axis_rotation_speed": "Y Axis Rotation Speed",
"midnightcontrols.menu.separate_controller_profile": "Separate Controller Profile",
"midnightcontrols.menu.separator.controller": "Controller", "midnightcontrols.menu.separator.controller": "Controller",
"midnightcontrols.menu.separator.general": "General", "midnightcontrols.menu.separator.general": "General",
"midnightcontrols.menu.title": "MidnightControls - Settings", "midnightcontrols.menu.title": "MidnightControls - Settings",
@@ -158,12 +183,14 @@
"midnightcontrols.tooltip.fly_drifting_vertical": "While flying, enables Vanilla vertical drifting/intertia.", "midnightcontrols.tooltip.fly_drifting_vertical": "While flying, enables Vanilla vertical drifting/intertia.",
"midnightcontrols.tooltip.hud_enable": "Toggles the on-screen controller button indicator.", "midnightcontrols.tooltip.hud_enable": "Toggles the on-screen controller button indicator.",
"midnightcontrols.tooltip.hud_side": "The position of the HUD.", "midnightcontrols.tooltip.hud_side": "The position of the HUD.",
"midnightcontrols.tooltip.joystick_as_mouse": "Make the joystick behave like a mouse in every menu.",
"midnightcontrols.tooltip.left_dead_zone": "The dead zone for the controller's left analog stick.", "midnightcontrols.tooltip.left_dead_zone": "The dead zone for the controller's left analog stick.",
"midnightcontrols.tooltip.max_left_x_value": "Changes what the mod considers the highest value for the left X axis. Useful if your axis does not use the full range and seems slow.", "midnightcontrols.tooltip.max_left_x_value": "Changes what the mod considers the highest value for the left X axis. Useful if your axis does not use the full range and seems slow.",
"midnightcontrols.tooltip.max_left_y_value": "Changes what the mod considers the highest value for the left Y axis. Useful if your axis does not use the full range and seems slow.", "midnightcontrols.tooltip.max_left_y_value": "Changes what the mod considers the highest value for the left Y axis. Useful if your axis does not use the full range and seems slow.",
"midnightcontrols.tooltip.max_right_x_value": "Changes what the mod considers the highest value for the right X axis. Useful if your axis does not use the full range and seems slow.", "midnightcontrols.tooltip.max_right_x_value": "Changes what the mod considers the highest value for the right X axis. Useful if your axis does not use the full range and seems slow.",
"midnightcontrols.tooltip.max_right_y_value": "Changes what the mod considers the highest value for the right Y axis. Useful if your axis does not use the full range and seems slow.", "midnightcontrols.tooltip.max_right_y_value": "Changes what the mod considers the highest value for the right Y axis. Useful if your axis does not use the full range and seems slow.",
"midnightcontrols.tooltip.mouse_speed": "The controller's emulated mouse speed.", "midnightcontrols.tooltip.mouse_speed": "The controller's emulated mouse speed.",
"midnightcontrols.tooltip.move_chat": "Moves the chat input field to the top, for better input on devices with on-screen keyboards.",
"midnightcontrols.tooltip.reacharound.horizontal": "Enables front block placing, §cmight be considered cheating on some servers§r.", "midnightcontrols.tooltip.reacharound.horizontal": "Enables front block placing, §cmight be considered cheating on some servers§r.",
"midnightcontrols.tooltip.reacharound.vertical": "Enables vertical reacharound, §cmight be considered cheating on some servers§r.", "midnightcontrols.tooltip.reacharound.vertical": "Enables vertical reacharound, §cmight be considered cheating on some servers§r.",
"midnightcontrols.tooltip.reload_controller_mappings": "Reloads the controller mappings file.", "midnightcontrols.tooltip.reload_controller_mappings": "Reloads the controller mappings file.",
@@ -176,5 +203,10 @@
"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",
"midnightcontrols.virtual_mouse.skin.second_dark": "Second Dark", "midnightcontrols.virtual_mouse.skin.second_dark": "Second Dark",
"midnightcontrols.midnightconfig.category.controller": "Controller",
"midnightcontrols.midnightconfig.category.misc": "Miscellaneous",
"midnightcontrols.midnightconfig.category.screens": "Screens",
"midnightcontrols.midnightconfig.category.gameplay": "Gameplay",
"midnightcontrols.midnightconfig.category.visual": "Visual",
"modmenu.descriptionTranslation.midnightcontrols": "Adds controller support and enhanced controls overall.\nForked from LambdaControls, which sadly got discontinued." "modmenu.descriptionTranslation.midnightcontrols": "Adds controller support and enhanced controls overall.\nForked from LambdaControls, which sadly got discontinued."
} }

View File

@@ -0,0 +1,203 @@
{
"midnightcontrols.midnightconfig.title": "Configurazione Avanzata MidnightControls",
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.DEFAULT_LIGHT": "Default Chiaro",
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.DEFAULT_DARK": "Default Scuro",
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.SECOND_LIGHT": "Chiaro Secondario",
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.SECOND_DARK": "Scuro secondario",
"midnightcontrols.midnightconfig.enum.ControllerType.DEFAULT": "Default",
"midnightcontrols.midnightconfig.enum.ControllerType.DUALSHOCK": "DualShock",
"midnightcontrols.midnightconfig.enum.ControllerType.DUALSENSE": "DualSense",
"midnightcontrols.midnightconfig.enum.ControllerType.SWITCH": "Controller Switch/Wii",
"midnightcontrols.midnightconfig.enum.ControllerType.XBOX": "Controller Xbox One/Series",
"midnightcontrols.midnightconfig.enum.ControllerType.XBOX_360": "Controller Xbox 360",
"midnightcontrols.midnightconfig.enum.ControllerType.STEAM_CONTROLLER": "Controller Steam",
"midnightcontrols.midnightconfig.enum.ControllerType.STEAM_DECK": "Steam Deck",
"midnightcontrols.midnightconfig.enum.ControllerType.OUYA": "Controller OUYA",
"midnightcontrols.midnightconfig.enum.ControllerType.NUMBERED": "Controller Numerato",
"midnightcontrols.midnightconfig.enum.ControlsMode.DEFAULT": "Tastiera/Mouse",
"midnightcontrols.midnightconfig.enum.ControlsMode.CONTROLLER": "Controller",
"midnightcontrols.midnightconfig.enum.ControlsMode.TOUCHSCREEN": "Touchscreen (WIP)",
"midnightcontrols.midnightconfig.enum.HudSide.LEFT": "Sinistra",
"midnightcontrols.midnightconfig.enum.HudSide.RIGHT": "Destra",
"key.midnightcontrols.look_down": "Guarda in basso",
"key.midnightcontrols.look_left": "Guarda a sinistra",
"key.midnightcontrols.look_right": "Guarda a destra",
"key.midnightcontrols.look_up": "Guarda sopra",
"key.midnightcontrols.ring": "Apri Tasti non impostati",
"midnightcontrols.action.attack": "Attacca",
"midnightcontrols.action.back": "Indietro",
"midnightcontrols.action.chat": "Apri Chat",
"midnightcontrols.action.controls_ring": "Apri Tasti non impostati",
"midnightcontrols.action.debug_screen": "Apri HUD di Debug (F3)",
"midnightcontrols.action.drop_item": "Rilascia oggetto",
"midnightcontrols.action.exit": "Esci",
"midnightcontrols.action.forward": "Avanti",
"midnightcontrols.action.hit": "Colpisci",
"midnightcontrols.action.hotbar_left": "Hotbar sinistra",
"midnightcontrols.action.hotbar_right": "Hotbar destra",
"midnightcontrols.action.inventory": "Inventario",
"midnightcontrols.action.jump": "Salta",
"midnightcontrols.action.left": "Sinistra",
"midnightcontrols.action.pause_game": "Pausa il gioco",
"midnightcontrols.action.pick_block": "Prendi Blocco",
"midnightcontrols.action.pickup": "Raccogli",
"midnightcontrols.action.pickup_all": "Raccogli Tutto",
"midnightcontrols.action.place": "Piazza",
"midnightcontrols.action.player_list": "Lista Giocatori",
"midnightcontrols.action.quick_move": "Muovi veloce",
"midnightcontrols.action.right": "Destra",
"midnightcontrols.action.screenshot": "Fai uno Screenshot",
"midnightcontrols.action.slot_up": "Muovi slot sopra",
"midnightcontrols.action.slot_down": "Muovi slot sotto",
"midnightcontrols.action.slot_left": "Muovi slot a sinistra",
"midnightcontrols.action.slot_right": "Muovi slot a destra",
"midnightcontrols.action.sneak": "Accovaccia",
"midnightcontrols.action.sprint": "Corri",
"midnightcontrols.action.swap_hands": "Scambia le mani",
"midnightcontrols.action.toggle_perspective": "Cambia la prospettiva",
"midnightcontrols.action.toggle_smooth_camera": "Cambia Camera Cinematica",
"midnightcontrols.action.page_back": "Pagina precedente",
"midnightcontrols.action.page_next": "Pagina Successica",
"midnightcontrols.action.tab_back": "Tab Precedente",
"midnightcontrols.action.tab_next": "Tab Successiva",
"midnightcontrols.action.take": "Prendi Item",
"midnightcontrols.action.take_all": "Prendi Stack",
"midnightcontrols.action.use": "Usa",
"midnightcontrols.action.zoom": "Zoom",
"midnightcontrols.action.zoom_in": "Aumenta Zoom",
"midnightcontrols.action.zoom_out": "Diminuisci Zoom",
"midnightcontrols.action.zoom_reset": "Resetta Zoom",
"midnightcontrols.action.emi_page_left": "Pagina Precedente",
"midnightcontrols.action.emi_page_right": "Pagina Successiva",
"midnightcontrols.category.emi": "EMI",
"midnightcontrols.button.a": "A",
"midnightcontrols.button.b": "B",
"midnightcontrols.button.x": "X",
"midnightcontrols.button.y": "Y",
"midnightcontrols.button.left_bumper": "Bumper Destro",
"midnightcontrols.button.right_bumper": "Bumper Sinistro",
"midnightcontrols.button.back": "Indietro",
"midnightcontrols.button.start": "Avvia",
"midnightcontrols.button.guide": "Guida",
"midnightcontrols.button.left_thumb": "Pollice Sinistro",
"midnightcontrols.button.right_thumb": "Pollice Destro",
"midnightcontrols.button.dpad_up": "DPAD Sopra",
"midnightcontrols.button.dpad_right": "DPAD Destra",
"midnightcontrols.button.dpad_down": "DPAD Sotto",
"midnightcontrols.button.dpad_left": "DPAD Sinistra",
"midnightcontrols.button.l4": "L4",
"midnightcontrols.button.l5": "L5",
"midnightcontrols.button.r4": "R4",
"midnightcontrols.button.r5": "L5",
"midnightcontrols.axis.left_x+": "Sinistra X+",
"midnightcontrols.axis.left_y+": "Sinistra Y+",
"midnightcontrols.axis.right_x+": "Destra X+",
"midnightcontrols.axis.right_y+": "Destra Y+",
"midnightcontrols.axis.left_trigger": "Trigger Sinistro",
"midnightcontrols.axis.right_trigger": "Trigger Destro",
"midnightcontrols.axis.left_x-": "Sinistra X-",
"midnightcontrols.axis.left_y-": "Sinistra Y-",
"midnightcontrols.axis.right_x-": "Destra X-",
"midnightcontrols.axis.right_y-": "Destra Y-",
"midnightcontrols.button.unknown": "Sconosciuto",
"midnightcontrols.controller.tutorial.title": "Gioca il gioco con un Controller!",
"midnightcontrols.controller.tutorial.description": "Vai a %s -> %s -> %s",
"midnightcontrols.controller.connected": "Controller %d connesso.",
"midnightcontrols.controller.disconnected": "Controller %d disconnesso",
"midnightcontrols.controller.mappings.1": "Per configurare le mappature dei controller, per favore usa %s",
"midnightcontrols.controller.mappings.3": "e incolla le mappature nel file editor.",
"midnightcontrols.controller.mappings.error": "Errore durante il caricamento delle mappature",
"midnightcontrols.controller.mappings.error.write": "Errore durante la scrittura delle mappature su file",
"midnightcontrols.controller.mappings.updated": "Aggiornate le mappature!",
"midnightcontrols.controller_type.default": "Default",
"midnightcontrols.controller_type.dualshock": "DualShock",
"midnightcontrols.controller_type.dualsense": "DualSense",
"midnightcontrols.controller_type.switch": "Controller Switch/Wii",
"midnightcontrols.controller_type.xbox": "Controller Xbox One/Series",
"midnightcontrols.controller_type.xbox_360": "Controller Xbox 360",
"midnightcontrols.controller_type.steam_controller": "Controller Steam",
"midnightcontrols.controller_type.steam_deck": "Steam Deck",
"midnightcontrols.controller_type.ouya": "Controller OUYA",
"midnightcontrols.controller_type.numbered": "Controller Numerato",
"midnightcontrols.controls_mode.default": "Tastiera/Mouse",
"midnightcontrols.controls_mode.controller": "Controller",
"midnightcontrols.controls_mode.touchscreen": "Touchscreen (WIP)",
"midnightcontrols.hud_side.left": "Left",
"midnightcontrols.hud_side.right": "Destra",
"midnightcontrols.menu.analog_movement": "Movimento Analogo",
"midnightcontrols.menu.auto_switch_mode": "Modalità Cambio Automatico",
"midnightcontrols.menu.controller": "Controller",
"midnightcontrols.menu.controller2": "Controller Secondario",
"midnightcontrols.menu.controller_toggle_sneak": "Attiva/Disattiva Accovacciamento su Controller",
"midnightcontrols.menu.controller_toggle_sprint": "Attiva/Disattiva Correre su Controller",
"midnightcontrols.menu.controller_type": "Tipo di Controller",
"midnightcontrols.menu.controls_mode": "Modalità",
"midnightcontrols.menu.double_tap_to_sprint": "Doppio Tap per Sprintare",
"midnightcontrols.menu.fast_block_placing": "Veloce Piazzamento di Blocchi",
"midnightcontrols.menu.fly_drifting": "Drift in Volo",
"midnightcontrols.menu.fly_drifting_vertical": "Drift in Volo Verticale",
"midnightcontrols.menu.hud_enable": "Attiva HUD",
"midnightcontrols.menu.hud_side": "Lato HUD",
"midnightcontrols.menu.invert_right_x_axis": "Inverti Destro X",
"midnightcontrols.menu.invert_right_y_axis": "Inverti Destro Y",
"midnightcontrols.menu.keyboard_controls": "Controlli da Tastiera...",
"midnightcontrols.menu.left_dead_zone": "Zona Morta dello Stick Sinistro",
"midnightcontrols.menu.mappings.open_input_str": "Apri il File Editor delle Mappature",
"midnightcontrols.menu.max_left_x_value": "Asse X Sinistro Massimo Valore",
"midnightcontrols.menu.max_left_y_value": "Asse Y Sinistro Massimo Valore",
"midnightcontrols.menu.max_right_x_value": "Asse Destro X Massimo Valore",
"midnightcontrols.menu.max_right_y_value": "Asse Destro Y Massimo Valore",
"midnightcontrols.menu.mouse_speed": "Velocità Mouse",
"midnightcontrols.menu.reacharound.horizontal": "Piazza blocchi Davanti",
"midnightcontrols.menu.reacharound.vertical": "Reach Verticale",
"midnightcontrols.menu.reload_controller_mappings": "Ricarica Mappature del Controller",
"midnightcontrols.menu.right_dead_zone": "Zona Morta Stick Destro",
"midnightcontrols.menu.rotation_speed": "Velocità di rotazione dell'Asse X",
"midnightcontrols.menu.y_axis_rotation_speed": "Velocità di rotazione dell'Asse Y",
"midnightcontrols.menu.separate_controller_profile": "Profilo Controller Separato",
"midnightcontrols.menu.separator.controller": "Controller",
"midnightcontrols.menu.separator.general": "Generale",
"midnightcontrols.menu.title": "MidnightControls - Impostazioni",
"midnightcontrols.menu.title.controller": "Opzioni Controller",
"midnightcontrols.menu.title.controller_controls": "Tasti Controller",
"midnightcontrols.menu.title.gameplay": "Opzioni del Gameplay",
"midnightcontrols.menu.title.general": "Impostazioni Generali",
"midnightcontrols.menu.title.hud": "Opzioni della HUD",
"midnightcontrols.menu.title.mappings.string": "Editor di file delle Mappature",
"midnightcontrols.menu.title.visual": "Aspetto",
"midnightcontrols.menu.unfocused_input": "Input non a fuoco",
"midnightcontrols.menu.virtual_mouse": "Mouse Virtuale",
"midnightcontrols.menu.virtual_mouse.skin": "Aspetto Mouse Virtuale",
"midnightcontrols.narrator.unbound": "Disimpostato %s",
"midnightcontrols.not_bound": "Non Impostato",
"midnightcontrols.tooltip.analog_movement": "Quando possibile, attiva movimento analogo.",
"midnightcontrols.tooltip.auto_switch_mode": "Quando la modalità controlli dovrebbe passare a Controller automaticamente se uno è connesso",
"midnightcontrols.tooltip.controller2": "Secondo controller da usare, che permette (per esempio) Supporto dei Joy-Cons.",
"midnightcontrols.tooltip.controller_type": "Il tipo di controller che stai usando (usato per mostrare i pulsanti corretti)",
"midnightcontrols.tooltip.controls_mode": "Modalita controlli.",
"midnightcontrols.tooltip.double_tap_to_sprint": "Attiva quando il tasto \"Cammina Avanti\" fa correre il giocatore con doppio tap velocemente",
"midnightcontrols.tooltip.fast_block_placing": "Quando si vola in creativa, attiva il movimento veloce dei blocchi in base alla tua velocità. §cSu alcuni server potrebbe essere considerato un cheat.§r",
"midnightcontrols.tooltip.fly_drifting": "Quando si vola, attiva L'inerzia del Vanilla",
"midnightcontrols.tooltip.fly_drifting_vertical": "Quando si vola, attiva l'inerzia verticale Vanilla",
"midnightcontrols.tooltip.hud_enable": "Attiva gli indicatori dei pulsanti dei controller sullo schermo.",
"midnightcontrols.tooltip.hud_side": "La posizione della HUD",
"midnightcontrols.tooltip.left_dead_zone": "La zona morta per lo stick sinistro del controller.",
"midnightcontrols.tooltip.max_left_x_value": "Cambia cosa la mod considera il più alto valore per l'asse X sinistro. Utile se il tuo asse non usa il range massimo e sembra lento",
"midnightcontrols.tooltip.max_left_y_value": "Cambia cosa la mod considera il più alto valore per l'asse Y sinistro. Utile se il tuo asse non usa il range massimo e sembra lento",
"midnightcontrols.tooltip.max_right_x_value": "Cambia cosa la mod considera il più alto valore per l'asse X Destro. Utile se il tuo asse non usa il range massimo e sembra lento.",
"midnightcontrols.tooltip.max_right_y_value": "Cambia cosa la mod considera il più alto valore per l'asse Y Destro. Utile se il tuo asse non usa il range massimo e sembra lento.",
"midnightcontrols.tooltip.mouse_speed": "La velocità del controller emulato.",
"midnightcontrols.tooltip.reacharound.horizontal": "Attiva il piazzare blocchi davanti, Potrebbe essere considerato un cheat su alcuni server.",
"midnightcontrols.tooltip.reacharound.vertical": "Attiva il reach verticale, potrebbe essere considerato cheating su alcuni server",
"midnightcontrols.tooltip.reload_controller_mappings": "Riavvia il file dlle mappature del controller",
"midnightcontrols.tooltip.right_dead_zone": "La zona morta per lo stick destro del controller",
"midnightcontrols.tooltip.rotation_speed": "L'asse X della velocità di rotazione della camera im modalità controller",
"midnightcontrols.tooltip.y_axis_rotation_speed": "L'asse Y della velocità di rotazione della camera im modalità controller",
"midnightcontrols.tooltip.unfocused_input": "Permette imput dei controller quando la finestra non è messa a fuoco",
"midnightcontrols.tooltip.virtual_mouse": "Attiva il mouse virtuale, che può essere utile nello schermo diviso.",
"midnightcontrols.virtual_mouse.skin.default_light": "Chiaro Default",
"midnightcontrols.virtual_mouse.skin.default_dark": "Scuro Default",
"midnightcontrols.virtual_mouse.skin.second_light": "Chiaro Secondario",
"midnightcontrols.virtual_mouse.skin.second_dark": "Scuro Secondario",
"modmenu.descriptionTranslation.midnightcontrols": "Aggiunge supporto e controlli migliorati in generale. \\nProveniente da LambdaControls, che è stato rimosso."
}

View File

@@ -0,0 +1,184 @@
{
"midnightcontrols.midnightconfig.title": "Розширена конфігурація MidnightControls",
"key.midnightcontrols.look_down": "Дивитись вниз",
"key.midnightcontrols.look_left": "Дивитись ліворуч",
"key.midnightcontrols.look_right": "Дивитись направо",
"key.midnightcontrols.look_up": "Дивитись вгору",
"key.midnightcontrols.ring": "Показати кільце управління",
"midnightcontrols.action.attack": "Атакувати",
"midnightcontrols.action.back": "Назад",
"midnightcontrols.action.chat": "Відкрити чат",
"midnightcontrols.action.debug_screen": "Відкрити налагодження (F3)",
"midnightcontrols.action.drop_item": "Викинути предмет",
"midnightcontrols.action.exit": "Вийти",
"midnightcontrols.action.forward": "Вперед",
"midnightcontrols.action.hit": "Вдарити",
"midnightcontrols.action.hotbar_left": "Панель швидкого доступу ліворуч",
"midnightcontrols.action.hotbar_right": "Панель швидкого доступу праворуч",
"midnightcontrols.action.inventory": "Інвентар",
"midnightcontrols.action.jump": "Стрибок",
"midnightcontrols.action.left": "Наліво",
"midnightcontrols.action.pause_game": "Зупинити гру",
"midnightcontrols.action.pick_block": "Вибір блоку",
"midnightcontrols.action.pickup": "Взяти половину",
"midnightcontrols.action.pickup_all": "Взяти все",
"midnightcontrols.action.place": "Поставити",
"midnightcontrols.action.player_list": "Аркуш гравців",
"midnightcontrols.action.quick_move": "Перекласти",
"midnightcontrols.action.right": "Направо",
"midnightcontrols.action.screenshot": "Зробити скріншот",
"midnightcontrols.action.slot_up": "Двинути на слот вгору",
"midnightcontrols.action.slot_down": "Повернути на слот вниз",
"midnightcontrols.action.slot_left": "Двинути на слот вліво",
"midnightcontrols.action.slot_right": "Повернути на слот вправо",
"midnightcontrols.action.sneak": "Крастися",
"midnightcontrols.action.sprint": "Біг",
"midnightcontrols.action.swap_hands": "Змінити руку",
"midnightcontrols.action.toggle_perspective": "Переключити перспективу",
"midnightcontrols.action.toggle_smooth_camera": "Переключити кінематографічну камеру",
"midnightcontrols.action.page_back": "Попередня сторінка",
"midnightcontrols.action.page_next": "Наступна сторінка",
"midnightcontrols.action.tab_back": "Попередня секція",
"midnightcontrols.action.tab_next": "Наступна секція",
"midnightcontrols.action.take": "Взяти предмет",
"midnightcontrols.action.take_all": "Взяти стак",
"midnightcontrols.action.use": "Використовувати",
"midnightcontrols.action.zoom": "Наблизити",
"midnightcontrols.action.zoom_in": "Збільшити масштаб",
"midnightcontrols.action.zoom_out": "Зменшити масштаб",
"midnightcontrols.action.zoom_reset": "Скинути масштаб",
"midnightcontrols.action.emi_page_left": "Попередня сторінка",
"midnightcontrols.action.emi_page_right": "Наступна сторінка",
"midnightcontrols.category.emi": "ЕМІ",
"midnightcontrols.button.a": "A",
"midnightcontrols.button.b": "B",
"midnightcontrols.button.x": "X",
"midnightcontrols.button.y": "Y",
"midnightcontrols.button.left_bumper": "Лівий бампер",
"midnightcontrols.button.right_bumper": "Правий бампер",
"midnightcontrols.button.back": "Назад",
"midnightcontrols.button.start": "Старт",
"midnightcontrols.button.guide": "Гайд кнопка",
"midnightcontrols.button.left_thumb": "Лівий стік",
"midnightcontrols.button.right_thumb": "Правий стік",
"midnightcontrols.button.dpad_up": "Хрестовина вг.",
"midnightcontrols.button.dpad_right": "Хрестовина пр.",
"midnightcontrols.button.dpad_down": "Хрестовина вн.",
"midnightcontrols.button.dpad_left": "Хрестовина лів.",
"midnightcontrols.button.l4": "L4",
"midnightcontrols.button.l5": "L5",
"midnightcontrols.button.r4": "R4",
"midnightcontrols.button.r5": "L5",
"midnightcontrols.axis.left_x+": "Лівий cтік X+",
"midnightcontrols.axis.left_y+": "Лівий cтік Y+",
"midnightcontrols.axis.right_x+": "Правий cтік X+",
"midnightcontrols.axis.right_y+": "Правий cтік Y+",
"midnightcontrols.axis.left_trigger": "Лівий тригер",
"midnightcontrols.axis.right_trigger": "Правий тригер",
"midnightcontrols.axis.left_x-": "Лівий стік X-",
"midnightcontrols.axis.left_y-": "Лівий стік Y-",
"midnightcontrols.axis.right_x-": "Правий стік X-",
"midnightcontrols.axis.right_y-": "Правий стік Y-",
"midnightcontrols.button.unknown": "Невідомий (%d)",
"midnightcontrols.controller.connected": "Контролер %d був приєднаний.",
"midnightcontrols.controller.disconnected": "Контролер %d вимкнений.",
"midnightcontrols.controller.mappings.1": "Щоб налаштувати розкладку контролера, використовуйте %s",
"midnightcontrols.controller.mappings.3": "і вставте ваш підсумок у редактор файлів розкладок.",
"midnightcontrols.controller.mappings.error": "Помилка під час завантаження розкладки.",
"midnightcontrols.controller.mappings.error.write": "Помилка під час запису розкладки у файл.",
"midnightcontrols.controller.mappings.updated": "Розкладка оновлена!",
"midnightcontrols.controller_type.default": "За стандартом",
"midnightcontrols.controller_type.dualshock": "DualShock",
"midnightcontrols.controller_type.dualsense": "DualSense",
"midnightcontrols.controller_type.switch": "Switch",
"midnightcontrols.controller_type.xbox": "Xbox",
"midnightcontrols.controller_type.xbox_360": "Xbox 360",
"midnightcontrols.controller_type.steam_controller": "Steam Controller",
"midnightcontrols.controller_type.steam_deck": "Steam Deck",
"midnightcontrols.controller_type.ouya": "OUYA",
"midnightcontrols.controls_mode.default": "Клавіатура/Миша",
"midnightcontrols.controls_mode.controller": "Контролер",
"midnightcontrols.controls_mode.touchscreen": "Сенсорний екран (Розроб.)",
"midnightcontrols.hud_side.left": "Більше ліворуч",
"midnightcontrols.hud_side.right": "Більше направо",
"midnightcontrols.menu.analog_movement": "Аналоговий рух",
"midnightcontrols.menu.auto_switch_mode": "Автоматичне перемикання",
"midnightcontrols.menu.controller": "Контролер",
"midnightcontrols.menu.controller2": "Додатковий контролер",
"midnightcontrols.menu.controller_type": "Тип контролера",
"midnightcontrols.menu.controls_mode": "Тип",
"midnightcontrols.menu.double_tap_to_sprint": "Двічі відвести лівий стік, щоб почати бігти",
"midnightcontrols.menu.fast_block_placing": "Швидка постачання блоків",
"midnightcontrols.menu.fly_drifting": "Інерція при польоті",
"midnightcontrols.menu.fly_drifting_vertical": "Вертикальна інерція при польоті",
"midnightcontrols.menu.hud_enable": "Увімкнути іконоки контролера",
"midnightcontrols.menu.hud_side": "Розташування інтерфейсу",
"midnightcontrols.menu.invert_right_x_axis": "Інвертувати прав. X",
"midnightcontrols.menu.invert_right_y_axis": "Інвертувати прав. Y",
"midnightcontrols.menu.keyboard_controls": "Клавіатурне налаштування...",
"midnightcontrols.menu.left_dead_zone": "Мертва зона лівого стіка",
"midnightcontrols.menu.mappings.open_input_str": "Відкрити редактор файлів розкладок",
"midnightcontrols.menu.max_left_x_value": "Максимальне значення вісь лівого X",
"midnightcontrols.menu.max_left_y_value": "Максимальне значення вісь лівого Y",
"midnightcontrols.menu.max_right_x_value": "Максимальне значення вісь правого X",
"midnightcontrols.menu.max_right_y_value": "Максимальне значення Вісь правого Y",
"midnightcontrols.menu.mouse_speed": "Швидкість курсору",
"midnightcontrols.menu.reacharound.horizontal": "Розміщення переднього блоку",
"midnightcontrols.menu.reacharound.vertical": "Вертикальний охоплення",
"midnightcontrols.menu.reload_controller_mappings": "Перезавантажити розкладку контролера",
"midnightcontrols.menu.right_dead_zone": "Мертва зона правого стіка",
"midnightcontrols.menu.rotation_speed": "Швидкість обертання по осі X",
"midnightcontrols.menu.y_axis_rotation_speed": "Швидкість обертання по осі Y",
"midnightcontrols.menu.separator.controller": "Контролер",
"midnightcontrols.menu.separator.general": "Загальні",
"midnightcontrols.menu.title": "MidnightControls - налаштування",
"midnightcontrols.menu.title.controller": "Налаштування контролера",
"midnightcontrols.menu.title.controller_controls": "Управління контролером",
"midnightcontrols.menu.title.gameplay": "Налаштування під час гри",
"midnightcontrols.menu.title.general": "Загальні Налаштування",
"midnightcontrols.menu.title.hud": "Налаштування інтерфейсу",
"midnightcontrols.menu.title.mappings.string": "Редактор файлів розкладок",
"midnightcontrols.menu.title.visual": "Налаштування зовнішнього вигляду",
"midnightcontrols.menu.unfocused_input": "Несфокусоване введення",
"midnightcontrols.menu.virtual_mouse": "Віртуальні мишки",
"midnightcontrols.menu.virtual_mouse.skin": "Дизайн віртуальної мишки",
"midnightcontrols.narrator.unbound": "Звільнений %s",
"midnightcontrols.not_bound": "Не призначено",
"midnightcontrols.tooltip.analog_movement": "Включає аналоговий рух, коли це можливо.",
"midnightcontrols.tooltip.auto_switch_mode": "Автоматичне перемикання на новий, тільки підключений контролер.",
"midnightcontrols.tooltip.controller2": "Додатковий контролер, наприклад для джой-конів.",
"midnightcontrols.tooltip.controller_type": "Тип контролера, щоб правильно зіставити іконки кнопок.",
"midnightcontrols.tooltip.controls_mode": "Тип контролю за грою.",
"midnightcontrols.tooltip.double_tap_to_sprint": "При подвійному переміщенні на лівий стик, персонаж починає бігти.",
"midnightcontrols.tooltip.fast_block_placing": "Під час польоту в творчому режимі дозволяє швидко розміщувати блоки в залежності від вашої швидкості. §cНа деяких серверах це може розцінюватися як читерство.§r",
"midnightcontrols.tooltip.fly_drifting": "Під час польоту включає ванільну інерцію.",
"midnightcontrols.tooltip.fly_drifting_vertical": "Під час польоту включає ванільну вертикальну інерцію.",
"midnightcontrols.tooltip.hud_enable": "Переключає бачення іконок кнопок контролера на екрані.",
"midnightcontrols.tooltip.hud_side": "Розташування інтерфейсу у певний бік.",
"midnightcontrols.tooltip.left_dead_zone": "Мертва зона для лівого аналогового стику контролера.",
"midnightcontrols.tooltip.max_left_x_value": "Змінює те, що мод в результаті вважає максимальним значенням для лівої осі X. Корисно, якщо ваша вісь не використовує весь діапазон і здається повільною.",
"midnightcontrols.tooltip.max_left_y_value": "Змінює те, що мод в результаті вважає максимальним значенням для лівої осі Y. Корисно, якщо ваша вісь не використовує весь діапазон і здається повільною.",
"midnightcontrols.tooltip.max_right_x_value": "Змінює те, що мод в результаті вважає максимальним значенням для правої осі X. Корисно, якщо ваша вісь не використовує весь діапазон і здається повільною.",
"midnightcontrols.tooltip.max_right_y_value": "Змінює те, що мод в результаті вважає максимальним значенням для правої осі Y. Корисно, якщо ваша вісь не використовує весь діапазон і здається повільною.",
"midnightcontrols.tooltip.mouse_speed": "Швидкість миші, що емульується контролером.",
"midnightcontrols.tooltip.reacharound.horizontal": "Дозволяє розміщувати передній блок перед собою. §cМоже розглядатися як читерство на деяких серверах§r.",
"midnightcontrols.tooltip.reacharound.vertical": "Забезпечує вертикальне охоплення. §cМоже розглядатися як шахрайство на деяких серверах§r.",
"midnightcontrols.tooltip.reload_controller_mappings": "Перезавантажує файл розкладки контролерів.",
"midnightcontrols.tooltip.right_dead_zone": "Мертва зона для правого аналогового стику контролера.",
"midnightcontrols.tooltip.rotation_speed": "Швидкість обертання камери по осі X в режимі контролера.",
"midnightcontrols.tooltip.y_axis_rotation_speed": "Швидкість обертання камери по осі Y в режимі контролера.",
"midnightcontrols.tooltip.unfocused_input": "Дозволити введення з контролера, навіть якщо гра сфокусована.",
"midnightcontrols.tooltip.virtual_mouse": "Включити віртуальну мишу дуже корисно при грі двом на одному комп'ютері.",
"midnightcontrols.virtual_mouse.skin.default_light": "Звичайний світлий",
"midnightcontrols.virtual_mouse.skin.default_dark": "Звичайний темний",
"midnightcontrols.virtual_mouse.skin.second_light": "Додатковий світлий",
"midnightcontrols.virtual_mouse.skin.second_dark": "Додатковий темний",
"modmenu.descriptionTranslation.midnightcontrols": "Додавання підтримки контролера та покращення елементів керування в цілому.\nРозгалужений від LambdaControls, підтримка якого, на жаль, припинена..",
"midnightcontrols.menu.joystick_as_mouse": "Завжди використовуйте лівий стік як мишку",
"midnightcontrols.tooltip.joystick_as_mouse": "Джойстик поводиться як миша в кожному меню.",
"midnightcontrols.menu.controller_toggle_sneak": "Перемикач присідання на контролері",
"midnightcontrols.menu.controller_toggle_sprint": "Перемикач бігу на контролері",
"midnightcontrols.menu.move_chat": "Перемістити поле введення чату вгору",
"midnightcontrols.action.controls_ring": "Показати кільце Управління",
"midnightcontrols.menu.separate_controller_profile": "Окремий профіль контролера"
}

View File

@@ -0,0 +1,152 @@
{
"key.midnightcontrols.look_down": "視角下移",
"key.midnightcontrols.look_left": "視角左移",
"key.midnightcontrols.look_right": "視角右移",
"key.midnightcontrols.look_up": "視角上移",
"key.midnightcontrols.ring": "顯示額外按鍵菜單",
"midnightcontrols.action.attack": "攻擊",
"midnightcontrols.action.back": "向後移動",
"midnightcontrols.action.chat": "打開聊天欄",
"midnightcontrols.action.drop_item": "丟棄所選物品",
"midnightcontrols.action.exit": "退出",
"midnightcontrols.action.forward": "向前移動",
"midnightcontrols.action.hit": "挖掘",
"midnightcontrols.action.hotbar_left": "向左循環選擇快捷欄",
"midnightcontrols.action.hotbar_right": "向右循環選擇快捷欄",
"midnightcontrols.action.inventory": "物品欄",
"midnightcontrols.action.jump": "跳躍",
"midnightcontrols.action.left": "向左移動",
"midnightcontrols.action.pause_game": "暫停遊戲",
"midnightcontrols.action.pick_block": "選取方塊",
"midnightcontrols.action.pickup": "拿取一個/拿取一半",
"midnightcontrols.action.pickup_all": "拿取一組/拿取全部",
"midnightcontrols.action.place": "放置方塊",
"midnightcontrols.action.player_list": "玩家列表",
"midnightcontrols.action.quick_move": "快速移動物品",
"midnightcontrols.action.right": "向右移動",
"midnightcontrols.action.screenshot": "截圖",
"midnightcontrols.action.sneak": "潛行",
"midnightcontrols.action.sprint": "疾跑",
"midnightcontrols.action.swap_hands": "與副手交換",
"midnightcontrols.action.toggle_perspective": "切換視角",
"midnightcontrols.action.toggle_smooth_camera": "切換電影視角",
"midnightcontrols.action.use": "使用物品/放置方塊",
"midnightcontrols.action.zoom": "視野縮放",
"midnightcontrols.action.zoom_in": "縮放時將視野推近",
"midnightcontrols.action.zoom_out": "縮放時將視野拉遠",
"midnightcontrols.action.zoom_reset": "縮放時重置縮放距離",
"midnightcontrols.button.a": "A",
"midnightcontrols.button.b": "B",
"midnightcontrols.button.x": "X",
"midnightcontrols.button.y": "Y",
"midnightcontrols.button.left_bumper": "LB 鍵",
"midnightcontrols.button.right_bumper": "RB 鍵",
"midnightcontrols.button.back": "選擇鍵",
"midnightcontrols.button.start": "開始鍵",
"midnightcontrols.button.guide": "功能鍵",
"midnightcontrols.button.left_thumb": "左搖桿(按壓)",
"midnightcontrols.button.right_thumb": "右搖桿(按壓)",
"midnightcontrols.button.dpad_up": "十字鍵上",
"midnightcontrols.button.dpad_right": "十字鍵右",
"midnightcontrols.button.dpad_down": "十字鍵下",
"midnightcontrols.button.dpad_left": "十字鍵左",
"midnightcontrols.axis.left_x+": "左搖桿右X軸正向",
"midnightcontrols.axis.left_y+": "左搖桿上Y軸正向",
"midnightcontrols.axis.right_x+": "右搖桿右X軸正向",
"midnightcontrols.axis.right_y+": "右搖桿上Y軸正向",
"midnightcontrols.axis.left_trigger": "左扳機鍵",
"midnightcontrols.axis.right_trigger": "右扳機鍵",
"midnightcontrols.axis.left_x-": "左搖桿左X軸負向",
"midnightcontrols.axis.left_y-": "左搖桿下Y軸負向",
"midnightcontrols.axis.right_x-": "右搖桿左X軸負向",
"midnightcontrols.axis.right_y-": "右搖桿下Y軸負向",
"midnightcontrols.button.unknown": "未知(%d",
"midnightcontrols.controller.connected": "手把 %d 已連接。",
"midnightcontrols.controller.disconnected": "手把 %d 已斷開。",
"midnightcontrols.controller.mappings.1": "請使用 %s 配置手把按鍵映射",
"midnightcontrols.controller.mappings.3": "並將按鍵映射文件放入此路徑:`%s.minecraft/config/gamecontrollerdb.txt%s`。",
"midnightcontrols.controller.mappings.error": "發生錯誤,無法讀取按鍵映射文件。",
"midnightcontrols.controller.mappings.error.write": "發生錯誤,無法保存按鍵映射文件。",
"midnightcontrols.controller.mappings.updated": "按鍵映射已更新!",
"midnightcontrols.controller_type.default": "默認",
"midnightcontrols.controller_type.dualshock": "DualShock",
"midnightcontrols.controller_type.switch": "Switch",
"midnightcontrols.controller_type.xbox": "Xbox",
"midnightcontrols.controller_type.steam": "Steam",
"midnightcontrols.controller_type.ouya": "OUYA",
"midnightcontrols.controls_mode.default": "鍵鼠",
"midnightcontrols.controls_mode.controller": "手把",
"midnightcontrols.controls_mode.touchscreen": "觸摸屏",
"midnightcontrols.hud_side.left": "左側",
"midnightcontrols.hud_side.right": "右側",
"midnightcontrols.menu.analog_movement": "識別搖桿輸入的精確值",
"midnightcontrols.menu.auto_switch_mode": "自動切換模式",
"midnightcontrols.menu.controller": "手把",
"midnightcontrols.menu.controller2": "額外手把",
"midnightcontrols.menu.controller_type": "手把類型",
"midnightcontrols.menu.controls_mode": "模式",
"midnightcontrols.menu.fast_block_placing": "方塊快速放置",
"midnightcontrols.menu.fly_drifting": "水平方向飛行慣性",
"midnightcontrols.menu.fly_drifting_vertical": "垂直方向飛行慣性",
"midnightcontrols.menu.hud_enable": "啟用HUD",
"midnightcontrols.menu.hud_side": "HUD位置",
"midnightcontrols.menu.invert_right_x_axis": "反轉右搖桿X軸",
"midnightcontrols.menu.invert_right_y_axis": "反轉右搖桿Y軸",
"midnightcontrols.menu.keyboard_controls": "鍵盤控制…",
"midnightcontrols.menu.left_dead_zone": "左搖桿死區",
"midnightcontrols.menu.mappings.open_input_str": "編輯按鍵映射文件",
"midnightcontrols.menu.max_left_x_value": "左搖桿X軸最大值識別範圍",
"midnightcontrols.menu.max_left_y_value": "左搖桿Y軸最大值識別範圍",
"midnightcontrols.menu.max_right_x_value": "右搖桿X軸最大值識別範圍",
"midnightcontrols.menu.max_right_y_value": "右搖桿Y軸最大值識別範圍",
"midnightcontrols.menu.mouse_speed": "鼠標移動速度",
"midnightcontrols.menu.reacharound.horizontal": "水平方向方塊放置輔助",
"midnightcontrols.menu.reacharound.vertical": "垂直方向方塊放置輔助",
"midnightcontrols.menu.reload_controller_mappings": "重新加載手把按鍵映射",
"midnightcontrols.menu.right_dead_zone": "右搖桿死區",
"midnightcontrols.menu.rotation_speed": "鏡頭旋轉速度 (X)",
"midnightcontrols.menu.y_axis_rotation_speed": "鏡頭旋轉速度 (Y)",
"midnightcontrols.menu.separator.controller": "手把",
"midnightcontrols.menu.separator.general": "通用",
"midnightcontrols.menu.title": "midnightcontrols — 設置",
"midnightcontrols.menu.title.controller": "手把選項",
"midnightcontrols.menu.title.controller_controls": "手把控制",
"midnightcontrols.menu.title.gameplay": "遊戲內容選項",
"midnightcontrols.menu.title.general": "通用選項",
"midnightcontrols.menu.title.hud": "HUD選項",
"midnightcontrols.menu.title.mappings.string": "編輯按鍵映射文件",
"midnightcontrols.menu.title.visual": "界面選項",
"midnightcontrols.menu.unfocused_input": "非活動狀態輸入",
"midnightcontrols.menu.virtual_mouse": "虛擬鼠標",
"midnightcontrols.menu.virtual_mouse.skin": "虛擬鼠標指針樣式",
"midnightcontrols.narrator.unbound": "取消綁定 %s",
"midnightcontrols.not_bound": "未綁定",
"midnightcontrols.tooltip.analog_movement": "若遊戲機制允許,則可根據推動搖桿的力度與幅度決定移動的速度。",
"midnightcontrols.tooltip.auto_switch_mode": "如果已有手把連接,則自動切換為手把操作模式。",
"midnightcontrols.tooltip.controller2": "使用額外的手把,比如將一左一右的兩個 Joy-Con 合為一個功能完全的手把。",
"midnightcontrols.tooltip.controller_type": "選擇手把類型,以顯示對應的按鍵圖標。",
"midnightcontrols.tooltip.controls_mode": "操作模式",
"midnightcontrols.tooltip.fast_block_placing": "在創造模式中處於飛行狀態時,可以根據你飛行的速度快速放置方塊。\n§c在部分服務器可能會被認定為作弊。",
"midnightcontrols.tooltip.fly_drifting": "處於飛行狀態時,啟用原版的水平方向飛行慣性(緩停滑行)。",
"midnightcontrols.tooltip.fly_drifting_vertical": "處於飛行狀態時,啟用原版的垂直方向飛行慣性(緩停滑行)。",
"midnightcontrols.tooltip.hud_enable": "顯示手把按鍵操作提示。",
"midnightcontrols.tooltip.hud_side": "HUD的位置位於畫面的哪一側。",
"midnightcontrols.tooltip.left_dead_zone": "左搖桿配置的死區。\n死區決定搖桿要偏離中心位置多遠才能讓搖桿的輸入有效。",
"midnightcontrols.tooltip.max_left_x_value": "更改左搖桿X軸最大值的識別範圍。\n若感覺即便推滿搖桿也未達到最大的輸入值導致在識別搖桿輸入的精確值的情況下左右移動較為緩慢等問題本項可能會有所幫助。",
"midnightcontrols.tooltip.max_left_y_value": "更改左搖桿Y軸最大值的識別範圍。\n若感覺即便推滿搖桿也未達到最大的輸入值導致在識別搖桿輸入的精確值的情況下前後移動較為緩慢等問題本項可能會有所幫助。",
"midnightcontrols.tooltip.max_right_x_value": "更改右搖桿X軸最大值的識別範圍。\n若感覺即便推滿搖桿也未達到最大的輸入值導致鏡頭左右旋轉較為緩慢等問題本項可能會有所幫助。",
"midnightcontrols.tooltip.max_right_y_value": "更改右搖桿Y軸最大值的識別範圍。\n若感覺即便推滿搖桿也未達到最大的輸入值導致鏡頭上下旋轉較為緩慢等問題本項可能會有所幫助。",
"midnightcontrols.tooltip.mouse_speed": "手把模擬的鼠標的移動速度。",
"midnightcontrols.tooltip.reacharound.horizontal": "啟用水平方向方塊放置輔助,可在腳下方塊的前方放置方塊。\n§c在部分服務器可能會被認定為作弊。",
"midnightcontrols.tooltip.reacharound.vertical": "啟用垂直方向方塊放置輔助,可在腳下方塊的下方放置方塊。\n§c在部分服務器可能會被認定為作弊。",
"midnightcontrols.tooltip.reload_controller_mappings": "重新加載手把的按鍵映射文件。",
"midnightcontrols.tooltip.right_dead_zone": "右搖桿配置的死區。\n死區決定搖桿要偏離中心位置多遠才能讓搖桿的輸入有效。",
"midnightcontrols.tooltip.rotation_speed": "手把操作模式下的鏡頭旋轉速度。(X)",
"midnightcontrols.tooltip.y_axis_rotation_speed": "手把操作模式下的鏡頭旋轉速度。(Y)",
"midnightcontrols.tooltip.unfocused_input": "即使遊戲窗口處於非活動狀態,也允許手把進行按鍵輸入。",
"midnightcontrols.tooltip.virtual_mouse": "啟用虛擬鼠標,在分屏的情況下很有用。",
"midnightcontrols.virtual_mouse.skin.default_light": "默認樣式(白色)",
"midnightcontrols.virtual_mouse.skin.default_dark": "默認樣式(黑色)",
"midnightcontrols.virtual_mouse.skin.second_light": "額外樣式(白色)",
"midnightcontrols.virtual_mouse.skin.second_dark": "額外樣式(黑色)"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 416 B

After

Width:  |  Height:  |  Size: 479 B

View File

@@ -11,15 +11,20 @@
"contributors": [ "contributors": [
"akemin-dayo", "akemin-dayo",
"DioEgizio", "DioEgizio",
"Ivanoks", "dogtopus",
"KiskaUWU", "egeesin",
"RaptaG",
"Madis0",
"FlashyReese",
"Hambaka",
"joaoh1",
"EnnuiL", "EnnuiL",
"egeesin" "FlashyReese",
"gyular",
"Hambaka",
"Ivanoks",
"joaoh1",
"KiskaUWU",
"Madis0",
"RaptaG",
"ronniedude",
"spudpiggy",
"TrueHorse"
], ],
"contact": { "contact": {
"homepage": "https://modrinth.com/mod/midnightcontrols", "homepage": "https://modrinth.com/mod/midnightcontrols",
@@ -47,8 +52,8 @@
], ],
"depends": { "depends": {
"fabricloader": ">=0.11.3", "fabricloader": ">=0.11.3",
"fabric": ">=0.36.0", "fabric": ">=0.71.0",
"minecraft": ">=1.17", "minecraft": "~1.19.3",
"spruceui": ">=3.2.0", "spruceui": ">=3.2.0",
"java": ">=17" "java": ">=17"
}, },

View File

@@ -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/widget/EntryListWidget$MoveDirection

View File

@@ -15,10 +15,13 @@
"KeyBindingMixin", "KeyBindingMixin",
"MinecraftClientMixin", "MinecraftClientMixin",
"MouseMixin", "MouseMixin",
"ChatScreenMixin",
"RecipeBookWidgetAccessor", "RecipeBookWidgetAccessor",
"WorldRendererMixin", "WorldRendererMixin",
"KeyBindingRegistryImplAccessor", "KeyBindingRegistryImplAccessor",
"ScreenAccessor" "KeyBindingIDAccessor",
"ScreenAccessor",
"TabNavigationWidgetAccessor"
], ],
"injectors": { "injectors": {
"defaultRequire": 1 "defaultRequire": 1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@@ -1,6 +1,6 @@
{ {
"pack": { "pack": {
"pack_format": 9, "pack_format": 13,
"description": "Makes controller tooltips use similar icons to Bedrock Edition" "description": "Makes controller tooltips use similar icons to Bedrock Edition"
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@@ -1,6 +1,6 @@
{ {
"pack": { "pack": {
"pack_format": 9, "pack_format": 13,
"description": "Makes controller icons look similar to Legacy Console Edit." "description": "Makes controller icons look similar to Legacy Console Edit."
} }
} }