-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
79 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use pumpkin_world::item::Item; | ||
|
||
pub struct PlayerInventory { | ||
// Main Inventory + Hotbar | ||
items: [Option<Item>; 36], | ||
armor: [Option<Item>; 4], | ||
offhand: Option<Item>, | ||
// current selected slot in hortbar | ||
selected: i16, | ||
} | ||
|
||
impl Default for PlayerInventory { | ||
fn default() -> Self { | ||
Self::new() | ||
} | ||
} | ||
|
||
impl PlayerInventory { | ||
pub fn new() -> Self { | ||
Self { | ||
items: [None; 36], | ||
armor: [None; 4], | ||
offhand: None, | ||
// TODO: What when player spawns in with an diffrent index ? | ||
selected: 0, | ||
} | ||
} | ||
|
||
pub fn set_slot(slot: u32, item: Item) {} | ||
|
||
pub fn set_selected(&mut self, slot: i16) { | ||
assert!((0..9).contains(&slot)); | ||
self.selected = slot; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
mod c_client_information; | ||
mod c_interact; | ||
mod s_chat_command; | ||
mod s_chat_message; | ||
mod s_client_information; | ||
mod s_confirm_teleport; | ||
mod s_interact; | ||
mod s_player_action; | ||
mod s_player_command; | ||
mod s_player_position; | ||
mod s_player_position_rotation; | ||
mod s_player_rotation; | ||
mod s_set_held_item; | ||
mod s_swing_arm; | ||
mod s_use_item_on; | ||
|
||
pub use c_client_information::*; | ||
pub use c_interact::*; | ||
pub use s_chat_command::*; | ||
pub use s_chat_message::*; | ||
pub use s_client_information::*; | ||
pub use s_confirm_teleport::*; | ||
pub use s_interact::*; | ||
pub use s_player_action::*; | ||
pub use s_player_command::*; | ||
pub use s_player_position::*; | ||
pub use s_player_position_rotation::*; | ||
pub use s_player_rotation::*; | ||
pub use s_set_held_item::*; | ||
pub use s_swing_arm::*; | ||
pub use s_use_item_on::*; |
File renamed without changes.
1 change: 0 additions & 1 deletion
1
...in-protocol/src/server/play/c_interact.rs → ...in-protocol/src/server/play/s_interact.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
use pumpkin_macros::packet; | ||
use serde::Deserialize; | ||
|
||
use crate::{ServerPacket, VarInt}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use pumpkin_macros::packet; | ||
use serde::Deserialize; | ||
|
||
#[derive(Deserialize)] | ||
#[packet(0x2F)] | ||
pub struct SSetHeldItem { | ||
pub slot: i16, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,6 @@ pub enum Raritiy { | |
Rare, | ||
Epic, | ||
} | ||
|
||
#[derive(Clone, Copy)] | ||
pub struct Item {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters