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

bedrock Packet play_sound coordinates are wrong #646

Open
Bluebotlabz opened this issue Oct 20, 2022 · 3 comments
Open

bedrock Packet play_sound coordinates are wrong #646

Bluebotlabz opened this issue Oct 20, 2022 · 3 comments
Labels
bedrock Bedrock edition

Comments

@Bluebotlabz
Copy link

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

@extremeheat extremeheat transferred this issue from PrismarineJS/bedrock-protocol Oct 21, 2022
@extremeheat extremeheat changed the title Packet play_sound coordinates are wrong bedrock Packet play_sound coordinates are wrong Oct 21, 2022
@extremeheat
Copy link
Member

Moved your issues to minecraft-data

@extremeheat extremeheat added the bedrock Bedrock edition label Apr 8, 2023
@Cdm2883
Copy link

Cdm2883 commented May 5, 2024

It's not a problem with minecraft-data, it's a problem with the official packets. The exact reason for the creation of this feature is beyond my knowledge.

This is evidenced by the definition of pmmp.
https://github.com/pmmp/BedrockProtocol/blob/8d63f39bb2cded3d3e578fd3cf7bc769b9674857/src/PlaySoundPacket.php

@extremeheat
Copy link
Member

Hmm, not sure why they are shifting 3 bits, but yes looks like something to be handled by the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bedrock Bedrock edition
Projects
None yet
Development

No branches or pull requests

3 participants