fix: use world clock for HUD time display on 26.1+ - #6666
Open
Promptt001 wants to merge 1 commit into
Open
Promptt001 wants to merge 1 commit into
Promptt001 wants to merge 1 commit into
Conversation
Minecraft 26.1 moved day/night time to World Clocks. The existing getWorldTime implementation formats Level#getGameTime, which is world age and is unaffected by /time changes. Use the dimension's default World Clock instead so the HUD follows the actual day/night cycle.
Collaborator
|
fyi your git config is set up wrong |
Author
did i leak something or are you talking about me leaving user.name and user.email unset? |
author "Local Build" committed 17 hours ago |
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.
Summary
Fixes #6667.
Since Minecraft 26.1, the day/night cycle and
/timeoperate on data-driven World Clocks, whileLevel#getGameTime()is the world/simulation age and is explicitly unaffected by/timechanges.Utils#getWorldTime()was formatting the world-age counter as time of day, so the HUD{time}value (e.g. Info HUD "Server time") behaved like an independent clock that never reacted to/time set.Changes
Utils#getWorldTime()now reads the dimension's default World Clock (Level#getDefaultClockTime()) — the same clock/timetargets when no explicit clock is given — instead ofLevel#getGameTime().Math.floorMod+ modulo wrap, which also fixes the oldif (ticks > 24000) ticks -= 24000;edge case at exactly 24000 ticks and is safe for negative clock values.Testing
/time set day|noon|night|midnightand matches the visible day/night cycle, clock items, and daylight detectors, where the pre-patch build did not.Design note
Level#getDefaultClockTime()is dimension-aware: a dimension whose default clock is not a standard 24,000-tick day (custom datapack clocks) may not render meaningfully as HH:MM. If "Overworld time everywhere" is the intended semantic,Level#getOverworldClockTime()is the alternative — happy to switch if maintainers prefer that.