mojira.dev
MC-264383

Moon changes phase at sunrise, potentially visible to the player

The moon changes phase at the beginning of a new day. This change can be visible to players who are at an elevated location in the world at this time.

To reproduce:
1. Create a void world.
2. Look at the moon.
3. Set time to 23800.
4. Watch the moon -> it changes phase when it is just below the horizon.

The cause is found in DimensionType.moonPhase(long), where the calculation of the moon phase looks like this:

{{public int moonPhase(long t) {
return (int)(t / 24000L % 8L + 8L) % 8;
}}}

A small change to this calculation will shift the change of phase to the nadir (below the player):

{{public int moonPhase(long t) {
return (int)((t + 186000L) / 24000L % 8L + 8L) % 8;
}}}

The constant 186000L is equal to 8 × 24000 - 6000, where 6000 is the time at noon. As a result, all phase changes will take place at noon.

A side effect of this change would be for the moon to start the game at phase 7, not phase 0.

Related issues: MC-241706 Moon Phase Changes immediately after sleeping (closed as Invalid)

Linked issues

Comments 0

No comments.

bdm68

(Unassigned)

Confirmed

(Unassigned)

1.20.1

Retrieved