mojira.dev
MC-184066

Respawn anchors don't produce an ambient sound

The bug

Respawn anchors do not produce ambient sound, although a sound file for it exists (sound id minecraft:block.respawn_anchor.ambient)

To reproduce

  1. Place a respawn anchor.

  2. Charge it with glowstone.

  3. Wait.

Expected result

The respawn anchor would produce its ambient sound.

Observed result

The respawn anchor does not produce its ambient sound.

Code analysis

Code analysis by @unknown can be found in this comment.

Linked issues

Comments

galaxy_2alex

"Ambient Sound"?

violine1101

Yes, respawn anchors have an ambient sound but it doesn't play.

ampolive

Can confirm in 21w44a.

TkainMinecraft

I was just analyzing the code used to play the ambience sound for the respawn anchors, and I think I've found the issue. Using official Mojang mappings on 1.17.1, within the animateTick method of the RespawnAnchorBlock class, the playSound method is used to play the anchor's ambient sounds. The playSound method works on the server's end by getting the server to tell its clients to play the sound appropriately - when run by itself on a client, the sound isn't played. Meanwhile, the animateTick function is only run on client's end because it deals with cosmetic updates such as particle effects and animations. Since playSound, a server-side-only method, is being used within animateTick, a client-side-only method, the sound fails to play. The Nether Portal block's code (NetherPortalBlock) plays its ambience correctly; it uses playLocalSound instead, which is meant to run on the client-side.

 

TL;DR: The code for playing the respawn anchor's ambient sounds uses a server-side method within a method that only runs on clients, which causes it to not work.

ampolive

Can confirm in 1.18 Pre-release 1.

Avoma

Can confirm in 1.18.

Avoma

Can confirm in 1.18.2 and 22w13a.

Avoma

Can confirm in 1.19.2.

Brevort

Can confirm in 23w14a.

Johnathon Acosta

Cannot reproduce in 1.21.72.

Ihasdisconnected

Fantastime

Confirmed

Gameplay

Normal

Sound

20w20b, 1.16.5, 1.17.1, 21w44a, 1.18 Pre-release 1, ..., 1.19 Pre-release 5, 1.19, 1.19.2, 1.19.4, 23w14a

23w51a

Retrieved