The Bug:
The game crashes when a jukebox in a playlist has a negative playlist_position value.
Steps to Reproduce:
Place down a jukebox with a negative
playlist_positionvalue by using the command provided below./setblock ~ ~ ~2 minecraft:jukebox{playlist_position:-10}Place down a chest on top of the jukebox by using the command provided below.
/setblock ~ ~1 ~2 minecraft:chestObserve if the game crashes.
Observed Behavior:
The game crashes.
Expected Behavior:
The game would not crash.
JukeboxBlockEntity#findNextPlayListPositionis calculating the next slot with(startPosition + offset) % container.getContainerSize()When you pass
playlist_position: -10,container.getItem(-9)throws the exception shown in the crash report.loadAdditionalalso accepts the stored position without checking its range.Need to add a validation check here when the value is loaded.