Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-264383

Moon changes phase at sunrise, potentially visible to the player

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • None
    • 1.20.1
    • None
    • Confirmed
    • (Unassigned)

      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)

            Unassigned Unassigned
            bdm68 bdm68
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: