Get hovered item in Inventory

Place to get help with not working mods / modding interface.
Post Reply
NotQuiteNull
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri Nov 10, 2023 11:42 pm
Contact:

Get hovered item in Inventory

Post by NotQuiteNull »

Hi all ^^

I am looking for a way to get the inventory and the item the mouse is hovering inside it.
My goal is to write a mod which allows to transfer items by scrolling the mouse wheel while
hovering over them. Those of you who played Minecraft modpacks will recognize this
behaviour from Inventory Tewaks or Mouse Tweaks.

Why do I want this?
I have found myself trying to take a locomotive from my mall chest this way on multiple
occasions. Obviously not limited to locomotives, but it is one of those items where one
usually needs only one or two. The muscle memory simply sticks, and I feel the slight
disappointment every time this doesn't work in Factorio xD

From my digging in the api documentation I couldn't find any straight forward way
of achieving this, any help is appreciated :)

PFQNiet
Filter Inserter
Filter Inserter
Posts: 289
Joined: Sat Sep 05, 2020 7:48 pm
Contact:

Re: Get hovered item in Inventory

Post by PFQNiet »

The closest thing I can think of is to have the custom input provide the hovered prototype, and try to infer what to do from that. This would, however, not allow you to select a specific item stack, the best you could do with it is "take one item matching the prototype that was hovered", but it might be good enough.

An interface request for "the item stack a custom input was triggered on" might be useful.

Post Reply

Return to “Modding help”