Predict the sort and tweak clicks on a server like an ordinary click
This commit is contained in:
@@ -4791,26 +4791,6 @@ impl Game<'_> {
|
||||
}));
|
||||
}
|
||||
}
|
||||
/// A `ContainerClick` on game slot `internal` of the server's open menu
|
||||
/// (`input` is the ContainerInput ordinal). False when the menu has no
|
||||
/// such slot.
|
||||
pub(super) fn remote_slot_click(&mut self, internal: usize, button: i8, input: i32) -> bool {
|
||||
let (container, menu) = self.remote_menu();
|
||||
let slot = Self::menu_slot_index(&menu, internal);
|
||||
let Some(slot) = slot else { return false };
|
||||
let carried = self.to_network(&self.carried).map(|s| Hashed::of(&s));
|
||||
let state = self.remote.as_ref().map_or(0, |r| r.state_id);
|
||||
self.send(S::ContainerClick(play::ContainerClick {
|
||||
container,
|
||||
state,
|
||||
slot: slot as i16,
|
||||
button,
|
||||
input,
|
||||
changed: Vec::new(),
|
||||
carried,
|
||||
}));
|
||||
true
|
||||
}
|
||||
/// The server's open menu is the inventory or a chest-like container
|
||||
/// (chests, barrels, ender chests: `generic_9xN`; shulker boxes).
|
||||
pub(super) fn remote_storage_open(&self) -> bool {
|
||||
|
||||
@@ -70,8 +70,7 @@ impl Game<'_> {
|
||||
/// One ordinary click on a game slot. False when nothing took it.
|
||||
pub(super) fn tweak_click(&mut self, slot: usize, button: i32, input: Input) -> bool {
|
||||
if self.remote.is_some() {
|
||||
let ordinal = super::remote::input_ordinal(input);
|
||||
return self.remote_slot_click(slot, button as i8, ordinal);
|
||||
return self.remote_menu_ops(&[(Some(slot), button, input)]);
|
||||
}
|
||||
if !self.menu_click(Some(slot), button, input) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user