mojira.dev
MCPE-154378

min_distance / max_distance requires decimal numbers, silently fails with integers

The bug

If you specify a min_distance field in a sound definition without including a decimal point, the field is completely ignored with no error or warning. Other fields like pitch work just fine.

How to reproduce

1. Download and open the attached world

2. Use the two command blocks
Expected result: They should sound identical
Actual result: The one on the left is quieter because its max_distance field was ignored

Sound file

For reference, here is the sound_definitions.json file. integer completely ignores the max_distance because it's set to 50 instead of 50.0.

{
   "format_version": "1.14.0",
   "sound_definitions": {
      "integer": {
         "category": "neutral",
         "max_distance": 50,
         "sounds": [
            {
               "name": "sounds/unique1"
            }
         ]
      },
      "float": {
         "category": "neutral",
         "max_distance": 50.0,
         "sounds": [
            {
               "name": "sounds/unique2"
            }
         ]
      }
   }
}

Attachments

Comments 2

Still in effect as of 1.21.50. max_distance being an integer still silently fails.

According to the 1.20.20.20 changelog

Sound definitions now accept both float and integer values for min_distance and max_distance - please set sound_definitions.json "format_version" parameter equal to or greater than 1.20.20 to use this functionality (MCPE-154378)

Thank goodness this important behavior was preserved

tryashtar

(Unassigned)

866829

Confirmed

Windows

1.18.30

1.20.20.20 Preview, 1.20.30

Retrieved