Giter Site home page Giter Site logo

hscroll's Introduction

HScroll Fabric Mod

This code is not maintained - I don't play Minecraft enough to warrant maintaining this mod and building new releases.

There are links to some workarounds in the issue thread here and the best workaround seems to be MCMacOSInputFixes.

Original README

This is some test code to see if I can work around a long-standing bug related to horizontal scrolling, particularly on Mac which translates Shift+Scroll into a horizontal scroll, which has no effect in Minecraft, but happens whenever you sneak and scroll your inventory slots.

The entire functionality is in MinecraftClientMixin.java which basically swaps out the default scroll handler for a custom one which translates horizontal scrolling into vertical scrolling.

I intend this as a purely temporary fix and proof of concept. One thing that I did not expect is that scrolling on a touchpad or magic mouse actually scrolls the opposite way than you might expect. This is likely due to "Natural Scrolling" on Mac and it's debatable whether the horizontal scroll direction should be the reverse of what it currently is. With a Magic Mouse the Shift+Scroll works exactly as expected, but a left swipe causes your inventory to scroll right. Currently it works perfectly for my needs using a Logitech Mouse.

Install

Using MultiMC - all that's required is to:

  • Download the jar file for your Minecraft version (eg: MC 1.16.4 -> hscroll-1.16.4.00X.jar) from the Releases Page
  • Edit Instance
  • Install Fabric (tested with fabric loader 0.10.6)
  • Add the downloaded jar file to 'Loader Mods'

For developers

In order to build the jar file, run the following commands:

# Set up build environment
gradle wrapper

# If you want the decompiled sources to browse
./gradlew genSources

# Build the jar file
./gradlew build

The build output will be in the build/libs directory.

See gradle.properties for building a specific version.

TODO

  • The mod works as intended for vertical scrolling, with and without Shift, using all mice tested. It does not, however, behave as well for the Magic Mouse or Trackpad which have a horizontal scroll gesture. For these devices, a left swipe will result in the inventory scrolling right. I assume track balls would behave the same, but I don't have one to test. This situation is unavoidable as far as I can tell, since it's not feasible to distinguish between a Left/Right scroll via trackpad from an Up/Down+Shift scroll.

License

MIT

hscroll's People

Contributors

andyvanee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hscroll's Issues

Forge Port?

Would there by chance be any plans on porting this mod to Forge instead of being exclusive to Fabric? I personally play modded minecraft all the time and for me, Forge is the superior mod loader for me as it has all the mods I want to play on that over Fabric. I'm not sure the exactly how much more difficult it would be to port over to Forge, but it would be really nice to be able to have a version available for both mod loaders (especially considering some mods I have played with require you to be able to shift scroll to use them to it's fullest potential).

Forge Fix on MC Bug Form

Hello, you mentioned me on the bug report for MC-121772, and I just added new code that they could very easily implement. I mean, it is not like the xoffset is used for anything at all in regards to scrollCallbacks, so, why not implement it.

I was looking at your code, and tried to make a script to pull the callbacks, but could not figure it out in forge.. Plus, in both versions, the actual definition of the scrollCallback is Private, which means I can not override it, not matter how hard I try to. So, if minecraft won't hot fix it, I am hoping forge will take my PR once I get it up to them. Fingers crossed.

Thanks for the inspiration. :)

Great mod!!!

Help!

I was able to get through the install process, however, I'm completely lost on the set up. Is it possible to simplify the instructions or make them more detailed? When I launch I get this in the log:

MultiMC version: 0.6.7-develop-1321

Minecraft folder is:
/Applications/MultiMC.app/Contents/MacOS/instances/Scroll Mod/.minecraft

Java path is:
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java

Java is version 1.8.0_221, using 64-bit architecture.

Main Class:
net.fabricmc.loader.launch.knot.KnotClient

Native path:
/Applications/MultiMC.app/Contents/MacOS/instances/Scroll Mod/natives

Traits:
traits FirstThreadOnMacOS

Libraries:
/Applications/MultiMC.app/Contents/MacOS/libraries/org/lwjgl/lwjgl/3.2.2/lwjgl-3.2.2.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/lwjgl/lwjgl-jemalloc/3.2.2/lwjgl-jemalloc-3.2.2.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/lwjgl/lwjgl-openal/3.2.2/lwjgl-openal-3.2.2.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/lwjgl/lwjgl-opengl/3.2.2/lwjgl-opengl-3.2.2.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/lwjgl/lwjgl-glfw/3.2.2/lwjgl-glfw-3.2.2.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/lwjgl/lwjgl-stb/3.2.2/lwjgl-stb-3.2.2.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/com/mojang/patchy/1.1/patchy-1.1.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/oshi-project/oshi-core/1.1/oshi-core-1.1.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/net/java/dev/jna/jna/4.4.0/jna-4.4.0.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/com/ibm/icu/icu4j-core-mojang/51.2/icu4j-core-mojang-51.2.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/com/mojang/javabridge/1.0.22/javabridge-1.0.22.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/net/sf/jopt-simple/jopt-simple/5.0.3/jopt-simple-5.0.3.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/io/netty/netty-all/4.1.25.Final/netty-all-4.1.25.Final.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/com/google/guava/guava/21.0/guava-21.0.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/commons-io/commons-io/2.5/commons-io-2.5.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/commons-codec/commons-codec/1.10/commons-codec-1.10.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/com/mojang/brigadier/1.0.17/brigadier-1.0.17.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/com/mojang/datafixerupper/2.0.24/datafixerupper-2.0.24.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/com/mojang/authlib/1.5.25/authlib-1.5.25.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/it/unimi/dsi/fastutil/8.2.1/fastutil-8.2.1.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/apache/logging/log4j/log4j-api/2.8.1/log4j-api-2.8.1.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/apache/logging/log4j/log4j-core/2.8.1/log4j-core-2.8.1.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/com/mojang/text2speech/1.11.3/text2speech-1.11.3.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/ca/weblite/java-objc-bridge/1.0.0/java-objc-bridge-1.0.0.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/net/fabricmc/intermediary/1.14.4/intermediary-1.14.4.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/net/fabricmc/tiny-mappings-parser/0.1.1.8/tiny-mappings-parser-0.1.1.8.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/net/fabricmc/sponge-mixin/0.7.11.38/sponge-mixin-0.7.11.38.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/net/fabricmc/tiny-remapper/0.1.0.40/tiny-remapper-0.1.0.40.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/net/fabricmc/fabric-loader-sat4j/2.3.5.4/fabric-loader-sat4j-2.3.5.4.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/com/google/jimfs/jimfs/1.1/jimfs-1.1.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/ow2/asm/asm/7.1/asm-7.1.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/ow2/asm/asm-analysis/7.1/asm-analysis-7.1.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/ow2/asm/asm-commons/7.1/asm-commons-7.1.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/ow2/asm/asm-tree/7.1/asm-tree-7.1.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/ow2/asm/asm-util/7.1/asm-util-7.1.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/net/fabricmc/fabric-loader/0.6.1+build.165/fabric-loader-0.6.1+build.165.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/com/mojang/minecraft/1.14.4/minecraft-1.14.4-client.jar

Native libraries:
/Applications/MultiMC.app/Contents/MacOS/libraries/org/lwjgl/lwjgl/3.2.2/lwjgl-3.2.2-natives-macos.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/lwjgl/lwjgl-jemalloc/3.2.2/lwjgl-jemalloc-3.2.2-natives-macos.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/lwjgl/lwjgl-openal/3.2.2/lwjgl-openal-3.2.2-natives-macos.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/lwjgl/lwjgl-opengl/3.2.2/lwjgl-opengl-3.2.2-natives-macos.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/lwjgl/lwjgl-glfw/3.2.2/lwjgl-glfw-3.2.2-natives-macos.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/org/lwjgl/lwjgl-stb/3.2.2/lwjgl-stb-3.2.2-natives-macos.jar
/Applications/MultiMC.app/Contents/MacOS/libraries/ca/weblite/java-objc-bridge/1.0.0/java-objc-bridge-1.0.0-natives-osx.jar

Mods:
[โœ”๏ธ] fabric-example-mod-1.0.0

Params:
--username --version MultiMC5 --gameDir /Applications/MultiMC.app/Contents/MacOS/instances/Scroll Mod/.minecraft --assetsDir /Applications/MultiMC.app/Contents/MacOS/assets --assetIndex 1.14 --uuid --accessToken --userType --versionType release

Window size: 3185 x 1779

Java Arguments:
[-Xdock:icon=icon.png, -Xdock:name="MultiMC: Scroll Mod", -XstartOnFirstThread, -Xms1024m, -Xmx8192m, -Duser.language=en]

Minecraft process ID: 11729

Using onesix launcher.

[13:21:04] [main/INFO]: Loading for game Minecraft 1.14.4
Failed to start Minecraft:
Exiting with -1
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:196)
at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:231)
at org.multimc.EntryPoint.listen(EntryPoint.java:143)
at org.multimc.EntryPoint.main(EntryPoint.java:34)
Caused by: java.lang.RuntimeException: Mod resolution failed!
at net.fabricmc.loader.discovery.ModResolver.resolve(ModResolver.java:599)
at net.fabricmc.loader.FabricLoader.load(FabricLoader.java:157)
at net.fabricmc.loader.launch.knot.Knot.init(Knot.java:122)
at net.fabricmc.loader.launch.knot.KnotClient.main(KnotClient.java:26)
... 8 more
Caused by: java.util.zip.ZipError: zip END header not found
at com.sun.nio.zipfs.ZipFileSystem.zerror(ZipFileSystem.java:1612)
at com.sun.nio.zipfs.ZipFileSystem.findEND(ZipFileSystem.java:1021)
at com.sun.nio.zipfs.ZipFileSystem.initCEN(ZipFileSystem.java:1030)
at com.sun.nio.zipfs.ZipFileSystem.(ZipFileSystem.java:130)
at com.sun.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:117)
at java.nio.file.FileSystems.newFileSystem(FileSystems.java:326)
at java.nio.file.FileSystems.newFileSystem(FileSystems.java:276)
at net.fabricmc.loader.util.FileSystemUtil.getJarFileSystem(FileSystemUtil.java:79)
at net.fabricmc.loader.util.FileSystemUtil.getJarFileSystem(FileSystemUtil.java:67)
at net.fabricmc.loader.discovery.ModResolver$UrlProcessAction.compute(ModResolver.java:453)
at java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:189)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Process exited with code 255.

I Really Don't Know

Hello, you mentioned me on the bug report for MC-121772, and I just added new code that they could very easily implement. I mean, it is not like the xoffset is used for anything at all in regards to scrollCallbacks, so, why not implement it.

I was looking at your code, and tried to make a script to pull the callbacks, but could not figure it out in forge.. Plus, in both versions, the actual definition of the scrollCallback is Private, which means I can not override it, not matter how hard I try to. So, if minecraft won't hot fix it, I am hoping forge will take my PR once I get it up to them. Fingers crossed.

Great mod!!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.