Jump to content

How to drag item in inventory


anderiel

Recommended Posts

I want to drag around items in inventory, to arrange them for easier clicking.

 

But i cant figure out how to actually drag them to change the place of one item.

 

Inventory does not have any calls for that (or at least i did not find any) and i also tried this:

execute(new ContinualClickMouseEvent(inventory.getMouseDestination(from),new Condition(){
            @Override
            public boolean evaluate() {
                return InventorySlotDestination.getSlot(to).contains(mouse.getPosition());
            }
        }));
        execute(new MoveMouseEvent(inventory.getMouseDestination(to),true));

but all that does is it clicks the item i want to drag and stays there until i force quit the script.

Link to comment
Share on other sites

This is what I use to swap items in inventory spaces.

	public boolean swapItems(int slot1, int slot2) throws InterruptedException {
		if (getInventory().isItemSelected()) {
			getInventory().deselectItem();
		}
		return getMouse().continualClick(getInventory().getMouseDestination(slot1), new Condition() {
			@Override
			public boolean evaluate() {
				getMouse().move(getInventory().getMouseDestination(slot2), true);
				return getInventory().getMouseDestination(slot2).getBoundingBox().contains(getMouse().getPosition());
			}
		});
	}

Kinda messy, but it works.

Edited by Incus Valley
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...