Burger icon indicating copy to clipboard operation
Burger copied to clipboard

Sound IDs are incorrect for 1.19.3

Open j-tai opened this issue 2 years ago • 3 comments

Burger produces incorrect sound IDs for Minecraft 1.19.3.

From my own observations & empirical testing*, it looks like Burger is making two errors:

  • ~~Sound IDs start from 1, not 0. The first sound, entity.allay.ambient_with_item, has ID 1, not 0.~~
  • The output is missing goat horn sounds, causing all sounds after it to have IDs offset. Goat horn sounds are added in its own method (net.minecraft.sound.SoundEvents#registerGoatHornSounds() in yarn mappings). Probably Burger's static code analysis does not account for this.

Here are the sound IDs for 1.19.3 (by decompiling Minecraft + some vim macros). I tested a handful of sounds and these seem to be accurate. sounds.txt

*I tested this by sending a Sound Effect packet with the appropriate ID and observing the sound that gets played

j-tai avatar Dec 25 '22 07:12 j-tai

It looks like data generators include minecraft:sound_event now, which should provide the correct IDs as well. They seem to match what you have, except that they do start at 0 instead of 1 (entity.zombie_villager.step is 1391 and entity.allay.ambient_with_item is 0). Maybe that offset comes from elsewhere? I'm not sure how much work I want to put into fixing this, though.

Pokechu22 avatar Dec 25 '22 23:12 Pokechu22

Thanks! I will look into data generators.

It looks like the packet uses the sound ID plus one; see net.minecraft.network.PacketByteBuf#writeRegistryEntry (yarn mappings). The +1 offset probably applies to more packets than just Sound Effect. Perhaps this should be documented on wiki.vg.

j-tai avatar Dec 26 '22 01:12 j-tai

Ah, right. Burger actually accounts for that in the packet decompilation (see PLAY_CLIENTBOUND_5E and the fairly jank code responsible for it). This should definitely be documented on wiki.vg. It looks like it's only used by Sound Effect and Entity Sound Effect though.

Pokechu22 avatar Dec 26 '22 01:12 Pokechu22