minecraft-data icon indicating copy to clipboard operation
minecraft-data copied to clipboard

bedrock Packet play_sound coordinates are wrong

Open Bluebotlabz opened this issue 1 year ago • 3 comments

When I execute a command such as /playsound beacon.activate @a 1 2 3 1 1 the resulting play_sound packet send by the server has completely different coordinates, after taking a look at some packets, I believe I have found the difference between the two

/playsound command coordinates play_sound packet coordinates
1 2 3 12 16 28
1.5 2.5 3.5 12 20 28
0 0 0 4 0 4
1 1 1 12 8 12
0.5 0.5 0.5 4 4 4
0.5 0 0.5 4 0 4
0.25 0 0.25 2 0 2
0.125 0 0.125 1 0 1
0.1 0 0.1 0 0 0
0.124 0 0.124 0 0 0

this leads me to believe that normal coordinates are being converted as so:

  1. If coordinate is whole number +.5 (except for Y)
  2. Multiply coordinate by 8
  3. Round down

Why does this happen?

Also, for some entity data packet that I have, the difference appears to be different:

actual entity coordinates play_sound packet coordinates
{"x": -1.1718597412109375, "y": -23, "z": 9.035000801086426} {"x":-6,"y":-189,"z":71}
{ x: 23.53493309020996, y: -20, z: -15.242581367492676 } {"x":186,"y":-162,"z":-126}

Note: the level_sound_event packet does give the correct coordinates

Bluebotlabz avatar Oct 20 '22 08:10 Bluebotlabz