3232import net .minecraft .client .MinecraftClient ;
3333import net .minecraft .client .Mouse ;
3434import net .minecraft .client .gui .Element ;
35+ import net .minecraft .client .gui .screen .Screen ;
3536
3637@ Mixin (Mouse .class )
3738public abstract class MixinMouse {
@@ -52,71 +53,71 @@ public abstract class MixinMouse {
5253 private double cursorDeltaX ;
5354
5455 @ Inject (method = "method_1611" , at = @ At ("HEAD" ), locals = LocalCapture .CAPTURE_FAILHARD , cancellable = true )
55- public void preMouseClicked (boolean [] bls , double d , double e , int button , CallbackInfo info ) {
56- if (MinecraftForge .EVENT_BUS .post (new GuiScreenEvent .MouseClickedEvent .Pre (client .currentScreen , d , e , button ))) {
57- bls [0 ] = true ;
56+ public void preMouseClicked (boolean [] handled , double mouseX , double mouseY , int button , CallbackInfo info ) {
57+ if (MinecraftForge .EVENT_BUS .post (new GuiScreenEvent .MouseClickedEvent .Pre (client .currentScreen , mouseX , mouseY , button ))) {
58+ handled [0 ] = true ;
5859 info .cancel ();
5960 }
6061 }
6162
6263 @ Inject (method = "method_1611" , at = @ At ("RETURN" ), locals = LocalCapture .CAPTURE_FAILHARD , cancellable = true )
63- private void postMouseClicked (boolean [] bls , double d , double e , int button , CallbackInfo info ) {
64- if (bls [0 ]) {
64+ private void postMouseClicked (boolean [] handled , double mouseX , double mouseY , int button , CallbackInfo info ) {
65+ if (handled [0 ]) {
6566 return ;
6667 }
6768
68- if (MinecraftForge .EVENT_BUS .post (new GuiScreenEvent .MouseClickedEvent .Post (client .currentScreen , d , e , button ))) {
69- bls [0 ] = true ;
69+ if (MinecraftForge .EVENT_BUS .post (new GuiScreenEvent .MouseClickedEvent .Post (client .currentScreen , mouseX , mouseY , button ))) {
70+ handled [0 ] = true ;
7071 info .cancel ();
7172 }
7273 }
7374
7475 @ Inject (method = "method_1605" , at = @ At ("HEAD" ), locals = LocalCapture .CAPTURE_FAILHARD , cancellable = true )
75- private void preMouseReleased (boolean [] bls , double d , double e , int button , CallbackInfo info ) {
76- if (MinecraftForge .EVENT_BUS .post (new GuiScreenEvent .MouseReleasedEvent .Pre (client .currentScreen , d , e , button ))) {
77- bls [0 ] = true ;
76+ private void preMouseReleased (boolean [] handled , double mouseX , double mouseY , int button , CallbackInfo info ) {
77+ if (MinecraftForge .EVENT_BUS .post (new GuiScreenEvent .MouseReleasedEvent .Pre (client .currentScreen , mouseX , mouseY , button ))) {
78+ handled [0 ] = true ;
7879 info .cancel ();
7980 }
8081 }
8182
8283 @ Inject (method = "method_1605" , at = @ At ("RETURN" ), locals = LocalCapture .CAPTURE_FAILHARD )
83- private void postMouseReleased (boolean [] bls , double d , double e , int button , CallbackInfo info ) {
84- if (bls [0 ]) {
84+ private void postMouseReleased (boolean [] handled , double mouseX , double mouseY , int button , CallbackInfo info ) {
85+ if (handled [0 ]) {
8586 return ;
8687 }
8788
88- if (MinecraftForge .EVENT_BUS .post (new GuiScreenEvent .MouseReleasedEvent .Post (client .currentScreen , d , e , button ))) {
89- bls [0 ] = true ;
89+ if (MinecraftForge .EVENT_BUS .post (new GuiScreenEvent .MouseReleasedEvent .Post (client .currentScreen , mouseX , mouseY , button ))) {
90+ handled [0 ] = true ;
9091 info .cancel ();
9192 }
9293 }
9394
9495 @ Inject (method = "method_1602" , at = @ At ("HEAD" ), cancellable = true )
95- private void preMouseDragged (Element element , double d , double e , double f , double g , CallbackInfo info ) {
96- if (MinecraftForge .EVENT_BUS .post (new GuiScreenEvent .MouseDragEvent .Pre (client . currentScreen , d , e , activeButton , f , g ))) {
96+ private void preMouseDragged (Element element , double mouseX , double mouseY , double deltaX , double deltaY , CallbackInfo info ) {
97+ if (MinecraftForge .EVENT_BUS .post (new GuiScreenEvent .MouseDragEvent .Pre (( Screen ) element , mouseX , mouseY , activeButton , deltaX , deltaY ))) {
9798 info .cancel ();
9899 }
99100 }
100101
101102 @ Inject (method = "method_1602" , at = @ At ("RETURN" ))
102- private void postMouseDragged (Element element , double d , double e , double f , double g , CallbackInfo info ) {
103- MinecraftForge .EVENT_BUS .post (new GuiScreenEvent .MouseDragEvent .Post (client . currentScreen , d , e , activeButton , f , g ));
103+ private void postMouseDragged (Element element , double mouseX , double mouseY , double deltaX , double deltaY , CallbackInfo info ) {
104+ MinecraftForge .EVENT_BUS .post (new GuiScreenEvent .MouseDragEvent .Post (( Screen ) element , mouseX , mouseY , activeButton , deltaX , deltaY ));
104105 }
105106
106107 @ Inject (method = "onMouseScroll" , at = @ At (value = "INVOKE" ,
107108 target = "Lnet/minecraft/client/gui/screen/Screen;mouseScrolled(DDD)Z" ,
108109 ordinal = 0 ), locals = LocalCapture .CAPTURE_FAILHARD , cancellable = true )
109- private void preMouseScrolled (long window , double d , double e , CallbackInfo ci , double f , double g , double h ) {
110- if (MinecraftForge .EVENT_BUS .post (new GuiScreenEvent .MouseScrollEvent .Pre (client .currentScreen , g , h , f ))) {
111- ci .cancel ();
110+ private void preMouseScrolled (long window , double xOffset , double yOffset , CallbackInfo info , double amount , double mouseX , double mouseY ) {
111+ if (MinecraftForge .EVENT_BUS .post (new GuiScreenEvent .MouseScrollEvent .Pre (client .currentScreen , mouseX , mouseY , amount ))) {
112+ info .cancel ();
112113 }
113114 }
114115
115116 @ Inject (method = "onMouseScroll" , at = @ At (value = "INVOKE" ,
116117 target = "Lnet/minecraft/client/gui/screen/Screen;mouseScrolled(DDD)Z" ,
117118 ordinal = 0 , shift = At .Shift .BY , by = 2 ), locals = LocalCapture .CAPTURE_FAILHARD , cancellable = true )
118- private void postMouseScrolled (long window , double d , double e , CallbackInfo ci , double f , double g , double h ) {
119- MinecraftForge .EVENT_BUS .post (new GuiScreenEvent .MouseScrollEvent .Post (client .currentScreen , g , h , f ));
119+ private void postMouseScrolled (long window , double xOffset , double yOffset , CallbackInfo info , double amount , double mouseX , double mouseY ) {
120+ MinecraftForge .EVENT_BUS .post (new GuiScreenEvent .MouseScrollEvent .Post (client .currentScreen , mouseX , mouseY , amount ));
120121 }
121122
122123 public boolean isMiddleDown () {
0 commit comments