Custom music discs cut off in the same time when the vanilla disc would end. This bug shows up in snapshot 23w07a and affects any release/snapshot after it. I attached a video showing a copyright free song getting cut off in minute 1:11, the length of disc 11.
Code Analysis:
Code analysis by @unknown can be found in this comment.
Linked issues
is duplicated by 9
relates to 3
Attachments
Comments 40
Can confirm in 23w07a. This is being caused by a recent change to jukebox mechanics, which automatically cuts off the disc track when the jukebox's TickCount value reaches its RecordStartTick + the length of the track and the IsPlaying value is set to 0. I've attached a resource pack that replaces the music disc "5" (a 71-second track) with the game's end credits song "alpha" (well over 10 minutes), which cuts out mid-note at the 1:11 mark. This behavior does not extend to playing the sound event with /playsound.
Given that resource packs have been able to overwrite music discs for nearly 10 years now, it may be worth re-evaluating how that system works.
Can confirm. And this completely clones MCPE-162976. The reason for both is because the time of the record item is hardcoded without considering the resource pack.
Do note that the jukebox behavior is a sever side behavior, and a resource pack shouldn't be considered in changing the time value. The best way to resolve this is rolling back the change, or allow players to specify how long to play the music for.
Confirmed in 1.19.4 pre-release 2.
My first instinct, short of rolling back the changes entirely, would just be to keep the sound playing after {{IsPlaying }}ticks to 0, unless the disc is physically ejected. It would still automatically eject the disc into a hopper after the normal runtime, but that's not hard to work around with redstone if you still want custom music discs and jukebox automation.
Bless y'all for the fix, but if I'm to understand correctly from the changelog in 24w21a, this bug can only be fixed if you're using a datapack that accepts the extended lengths of the custom songs? Just tried in 1.21-pre1 and my custom song cut abruptly again. I'm sure that this is intended, but I'm still hoping for clarity on what to do so that the songs may be fully played without the use of mods.
@Chase Yes, data packs are required to change the length of jukebox tracks. Music discs have a tangible effect on gameplay (jukeboxes emit a redstone single for the duration of the song), so it would be impossible to change track lengths with just a resource pack because the game has to behave identically for every player on a server.
If your custom music disc audio files are a different length from the vanilla tracks, they need to be accompanied by a data pack that overrides the default values.
If anyone here is still interested: the mod I coded will be updated to 1.21, to fix this bug for vanilla discs without requiring a datapack (though I do recommend using the datapack way if you can!). Additionally, client-side support will be added, meaning you can join your favourite servers with a custom disc resource pack and listen to those custom discs without them being cut off, even if the server doesn't have this mod or any datapacks.
Please provide me the resource pack you use.