Compare commits

...

30 Commits

Author SHA1 Message Date
Martin Prokoph
f263908f5f fix: multiple touch-related bug fixes 2025-05-08 00:08:27 +02:00
Martin Prokoph
28de7312f8 fix: get touchscreen controls working again 2025-05-07 15:08:52 +02:00
Martin Prokoph
114a72cdde chore: bump version 2025-03-29 00:59:43 +01:00
Martin Prokoph
25e9c9afe3 feat: improve advanced config screen
- Thanks to MidnightLib 1.7.0 :)
2025-03-29 00:58:41 +01:00
Martin Prokoph
d313115388 Merge pull request #327 from Kichura/ge_fun
Gradle 8.13, Change artifact path
2025-03-27 23:33:26 +01:00
Martin Prokoph
e46e855961 Merge branch 'architectury-1.21.5' into ge_fun 2025-03-27 21:22:50 +01:00
Martin Prokoph
38229bc827 port: Spring to Life (1.21.5)
- Still waiting for ObsidianUI to get the settings screen working. Guess I'm gonna have to port that myself again.
2025-03-27 16:10:03 +01:00
Martin Prokoph
f004f0a32d compat: improve/fix Emotecraft compat 2025-03-27 00:00:29 +01:00
Martin Prokoph
c07f3d94dd chore: bump version 2025-03-26 19:54:42 +01:00
Martin Prokoph
6007ef315d fix: controller options button not being clickable 2025-03-26 19:53:31 +01:00
Kichura
1e2dd30e3a Gradle 8.13. 2025-02-25 18:56:00 +01:00
Martin Prokoph
1c26eeed5e fix: catch errors in camera thread
- Solves camera movement breaking entirely when encountering an error
2025-02-15 22:20:29 +01:00
Kichura
f14387b6b4 Gradle 8.12.1. 2025-01-30 02:10:20 +01:00
Kichura
1344a949cd Do not persist credentials. 2025-01-07 22:57:18 +01:00
Kichura
65a0b1cf1f Gradle 8.12, Migrate to setup-gradle. 2025-01-06 23:43:22 +01:00
Kichura
23f7b2e199 Change artifacts path. 2025-01-06 21:16:18 +01:00
Martin Prokoph
e35850c5d5 Bump version 2024-12-11 18:10:57 +01:00
Martin Prokoph
78900ac83e Fix movement while riding boats and other entities 2024-12-11 18:08:40 +01:00
Martin Prokoph
7d791fac89 Port to 1.21.4
- For once, this has been easy :)
2024-12-06 21:11:39 +01:00
Martin Prokoph
bf60595c12 Merge pull request #322 from TeamMidnightDust/architectury-1.21
Sync translations
2024-12-06 21:02:04 +01:00
Martin Prokoph
b96547dafb Merge pull request #319 from FlocosDEV/architectury-1.21
Create pt-br.json
2024-12-06 21:00:56 +01:00
Martin Prokoph
ab869f4f76 First and final 1.21.3 release
- Moving on to 1.21.4
2024-12-06 20:53:14 +01:00
Martin Prokoph
84df412162 Merge pull request #321 from TeamMidnightDust/architectury-1.21
Add @Kichura 's workflow improvements to 1.21.3 branch
2024-12-05 22:10:05 +01:00
Martin Prokoph
afb80fd89c Merge pull request #316 from Kichura/architectury-1.21
Replace Java 16/17 -> 21, Upgrade workflow system
2024-12-04 13:44:12 +01:00
Gabriel
b835a6c4ca Create pt-br.json
Create pt-br.json
2024-11-19 21:36:33 -03:00
Martin Prokoph
3eec0dda4a Update ObsidianUI to my 1.21.3 port 2024-11-18 14:16:44 +01:00
Kichura
35ab81f696 Apply "chmod +x" to gradlew. 2024-10-30 19:44:35 +01:00
Kichura
e08547a641 Ensure fabric requests end-user to use Java 21 instead. 2024-10-29 23:02:21 +01:00
Kichura
c93cc729f4 Upgrade the entire workflow system. 2024-10-29 22:57:47 +01:00
Kichura
1595fffc2c Change Java version reference to 21. 2024-10-29 22:52:02 +01:00
43 changed files with 638 additions and 293 deletions

29
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,29 @@
name: Build with Gradle
on: [ push, pull_request ]
jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
check-latest: true
- name: Build with Gradle
run: ./gradlew build
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v4
with:
name: MidnightControls-Artifacts
path: |
fabric/build/libs/
neoforge/build/libs/

View File

@@ -1,23 +0,0 @@
name: Gradle Build
on: [ push, pull_request ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 16
uses: actions/setup-java@v1
with:
java-version: 16
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Build with Gradle
run: ./gradlew build
- uses: actions/upload-artifact@v2
with:
name: Artifacts
path: ./build/libs/

View File

@@ -1,23 +0,0 @@
name: Gradle Build
on:
release:
types:
- published
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 16
uses: actions/setup-java@v1
with:
java-version: 16
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Build with Gradle
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
run: ./gradlew publishModrinth

40
.github/workflows/gradlepublish.yml → .github/workflows/publish.yml vendored Executable file → Normal file
View File

@@ -1,30 +1,26 @@
name: Gradle Package
name: Publish to Modrinth
on:
push:
tags:
- '*'
release:
types:
- published
jobs:
build:
runs-on: ubuntu-latest
publish:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- name: Set up JDK 16
uses: actions/setup-java@v1
- name: Checkout Repository
uses: actions/checkout@v4
with:
java-version: 16
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Build with Gradle
run: ./gradlew build
- uses: actions/upload-artifact@v2
persist-credentials: false
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
name: Artifacts
path: ./build/libs/
distribution: 'temurin'
java-version: 21
check-latest: true
# The USERNAME and PASSWORD need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle
- name: Publish to GitHub Packages and other Mavens
@@ -38,3 +34,7 @@ jobs:
midnightcontrols_MAVEN: ${{ secrets.MAVEN_URL }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
- name: Publish to Modrinth
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
run: ./gradlew publishModrinth

View File

@@ -8,7 +8,7 @@
[![Version](https://img.shields.io/github/v/tag/TeamMidnightDust/MidnightControls?label=version&style=round)](https://github.com/TeamMidnightDust/MidnightControls/releases)
![Environment: Client](https://img.shields.io/badge/environment-client-1976d2?style=round)
[![Mod loader: Quilt/Fabric]][Quilt]
[![Java 17](https://img.shields.io/badge/language-Java%2017-9B599A.svg?style=round)](https://www.oracle.com/java/technologies/downloads/#java17)
[![Java 21](https://img.shields.io/badge/language-Java%2021-9B599A.svg?style=round)](https://www.oracle.com/java/technologies/downloads/#java21)
[![GitHub license](https://img.shields.io/github/license/TeamMidnightDust/MidnightControls?style=round)](LICENSE)
A Fabric Minecraft mod which adds better controls, reach-around and controller support.

View File

@@ -1,6 +1,6 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.10-SNAPSHOT" apply false
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
}
@@ -13,6 +13,9 @@ repositories {
maven {
url = "https://api.modrinth.com/maven"
}
flatDir {
dirs("localMaven")
}
}
subprojects {
@@ -22,6 +25,9 @@ subprojects {
url = "https://api.modrinth.com/maven"
}
maven { url 'https://jitpack.io' }
flatDir {
dirs("../localMaven")
}
}
dependencies {
@@ -79,4 +85,4 @@ allprojects {
java {
withSourcesJar()
}
}
}

View File

@@ -39,7 +39,7 @@ dependencies {
modCompileOnlyApi "org.quiltmc:quilt-json5:1.0.0"
modImplementation "maven.modrinth:sodium:${project.sodium_version}-fabric"
modCompileOnlyApi "maven.modrinth:emi:${project.emi_version}"
modCompileOnlyApi "maven.modrinth:emotecraft:${project.emotecraft_version}"
modImplementation "maven.modrinth:emotecraft:${project.emotecraft_version}"
modCompileOnlyApi "io.github.kosmx:bendy-lib:${project.bendylib_version}"
modCompileOnlyApi "dev.isxander:yet-another-config-lib:${project.yacl_version}"
modCompileOnlyApi "maven.modrinth:inventory-tabs-updated:${project.inventorytabs_version}"

View File

@@ -86,12 +86,16 @@ public class MidnightControlsClient extends MidnightControls {
int period = 1; // repeat every 0.001 sec. (1000 times a second)
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
public void run() { // TODO: Add a try/catch here after the alpha testing period
if (lateInitDone && client.isRunning()) {
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && (client.isWindowFocused() || MidnightControlsConfig.unfocusedInput)) {
input.tickCameraStick();
input.updateCamera();
public void run() {
try {
if (lateInitDone && client.isRunning()) {
if (MidnightControlsConfig.controlsMode != ControlsMode.DEFAULT && (client.isWindowFocused() || MidnightControlsConfig.unfocusedInput)) {
if (MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER) input.tickCameraStick();
input.updateCamera();
}
}
} catch (Exception | Error e) {
MidnightControls.logger.error("Exception encountered in camera loop: ",e);
}
}
}, delay, period);

View File

@@ -11,7 +11,7 @@ package eu.midnightdust.midnightcontrols.client;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.mojang.blaze3d.platform.GlDebugInfo;
import com.mojang.blaze3d.platform.GLX;
import eu.midnightdust.lib.config.MidnightConfig;
import eu.midnightdust.midnightcontrols.ControlsMode;
import eu.midnightdust.midnightcontrols.MidnightControls;
@@ -52,78 +52,106 @@ public class MidnightControlsConfig extends MidnightConfig {
public static boolean isEditing = false;
@Hidden @Entry public static int configVersion = 2;
// General
@Comment(category = CONTROLLER, centered = true, name="\uD83C\uDFAE General") public static Comment _general;
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.controls_mode") public static ControlsMode controlsMode = ControlsMode.DEFAULT;
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.auto_switch_mode") public static boolean autoSwitchMode = true;
@Entry(category = MISC, name = "Debug") public static boolean debug = false;
// HUD
@Comment(category = VISUAL, centered = true, name="\uD83D\uDDB9 Hud") public static Comment _hud;
@Entry(category = VISUAL, name = "midnightcontrols.menu.hud_enable") public static boolean hudEnable = true;
@Entry(category = VISUAL, name = "midnightcontrols.menu.hud_side") public static HudSide hudSide = HudSide.LEFT;
@Entry(category = SCREENS, name = "midnightcontrols.menu.move_chat") public static boolean moveChat = false;
@Entry(category = VISUAL, name = "midnightcontrols.menu.controller_type") public static ControllerType controllerType = ControllerType.DEFAULT;
// Gameplay
@Comment(category = GAMEPLAY, centered = true, name="\uD83D\uDECB Comfort") public static Comment _comfort;
@Entry(category = GAMEPLAY, name = "Enable Hints") public static boolean enableHints = true;
@Entry(category = GAMEPLAY, name = "midnightcontrols.menu.analog_movement") public static boolean analogMovement = true;
@Entry(category = GAMEPLAY, name = "midnightcontrols.menu.double_tap_to_sprint") public static boolean doubleTapToSprint = true;
@Entry(category = GAMEPLAY, name = "midnightcontrols.menu.controller_toggle_sneak") public static boolean controllerToggleSneak = MinecraftClient.getInstance().options.getSneakToggled().getValue();
@Entry(category = GAMEPLAY, name = "midnightcontrols.menu.controller_toggle_sprint") public static boolean controllerToggleSprint = MinecraftClient.getInstance().options.getSprintToggled().getValue();
@Condition(requiredModId = "midnightcontrols-extra")
@Comment(category = GAMEPLAY, centered = true, name="✨ Extras") public static Comment _extras;
@Condition(requiredModId = "midnightcontrols-extra")
@Entry(category = GAMEPLAY, name = "midnightcontrols.menu.fast_block_placing") public static boolean fastBlockPlacing = false; // Disabled by default as this behaviour can be considered cheating on multiplayer servers.
@Condition(requiredModId = "midnightcontrols-extra")
@Entry(category = GAMEPLAY, name = "midnightcontrols.menu.fly_drifting") public static boolean flyDrifting = true; // Enabled by default as disabling this behaviour can be considered cheating on multiplayer servers. It can also conflict with some other mods.
@Condition(requiredModId = "midnightcontrols-extra")
@Entry(category = GAMEPLAY, name = "midnightcontrols.menu.fly_drifting_vertical") public static boolean verticalFlyDrifting = true; // Enabled by default as disabling this behaviour can be considered cheating on multiplayer servers.
@Condition(requiredModId = "midnightcontrols-extra")
@Entry(category = GAMEPLAY, name = "midnightcontrols.menu.reacharound.horizontal") public static boolean horizontalReacharound = false; // Disabled by default as this behaviour can be considered cheating on multiplayer servers.
@Condition(requiredModId = "midnightcontrols-extra")
@Entry(category = GAMEPLAY, name = "midnightcontrols.menu.reacharound.vertical") public static boolean verticalReacharound = false; // Disabled by default as this behaviour can be considered cheating on multiplayer servers.
@Condition(requiredModId = "midnightcontrols-extra")
@Comment(category = VISUAL, centered = true, name="⊽ Reacharound") public static Comment _reacharoundOutline;
@Condition(requiredModId = "midnightcontrols-extra")
@Entry(category = VISUAL, name = "Reacharound Outline") public static boolean shouldRenderReacharoundOutline = true;
@Condition(requiredModId = "midnightcontrols-extra", requiredOption = "shouldRenderReacharoundOutline")
@Entry(category = VISUAL, name = "Reacharound Outline Color", isColor = true) public static String reacharoundOutlineColorHex = "#ffffff";
@Condition(requiredModId = "midnightcontrols-extra", requiredOption = "shouldRenderReacharoundOutline")
@Entry(category = VISUAL, name = "Reacharound Outline Alpha", isSlider = true, min = 0, max = 255) public static int reacharoundOutlineColorAlpha = 102;
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.right_dead_zone", isSlider = true, min = 0.05, max = 1) public static double rightDeadZone = 0.25;
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.left_dead_zone", isSlider = true, min = 0.05, max = 1) public static double leftDeadZone = 0.25;
@Entry(category = CONTROLLER, name = "Trigger Dead-Zone", isSlider = true, min = 0.05, max = 1) public static double triggerDeadZone = 0.1;
@Comment(category = CONTROLLER, centered = true, name="\uD83D\uDCF7 Camera Settings") public static Comment _cameraSettings;
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.invert_right_y_axis") public static boolean invertRightYAxis = false;
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.invert_right_x_axis") public static boolean invertRightXAxis = false;
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.rotation_speed", isSlider = true, min = 0, max = 100, precision = 10) public static double rotationSpeed = 35.0; //used for x-axis, name kept for compatibility
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.y_axis_rotation_speed", isSlider = true, min = 0, max = 100, precision = 10) public static double yAxisRotationSpeed = rotationSpeed;
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.camera_mode") public static CameraMode cameraMode = CameraMode.FLAT;
@Comment(category = SCREENS, centered = true, name="\uD83D\uDDB1 Mouse Behaviour") public static Comment _mouseBehaviour;
@Entry(category = SCREENS, name = "midnightcontrols.menu.mouse_speed", isSlider = true, min = 0, max = 150, precision = 10) public static double mouseSpeed = 25.0;
@Entry(category = SCREENS, name = "midnightcontrols.menu.joystick_as_mouse") public static boolean joystickAsMouse = false;
@Entry(category = SCREENS, name = "midnightcontrols.menu.eye_tracker_as_mouse") public static boolean eyeTrackerAsMouse = false;
@Entry(category = SCREENS, name = "midnightcontrols.menu.eye_tracker_deadzone", isSlider = true, min = 0, max = 0.4) public static double eyeTrackerDeadzone = 0.05;
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.unfocused_input") public static boolean unfocusedInput = false;
@Entry(category = SCREENS, name = "midnightcontrols.menu.virtual_mouse") public static boolean virtualMouse = false;
@Entry(category = SCREENS, name = "midnightcontrols.menu.virtual_mouse.skin") public static VirtualMouseSkin virtualMouseSkin = VirtualMouseSkin.DEFAULT_LIGHT;
@Entry(category = SCREENS, name = "midnightcontrols.menu.hide_cursor") public static boolean hideNormalMouse = false;
@Entry(category = CONTROLLER, name = "Controller ID") @Hidden public static Object controllerID = 0;
@Entry(category = CONTROLLER, name = "2nd Controller ID") @Hidden public static Object secondControllerID = -1;
@Entry(category = VISUAL, name = "midnightcontrols.menu.controller_type") public static ControllerType controllerType = ControllerType.DEFAULT;
@Entry(category = SCREENS, name = "Mouse screens") public static List<String> mouseScreens = Lists.newArrayList("net.minecraft.client.gui.screen.advancement",
"net.minecraft.class_457", "net.minecraft.class_408", "net.minecraft.class_3872", "me.flashyreese.mods.reeses_sodium_options.client.gui", "dev.emi.emi.screen",
"hardcorequesting.client.interfaces.GuiQuestBook", "hardcorequesting.client.interfaces.GuiReward", "hardcorequesting.client.interfaces.EditTrackerScreen",
"me.shedaniel.clothconfig2.gui.ClothConfigScreen", "com.mamiyaotaru.voxelmap.gui.GuiWaypoints", "com.mamiyaotaru.voxelmap.gui.GuiPersistentMap");
@Entry(category = SCREENS, name = "Arrow screens") public static List<String> arrowScreens = Lists.newArrayList(ChatScreen.class.getCanonicalName());
@Entry(category = SCREENS, name = "WASD screens") public static List<String> wasdScreens = Lists.newArrayList("com.ultreon.devices.core.Laptop");
@Entry(category = TOUCH, name = "Screens with close button") public static List<String> closeButtonScreens = Lists.newArrayList(ChatScreen.class.getCanonicalName(), AdvancementsScreen.class.getCanonicalName(), RingScreen.class.getCanonicalName());
@Comment(category = CONTROLLER, centered = true, name="\uD83D\uDC40 Eye Tracking") public static Comment _eyeTracker;
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.eye_tracker_as_mouse") public static boolean eyeTrackerAsMouse = false;
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.eye_tracker_deadzone", isSlider = true, min = 0, max = 0.4) public static double eyeTrackerDeadzone = 0.05;
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.unfocused_input") public static boolean unfocusedInput = false;
@Comment(category = SCREENS, centered = true, name="\uD83D\uDC46 Virtual Mouse") public static Comment _virtualMouse;
@Entry(category = SCREENS, name = "midnightcontrols.menu.virtual_mouse") public static boolean virtualMouse = false;
@Condition(requiredOption = "virtualMouse", visibleButLocked = true)
@Entry(category = SCREENS, name = "midnightcontrols.menu.virtual_mouse.skin") public static VirtualMouseSkin virtualMouseSkin = VirtualMouseSkin.DEFAULT_LIGHT;
@Entry(category = SCREENS, name = "midnightcontrols.menu.hide_cursor") public static boolean hideNormalMouse = false;
@Entry(category = CONTROLLER, name = "Controller ID") @Hidden public static Object controllerID = 0;
@Entry(category = CONTROLLER, name = "2nd Controller ID") @Hidden public static Object secondControllerID = -1;
@Comment(category = TOUCH, centered = true, name="\uD83E\uDE84 Behaviour") public static Comment _touchBehaviour;
@Entry(category = TOUCH, name = "midnightcontrols.menu.touch_with_controller") public static boolean touchInControllerMode = false;
@Entry(category = TOUCH, name = "midnightcontrols.menu.touch_speed", isSlider = true, min = 0, max = 150, precision = 10) public static double touchSpeed = 50.0;
@Entry(category = TOUCH, name = "midnightcontrols.menu.invert_touch") public static boolean invertTouch = false;
@Entry(category = TOUCH, name = "midnightcontrols.menu.touch_mode") public static TouchMode touchMode = TouchMode.CROSSHAIR;
@Entry(category = TOUCH, name = "midnightcontrols.menu.touch_break_delay", isSlider = true, min = 50, max = 500) public static int touchBreakDelay = 120;
@Comment(category = TOUCH, centered = true, name="\uD83D\uDCA1 Visuals") public static Comment _visuals;
@Entry(category = TOUCH, name = "midnightcontrols.menu.touch_transparency", isSlider = true, min = 0, max = 100) public static int touchTransparency = 75;
@Entry(category = TOUCH, name = "Touch Outline Color", isColor = true) public static String touchOutlineColorHex = "#ffffff";
@Entry(category = TOUCH, name = "Touch Outline Alpha", isSlider = true, min = 0, max = 255) public static int touchOutlineColorAlpha = 150;
@Comment(category = TOUCH, centered = true, name="\uD83E\uDDEA Advanced") public static Comment _advanced;
@Entry(category = TOUCH, name = "Screens with close button") public static List<String> closeButtonScreens = Lists.newArrayList(ChatScreen.class.getCanonicalName(), AdvancementsScreen.class.getCanonicalName(), RingScreen.class.getCanonicalName());
@Entry(category = TOUCH, name = "Left Touch button bindings") public static List<String> leftTouchBinds = Lists.newArrayList("debug_screen", "screenshot","toggle_perspective");
@Entry(category = TOUCH, name = "Right Touch button bindings") public static List<String> rightTouchBinds = Lists.newArrayList("screenshot","toggle_perspective", "use");
@Entry @Hidden public static Map<String, String> BINDING = new HashMap<>();
private static final Pattern BUTTON_BINDING_PATTERN = Pattern.compile("(-?\\d+)\\+?");
@Comment(category = CONTROLLER, centered = true, name="\uD83D\uDD79 Max Analog Stick Values") public static Comment _maxAnalogValues;
@Entry(category = CONTROLLER, name = "Max analog value: Left X", isSlider = true, min = .25f, max = 1.f) public static double maxAnalogValueLeftX = 1;
@Entry(category = CONTROLLER, name = "Max analog value: Left Y", isSlider = true, min = .25f, max = 1.f) public static double maxAnalogValueLeftY = 1;
@Entry(category = CONTROLLER, name = "Max analog value: Right X", isSlider = true, min = .25f, max = 1.f) public static double maxAnalogValueRightX = 1;
@Entry(category = CONTROLLER, name = "Max analog value: Right Y", isSlider = true, min = .25f, max = 1.f) public static double maxAnalogValueRightY = 1;
@Comment(category = CONTROLLER, centered = true, name="☠ Dead Zones") public static Comment _deadZones;
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.right_dead_zone", isSlider = true, min = 0.05, max = 1) public static double rightDeadZone = 0.25;
@Entry(category = CONTROLLER, name = "midnightcontrols.menu.left_dead_zone", isSlider = true, min = 0.05, max = 1) public static double leftDeadZone = 0.25;
@Entry(category = CONTROLLER, name = "Trigger Dead-Zone", isSlider = true, min = 0.05, max = 1) public static double triggerDeadZone = 0.1;
@Comment(category = CONTROLLER, centered = true, name="☆ Other Options") public static Comment _otherOptions;
@Entry(category = CONTROLLER, name = "Trigger button fix") public static boolean triggerFix = true;
@Entry(category = CONTROLLER, name = "Excluded Controllers (Name Regex)") public static List<String> excludedControllers = Lists.newArrayList(".*(Keyboard)$", ".*(Touchpad)$", ".*(Pen)$", ".*(Finger)$");
@Comment(category = SCREENS, centered = true, name="\uD83D\uDD27 UI Modifications") public static Comment _uiMods;
@Entry(category = SCREENS, name = "midnightcontrols.menu.move_chat") public static boolean moveChat = false;
@Entry(category = SCREENS, name = "Enable Shortcut in Controls Options") public static boolean shortcutInControls = true;
@Entry(category = MISC, name = "Debug") public static boolean debug = false;
@Entry(category = MISC, name = "Excluded Keybindings") public static List<String> excludedKeybindings = Lists.newArrayList("key.forward", "key.left", "key.back", "key.right", "key.jump", "key.sneak", "key.sprint", "key.inventory",
"key.swapOffhand", "key.drop", "key.use", "key.attack", "key.chat", "key.playerlist", "key.screenshot", "key.togglePerspective", "key.smoothCamera", "key.fullscreen", "key.saveToolbarActivator", "key.loadToolbarActivator",
"key.pickItem", "key.hotbar.1", "key.hotbar.2", "key.hotbar.3", "key.hotbar.4", "key.hotbar.5", "key.hotbar.6", "key.hotbar.7", "key.hotbar.8", "key.hotbar.9");
@Entry(category = GAMEPLAY, name = "Enable Hints") public static boolean enableHints = true;
@Entry(category = SCREENS, name = "Enable Shortcut in Controls Options") public static boolean shortcutInControls = true;
@Entry(category = MISC, name = "Ring Bindings (WIP)") public static List<String> ringBindings = new ArrayList<>();
@Entry(category = MISC, name = "Ring Bindings (WIP)") @Hidden 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<>();
@@ -400,7 +428,7 @@ public class MidnightControlsConfig extends MidnightConfig {
String controller = getController().getName().toLowerCase();
if (controller.contains("xbox 360")) return ControllerType.XBOX_360;
else if (controller.contains("xbox") || controller.contains("afterglow")) return ControllerType.XBOX;
else if (controller.contains("steam") && GlDebugInfo.getCpuInfo().contains("AMD Custom APU")) return ControllerType.STEAM_DECK;
else if (controller.contains("steam") && GLX._getCpuInfo().contains("AMD Custom APU")) return ControllerType.STEAM_DECK;
else if (controller.contains("steam")) return ControllerType.STEAM_CONTROLLER;
else if (controller.contains("dualsense") || controller.contains("ps5")) return ControllerType.DUALSENSE;
else if (controller.contains("dualshock") || controller.contains("ps4") || controller.contains("sony")) return ControllerType.DUALSHOCK;

View File

@@ -214,10 +214,10 @@ public class MidnightInput {
return;
if (this.targetYaw != 0.f || this.targetPitch != 0.f) {
float rotationYaw = (float) (client.player.prevYaw + (this.targetYaw * 0.175));
float rotationPitch = (float) (client.player.prevPitch + (this.targetPitch * 0.175));
client.player.prevYaw = rotationYaw;
client.player.prevPitch = MathHelper.clamp(rotationPitch, -90.f, 90.f);
float rotationYaw = (float) (client.player.lastYaw + (this.targetYaw * 0.175));
float rotationPitch = (float) (client.player.lastPitch + (this.targetPitch * 0.175));
client.player.lastYaw = rotationYaw;
client.player.lastPitch = MathHelper.clamp(rotationPitch, -90.f, 90.f);
client.player.setYaw(rotationYaw);
client.player.setPitch(MathHelper.clamp(rotationPitch, -90.f, 90.f));
if (client.player.isRiding() && client.player.getVehicle() != null) {

View File

@@ -1,36 +1,51 @@
package eu.midnightdust.midnightcontrols.client.compat;
import eu.midnightdust.midnightcontrols.client.controller.InputManager;
import io.github.kosmx.emotes.arch.gui.EmoteMenuImpl;
import io.github.kosmx.emotes.arch.gui.screen.ingame.FastChosseScreen;
import eu.midnightdust.midnightcontrols.client.mixin.MouseAccessor;
import io.github.kosmx.emotes.arch.screen.ingame.FastMenuScreen;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import org.joml.Vector2i;
import org.lwjgl.glfw.GLFW;
public class EmotecraftCompat {
private static final MinecraftClient client = MinecraftClient.getInstance();
public static void openEmotecraftScreen(Screen parent) {
client.setScreen(new EmoteMenuImpl(parent));
client.setScreen(new FastMenuScreen(parent));
}
public static boolean isEmotecraftScreen(Screen screen) {
return screen instanceof FastChosseScreen;
return screen instanceof FastMenuScreen;
}
static int prevIndex = -1;
public static void handleEmoteSelector(int index) {
if (client.currentScreen instanceof FastChosseScreen) {
int x = client.getWindow().getWidth() / 2;
int y = client.getWindow().getHeight() / 2;
switch (index) {
case 0, 3, 5 -> x -= 200;
case 2, 4, 7 -> x += 200;
}
switch (index) {
case 0, 1, 2 -> y -= 200;
case 5, 6, 7 -> y += 200;
}
InputManager.queueMousePosition(x, y);
try {
if (client.currentScreen instanceof FastMenuScreen) {
boolean stickReleased = index == -1 && prevIndex != -1;
var pos = calcMousePos(stickReleased ? prevIndex : index);
InputManager.queueMousePosition(pos.x, pos.y);
InputManager.INPUT_MANAGER.updateMousePosition(client);
InputManager.INPUT_MANAGER.updateMousePosition(client);
if (stickReleased) {
((MouseAccessor) client.mouse).midnightcontrols$onMouseButton(client.getWindow().getHandle(), GLFW.GLFW_MOUSE_BUTTON_LEFT, GLFW.GLFW_PRESS, 0);
prevIndex = -1;
}
else prevIndex = index;
} else prevIndex = -1;
} catch (Exception ignored) {}
}
public static Vector2i calcMousePos(int index) {
int x = client.getWindow().getWidth() / 2;
int y = client.getWindow().getHeight() / 2;
switch (index) {
case 0, 3, 5 -> x -= 275;
case 2, 4, 7 -> x += 275;
}
switch (index) {
case 0, 1, 2 -> y -= 275;
case 5, 6, 7 -> y += 275;
}
return new Vector2i(x, y);
}
}

View File

@@ -62,9 +62,9 @@ public class InputHandlers {
if (!client.player.isSpectator()) {
var inv = client.player.getInventory();
if (next)
inv.setSelectedSlot(inv.selectedSlot < 8 ? inv.selectedSlot + 1 : inv.selectedSlot - 8);
inv.setSelectedSlot(inv.getSelectedSlot() < 8 ? inv.getSelectedSlot() + 1 : inv.getSelectedSlot() - 8);
else
inv.setSelectedSlot(inv.selectedSlot > 0 ? inv.selectedSlot - 1 : inv.selectedSlot + 8);
inv.setSelectedSlot(inv.getSelectedSlot() > 0 ? inv.getSelectedSlot() - 1 : inv.getSelectedSlot() + 8);
}
else {
if (client.inGameHud.getSpectatorHud().isOpen()) {

View File

@@ -76,8 +76,8 @@ public class InputManager {
public void updateMousePosition(@NotNull MinecraftClient client) {
Objects.requireNonNull(client, "Client instance cannot be null.");
if (this.prevTargetMouseX != this.targetMouseX || this.prevTargetMouseY != this.targetMouseY) {
double mouseX = this.prevTargetMouseX + (this.targetMouseX - this.prevTargetMouseX) * client.getRenderTickCounter().getTickDelta(true) + 0.5;
double mouseY = this.prevTargetMouseY + (this.targetMouseY - this.prevTargetMouseY) * client.getRenderTickCounter().getTickDelta(true) + 0.5;
double mouseX = this.prevTargetMouseX + (this.targetMouseX - this.prevTargetMouseX) * client.getRenderTickCounter().getTickProgress(true) + 0.5;
double mouseY = this.prevTargetMouseY + (this.targetMouseY - this.prevTargetMouseY) * client.getRenderTickCounter().getTickProgress(true) + 0.5;
if (!MidnightControlsConfig.virtualMouse)
GLFW.glfwSetCursorPos(client.getWindow().getHandle(), mouseX, mouseY);
((MouseAccessor) client.mouse).midnightcontrols$onCursorPos(client.getWindow().getHandle(), mouseX, mouseY);

View File

@@ -11,11 +11,14 @@ package eu.midnightdust.midnightcontrols.client.controller;
import eu.midnightdust.midnightcontrols.client.enums.ButtonState;
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
import eu.midnightdust.midnightcontrols.client.mixin.InputAccessor;
import eu.midnightdust.midnightcontrols.client.util.MathUtil;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.util.PlayerInput;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec2f;
import org.jetbrains.annotations.NotNull;
/**
@@ -48,15 +51,12 @@ public final class MovementHandler implements PressAction {
public void applyMovement(@NotNull ClientPlayerEntity player) {
if (!this.shouldOverrideMovement)
return;
// TODO
// player.input.playerInput.pressingForward = this.pressingForward;
// player.input.pressingBack = this.pressingBack;
// player.input.pressingLeft = this.pressingLeft;
// player.input.pressingRight = this.pressingRight;
player.input.playerInput = new PlayerInput(this.pressingForward, this.pressingBack, this.pressingLeft, this.pressingRight,
player.input.playerInput.jump(), player.input.playerInput.sneak(), player.input.playerInput.sprint());
polarUtil.calculate(this.movementSideways, this.movementForward, this.slowdownFactor);
player.input.movementForward = polarUtil.polarY;
player.input.movementSideways = polarUtil.polarX;
Vec2f inputVector = new Vec2f(polarUtil.polarX, polarUtil.polarY);
((InputAccessor)player.input).setMovementVector(inputVector);
this.shouldOverrideMovement = false;
}

View File

@@ -98,7 +98,7 @@ public class MidnightControlsHud extends Hud {
var window = this.client.getWindow();
var text = "[ ]";
float scale = Math.min(5, this.ticksDisplayedCrosshair + tickCounter.getTickDelta(true)) / 5F;
float scale = Math.min(5, this.ticksDisplayedCrosshair + tickCounter.getTickProgress(true)) / 5F;
scale *= scale;
int opacity = ((int) (255 * scale)) << 24;

View File

@@ -9,6 +9,8 @@
package eu.midnightdust.midnightcontrols.client.gui;
import com.mojang.blaze3d.opengl.GlStateManager;
import com.mojang.blaze3d.platform.GLX;
import com.mojang.blaze3d.systems.RenderSystem;
import eu.midnightdust.midnightcontrols.ControlsMode;
import eu.midnightdust.midnightcontrols.client.enums.ControllerType;
@@ -169,7 +171,7 @@ public class MidnightControlsRenderer {
case GLFW.GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER + 100, GLFW.GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER + 200 -> buttonOffset = 10 * 15;
}
RenderSystem.disableDepthTest();
GlStateManager._disableDepthTest();
int assetSize = axis || (button >= 15 && button <= 18) ? AXIS_SIZE : BUTTON_SIZE;
@@ -179,7 +181,7 @@ public class MidnightControlsRenderer {
(float) buttonOffset, (float) (controllerType * assetSize),
assetSize, assetSize,
256, 256);
RenderSystem.enableDepthTest();
GlStateManager._enableDepthTest();
return ICON_SIZE;
}

View File

@@ -9,11 +9,13 @@
package eu.midnightdust.midnightcontrols.client.gui;
import com.mojang.blaze3d.opengl.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
import eu.midnightdust.midnightcontrols.client.MidnightControlsClient;
import eu.midnightdust.midnightcontrols.client.util.platform.NetworkUtil;
import org.thinkingstudio.obsidianui.background.Background;
import org.thinkingstudio.obsidianui.mixin.DrawContextAccessor;
import org.thinkingstudio.obsidianui.widget.SpruceWidget;
import eu.midnightdust.lib.util.MidnightColorUtil;
import eu.midnightdust.midnightcontrols.MidnightControls;
@@ -501,27 +503,24 @@ public class MidnightControlsSettingsScreen extends SpruceScreen {
}
@Override
public void render(DrawContext context, SpruceWidget widget, int vOffset, int mouseX, int mouseY, float delta) {
fill(context.getMatrices(), widget.getX(), widget.getY(), widget.getX() + widget.getWidth(), widget.getY() + widget.getHeight(), MidnightColorUtil.hex2Rgb("#000000"));
fill(context, widget.getX(), widget.getY(), widget.getX() + widget.getWidth(), widget.getY() + widget.getHeight(), Color.black);
}
private static void fill(MatrixStack matrixStack, int x2, int y2, int x1, int y1, Color color) {
matrixStack.push();
private static void fill(DrawContext context, int x2, int y2, int x1, int y1, Color color) {
RenderLayer renderLayer = RenderLayer.getGui();
VertexConsumer vertexConsumer = ((DrawContextAccessor)context).getVertexConsumers().getBuffer(renderLayer);
Matrix4f matrix = matrixStack.peek().getPositionMatrix();
float r = (float)(color.getRed()) / 255.0F;
float g = (float)(color.getGreen()) / 255.0F;
float b = (float)(color.getBlue()) / 255.0F;
float t = (float)(transparency) / 255.0F;
BufferBuilder bufferBuilder = Tessellator.getInstance().begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
//RenderSystem.setShader(GameRenderer::getPositionColorProgram);
bufferBuilder.vertex(matrix, (float)x1, (float)y2, 0.0F).color(r, g, b, t);
bufferBuilder.vertex(matrix, (float)x2, (float)y2, 0.0F).color(r, g, b, t);
bufferBuilder.vertex(matrix, (float)x2, (float)y1, 0.0F).color(r, g, b, t);
bufferBuilder.vertex(matrix, (float)x1, (float)y1, 0.0F).color(r, g, b, t);
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
RenderSystem.disableBlend();
matrixStack.pop();
GlStateManager._enableBlend();
//GlStateManager._defaultBlendFunc();
vertexConsumer.vertex((float)x1, (float)y2, 0.0F).color(r, g, b, t);
vertexConsumer.vertex((float)x2, (float)y2, 0.0F).color(r, g, b, t);
vertexConsumer.vertex((float)x2, (float)y1, 0.0F).color(r, g, b, t);
vertexConsumer.vertex((float)x1, (float)y1, 0.0F).color(r, g, b, t);
GlStateManager._disableBlend();
context.draw();
}
}
}

View File

@@ -0,0 +1,14 @@
package eu.midnightdust.midnightcontrols.client.mixin;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldView;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;
@Mixin(AbstractBlock.class)
public interface AbstractBlockAccessor {
@Invoker("canPlaceAt")
boolean midnightcontrols$canPlaceAt(BlockState state, WorldView world, BlockPos pos);
}

View File

@@ -77,7 +77,7 @@ public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity
}
}
@Inject(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/input/Input;tick(ZF)V", shift = At.Shift.AFTER))
@Inject(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/input/Input;tick()V", shift = At.Shift.AFTER))
public void onInputUpdate(CallbackInfo ci) {
MovementHandler.HANDLER.applyMovement((ClientPlayerEntity) (Object) this);
}

View File

@@ -33,17 +33,24 @@ import static eu.midnightdust.midnightcontrols.MidnightControls.id;
@Mixin(GameOptionsScreen.class)
public abstract class GameOptionsScreenMixin extends Screen {
@Shadow @Nullable protected OptionListWidget body;
@Unique TextIconButtonWidget midnightcontrols$button = TextIconButtonWidget.builder(Text.translatable("midnightcontrols.menu.title.controller"), (button -> this.client.setScreen(new MidnightControlsSettingsScreen(this, false))), true)
@Unique TextIconButtonWidget midnightcontrols$button = TextIconButtonWidget.builder(Text.translatable("midnightcontrols.menu.title.controller"),
(button -> this.client.setScreen(new MidnightControlsSettingsScreen(this, false))), true)
.dimension(20,20).texture(id("icon/controller"), 20, 20).build();
protected GameOptionsScreenMixin(Text title) {
super(title);
}
@Inject(method = "init", at = @At("TAIL"))
@Inject(method = "initBody", at = @At("TAIL"))
public void midnightcontrols$addMCButton(CallbackInfo ci) {
if (this.getClass().toString().equals(ControlsOptionsScreen.class.toString())) {
this.midnightcontrols$setButtonPos();
this.addSelectableChild(midnightcontrols$button);
}
}
@Inject(method = "init", at = @At("TAIL"))
public void midnightcontrols$drawMCButton(CallbackInfo ci) {
if (this.getClass().toString().equals(ControlsOptionsScreen.class.toString())) {
this.addDrawableChild(midnightcontrols$button);
}
}

View File

@@ -30,9 +30,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(GameRenderer.class)
public abstract class GameRendererMixin {
@Shadow @Final MinecraftClient client;
@Shadow @Final private MinecraftClient client;
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Mouse;getX()D", shift = At.Shift.BEFORE))
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Mouse;getScaledX(Lnet/minecraft/client/util/Window;)D", shift = At.Shift.BEFORE))
private void midnightcontrols$onRender(RenderTickCounter tickCounter, boolean tick, CallbackInfo ci) {
if (this.client.currentScreen != null && MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER)
MidnightControlsClient.input.onPreRenderScreen(this.client.currentScreen);
@@ -44,7 +44,7 @@ public abstract class GameRendererMixin {
drawContext.draw();
}
@Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/GameRenderer;renderHand:Z"), method = "renderWorld")
private void midnigtcontrols$captureMatrices(RenderTickCounter tickCounter, CallbackInfo ci, @Local(ordinal = 1) Matrix4f matrices) {
private void midnigtcontrols$captureMatrices(RenderTickCounter tickCounter, CallbackInfo ci, @Local(ordinal = 2) Matrix4f matrices) {
TouchUtils.lastProjMat.set(RenderSystem.getProjectionMatrix());
TouchUtils.lastModMat.set(RenderSystem.getModelViewMatrix());
TouchUtils.lastWorldSpaceMatrix.set(matrices);

View File

@@ -0,0 +1,12 @@
package eu.midnightdust.midnightcontrols.client.mixin;
import net.minecraft.client.input.Input;
import net.minecraft.util.math.Vec2f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(Input.class)
public interface InputAccessor {
@Accessor
void setMovementVector(Vec2f input);
}

View File

@@ -28,6 +28,7 @@ import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.profiler.Profiler;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.glfw.GLFW;
import org.spongepowered.asm.mixin.Final;
@@ -38,6 +39,7 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.client;
import static eu.midnightdust.midnightcontrols.client.MidnightControlsClient.reacharound;
@Mixin(MinecraftClient.class)
@@ -54,6 +56,10 @@ public abstract class MinecraftClientMixin {
@Shadow public abstract void setScreen(Screen screen);
@Shadow public int attackCooldown;
@Shadow protected abstract void handleInputEvents();
@Unique private BlockPos midnightcontrols$lastTargetPos;
@Unique private Vec3d midnightcontrols$lastPos;
@Unique private Direction midnightcontrols$lastTargetSide;
@@ -81,7 +87,7 @@ public abstract class MinecraftClientMixin {
var side = hitResult.getSide();
boolean sidewaysBlockPlacing = this.midnightcontrols$lastTargetPos == null || !targetPos.equals(this.midnightcontrols$lastTargetPos.offset(this.midnightcontrols$lastTargetSide));
boolean backwardsBlockPlacing = this.player.input.movementForward < 0.0f && (this.midnightcontrols$lastTargetPos == null || targetPos.equals(this.midnightcontrols$lastTargetPos.offset(this.midnightcontrols$lastTargetSide)));
boolean backwardsBlockPlacing = this.player.input.getMovementInput().y < 0.0f && (this.midnightcontrols$lastTargetPos == null || targetPos.equals(this.midnightcontrols$lastTargetPos.offset(this.midnightcontrols$lastTargetSide)));
if (cooldown > 1
&& !targetPos.equals(this.midnightcontrols$lastTargetPos)
@@ -129,7 +135,7 @@ public abstract class MinecraftClientMixin {
if (result.isAccepted()) {
//if (result.shouldSwingHand()) {
this.player.swingHand(hand);
if (!stackInHand.isEmpty() && (stackInHand.getCount() != previousStackCount || this.interactionManager.hasCreativeInventory())) {
if (!stackInHand.isEmpty() && (stackInHand.getCount() != previousStackCount || this.player.isInCreativeMode())) {
this.gameRenderer.firstPersonRenderer.resetEquipProgress(hand);
}
//}
@@ -144,10 +150,21 @@ public abstract class MinecraftClientMixin {
}
}
}
// This is always supposed to be located at before the line 'this.profiler.swap("Keybindings");'
// @Redirect(method = "tick", at = @At(value = "FIELD",target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;", ordinal = 6))
// private Screen midnightcontrols$ignoreTouchOverlay(MinecraftClient instance) {
// if (instance.currentScreen instanceof TouchscreenOverlay) return null;
// return instance.currentScreen;
// }
// TODO: Replace this with MixinExtras' Expressions once that's officially released
@Inject(method = "tick", at = @At(value = "INVOKE",target = "Lnet/minecraft/client/gui/hud/DebugHud;shouldShowDebugHud()Z"))
private void midnightcontrols$handleKeybindsWithTouchOverlay(CallbackInfo ci, @Local Profiler profiler) {
if (client.currentScreen instanceof TouchscreenOverlay) {
profiler.swap("Keybindings");
this.handleInputEvents();
if (this.attackCooldown > 0) {
--this.attackCooldown;
}
}
}
// Needed, as it will cause item actions not to work in touchscreen mode otherwise with the above method
@Inject(method = "handleInputEvents", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isUsingItem()Z"), cancellable = true)
private void midnightcontrols$dontHandleItemAndBlockInteractions(CallbackInfo ci) {
if (client.currentScreen instanceof TouchscreenOverlay) ci.cancel();
}
}

View File

@@ -77,7 +77,8 @@ public abstract class MouseMixin implements MouseAccessor {
for (int slot = 0; slot < 9; ++slot) {
int slotX = centerX - 90 + slot * 20 + 2;
if (mouseX >= (double) slotX && mouseX <= (double) (slotX + 20)) {
client.player.getInventory().selectedSlot = slot;
client.player.getInventory().setSelectedSlot(slot);
TouchInput.clickStartTime = -1;
ci.cancel();
return;
}

View File

@@ -68,7 +68,7 @@ public abstract class WorldRendererMixin {
@Inject(
method = "renderTargetBlockOutline",
at = @At("TAIL")
at = @At("HEAD")
)
private void onOutlineRender(Camera camera, VertexConsumerProvider.Immediate vertexConsumers, MatrixStack matrices, boolean translucent, CallbackInfo ci) {
if (((MidnightControlsConfig.controlsMode == ControlsMode.CONTROLLER && MidnightControlsConfig.touchInControllerMode) || MidnightControlsConfig.controlsMode == ControlsMode.TOUCHSCREEN)

View File

@@ -87,7 +87,7 @@ public class TouchInput {
if (interaction.isAccepted()) {
//if (interaction.shouldSwingHand()) {
client.player.swingHand(client.player.preferredHand);
if (!stackInHand.isEmpty() && (stackInHand.getCount() != previousStackCount || client.interactionManager.hasCreativeInventory())) {
if (!stackInHand.isEmpty() && (stackInHand.getCount() != previousStackCount || client.player.isInCreativeMode())) {
client.gameRenderer.firstPersonRenderer.resetEquipProgress(client.player.preferredHand);
}
//}

View File

@@ -38,7 +38,7 @@ public class TouchUtils {
if (entityCast != null && entityCast.getType() == HitResult.Type.ENTITY) return entityCast;
BlockHitResult result = client.world.raycast(new RaycastContext(near, far, RaycastContext.ShapeType.OUTLINE, RaycastContext.FluidHandling.ANY, client.player));
BlockHitResult result = client.world.raycast(new RaycastContext(near, far, RaycastContext.ShapeType.OUTLINE, RaycastContext.FluidHandling.NONE, client.player));
if (client.player.getPos().distanceTo(result.getPos()) > playerRange) return null;
return result;

View File

@@ -1,11 +1,11 @@
package eu.midnightdust.midnightcontrols.client.touch.gui;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.item.consume.UseAction;
import org.thinkingstudio.obsidianui.Position;
import org.thinkingstudio.obsidianui.widget.SpruceButtonWidget;
import eu.midnightdust.midnightcontrols.MidnightControlsConstants;
import eu.midnightdust.midnightcontrols.client.MidnightControlsConfig;
import net.minecraft.item.ArmorItem;
import net.minecraft.text.Text;
public class ItemUseButtonWidget extends SpruceButtonWidget {
@@ -30,7 +30,7 @@ public class ItemUseButtonWidget extends SpruceButtonWidget {
this.setMessage(Text.translatable(MidnightControlsConstants.NAMESPACE+".action.eat"));
} else if (action == UseAction.DRINK) {
this.setMessage(Text.translatable(MidnightControlsConstants.NAMESPACE+".action.drink"));
} else if (client.player.getMainHandStack().getItem() instanceof ArmorItem) {
} else if (client.player.getMainHandStack().getComponents().contains(DataComponentTypes.EQUIPPABLE)) {
this.setMessage(Text.translatable(MidnightControlsConstants.NAMESPACE+".action.equip"));
} else if (!action.equals(UseAction.NONE)) {
this.setMessage(Text.translatable(MidnightControlsConstants.NAMESPACE+".action.use"));

View File

@@ -1,5 +1,6 @@
package eu.midnightdust.midnightcontrols.client.touch.gui;
import eu.midnightdust.midnightcontrols.client.touch.TouchInput;
import org.thinkingstudio.obsidianui.Position;
import org.thinkingstudio.obsidianui.widget.SpruceTexturedButtonWidget;
import net.minecraft.text.Text;
@@ -34,6 +35,7 @@ public class SilentTexturedButtonWidget extends SpruceTexturedButtonWidget {
public void onClick(double mouseX, double mouseY) {
this.setActive(true);
super.onClick(mouseX, mouseY);
TouchInput.clickStartTime = -1;
this.setActive(false);
}
}

View File

@@ -9,12 +9,14 @@
package eu.midnightdust.midnightcontrols.client.touch.gui;
import eu.midnightdust.midnightcontrols.client.mixin.KeyBindingIDAccessor;
import eu.midnightdust.midnightcontrols.client.touch.TouchInput;
import eu.midnightdust.midnightcontrols.client.util.storage.AxisStorage;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.gui.screen.GameMenuScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.item.ArmorItem;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.item.consume.UseAction;
import net.minecraft.util.Arm;
import net.minecraft.util.Hand;
@@ -298,7 +300,13 @@ public class TouchscreenOverlay extends Screen {
if (binding == null) continue;
boolean hasTexture = client.getGuiAtlasManager().getSprite(id("binding/"+bindName)) != missingSprite;
if (MidnightControlsConfig.debug) System.out.println(left +" "+id("binding/"+bindName)+" "+ hasTexture);
var button = TextIconButtonWidget.builder(Text.translatable(binding.getTranslationKey()), b -> binding.handle(client, 1, ButtonState.PRESS), hasTexture)
var button = TextIconButtonWidget.builder(Text.translatable(binding.getTranslationKey()), b -> {
binding.handle(client, 1.0f, ButtonState.PRESS);
if (binding.asKeyBinding().isPresent()) {
binding.asKeyBinding().get().setPressed(true);
((KeyBindingAccessor)binding.asKeyBinding().get()).midnightcontrols$press();
}
}, hasTexture)
.texture(hasTexture ? id("binding/"+bindName) : emptySprite, 20, 20).dimension(20, 20).build();
button.setPosition(left ? (3+(i*23)) : this.width-(23+(i*23)), 3);
button.setAlpha(MidnightControlsConfig.touchTransparency / 100f);
@@ -340,7 +348,7 @@ public class TouchscreenOverlay extends Screen {
this.forwardLeftButton.setVisible(false);
this.forwardRightButton.setVisible(false);
}
this.useButton.setVisible(client.player.getMainHandStack() != null && (client.player.getMainHandStack().getUseAction() != UseAction.NONE || client.player.getMainHandStack().getItem() instanceof ArmorItem) && !TouchUtils.hasInWorldUseAction(client.player.getMainHandStack()));
this.useButton.setVisible(client.player.getMainHandStack() != null && (client.player.getMainHandStack().getUseAction() != UseAction.NONE || client.player.getMainHandStack().getComponents().contains(DataComponentTypes.EQUIPPABLE)) && !TouchUtils.hasInWorldUseAction(client.player.getMainHandStack()));
this.updateJumpButtons();
}
@@ -359,10 +367,4 @@ public class TouchscreenOverlay extends Screen {
}
return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
KeyBinding.onKeyPressed(InputUtil.fromKeyCode(keyCode, scanCode));
super.keyPressed(keyCode,scanCode,modifiers);
return true;
}
}

View File

@@ -91,7 +91,7 @@ public class InventoryUtil {
if (closestSlot.isPresent() && client.player != null) {
var slot = closestSlot.get().getLeft();
if (slot.hasStack() || !client.player.getInventory().getMainHandStack().isEmpty()) {
if (slot.hasStack() || !client.player.getInventory().getSelectedStack().isEmpty()) {
int slotCenterXScaled = guiLeft + slot.x + 8;
int slotCenterYScaled = guiTop + slot.y + 8;
int slotCenterX = (int) (slotCenterXScaled / ((double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth()));

View File

@@ -0,0 +1,238 @@
{
"midnightcontrols.midnightconfig.title": "Configurações avançadas do MidnightControls",
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.DEFAULT_LIGHT": "Padrão claro",
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.DEFAULT_DARK": "Padrão escuro",
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.SECOND_LIGHT": "Segundo claro",
"midnightcontrols.midnightconfig.enum.VirtualMouseSkin.SECOND_DARK": "Segundo escuro",
"midnightcontrols.midnightconfig.enum.ControllerType.DEFAULT": "Padrão",
"midnightcontrols.midnightconfig.enum.ControllerType.DUALSHOCK": "DualShock",
"midnightcontrols.midnightconfig.enum.ControllerType.DUALSENSE": "DualSense",
"midnightcontrols.midnightconfig.enum.ControllerType.SWITCH": "Controle de Switch/Wii",
"midnightcontrols.midnightconfig.enum.ControllerType.XBOX": "Controle de Xbox One/Series",
"midnightcontrols.midnightconfig.enum.ControllerType.XBOX_360": "Controle de Xbox 360",
"midnightcontrols.midnightconfig.enum.ControllerType.STEAM_CONTROLLER": "Controle da Steam",
"midnightcontrols.midnightconfig.enum.ControllerType.STEAM_DECK": "Steam Deck",
"midnightcontrols.midnightconfig.enum.ControllerType.OUYA": "Controle de OUYA",
"midnightcontrols.midnightconfig.enum.ControllerType.NUMBERED": "Controle númerado",
"midnightcontrols.midnightconfig.enum.ControlsMode.DEFAULT": "Teclado/Mouse",
"midnightcontrols.midnightconfig.enum.ControlsMode.CONTROLLER": "Controle",
"midnightcontrols.midnightconfig.enum.ControlsMode.TOUCHSCREEN": "Tela sensível ao toque (Beta)",
"midnightcontrols.midnightconfig.enum.HudSide.LEFT": "Esquerda",
"midnightcontrols.midnightconfig.enum.HudSide.RIGHT": "Direita",
"midnightcontrols.midnightconfig.enum.TouchMode.CROSSHAIR": "Na mira",
"midnightcontrols.midnightconfig.enum.TouchMode.FINGER_POS": "Posição do dedo",
"midnightcontrols.midnightconfig.enum.CameraMode.FLAT": "Plano",
"midnightcontrols.midnightconfig.enum.CameraMode.ADAPTIVE": "Adaptativo",
"key.categories.midnightcontrols": "MidnightControls",
"key.midnightcontrols.look_down": "Olhar para baixo",
"key.midnightcontrols.look_left": "Olhar para a esquerda",
"key.midnightcontrols.look_right": "Olhar para a direita",
"key.midnightcontrols.look_up": "Olhar para cima",
"key.midnightcontrols.ring": "Abrir anel de teclas não vinculadas",
"midnightcontrols.action.attack": "Atacar",
"midnightcontrols.action.back": "Voltar",
"midnightcontrols.action.chat": "Abrir bate-papo",
"midnightcontrols.action.controls_ring": "Abrir anel de teclas não vinculadas",
"midnightcontrols.action.debug_screen": "Abrir HUD de depuração (F3)",
"midnightcontrols.action.drop_item": "Soltar item",
"midnightcontrols.action.drink": "Beber",
"midnightcontrols.action.eat": "Comer",
"midnightcontrols.action.equip": "Equipar",
"midnightcontrols.action.exit": "Sair da tela",
"midnightcontrols.action.forward": "Para frente",
"midnightcontrols.action.hit": "Atacar",
"midnightcontrols.action.hotbar_left": "Move a barra rápida para esquerda",
"midnightcontrols.action.hotbar_right": "Move a barra rápida para direita",
"midnightcontrols.action.inventory": "Invetário",
"midnightcontrols.action.jump": "Pular",
"midnightcontrols.action.left": "Esquerda",
"midnightcontrols.action.pause_game": "Pausar",
"midnightcontrols.action.pick_block": "Pegar bloco",
"midnightcontrols.action.pickup": "Pegar",
"midnightcontrols.action.pickup_all": "Pegar todos",
"midnightcontrols.action.place": "Colocar",
"midnightcontrols.action.player_list": "Lista de jogadores",
"midnightcontrols.action.quick_move": "Mover rápido",
"midnightcontrols.action.right": "Direita",
"midnightcontrols.action.screenshot": "Tirar Screenshot",
"midnightcontrols.action.slot_up": "Mover Slot para cima",
"midnightcontrols.action.slot_down": "Mover Slot para baixo",
"midnightcontrols.action.slot_left": "Mover Slot para esquerda",
"midnightcontrols.action.slot_right": "Mover Slot para direita",
"midnightcontrols.action.sneak": "Esgueirar",
"midnightcontrols.action.sprint": "Correr",
"midnightcontrols.action.swap_hands": "Trocar de mãos",
"midnightcontrols.action.toggle_perspective": "Alternar perspectiva",
"midnightcontrols.action.toggle_smooth_camera": "Ativar câmera cinemática",
"midnightcontrols.action.page_back": "Página anterior",
"midnightcontrols.action.page_next": "Próxima página",
"midnightcontrols.action.tab_back": "Aba anterior",
"midnightcontrols.action.tab_next": "Próxima aba",
"midnightcontrols.action.take": "Pegar item",
"midnightcontrols.action.take_all": "Pegar pilha",
"midnightcontrols.action.use": "Usar",
"midnightcontrols.action.zoom": "Zoom",
"midnightcontrols.action.zoom_in": "Aumentar o Zoom",
"midnightcontrols.action.zoom_out": "Diminuir o Zoom",
"midnightcontrols.action.zoom_reset": "Resetar o Zoom",
"midnightcontrols.action.emi_page_left": "Página anterior",
"midnightcontrols.action.emi_page_right": "Próxima pickup",
"midnightcontrols.category.emi": "EMI",
"midnightcontrols.button.a": "A",
"midnightcontrols.button.b": "B",
"midnightcontrols.button.x": "X",
"midnightcontrols.button.y": "Y",
"midnightcontrols.button.left_bumper": "Botão L1",
"midnightcontrols.button.right_bumper": "Botão R1",
"midnightcontrols.button.back": "Voltar",
"midnightcontrols.button.start": "Começar",
"midnightcontrols.button.guide": "Guia",
"midnightcontrols.button.left_thumb": "Analógico esquerdo",
"midnightcontrols.button.right_thumb": "Analógico direito",
"midnightcontrols.button.dpad_up": "Botão direcional para cima",
"midnightcontrols.button.dpad_right": "Botão direcional para direita",
"midnightcontrols.button.dpad_down": "Botão direcional para baixo",
"midnightcontrols.button.dpad_left": "Botão direcional para esquerda",
"midnightcontrols.button.l4": "L4",
"midnightcontrols.button.l5": "L5",
"midnightcontrols.button.r4": "R4",
"midnightcontrols.button.r5": "L5",
"midnightcontrols.axis.left_x+": "Esquerda X+",
"midnightcontrols.axis.left_y+": "Esquerda Y+",
"midnightcontrols.axis.right_x+": "Direita X+",
"midnightcontrols.axis.right_y+": "Direita Y+",
"midnightcontrols.axis.left_trigger": "Gatilho da esquerda",
"midnightcontrols.axis.right_trigger": "Gatilho da direita",
"midnightcontrols.axis.left_x-": "Esquerda X-",
"midnightcontrols.axis.left_y-": "Esquerda Y-",
"midnightcontrols.axis.right_x-": "Direita X-",
"midnightcontrols.axis.right_y-": "Direita Y-",
"midnightcontrols.button.unknown": "Desconhecido (%d)",
"midnightcontrols.controller.tutorial.title": "Jogue o jogo com um controle!",
"midnightcontrols.controller.tutorial.description": "Vá para %s -> %s -> %s",
"midnightcontrols.controller.connected": "Controle %d conectado.",
"midnightcontrols.controller.disconnected": "Controle %d desconectado.",
"midnightcontrols.controller.mappings.1": "Para configurar o mapeamento do controle, por favor use %s",
"midnightcontrols.controller.mappings.3": "e cole o mapeamento no editor de arquivos do mapeamento.",
"midnightcontrols.controller.mappings.error": "Erro ao carregar mapeamentos.",
"midnightcontrols.controller.mappings.error.write": "Erro ao gravar mapeamentos no arquivo.",
"midnightcontrols.controller.mappings.updated": "Atualizando mapeamentos!",
"midnightcontrols.controller_type.default": "Padrão",
"midnightcontrols.controller_type.dualshock": "DualShock",
"midnightcontrols.controller_type.dualsense": "DualSense",
"midnightcontrols.controller_type.switch": "Controle de Switch/Wii",
"midnightcontrols.controller_type.xbox": "Controle de Xbox One/Series",
"midnightcontrols.controller_type.xbox_360": "Controle de Xbox 360",
"midnightcontrols.controller_type.steam_controller": "Controle da Steam",
"midnightcontrols.controller_type.steam_deck": "Steam Deck",
"midnightcontrols.controller_type.ouya": "Controle de OUYA",
"midnightcontrols.controller_type.numbered": "Controle númerado",
"midnightcontrols.controls_mode.default": "Teclado/Mouse",
"midnightcontrols.controls_mode.controller": "Controle",
"midnightcontrols.controls_mode.touchscreen": "Tela sensível ao toque (Beta)",
"midnightcontrols.hud_side.LEFT": "Esquerda",
"midnightcontrols.hud_side.RIGHT": "Direita",
"midnightcontrols.menu.analog_movement": "Movemento analógico",
"midnightcontrols.menu.analog_movement.tooltip": "Quando possível, ative o movemento analógico.",
"midnightcontrols.menu.auto_switch_mode": "Modo de troca automática",
"midnightcontrols.menu.auto_switch_mode.tooltip": "Se o modo de controle deve ser alterado automaticamente para o controle quando um for conectado.",
"midnightcontrols.menu.camera_mode": "Modo de câmera",
"midnightcontrols.menu.controller": "Controle",
"midnightcontrols.menu.controller2": "Segundo controle",
"midnightcontrols.menu.controller2.tooltip": "Segundo controle a ser usado, o que permite (por exemplo) o suporte a Joy-Cons.",
"midnightcontrols.menu.controller_toggle_sneak": "Alternar Esgueirar no Controle",
"midnightcontrols.menu.controller_toggle_sprint": "Alternar Correr no Controle",
"midnightcontrols.menu.controller_type": "Tipo de controle",
"midnightcontrols.menu.controller_type.tooltip": "O tipo de controle que você está usando (é preciso para mostrar os botões corretos)",
"midnightcontrols.menu.controls_mode": "Modo",
"midnightcontrols.menu.controls_mode.tooltip": "O modo de controle.",
"midnightcontrols.menu.copy_controller_guid": "Copiar o GUID",
"midnightcontrols.menu.current_controller_guid": "GUID do controle atual: %s",
"midnightcontrols.menu.double_tap_to_sprint": "Toque duplo para correr",
"midnightcontrols.menu.double_tap_to_sprint.tooltip": "Alterna se a tecla Andar para Frente faz o jogador correr quando pressionada duas vezes rapidamente",
"midnightcontrols.menu.fast_block_placing": "Colocação Rápida de Blocos",
"midnightcontrols.menu.fast_block_placing.tooltip": "Enquanto voando no criativo, ativar a Colocação de Rápida de Blocos. §cEm alguns servidores isso pode ser considerado como trapaça.",
"midnightcontrols.menu.fly_drifting": "Derrapagem ao Voar",
"midnightcontrols.menu.fly_drifting.tooltip": "Enquanto voando, ativa a deparragem/inércia Vanilla.",
"midnightcontrols.menu.fly_drifting_vertical": "Derrapagem vertical ao Voar",
"midnightcontrols.menu.fly_drifting_vertical.tooltip": "Enquanto voando, ativa a deparragem/inércia vertical Vanilla.",
"midnightcontrols.menu.hud_enable": "Ativar HUD",
"midnightcontrols.menu.hud_enable.tooltip": "Alterna o indicador de botão do controle na tela.",
"midnightcontrols.menu.hud_side": "Lado do HUD",
"midnightcontrols.menu.hud_side.tooltip": "A posição do HUD.",
"midnightcontrols.menu.invert_right_x_axis": "Inverter X Direito",
"midnightcontrols.menu.invert_right_y_axis": "Inverter Y Direito",
"midnightcontrols.menu.joystick_as_mouse": "Sempre usar analógico esquerdo como mouse",
"midnightcontrols.menu.joystick_as_mouse.tooltip": "Fazer o analógico agir como um mouse em todos os menus.",
"midnightcontrols.menu.eye_tracker_as_mouse": "Usar o rastreador ocular como um mouse",
"midnightcontrols.menu.eye_tracker_as_mouse.tooltip": "Substituir o mouse com um dispositivo de rastreamento ocular, (por exemplo) o Tobii 5.",
"midnightcontrols.menu.eye_tracker_deadzone": "Tamanho da zona morta do rastreador ocular",
"midnightcontrols.menu.eye_tracker_deadzone.tooltip": "Parar o movimento da camera quando olhar perto da mira",
"midnightcontrols.menu.keyboard_controls": "Controles do teclado...",
"midnightcontrols.menu.left_dead_zone": "Zona morta do analógico esquerdo",
"midnightcontrols.menu.left_dead_zone.tooltip": "A zona morta para o analógico esquerdo do controle.",
"midnightcontrols.menu.mappings.open_input_str": "Abrir editor de arquivo de mapeamentos",
"midnightcontrols.menu.max_left_x_value": "Valor máximo do eixo X esquerdo",
"midnightcontrols.menu.max_left_x_value.tooltip": "Altera o valor máximo considerado pelo mod para o eixo X esquerdo. Útil se o seu eixo não usa toda a faixa e parece lento.",
"midnightcontrols.menu.max_left_y_value": "Valor máximo do eixo Y esquerdo",
"midnightcontrols.menu.max_left_y_value.tooltip": "Altera o valor máximo considerado pelo mod para o eixo Y esquerdo. Útil se o seu eixo não usa toda a faixa e parece lento.",
"midnightcontrols.menu.max_right_x_value": "Valor máximo do eixo X direito",
"midnightcontrols.menu.max_right_x_value.tooltip": "Altera o valor máximo considerado pelo mod para o eixo X direito. Útil se o seu eixo não usa toda a faixa e parece lento.",
"midnightcontrols.menu.max_right_y_value": "Valor máximo do eixo Y direito",
"midnightcontrols.menu.max_right_y_value.tooltip": "Altera o valor máximo considerado pelo mod para o eixo Y direito. Útil se o seu eixo não usa toda a faixa e parece lento.",
"midnightcontrols.menu.mouse_speed": "Velocidade do mouse",
"midnightcontrols.menu.mouse_speed.tooltip": "A velocidade do mouse emulado pelo controle",
"midnightcontrols.menu.move_chat": "Mover a caixa do chat para o topo",
"midnightcontrols.menu.move_chat.tooltip": "Move a caixa do chat para o topo, para uma melhor digitação em dispositivos com teclados na tela.",
"midnightcontrols.menu.multiple_mapping_tip": "(Dica: Você também pode inserir múltiplos mapeamentos ao mesmo tempo)",
"midnightcontrols.menu.reacharound.horizontal": "Colocação frontal de blocos",
"midnightcontrols.menu.reacharound.horizontal.tooltip": "Ativa colocação frontal de blocos, §cEm alguns servidores isso pode ser considerado como trapaça.§r.",
"midnightcontrols.menu.reacharound.vertical": "Alcance vertical",
"midnightcontrols.menu.reacharound.vertical.tooltip": "Ativa alcance vertical, §c§cEm alguns servidores isso pode ser considerado como trapaça.§r.",
"midnightcontrols.menu.reload_controller_mappings": "Recarregar o mapeamento do controle",
"midnightcontrols.menu.reload_controller_mappings.tooltip": "Recarrega o arquivo de mapeamentos do controle.",
"midnightcontrols.menu.right_dead_zone": "Zona morta do analógico direito",
"midnightcontrols.menu.right_dead_zone.tooltip": "A zona morta para o analógico direito do controle..",
"midnightcontrols.menu.rotation_speed": "Velocidade de rotação do eixo X",
"midnightcontrols.menu.rotation_speed.tooltip": "A velocidade de rotação do eixo X da câmera no modo controle.",
"midnightcontrols.menu.y_axis_rotation_speed": "Velocidade de rotação do eixo Y",
"midnightcontrols.menu.y_axis_rotation_speed.tooltip": "A velocidade de rotação do eixo Y da câmera no modo controle.",
"midnightcontrols.menu.separate_controller_profile": "Separar perfil do controle",
"midnightcontrols.menu.separator.controller": "Controle",
"midnightcontrols.menu.separator.general": "Geral",
"midnightcontrols.menu.title": "MidnightControls - Configurações",
"midnightcontrols.menu.title.controller": "Configurações do controle",
"midnightcontrols.menu.title.controller_controls": "Mapeamento de controle",
"midnightcontrols.menu.title.gameplay": "Configurações de jogabilidade",
"midnightcontrols.menu.title.general": "Configurações gerais",
"midnightcontrols.menu.title.hud": "Configurações de HUD",
"midnightcontrols.menu.title.mappings.string": "Editor de arquivo de mapeamentos",
"midnightcontrols.menu.title.touch": "Configurações de toque",
"midnightcontrols.menu.title.visual": "Configurações de aparência",
"midnightcontrols.menu.touch_break_delay": "Atrasado de destruição do toque",
"midnightcontrols.menu.touch_speed": "Velocidade do toque",
"midnightcontrols.menu.invert_touch": "Inverter direção do toque",
"midnightcontrols.menu.touch_mode": "Modo de interação de toque",
"midnightcontrols.menu.touch_transparency": "Transparência do HUD de toque",
"midnightcontrols.menu.touch_with_controller": "Toque no modo do controle",
"midnightcontrols.menu.unfocused_input": "Entrada desfocada",
"midnightcontrols.menu.unfocused_input.tooltip": "Permite entrada de sinais do controle quando a janela não está em foco.",
"midnightcontrols.menu.virtual_mouse": "Mouse virtual",
"midnightcontrols.menu.virtual_mouse.tooltip": "Ativa o mouse virtual, que é útil durante o modo tela dividida.",
"midnightcontrols.menu.virtual_mouse.skin": "Tema do mouse virtual",
"midnightcontrols.menu.hide_cursor": "Desativar cursor do mouse padrão",
"midnightcontrols.menu.hide_cursor.tooltip": "Esconde o cursor padrão do mouse, deixando apenas o mouse virtual visível.",
"midnightcontrols.narrator.unbound": "Desmapear %s",
"midnightcontrols.not_bound": "Não mapeado",
"midnightcontrols.virtual_mouse.skin.default_light": "Padrão claro",
"midnightcontrols.virtual_mouse.skin.default_dark": "Padrão escuro",
"midnightcontrols.virtual_mouse.skin.second_light": "Segundo claro",
"midnightcontrols.virtual_mouse.skin.second_dark": "Segundo escuro",
"midnightcontrols.midnightconfig.category.controller": "Controle",
"midnightcontrols.midnightconfig.category.misc": "Variados",
"midnightcontrols.midnightconfig.category.screens": "Telas",
"midnightcontrols.midnightconfig.category.gameplay": "Jogabilidade",
"midnightcontrols.midnightconfig.category.touch": "Toque",
"midnightcontrols.midnightconfig.category.visual": "Visual",
"modmenu.descriptionTranslation.midnightcontrols": "Adiciona suporte a controles e aprimora o controle no geral.\nDerivado do LambdaControls, que infelizmente foi descontinuado."
}

View File

@@ -1,7 +1,7 @@
{
"required": true,
"package": "eu.midnightdust.midnightcontrols.client.mixin",
"compatibilityLevel": "JAVA_16",
"compatibilityLevel": "JAVA_21",
"client": [
"AdvancementsScreenAccessor",
"ChatScreenMixin",
@@ -12,6 +12,7 @@
"GameOptionsScreenMixin",
"GameRendererMixin",
"HandledScreenMixin",
"InputAccessor",
"InputUtilMixin",
"KeyBindingIDAccessor",
"KeyBindingMixin",
@@ -23,7 +24,8 @@
"RecipeBookWidgetAccessor",
"ScreenMixin",
"TabNavigationWidgetAccessor",
"WorldRendererMixin"
"WorldRendererMixin",
"AbstractBlockAccessor"
],
"injectors": {
"defaultRequire": 1

View File

@@ -2,7 +2,7 @@
"required": true,
"package": "eu.midnightdust.midnightcontrols.client.compat.mixin",
"plugin": "eu.midnightdust.midnightcontrols.client.compat.MidnightControlsMixinPlugin",
"compatibilityLevel": "JAVA_16",
"compatibilityLevel": "JAVA_21",
"client": [
"sodium.SodiumOptionsGUIAccessor"
],

View File

@@ -92,7 +92,8 @@ unifiedPublishing {
curseforge {
token = CURSEFORGE_TOKEN
id = rootProject.curseforge_id
gameVersions.addAll "Java 21", project.minecraft_version, project.supported_versions
gameVersions.addAll "Java 21", project.minecraft_version
if (project.supported_versions != "") gameVersions.addAll project.supported_versions
}
}
@@ -102,7 +103,8 @@ unifiedPublishing {
token = MODRINTH_TOKEN
id = rootProject.modrinth_id
version = "$project.version-$project.name"
gameVersions.addAll project.minecraft_version, project.supported_versions
gameVersions.addAll project.minecraft_version
if (project.supported_versions != "") gameVersions.addAll project.supported_versions
}
}
}

View File

@@ -54,7 +54,7 @@
"fabric": ">=0.71.0",
"minecraft": ">=1.20.5",
"obsidianui": ">=0.2.5",
"java": ">=17"
"java": ">=21"
},
"suggests": {
"kontrolo": "*"

View File

@@ -2,34 +2,34 @@
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx2048M
minecraft_version=1.21.3
supported_versions=1.21.2
yarn_mappings=1.21.3+build.2
minecraft_version=1.21.5
supported_versions=
yarn_mappings=1.21.5+build.1
enabled_platforms=fabric,neoforge
archives_base_name=midnightcontrols
mod_version=1.10.0
mod_version=1.10.6
maven_group=eu.midnightdust
release_type=beta
release_type=release
modrinth_id = bXX9h73M
curseforge_id = 621768
# Configure the IDs here after creating the projects on the websites
midnightlib_version=1.6.4
midnightlib_version=1.7.0+1.21.4
fabric_loader_version=0.16.9
fabric_api_version=0.107.3+1.21.3
fabric_loader_version=0.16.10
fabric_api_version=0.119.5+1.21.5
neoforge_version=21.3.28-beta
neoforge_version=21.5.2-beta
yarn_mappings_patch_neoforge_version = 1.21+build.4
quilt_loader_version=0.19.0-beta.18
quilt_fabric_api_version=7.0.1+0.83.0-1.20
sodium_version=mc1.21-0.6.0-beta.1
obsidianui_version=0.2.7+mc1.21
obsidianui_version=0.2.11+mc1.21.5
modmenu_version=10.0.0-beta.1
emotecraft_version=2.1.3-SNAPSHOT-build.29-MC1.19-fabric
emotecraft_version=2.5.5+1.21.4-fabric
bendylib_version=2.0.+
emi_version=1.1.10+1.21+fabric
libgui_version=6.0.0+1.19

Binary file not shown.

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

10
gradlew vendored
View File

@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -84,7 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -200,10 +202,10 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

186
gradlew.bat vendored
View File

@@ -1,92 +1,94 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -104,7 +104,8 @@ unifiedPublishing {
curseforge {
token = CURSEFORGE_TOKEN
id = rootProject.curseforge_id
gameVersions.addAll "Java 21", project.minecraft_version, project.supported_versions
gameVersions.addAll "Java 21", project.minecraft_version
if (project.supported_versions != "") gameVersions.addAll project.supported_versions
}
}
@@ -114,7 +115,8 @@ unifiedPublishing {
token = MODRINTH_TOKEN
id = rootProject.modrinth_id
version = "$project.version-$project.name"
gameVersions.addAll project.minecraft_version, project.supported_versions
gameVersions.addAll project.minecraft_version
if (project.supported_versions != "") gameVersions.addAll project.supported_versions
}
}
}

View File

@@ -19,7 +19,12 @@ public class NetworkUtilImpl {
handler.send(packet);
}
public static void sendPayloadC2S(CustomPayload payload) {
if (handler != null && client.world != null)
handler.send(new CustomPayloadC2SPacket(payload));
if (handler != null && client.world != null) {
try {
handler.send(new CustomPayloadC2SPacket(payload));
} catch (Exception e) {
e.fillInStackTrace();
}
}
}
}