better naming

This commit is contained in:
Edvin Bryntesson
2024-08-20 12:45:21 +02:00
parent c18cbdc06b
commit 65d9f39455

View File

@@ -318,15 +318,15 @@ impl Client {
}
pub fn handle_player_action(&mut self, _server: &mut Server, player_action: SPlayerAction) {}
pub fn handle_use_item_on(&mut self, server: &mut Server, use_item_on: SUseItemOn) {
pub fn handle_use_item_on(&mut self, server: &mut Server, use_item_on: SUseItemOn) {
let location = use_item_on.location;
let face = BlockFace::from_i32(use_item_on.face.0).unwrap();
let location = WorldPosition(location.0 + face.to_offset());
// TODO:
// - Add checking for if used item is a block
if let Some(item) = self.player.as_ref().unwrap().inventory.held_item() {
let id = global_registry::find_minecraft_id(global_registry::ITEM_REGISTRY,item.item_id).unwrap();
let block_state_id = pumpkin_world::block::block_registry::block_id_and_properties_to_block_state_id(id,None).expect("Id should exist");
let minecraft_id = global_registry::find_minecraft_id(global_registry::ITEM_REGISTRY,item.item_id).unwrap();
let block_state_id = pumpkin_world::block::block_registry::block_id_and_properties_to_block_state_id(minecraft_id,None).expect("Id should exist");
server.broadcast_packet(self, &CBlockUpdate::new(location, (block_state_id as i32).into()));
}
}