Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ON_PLAY_SOUND event doesn't capture most sounds #197

Open
Gakuto1112 opened this issue Mar 5, 2024 · 0 comments
Open

ON_PLAY_SOUND event doesn't capture most sounds #197

Gakuto1112 opened this issue Mar 5, 2024 · 0 comments

Comments

@Gakuto1112
Copy link

Gakuto1112 commented Mar 5, 2024

Description

ON_PLAY_SOUND event doesn't capture most sounds played in Minecraft. It captures only sounds played by avatars or UIs. The following video describes this issue.

The video that describes this issue
(This link has expiration date. If you can't watch the video, please watch in the conversation thread.)

In this video, I used the following script for the test.

events.ON_PLAY_SOUND:register(function (id, pos, vol, pitch, isLoop, category, path)
    print(id)
end)

keybinds:newKeybind("test_sound", "key.keyboard.z"):onPress(function ()
    sounds:playSound("minecraft:entity.player.levelup", player:getPos())
    print("Played a sound")
end)

This script outputs the sound id that ON_PLAY_SOUND captures and plays a sound when pressing a key. In above video, the script outputs only sounds played by itself and UIs.

In this conversation, @KitCat962 said that this may be a 1.20.4 bug.

How to reproduce

  1. Run above script.
  2. Emit sounds by doing something such as eating something, placing a block, shooting an arrow.
  3. You will see that the script doesn't output anything.

Expected behavior

According to this conversation, ON_PLAY_SOUND event captures most sounds including eating, placing, shooting sounds.

Enviroments

Item Version
Minecraft 1.20.4
Fabric Loader 0.15.7
Fabric API 0.96.4+1.20.4
Figura 0.1.4+1.20.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant