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

Add Pick item (Middle Mouse Click) #418

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Bafran
Copy link

@Bafran Bafran commented Dec 26, 2024

Description

Issue #397

Adding Pick Item (Middle Mouse Click). In survival, searches inventory and brings the item to the appropriate hotbar slot if available. In creative, sets the hotbar slot or grabs the item as appropriate.

Todo is adding pick item from entity. A placeholder was left however I don't believe /spawn and spawn eggs are implemented so I didn't have a way of testing on mobs and left that work as a todo.

Testing

  • Verified middle mouse click picks item in survival mode
  • Verified middle mouse click picks item in creative mode
  • Verified that middle mouse click in creative gives player item if item is not already in inventory
  • Verified that middle mouse click in creative gives deletes an item from inventory if inventory is full

Checklist

Things need to be done before this Pull Request can be merged.

  • Code is well-formatted and adheres to project style guidelines: cargo fmt
  • Code does not produce any clippy warnings: cargo clippy
  • All unit tests pass: cargo test
  • I added new unit tests, so other people don't accidentally break my code by changing other parts of the codebase. How?

Documentation

I literally could not get the actual docs to load so these are links to internet archive

Pick Item
Set Creative Mode Slot

@Bafran
Copy link
Author

Bafran commented Dec 26, 2024

Current progress - general structure is in place but crashes upon middle mouse click because the item stack comes back as none

@Snowiiii
Copy link
Member

Hey, Thanks for your interest in Contributing @Bafran :D. Looks good so far. @Bryntet likes to review Inventory stuff, But sometimes he needs a while

@Bafran Bafran marked this pull request as ready for review December 28, 2024 22:56
@Bafran Bafran changed the title Pick item Add Pick item (Middle Mouse Click) Dec 28, 2024
@Snowiiii
Copy link
Member

After testing i noticed that when you pick a block you already have in your hotbar you get another one, This is not vanilla behaviour. You should check if the player already has the block in this hotbar and when yes just switch to it

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