I run a Java server that uses Nexo for custom blocks. Like other custom block plugins, it uses note block states with a resource pack, and Paper stops those states from updating on the server.
The problem is the client. When I break or place a block right above or below one of these blocks, my client predicts it and runs NoteBlock.updateShape, which recalculates the instrument. So the custom block switches to a different state and flashes the wrong texture (usually the plain note block) until the server confirms and it snaps back. It happens every single time, and the worse your ping, the longer it lasts. Only the person breaking or placing sees it, other players don't.
Suggestion: only recalculate the instrument on the server. Skip setInstrument in NoteBlock.updateShape when level.isClientSide() is true. The server sends the new instrument to everyone anyway.
Repeaters already do this with their LOCKED state (RepeaterBlock.updateShape checks !level.isClientSide()), so it's not a new pattern.
In vanilla nothing should change: every note block state has the same model, and the instrument is still decided on the server, so redstone and observers work the same. The player who placed or broke the block would just get the instrument update at the same time as everyone else.
1 Comments
Please sign in to leave a comment.
Post a new comment: