mojira.dev
MC-260308

Jukebox note particles don't render all the possible colors

The Bug:

Jukeboxes now produce a musical note particle when playing a disc, the same one the Noteblock uses. It cycles through a few colors, but it doesn't seem to utilize all of the available ones, seemingly sticking to only warmer colors of the spectrum.

This behavior can be seen here, where a Noteblock is shown with every possible color the particle can utilize, while the jukebox only seems to do warmer colors:

[media]

Code Analysis (Yarn Mappings) Thanks to haykam:

The following code calculates the jukebox particle color:

world.getRandom().nextInt(4) / 24f

For comparison, the following code calculates the note block particle color:

Math.pow(2, (note - 12) / 12d) / 24f

As a result, note blocks' particle color ranges from 0 to 0.04166666667 while jukeboxes' particle color ranges from 0 to 0.125. Also note that note blocks' particle colors have 24 steps while jukeboxes' particle colors have only 4 steps.

Steps to Reproduce:

  1. Play a Jukebox in the 23w06a+

  2. Watch the particles it produces

  3. Compare it to the Noteblock's particles, and notice how the jukebox only ever displays a few of the possible colors. Namely only "warm" colors.

Attachments

Comments 1

Code analysis (Yarn mappings)

The following code calculates the jukebox particle color:

world.getRandom().nextInt(4) / 24f

For comparison, the following code calculates the note block particle color:

Math.pow(2, (note - 12) / 12d) / 24f

As a result, note blocks' particle color ranges from 0 to 0.04166666667 while jukeboxes' particle color ranges from 0 to 0.125. Also note that note blocks' particle colors have 24 steps while jukeboxes' particle colors have only 4 steps.

Orbic

(Unassigned)

Confirmed

Particles

jukebox, note-block, particle

23w07a

Retrieved