Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Fabric Api's ScreenMouseEvents$AllowMouseScroll event when a screen is open to allow for better mod compatibility #15

Open
Fuzss opened this issue May 17, 2023 · 0 comments

Comments

@Fuzss
Copy link

Fuzss commented May 17, 2023

Hi there, my Easy Shulker Boxes mod has a feature where you can scroll while hovering over a shulker box or bundle item in your inventory to change the slot to interact with the next time you right-click for extracting an item (as opposed to the vanilla bundle functionality where the last slot always is the one that will be interacted with).

Your Mouse Wheelie mod overrides this behavior with its item scrolling feature, which essentially comes back to Amecs and how the scroll keybind trigger is implemented in here:

private void onMouseScroll(long window, double rawX, double rawY, CallbackInfo callbackInfo, double deltaY) {
.

It would be great if Mouse Wheelie would allow me to handle the scroll (shulker boxes and bundles don't stack, so it wouldn't restrict Mouse Wheelie functionality anyway).

A very simple solution to this would be for you to only let your mixin run when no screen is open, and when a screen is open simply use net.fabricmc.fabric.api.client.screen.v1.ScreenMouseEvents$AllowMouseScroll, where I can register my callback at an earlier event phase than the default one, so I can cancel the event (mark the scroll handled) when I need to.

Would be great to see that change for both mods to be compatible, they really do complement each other quite well otherwise!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant