mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
better naming
This commit is contained in:
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user