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 /give Command #234

Merged
merged 12 commits into from
Nov 7, 2024
Prev Previous commit
Next Next commit
remove dbg! statements
user622628252416 committed Nov 6, 2024
commit c6e6bf8b5379a50d4272d3113b6dc77ad9453cbb
2 changes: 0 additions & 2 deletions pumpkin-inventory/src/player.rs
Original file line number Diff line number Diff line change
@@ -138,8 +138,6 @@ impl PlayerInventory {

/// Attempt to add items to inventory. If not all items could be successfully added because the inventory is full, only a part of the stack is added and an Err containing the number of items that couln't be added is returned.
pub fn add_items(&mut self, item_id: u16, count: u32) -> Result<(), u32> {
dbg!(item_id, count);

let max_stack_size: u8 = 64; // todo: get actual stack size of item

let mut remaining_items: u32 = count;
14 changes: 6 additions & 8 deletions pumpkin/src/command/commands/cmd_give.rs
Original file line number Diff line number Diff line change
@@ -60,16 +60,14 @@ impl CommandExecutor for GiveExecutor {
}
};

dbg!(item_count);

for target in targets {
target.give_items(item.item_id, item_count).await;
target
.inventory
.lock()
.await
.set_slot(36, Some(ItemStack::new(1, item.item_id)), true)
.unwrap();
//target
// .inventory
// .lock()
// .await
// .set_slot(36, Some(ItemStack::new(1, item.item_id)), true)
// .unwrap();
}

sender