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

Support dropping items #450

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

Conversation

tomasalias
Copy link

Description

Implement item dropping functionality.

  • pumpkin/src/net/container.rs

    • Add DropType to the use statement.
    • Handle ClickType::DropType in the match_click_behaviour function.
    • Implement handle_drop_item function to handle item dropping logic.
  • pumpkin/src/net/packet/play.rs

    • Handle SPlayerAction::DropItem and SPlayerAction::DropItemStack actions.
    • Implement handle_click_container function to handle container clicks.
    • Implement handle_decrease_item function to handle item decrease.
    • Implement match_click_behaviour function to match click behavior.
    • Implement mouse_click, shift_mouse_click, number_button_pressed, creative_pick_item, double_click, and mouse_drag functions to handle various click behaviors.
    • Implement handle_drop_item function to handle item dropping logic.
    • Implement get_current_players_in_container function to get current players in the container.
    • Implement send_container_changes and send_whole_container_change functions to send container changes.
    • Implement get_open_container function to get the open container.
    • Implement pickup_items and give_items functions to handle item pickup and giving.
    • Implement drop_item and drop_item_stack functions to handle item dropping and dropping item stacks.

Tested: ❌
Ready to merge: ❌

Testing

Please follow our Coding Guidelines

Implement item dropping functionality.

* **`pumpkin/src/net/container.rs`**
  - Add `DropType` to the `use` statement.
  - Handle `ClickType::DropType` in the `match_click_behaviour` function.
  - Implement `handle_drop_item` function to handle item dropping logic.

* **`pumpkin/src/net/packet/play.rs`**
  - Handle `SPlayerAction::DropItem` and `SPlayerAction::DropItemStack` actions.
  - Implement `handle_click_container` function to handle container clicks.
  - Implement `handle_decrease_item` function to handle item decrease.
  - Implement `match_click_behaviour` function to match click behavior.
  - Implement `mouse_click`, `shift_mouse_click`, `number_button_pressed`, `creative_pick_item`, `double_click`, and `mouse_drag` functions to handle various click behaviors.
  - Implement `handle_drop_item` function to handle item dropping logic.
  - Implement `get_current_players_in_container` function to get current players in the container.
  - Implement `send_container_changes` and `send_whole_container_change` functions to send container changes.
  - Implement `get_open_container` function to get the open container.
  - Implement `pickup_items` and `give_items` functions to handle item pickup and giving.
  - Implement `drop_item` and `drop_item_stack` functions to handle item dropping and dropping item stacks.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/tomasalias/Pumpkin?shareId=XXXX-XXXX-XXXX-XXXX).
@Bryntet
Copy link
Contributor

Bryntet commented Jan 4, 2025

i have a PR that started doing this a while ago, feel free to take any inspiration needed (tbh might be best to continue from it, all that's left is collisions)

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