PrismarineJS / PrismarineJS/minecraft-data

bedrock Packet play_sound coordinates are wrong

Open
#646 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bedrock
Dominant language
JavaScript
Stars
938
Forks
294
Avg merge
2d 10h
Merged PRs (30d)
23

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the /playsound example and capture the resulting play_sound packet alongside the level_sound_event packet, which the report says has correct coordinates. Trace the packet-coordinate conversion and compare it with the command and entity-coordinate examples; done means the emitted play_sound coordinates match the intended positions, including fractional and negative values.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.