Solved How do I stop the mouse position reset when opening inventories?

Discussion in 'Spigot Plugin Development' started by TheCrystalStar, Sep 15, 2018.

Thread Status:
Not open for further replies.
  1. For Example

    I have this inventory open the red circle being my cursor

    If I have that inventory reopened for that user, the cursor would be reset to :

    So to the bottom middle of the inventory.

    Possible solutions I've tried w/o success:
    1. Simply reopening the inventory (p.openInventory()) while they have it opened already
    2. Closing then opening, definitely won't work
    You may ask, why not just update the contents of the inventory, well having hundreds of items in a list that is being divided into more list of around 45 to be then organized on the gui for the pagination system, is simply causing too much of a hassle to make it worth the effort.

    Any thoughts / ideas?
  2. I think the only way to do that is to update the inventory contents, as far as I know there's no way for the server to set the mouse position and/or keep the mouse position.
    • Agree Agree x 1
  3. 2008Choco

    Junior Mod

    Edit the client or write a client mod. That's unfortunately just how the client handles the mouse position. It centers the mouse indefinitely to the middle of your display.
  4. I think you have a design flaw if you cannot come up with a way to do this object-orientated rather than some hacky way of moving the cursor. Attack the problem head-on rather than easy shortcuts.
  5. Welp, looks like i'm going to have to update the contents instead, I'll see how it goes and post an update whenever I finish it.
    Thanks for all the help!
  6. Hey Guys just wanted to update you on what I was told to do.

    I ended up figuring out how to clear and readd the new items with updated data to the inventory.

    I redid the way I manage the inventories, allowing me to just change that inventory, at least change it when a player has it open.
Thread Status:
Not open for further replies.

Share This Page