Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issues with dropping items #28

Closed
wants to merge 2 commits into from
Closed

fix: issues with dropping items #28

wants to merge 2 commits into from

Conversation

Boy0000
Copy link
Contributor

@Boy0000 Boy0000 commented Jun 1, 2024

There really is no perfect way to handle it
InventoryClickEvent lets us handle most things when dropped from the Inventory screen
Items dropped from hand are not possiible really to get
the issue is that the PlayerDropItemEvent fires after the player has dropped the item
Thus the GearyInventory#find returns -1 when attempting to index for the itemstack
It is also flawed as if you drop a single item, the itemstack would not be found in the inventory anyway

The best one can do is handle it via the itemDrop entity as a geary-entity though i doubt thats the idea

@EventHandler(ignoreCancelled = true)
fun PlayerDropItemEvent.emitOnItemDrop() {
    itemDrop.toGearyOrNull()?.emit<OnItemDrop>()
}

@Boy0000 Boy0000 requested a review from 0ffz June 1, 2024 11:08
@0ffz
Copy link
Member

0ffz commented Jun 5, 2024

Closing as we decided to create a temporary item entity from the dropped item instead.

@0ffz 0ffz closed this Jun 5, 2024
@Boy0000 Boy0000 deleted the fix-drops branch July 25, 2024 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants