mirror of
https://github.com/TeamMidnightDust/MidnightControls.git
synced 2025-12-14 07:35:10 +01:00
@@ -1,6 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
id "architectury-plugin" version "3.4-SNAPSHOT"
|
||||||
id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false
|
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
|
||||||
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
|
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
|
||||||
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -373,7 +373,7 @@ public class MidnightInput {
|
|||||||
var focused = client.currentScreen.getFocused();
|
var focused = client.currentScreen.getFocused();
|
||||||
if (focused != null && isScreenInteractive(client.currentScreen)) {
|
if (focused != null && isScreenInteractive(client.currentScreen)) {
|
||||||
if (this.handleAButton(client.currentScreen, focused)) {
|
if (this.handleAButton(client.currentScreen, focused)) {
|
||||||
this.actionGuiCooldown = 5; // Prevent to press too quickly the focused element, so we have to skip 5 ticks.
|
this.actionGuiCooldown = 5; // Set the cooldown to 5 ticks to avoid unintended button presses.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -388,28 +388,15 @@ public class MidnightInput {
|
|||||||
client.mouse.getX() * (double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth(),
|
client.mouse.getX() * (double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth(),
|
||||||
client.mouse.getY() * (double) client.getWindow().getScaledHeight() / (double) client.getWindow().getHeight()) != null) return;
|
client.mouse.getY() * (double) client.getWindow().getScaledHeight() / (double) client.getWindow().getHeight()) != null) return;
|
||||||
if (!this.ignoreNextARelease && client.currentScreen != null) {
|
if (!this.ignoreNextARelease && client.currentScreen != null) {
|
||||||
double mouseX = client.mouse.getX() * (double) client.getWindow().getScaledWidth() / (double) client.getWindow().getWidth();
|
var accessor = (MouseAccessor) client.mouse;
|
||||||
double mouseY = client.mouse.getY() * (double) client.getWindow().getScaledHeight() / (double) client.getWindow().getHeight();
|
accessor.midnightcontrols$onCursorPos(client.getWindow().getHandle(), client.mouse.getX(), client.mouse.getY());
|
||||||
if (action == 0) {
|
if (action == 0) { // Button pressed
|
||||||
Screen.wrapScreenError(() -> {
|
accessor.midnightcontrols$onMouseButton(client.getWindow().getHandle(), GLFW_MOUSE_BUTTON_LEFT, 1, 0);
|
||||||
((MouseAccessor) client.mouse).setLeftButtonClicked(false);
|
} else if (action == 1) { // Button released
|
||||||
client.currentScreen.mouseClicked(mouseX, mouseY, GLFW.GLFW_MOUSE_BUTTON_1);
|
accessor.midnightcontrols$onMouseButton(client.getWindow().getHandle(), GLFW_MOUSE_BUTTON_LEFT, 0, 0);
|
||||||
},
|
|
||||||
"mouseClicked event handler", client.currentScreen.getClass().getCanonicalName());
|
|
||||||
} else if (action == 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());
|
|
||||||
} 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);
|
client.currentScreen.setDragging(false);
|
||||||
},
|
} else if (action == 2) { // Button held down / dragging
|
||||||
"mouseClicked event handler", client.currentScreen.getClass().getCanonicalName());
|
client.currentScreen.setDragging(true);
|
||||||
}
|
}
|
||||||
this.screenCloseCooldown = 5;
|
this.screenCloseCooldown = 5;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -177,7 +177,6 @@ public class InputHandlers {
|
|||||||
int slotId;
|
int slotId;
|
||||||
if (slot == null) {
|
if (slot == null) {
|
||||||
if (button.getName().equals("take_all")) {
|
if (button.getName().equals("take_all")) {
|
||||||
((MouseAccessor) client.mouse).setLeftButtonClicked(true);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
slotId = accessor.midnightcontrols$isClickOutsideBounds(x, y, accessor.getX(), accessor.getY(), GLFW_MOUSE_BUTTON_1) ? -999 : -1;
|
slotId = accessor.midnightcontrols$isClickOutsideBounds(x, y, accessor.getX(), accessor.getY(), GLFW_MOUSE_BUTTON_1) ? -999 : -1;
|
||||||
|
|||||||
@@ -67,9 +67,10 @@ public abstract class HandledScreenMixin implements HandledScreenAccessor {
|
|||||||
y -= 24;
|
y -= 24;
|
||||||
}
|
}
|
||||||
if (MidnightControlsCompat.isEMIPresent() && EMICompat.isEMIEnabled() && EMICompat.isSearchBarCentered()) {
|
if (MidnightControlsCompat.isEMIPresent() && EMICompat.isEMIEnabled() && EMICompat.isSearchBarCentered()) {
|
||||||
x = client.getWindow().getScaledWidth() - 55 - client.textRenderer.getWidth(Text.translatable("midnightcontrols.action.pickup"))
|
x = client.getWindow().getScaledWidth() - 4 - client.textRenderer.getWidth(Text.translatable("midnightcontrols.action.pickup"))
|
||||||
- client.textRenderer.getWidth(Text.translatable("midnightcontrols.action.quick_move"))
|
- client.textRenderer.getWidth(Text.translatable("midnightcontrols.action.quick_move"))
|
||||||
- MidnightControlsRenderer.getBindingIconWidth(ButtonBinding.TAKE) - MidnightControlsRenderer.getBindingIconWidth(ButtonBinding.QUICK_MOVE);
|
- 2 * MidnightControlsRenderer.getBindingIconWidth(ButtonBinding.TAKE) - MidnightControlsRenderer.getBindingIconWidth(ButtonBinding.QUICK_MOVE);
|
||||||
|
y += 2;
|
||||||
}
|
}
|
||||||
if (!ButtonBinding.TAKE.isNotBound()) x = MidnightControlsRenderer.drawButtonTip(context, x, y, ButtonBinding.TAKE, true, client);
|
if (!ButtonBinding.TAKE.isNotBound()) x = MidnightControlsRenderer.drawButtonTip(context, x, y, ButtonBinding.TAKE, true, client);
|
||||||
if (!ButtonBinding.QUICK_MOVE.isNotBound()) MidnightControlsRenderer.drawButtonTip(context, x, y, ButtonBinding.QUICK_MOVE, true, client);
|
if (!ButtonBinding.QUICK_MOVE.isNotBound()) MidnightControlsRenderer.drawButtonTip(context, x, y, ButtonBinding.QUICK_MOVE, true, client);
|
||||||
|
|||||||
@@ -11,5 +11,6 @@ public interface MouseAccessor {
|
|||||||
void midnightcontrols$onCursorPos(long window, double x, double y);
|
void midnightcontrols$onCursorPos(long window, double x, double y);
|
||||||
@Accessor
|
@Accessor
|
||||||
void setLeftButtonClicked(boolean value);
|
void setLeftButtonClicked(boolean value);
|
||||||
|
@Invoker("onMouseButton")
|
||||||
|
void midnightcontrols$onMouseButton(long window, int button, int action, int mods);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ dependencies {
|
|||||||
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
|
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
|
||||||
modImplementation include ("maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric")
|
modImplementation include ("maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric")
|
||||||
modImplementation include ("maven.modrinth:obsidianui:${rootProject.obsidianui_version}-fabric") {}
|
modImplementation include ("maven.modrinth:obsidianui:${rootProject.obsidianui_version}-fabric") {}
|
||||||
|
modImplementation "maven.modrinth:emi:${project.emi_version}"
|
||||||
|
|
||||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||||
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
|
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ obsidianui_version=0.2.7+mc1.21
|
|||||||
modmenu_version=10.0.0-beta.1
|
modmenu_version=10.0.0-beta.1
|
||||||
emotecraft_version=2.1.3-SNAPSHOT-build.29-MC1.19-fabric
|
emotecraft_version=2.1.3-SNAPSHOT-build.29-MC1.19-fabric
|
||||||
bendylib_version=2.0.+
|
bendylib_version=2.0.+
|
||||||
emi_version=1.1.1+1.20.4+fabric
|
emi_version=1.1.10+1.21+fabric
|
||||||
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
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
Reference in New Issue
Block a user