-
-
Notifications
You must be signed in to change notification settings - Fork 26
[FEATURE] Adding boss bar system #27
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9927087
feat: add BossBarPacket
AxenoDev b3dbdee
feat: implement BossBarPacket and update packet registry
AxenoDev fd73781
refactor: remove default attributes from BossBar enums and clone titl…
AxenoDev 2013021
feat: Add all packet IDs to support all versions
AxenoDev 38770b1
feat: Add BossBar configuration and serialization support
AxenoDev ac6ca91
feat: Add Boss Bar documentation
AxenoDev b636531
feat: Update documentation links for Boss Bar configuration
AxenoDev ca792bb
feat: Implement BossBarPacket methods for action handling and simplif…
AxenoDev a2c5496
feat: Refactor BossBar division handling to use enum configuration
AxenoDev 3a1f3f2
feat: Update BossBarColorConfig to use explicit values and simplify c…
AxenoDev f8966de
feat: Simplify BossBarDivisionConfig usage in serialization and deser…
AxenoDev a9d6915
feat: Fix ci format
AxenoDev 78167e7
refactor: Simplified boss bar implementation
Quozul 0fc7ca7
refactor: Simplified uuid as two long implementation
Quozul f374a03
chore: Update docs
Quozul 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| use minecraft_protocol::prelude::*; | ||
| use pico_text_component::prelude::Component; | ||
|
|
||
| #[derive(PacketOut)] | ||
| pub struct BossBarPacket { | ||
| #[pvn(735..)] | ||
| pub v1_16_uuid: Uuid, | ||
| #[pvn(..735)] | ||
| pub uuid_most_sig: u64, | ||
| #[pvn(..735)] | ||
| pub uuid_least_sig: u64, | ||
| pub action: BossBarAction, | ||
| } | ||
|
|
||
| pub enum BossBarAction { | ||
| Add { | ||
| title: Component, | ||
| health: f32, | ||
| color: BossBarColor, | ||
| division: BossBarDivision, | ||
| flags: u8, | ||
| }, | ||
| Remove, | ||
| UpdateHealth { | ||
| health: f32, | ||
| }, | ||
| UpdateTitle { | ||
| title: Component, | ||
| }, | ||
| UpdateStyle { | ||
| color: BossBarColor, | ||
| division: BossBarDivision, | ||
| }, | ||
| UpdateFlags { | ||
| flags: u8, | ||
| }, | ||
| } | ||
|
|
||
| #[derive(Debug, Clone, Copy)] | ||
| #[repr(i32)] | ||
| pub enum BossBarColor { | ||
| Pink = 0, | ||
| Blue = 1, | ||
| Red = 2, | ||
| Green = 3, | ||
| Yellow = 4, | ||
| Purple = 5, | ||
| White = 6, | ||
| } | ||
|
|
||
| #[derive(Debug, Clone, Copy)] | ||
| #[repr(i32)] | ||
| pub enum BossBarDivision { | ||
| NoDivision = 0, | ||
| SixNotches = 1, | ||
| TenNotches = 2, | ||
| TwelveNotches = 3, | ||
| TwentyNotches = 4, | ||
| } | ||
|
|
||
| impl EncodePacket for BossBarAction { | ||
| fn encode( | ||
| &self, | ||
| writer: &mut BinaryWriter, | ||
| protocol_version: ProtocolVersion, | ||
| ) -> Result<(), BinaryWriterError> { | ||
| match self { | ||
| BossBarAction::Add { | ||
| title, | ||
| health, | ||
| color, | ||
| division, | ||
| flags, | ||
| } => { | ||
| VarInt::new(0).encode(writer, protocol_version)?; | ||
| title.clone().encode(writer, protocol_version)?; | ||
| health.encode(writer, protocol_version)?; | ||
| VarInt::new(*color as i32).encode(writer, protocol_version)?; | ||
| VarInt::new(*division as i32).encode(writer, protocol_version)?; | ||
| flags.encode(writer, protocol_version)?; | ||
| } | ||
| BossBarAction::Remove => { | ||
| VarInt::new(1).encode(writer, protocol_version)?; | ||
| } | ||
| BossBarAction::UpdateHealth { health } => { | ||
| VarInt::new(2).encode(writer, protocol_version)?; | ||
| health.encode(writer, protocol_version)?; | ||
| } | ||
| BossBarAction::UpdateTitle { title } => { | ||
| VarInt::new(3).encode(writer, protocol_version)?; | ||
| title.clone().encode(writer, protocol_version)?; | ||
| } | ||
| BossBarAction::UpdateStyle { color, division } => { | ||
| VarInt::new(4).encode(writer, protocol_version)?; | ||
| VarInt::new(*color as i32).encode(writer, protocol_version)?; | ||
| VarInt::new(*division as i32).encode(writer, protocol_version)?; | ||
| } | ||
| BossBarAction::UpdateFlags { flags } => { | ||
| VarInt::new(5).encode(writer, protocol_version)?; | ||
| flags.encode(writer, protocol_version)?; | ||
| } | ||
| } | ||
| Ok(()) | ||
| } | ||
| } | ||
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| # Boss Bar Settings | ||
|
|
||
| Representing the `[boss_bar]` section in `server.toml`. | ||
|
|
||
| ## Boss Bar Title | ||
|
|
||
| The title text displayed at the top of the player list. | ||
| The title supports [MiniMessage formatting](/customization/message-formatting.html) for colors and styling. | ||
|
|
||
| :::code-group | ||
| ```toml [server.toml] {2} | ||
| [boss_bar] | ||
| title = "<blue><bold>Welcome to PicoLimbo!</bold></blue>" | ||
| ``` | ||
| ::: | ||
|
|
||
| ## Boss Bar Health | ||
|
|
||
| The health of the boss bar, represented as a float between `0.0` (empty) and `1.0` (full). | ||
|
|
||
| :::code-group | ||
| ```toml [server.toml] {2} | ||
| [tab_list] | ||
| health = 1.0 | ||
| ``` | ||
| ::: | ||
|
|
||
| ## Boss Bar Color | ||
|
|
||
| The color of the boss bar. | ||
|
|
||
| :::code-group | ||
| ```toml [server.toml] {2} | ||
| [boss_bar] | ||
| color = "blue" | ||
| ``` | ||
| ::: | ||
|
|
||
| Possible values: | ||
| ``` | ||
| pink | ||
| blue | ||
| red | ||
| green | ||
| yellow | ||
| purple | ||
| white | ||
| ``` | ||
|
|
||
| ## Boss Bar Divisions | ||
|
|
||
| The number of divisions in the boss bar, affecting its visual segmentation. | ||
|
|
||
| :::code-group | ||
| ```toml [server.toml] {2} | ||
| [boss_bar] | ||
| division = 0 | ||
| ``` | ||
| ::: | ||
|
|
||
| Possible values: | ||
| ``` | ||
| 0 - No divisions | ||
| 6 - 6 segments | ||
| 10 - 10 segments | ||
| 12 - 12 segments | ||
| 20 - 20 segments | ||
| ``` |
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.