Mouse Tweaks Unofficial

Mouse Tweaks Unofficial

847k Downloads

Scrolling on multiplayer will randomly pick up the stack

Ricket opened this issue ยท 8 comments

commented

mousetweaks-1.12.2-3.1.4

Must be connected to a multiplayer server -- a separate computer; I could not repro it in the same computer even in separate client/server mode but I repro it every time over LAN to another computer in my house.

If you scroll your wheel fairly rapidly, like if you wanted to gather 10+ items, you'll find that about 2-4 of them will transfer and then suddenly you'll be holding the stack of the rest of the items.

Specifically one example scenario:

  1. Start with 30 cobblestone in a chest and none in your inventory.
  2. Hover over the cobblestone. Scroll rapidly down.
  3. Some cobblestone will transfer to the inventory, usually < 10, and you'll be holding the rest of the stack.
commented

I was thinking about this some more and obviously there are a few other mods that implement scrolling to move items, I'm curious how they differ.

Item Scroller has a slightly different procedure that's kind of a cool hack: they left-click the slotFrom to pick up the items, but then instead of right-clicking the slotTo, they just right-click the slotFrom once (to put back one item) and then shift-click it to send it to the destination inventory without needing to know which destination slot. And then they put the items back down with a left click.

We could try that procedure and see if it avoids this bug? It could also result in cleaner code since all the logic of figuring out slotTo would go away.

https://github.com/maruohon/itemscroller/blob/liteloader_1.12.2/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java#L1962

commented

If the push is changed to implement that way then we should be careful to test what happens when scrolling while already holding a stack of items

commented

I just installed Clumsy and added lag to the loopback (localhost) connection. Ran server & client from the MouseTweaks codebase and tested the scrolling, and it never picked up the stack. So I'm starting to think this bug could actually be an interaction between mods in E2E:E.

commented

Ok well I started up a singleplayer instance of E2E:E and couldn't get it to reproduce. And then, I opened to LAN and again opened Clumsy, and I confirmed I was able to add a lag because I set it to 1 second and felt it in opening chests and punching blocks. But still in this situation, scrolling was perfectly fine, could not reproduce the issue where the stack picks up. This is really unexpected but maybe opening to LAN isn't sufficient, maybe it needs to run in separate server-client.

commented

Need to test on its own to see if it's just MouseTweaks. As E2E:E has several different inventory improvement mods that may have introduced race conditions.

commented

Ok I have new information! This only seems to happen for Framed Chests from BiblioCraft. It just so happens that we're in early game of E2E:E where framed chests are the majority of our storage because of a quest reward (and they're cheaper to make than regular chests). But now that I have some regular chests and also Cabinet from Rustic, I finally just noticed tonight that this bug doesn't happen with those.

Framed chests have an interesting behavior that they show the majority item on the front of them (and it's a bit complicated how it figures out the majority item or whether it switches to a different majority item). So I'm guessing that behavior is probably somehow what's causing this bug.

commented

Framed Chests from Bibliocraft? Bibliocraft goes against a lot of the normal conventions when it comes to containers and GUIs.

commented

This also happens for the Cooking for Blockheads Fridge.