-
-
Notifications
You must be signed in to change notification settings - Fork 68
feat: Player Data Storage #205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
KingTimer12
wants to merge
33
commits into
ferrumc-rs:master
Choose a base branch
from
KingTimer12:feature/player-state
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 26 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
e823b3e
feat: player data storage initialized
KingTimer12 cae8c54
fix: cargo fmt and cargo audit
KingTimer12 2eeab0e
fix: cargo clippy
KingTimer12 4f8db95
feat: added sqlite support
KingTimer12 ed2e353
fix: cargo clippy
KingTimer12 67a9bf5
fix: benches test of storage
KingTimer12 4fff8d3
chore: changed to sqlite
KingTimer12 d9b0bfa
fix: cargo audit error
KingTimer12 400d746
fix: cargo fmt
KingTimer12 b7bea43
fix: cargo clippy
KingTimer12 a2b92ff
fix: cargo clippy
KingTimer12 234fb78
Merge branch 'master' of github.com:KingTimer12/ferrumc into feature/…
KingTimer12 64491ab
feat: player data storage initialized
KingTimer12 8ac0648
fix: cargo fmt and cargo audit
KingTimer12 cbfa307
fix: cargo clippy
KingTimer12 7fc22ef
feat: added sqlite support
KingTimer12 6d3c4c5
fix: cargo clippy
KingTimer12 9f0d3aa
fix: benches test of storage
KingTimer12 e093a28
chore: changed to sqlite
KingTimer12 cc4d935
fix: cargo audit error
KingTimer12 c383f0c
fix: cargo fmt
KingTimer12 813e9a3
fix: cargo clippy
KingTimer12 b35c2f5
fix: cargo clippy
KingTimer12 1ad2bca
Merge branch 'feature/player-state' of github.com:KingTimer12/ferrumc…
KingTimer12 b0e6aa7
chore: now is updating player data
KingTimer12 c408791
fix: i forgot fmt :p
KingTimer12 1a5ca03
chore: updated the way playerdata is used
KingTimer12 c31ee14
chore: saving data through event
KingTimer12 01f24fb
Merge branch 'master' of github.com:KingTimer12/ferrumc into feature/…
KingTimer12 b70b7b2
fix: problem in my gitignore; fix: cargo.toml with old dep;
KingTimer12 dcd5148
chore: added player disconnect event in connection killer
KingTimer12 3d8d02c
chore: removed PlayerState
KingTimer12 d386bd8
chore: added Display to player data
KingTimer12 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
20 changes: 17 additions & 3 deletions
20
src/bin/src/systems/shutdown_systems/send_shutdown_packet.rs
This file contains hidden or 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 hidden or 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 hidden or 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 @@ | ||
| pub mod player; |
This file contains hidden or 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,51 @@ | ||
| use bevy_ecs::component::Component; | ||
| use bitcode::{Decode, Encode}; | ||
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| use crate::transform::position::Position; | ||
|
|
||
| // https://minecraft.fandom.com/wiki/Player.dat_format | ||
| #[derive( | ||
| Serialize, Deserialize, Clone, Debug, Encode, Decode, Component, typename::TypeName, PartialEq, | ||
| )] | ||
| pub struct PlayerData { | ||
| pub pos: Position, | ||
KingTimer12 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| pub on_ground: bool, | ||
| pub dimension: String, | ||
| pub yaw: f32, | ||
| pub pitch: f32, | ||
| } | ||
|
|
||
| impl Default for PlayerData { | ||
| fn default() -> Self { | ||
| Self::new(Position::default(), false, "overworld", 0.0, 0.0) | ||
| } | ||
| } | ||
|
|
||
| impl PlayerData { | ||
| pub fn new(pos: Position, on_ground: bool, dimension: &str, yaw: f32, pitch: f32) -> Self { | ||
| Self { | ||
| pos, | ||
| on_ground, | ||
| dimension: dimension.to_string(), | ||
| yaw, | ||
| pitch, | ||
| } | ||
| } | ||
|
|
||
| pub fn update_position(&mut self, new_position: Position) { | ||
KingTimer12 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| self.pos = new_position; | ||
| } | ||
|
|
||
| pub fn update_on_ground(&mut self, on_ground: bool) { | ||
| self.on_ground = on_ground; | ||
| } | ||
|
|
||
| pub fn update_yaw(&mut self, new_yaw: f32) { | ||
| self.yaw = new_yaw; | ||
| } | ||
|
|
||
| pub fn update_pitch(&mut self, new_pitch: f32) { | ||
| self.pitch = new_pitch; | ||
| } | ||
| } | ||
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.