mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 11:59:25 +00:00
80 lines
4.0 KiB
Diff
80 lines
4.0 KiB
Diff
--- a/net/minecraft/client/MouseHandler.java
|
|
+++ b/net/minecraft/client/MouseHandler.java
|
|
@@ -87,6 +_,7 @@
|
|
this.activeButton = null;
|
|
}
|
|
|
|
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPre(mousebuttoninfo, p_423948_)) return;
|
|
if (this.minecraft.getOverlay() == null) {
|
|
if (this.minecraft.screen == null) {
|
|
if (!this.mouseGrabbed && flag) {
|
|
@@ -103,7 +_,7 @@
|
|
try {
|
|
long i = Util.getMillis();
|
|
boolean flag1 = i - this.lastClickTime < 250L && this.lastClickButton == mousebuttonevent.button();
|
|
- if (screen.mouseClicked(mousebuttonevent, flag1)) {
|
|
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseClicked(screen, d0, d1, mousebuttonevent, flag1)) {
|
|
this.lastClickTime = i;
|
|
this.lastClickButton = mousebuttoninfo.button();
|
|
return;
|
|
@@ -118,7 +_,7 @@
|
|
}
|
|
} else {
|
|
try {
|
|
- if (screen.mouseReleased(mousebuttonevent)) {
|
|
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseReleased(screen, d0, d1, mousebuttonevent)) {
|
|
return;
|
|
}
|
|
} catch (Throwable throwable) {
|
|
@@ -148,6 +_,7 @@
|
|
KeyMapping.click(inputconstants$key);
|
|
}
|
|
}
|
|
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseButtonPost(mousebuttoninfo, p_423948_);
|
|
}
|
|
}
|
|
|
|
@@ -204,7 +_,9 @@
|
|
if (this.minecraft.screen != null) {
|
|
double d3 = this.getScaledXPos(this.minecraft.getWindow());
|
|
double d4 = this.getScaledYPos(this.minecraft.getWindow());
|
|
- this.minecraft.screen.mouseScrolled(d3, d4, d1, d2);
|
|
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPre(this.minecraft.screen, d3, d4, d1, d2)) return;
|
|
+ if (this.minecraft.screen.mouseScrolled(d3, d4, d1, d2)) return;
|
|
+ net.minecraftforge.client.event.ForgeEventFactoryClient.onScreenMouseScrollPost(this.minecraft.screen, d3, d4, d1, d2);
|
|
this.minecraft.screen.afterMouseAction();
|
|
} else if (this.minecraft.player != null) {
|
|
Vector2i vector2i = this.scrollWheelHandler.onMouseScroll(d1, d2);
|
|
@@ -213,6 +_,7 @@
|
|
}
|
|
|
|
int i = vector2i.y == 0 ? -vector2i.x : vector2i.y;
|
|
+ if (net.minecraftforge.client.event.ForgeEventFactoryClient.onMouseScroll(this, d1, d2)) return;
|
|
if (this.minecraft.player.isSpectator()) {
|
|
if (this.minecraft.gui.getSpectatorGui().isMenuActive()) {
|
|
this.minecraft.gui.getSpectatorGui().onMouseScrolled(-i);
|
|
@@ -321,7 +_,7 @@
|
|
double d5 = getScaledYPos(window, this.accumulatedDY);
|
|
|
|
try {
|
|
- screen.mouseDragged(new MouseButtonEvent(d2, d3, this.activeButton), d4, d5);
|
|
+ net.minecraftforge.client.ForgeHooksClient.onScreenMouseDrag(screen, new MouseButtonEvent(d2, d3, this.activeButton), d4, d5);
|
|
} catch (Throwable throwable) {
|
|
CrashReport crashreport1 = CrashReport.forThrowable(throwable, "mouseDragged event handler");
|
|
screen.fillCrashDetails(crashreport1);
|
|
@@ -408,6 +_,14 @@
|
|
|
|
public double ypos() {
|
|
return this.ypos;
|
|
+ }
|
|
+
|
|
+ public double getXVelocity() {
|
|
+ return this.accumulatedDX;
|
|
+ }
|
|
+
|
|
+ public double getYVelocity() {
|
|
+ return this.accumulatedDY;
|
|
}
|
|
|
|
public void setIgnoreFirstMove() {
|