feat: live daylight cycle — track server time with Live/Day/Night toggle#794
Closed
Apezdr wants to merge 2 commits intoBlueMap-Minecraft:masterfrom
Closed
feat: live daylight cycle — track server time with Live/Day/Night toggle#794Apezdr wants to merge 2 commits intoBlueMap-Minecraft:masterfrom
Apezdr wants to merge 2 commits intoBlueMap-Minecraft:masterfrom
Conversation
Adds a Live lighting mode that polls the server world time every 5s and
smoothly transitions sunlightStrength to match the in-game time of day.
Live mode is the default; use ?lighting=day or ?lighting=night to override.
Java:
- ServerWorld.getTimeOfDay() interface method (default 6000/noon)
- Fabric/Forge/NeoForge: getOverworldClockTime() % 24000
- Bukkit/Paper: World.getTime()
- LiveWorldDataSupplier: emits {"timeOfDay": N} for 0-23999 range
- MapRequestHandler: registers live/world.json endpoint (5s cache)
Webapp:
- DayNightSwitch replaced with Live | Day | Night 3-button control
- Live mode polls live/world.json and animates sunlightStrength via
cosine curve (noon tick 6000 = 1.0, midnight tick 18000 = 0.25)
- ?lighting=day|night|live URL param overrides the default (live)
- Falls back silently when endpoint is unavailable (static deploys)
Closes BlueMap-Minecraft#398
MapViewer resets sunlightStrength to skyLight (1.0) when a map finishes loading, overwriting the initial live-time snap. Watch mapState='loaded' and re-apply the live server time the moment that reset occurs.
Author
|
May be helpful to have it also apply the default "live" view for embeds as well....and done |
Member
|
PR's that are low-effort and mainly developed by AI are not desired. Additionally the webapp is currently undergoing a major rewrite, big changes to the old webapp are currently avoided. Implementing this feature is planned for after the webapp-rewrite. I am closing this PR for the above reasons, for future PR's please follow the contributing guidelines and make sure your PR's are well designed, feature-complete and well-tested. Thank you :) |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #398
Summary
Adds a Live lighting mode that tracks the server's in-game world time and smoothly transitions the map's sunlight to match — so the map darkens at night and brightens at noon in real time.
Live is the default mode. Users can also lock to Day or Night manually, or use a URL param to override the default for embeds.
Changes
Java
ServerWorld.getTimeOfDay()— new interface method returning in-game time of day (0–23999); defaults to 6000 (noon) so platforms that don't implement it stay at full daygetOverworldClockTime() % 24000World.getTime()LiveWorldDataSupplier— new supplier emitting{"timeOfDay": N}MapRequestHandler— registerslive/world.jsonwith a 5s cacheWebapp
DayNightSwitchreplaced with a Live | Day | Night 3-button controllive/world.jsonevery 5s and animatessunlightStrengthvia a cosine curve: noon (tick 6000) → 1.0, midnight (tick 18000) → 0.25?lighting=day|night|liveURL param overrides the default (live) — useful for embedsLighting curve