Snowiiii / Pumpkin

Empowering everyone to host fast and efficient Minecraft servers.
https://snowiiii.github.io/Pumpkin/
MIT License
3.31k stars 118 forks source link

Implemented the Bossbar #306

Open leobeg opened 1 week ago

leobeg commented 1 week ago

Description

This PR adds the Bossbar. It implements the following:

It does this by sending the CBossEvent packet. This PR does not try to add the bossbar spawning when starting a fight with the enderdragon/wither

Testing

Start the server an join. Add a bossbar with /bossbar add namespace:id Title Add the bossbar to the player. /bossbar set namespace:id players @a You should now see the bossbar :D. You can now test every other feature of the bossbar.

Checklist

Things need to be done before this Pull Request can be merged.

ToDo

leobeg commented 1 week ago

@Snowiiii What is the correct way of storing such information like UUIDs of the bossbars and which players can see them?

Snowiiii commented 6 days ago

@Snowiiii What is the correct way of storing such information like UUIDs of the bossbars and which players can see them?

Maybe using a HashMap ?. Something like HashMap<UUID, Bossbar>

leobeg commented 6 days ago

Maybe using a HashMap ?. Something like HashMap<UUID, Bossbar>

Well I figured it out how the vanilla server stores it. It's in the level.dat. Afaik it's not read rn. Maybe that implementation of the level.dat is worth it's own PR. My plan rn is to just store to bossbars in memory and not performing read/write to this file. And as soon we have the data from the level file we can easily extend it.

Snowiiii commented 6 days ago

Maybe using a HashMap ?. Something like HashMap<UUID, Bossbar>

Well I figured it out how the vanilla server stores it. It's in the level.dat. Afaik it's not read rn. Maybe that implementation of the level.dat is worth it's own PR. My plan rn is to just store to bossbars in memory and not performing read/write to this file. And as soon we have the data from the level file we can easily extend it.

Ah you mean how to permanently storing it. Don't worry we currently don't use level.dat and you don't have to for now. I plan to support that later

leobeg commented 4 days ago

@Snowiiii It should be ready for review. Not gonna lie I really underestimated how big the bossbar feature is. As I'm quite new to rust I'm happy to recieve feedback. The only difference rn to the vanilla bossbar is that the title is a plain string and not a TextComponent as the cmd protocol has not implemented JSON Raw Text yet.