aboutsummaryrefslogtreecommitdiff
path: root/azalea-inventory/src/operations.rs
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2024-04-23 10:34:50 -0500
committerGitHub <noreply@github.com>2024-04-23 10:34:50 -0500
commit1d80f531b74bc3b31023753acb81b35efcdadd73 (patch)
tree675635c7c41fbb456e3e0dd7b9f09c7211d356f0 /azalea-inventory/src/operations.rs
parent0ddad8bd9c7c0e8846aec8bc90c95416418c9a63 (diff)
downloadazalea-drasl-1d80f531b74bc3b31023753acb81b35efcdadd73.tar.xz
1.20.5 (#127)
* 23w51b * make recalculate_near_end_of_path public so other plugins can do .after(recalculate_near_end_of_path) * update to 24w03a i think * start implementing 24w13a * registries work (but a lot of packets are still broken) * fix recipes and commands packets * i love codecs :D i am not going insane :D mojang's java is very readable :D * item components are "implemented" meowmeowmeowmeowmeowmeowmeowmeowmeowmeowmeowmeowmeowmeowmeowmeowmeowmeow * update to 1.20.5-pre3 * fix all the broken packets and clippy (mojang please don't do an update like this again or i will murder someone) * 1.20.5-rc1 * fix failing tests * 1.20.5
Diffstat (limited to 'azalea-inventory/src/operations.rs')
-rw-r--r--azalea-inventory/src/operations.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/azalea-inventory/src/operations.rs b/azalea-inventory/src/operations.rs
index ca21a3e7..652d1900 100644
--- a/azalea-inventory/src/operations.rs
+++ b/azalea-inventory/src/operations.rs
@@ -621,7 +621,7 @@ impl Menu {
}
/// Get the maximum number of items that can be placed in this slot.
- pub fn max_stack_size(&self, _target_slot_index: usize) -> u8 {
+ pub fn max_stack_size(&self, _target_slot_index: usize) -> u32 {
64
}
@@ -671,9 +671,11 @@ impl Menu {
let target_slot = self.slot(target_slot_index).unwrap();
if let ItemSlot::Present(target_item) = target_slot {
// the target slot is empty, so we can just move the item there
- if self.may_place(target_slot_index, item) && target_item.is_same_item_and_nbt(item) {
+ if self.may_place(target_slot_index, item)
+ && target_item.is_same_item_and_components(item)
+ {
let slot_item_limit = self.max_stack_size(target_slot_index);
- let new_target_slot_data = item.split(u8::min(slot_item_limit, item.count as u8));
+ let new_target_slot_data = item.split(u32::min(slot_item_limit, item.count as u32));
// get the target slot again but mut this time so we can update it
let target_slot = self.slot_mut(target_slot_index).unwrap();
@@ -691,7 +693,7 @@ impl Menu {
let target_slot = self.slot(target_slot_index).unwrap();
if target_slot.is_empty() && self.may_place(target_slot_index, item) {
let slot_item_limit = self.max_stack_size(target_slot_index);
- let new_target_slot_data = item.split(u8::min(slot_item_limit, item.count as u8));
+ let new_target_slot_data = item.split(u32::min(slot_item_limit, item.count as u32));
let target_slot = self.slot_mut(target_slot_index).unwrap();
*target_slot = ItemSlot::Present(new_target_slot_data);