PaperMC / PaperMC/Paper

Jukebox TileState interface is poorly defined and/or broken

Open
#9,029 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: accepted type: bug version: 1.19
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Expected behavior

Jukebox TileState methods are poorly defined or have broken behavior after 1.19.4 update. It is not clear what setPlaying, setRecord, isPlaying, stopPlaying should do to the block entity. It is more complicated because paper adds non-snapshot TileStates.

Observed/Actual behavior

setPlaying(Material) and setRecord do not change the IsPlaying nbt or start the tick counter or update neighbors either for snapshots or live views.

isPlaying incorrectly only checks if the BlockState has HAS_RECORD set to true. Which is not accurate as Jukebox can have a record but not be playing.

stopPlaying only plays the stop music event for clients to stop playing the music. It does not change the IsPlaying nbt value or the various tick counters. This breaks hoppers being able to extract once it's stopped. But the javadocs say "without ejecting the record". So what does that mean? Is being collected by a hopper ejected?

Steps/models to reproduce

Just use any of the methods mentioned with a block state snapshot or live view or look at the CraftJukebox implementation.

Plugin and Datapack List

N/A

Paper version

1.19.4

Other

The one issue not mentioned here upstream has already fixed (but not in the right way IMO).

This is very complicated because these methods both affect the snapshot, and the real experience of the clients before update() is called. Should startPlaying immediately start playing the disc or should it wait for update(). stopPlaying immediately stops the music regardless. It's just a big mess of confusing behavior.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CraftJukebox implementation and inspect setPlaying, setRecord, isPlaying, and stopPlaying for both block-state snapshots and live views. First establish the intended semantics for IsPlaying, tick counters, neighbor updates, hopper extraction, and client music before deciding how update() should affect playback. Done means the methods have consistent, documented behavior across both views.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.