-
Notifications
You must be signed in to change notification settings - Fork 68
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
feat: enable bossbar by default & support for custom title texts #259
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
/deploy |
Deployed to Vercel Preview: https://prismarine-p2emo882d-zaro.vercel.app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cant get it working, @Phoenix616 please specify versions on which you test your fixes
}) | ||
bot.on('bossBarUpdated', (bossBar) => { | ||
setBossBars(prevBossBars => new Map(prevBossBars.set(bossBar.entityUUID, bossBar as BossBarType))) | ||
removeBossBar(bossBar as BossBarType) | ||
setTimeout(() => addBossBar(bossBar as BossBarType), 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need timeout? would not create it flickering, so weird
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will otherwise not update the displayed text/values/styles, most likely because the element already exists? It was the only solution I found but I don't know how react works so there might be a better way to force an update of the changed element.
Style changes make sense, yeah. I'm unsure what you mean by "lets enable them by default" though. I didn't adjust any code regarding the behavior or when and how it displays, it instantly shows them as soon as the mineflayer bot event is called which should be whenever a packet is received. |
no worries I can these changes myself, I just have hundreds of tasks that I try to do at the same and had to write these here so I don't forget @Phoenix616 most importantly I wanted to know your opinion on these changes and if you have any other feedback |
- Adjusts the font size and gabs - Fixes that it would overlap the mobile buttons - Fixes that touching where the boss bar is would not move the camera - Better match the behaviour of really wide bossbar titles
Did some adjustments to the bossbar styles to make them behave pretty close to Java (imo) and also fixed the mobile issues at the same time. |
Deployed to Vercel Preview: https://prismarine-3lkbca6zf-zaro.vercel.app |
@Phoenix616 again, i still do not understand the intention to for setTimeout, will ltry to figure out as well will try to fix the re-login issue |
ok dont have time, feel free to help, need a plugin in src/mineflayer/plugins/bossbars.ts so bossbars are preserved into mineflayer bot state |
Deployed to Vercel Preview: https://prismarine-9w6g5l9b1-zaro.vercel.app |
User description
This fixes that the bossbar would not be rendered properly when added via the
/bossbar
command/plugin API and wasn't using the component rendering system but manual mapping. Also updates to the boss bar would not get rendered before.PR Type
Bug fix, Enhancement
Description
Fixed boss bar titles not displaying correctly.
Updated boss bar title handling to support various formats.
Refactored boss bar management with dedicated add/remove functions.
Improved boss bar update logic for better rendering.
Changes walkthrough 📝
BossBarOverlay.tsx
Refactor boss bar title handling and styles
src/react/BossBarOverlay.tsx
BossBarOverlayProvider.tsx
Refactor boss bar management with utility functions
src/react/BossBarOverlayProvider.tsx
addBossBar
andremoveBossBar
utility functions.