CloudburstMC / Protocol

A protocol library for Minecraft Bedrock Edition
https://git.io/ProtocolLib
Apache License 2.0
310 stars 96 forks source link

Unable to deserialize camera instruction #212

Closed onebeastchris closed 7 months ago

onebeastchris commented 7 months ago

Hey! Found this while trying to test out camera workings with 1.20.50 BDS.

Replication steps:

Details: Proxypass error log: https://paste.gg/p/anonymous/e89d6165c07b41a9b97a56986a59f1e8

Packet log (relevant parts):

  1. CameraPresetsPacket contents:
    [13:49:27:407] [CLIENT BOUND] - CameraPresetsPacket(presets=[CameraPreset(identifier=minecraft:first_person, parentPreset=, pos=null, yaw=null, pitch=null, listener=null, playEffect=OptionalBoolean.empty), CameraPreset(identifier=minecraft:free, parentPreset=, pos=(0.0, 0.0, 0.0), yaw=0.0, pitch=0.0, listener=null, playEffect=OptionalBoolean.empty), CameraPreset(identifier=minecraft:third_person, parentPreset=, pos=null, yaw=null, pitch=null, listener=null, playEffect=OptionalBoolean.empty), CameraPreset(identifier=minecraft:third_person_front, parentPreset=, pos=null, yaw=null, pitch=null, listener=null, playEffect=OptionalBoolean.empty), CameraPreset(identifier=example:example_free, parentPreset=minecraft:free, pos=null, yaw=10.0, pitch=40.0, listener=null, playEffect=OptionalBoolean.empty), CameraPreset(identifier=example:example_player_effects, parentPreset=minecraft:free, pos=null, yaw=null, pitch=null, listener=null, playEffect=OptionalBoolean[true]), CameraPreset(identifier=example:example_player_listener, parentPreset=minecraft:free, pos=null, yaw=null, pitch=null, listener=PLAYER, playEffect=OptionalBoolean.empty)])
  2. BDS console shows successful usage:
camera @a set minecraft:first_person
[2023-12-08 14:42:33:544 INFO] Sent a camera instruction to the following players: onebeastofchris
camera @a set minecraft:third_person
[2023-12-08 14:42:56:200 INFO] Sent a camera instruction to the following players: onebeastofchris

Protocol versions used:

bedrock-codec = { group = "org.cloudburstmc.protocol", name = "bedrock-codec", version = "3.0.0.Beta1-20231206.150507-114" }
bedrock-common = { group = "org.cloudburstmc.protocol", name = "common", version = "3.0.0.Beta1-20231206.150507-113" }
bedrock-connection = { group = "org.cloudburstmc.protocol", name = "bedrock-connection", version = "3.0.0.Beta1-20231206.150507-113" }

Interestingly, it seems like Gophertunnel just sends the index of the camera preset, not a NamedDefinition: https://github.com/Sandertv/gophertunnel/blob/2b48a19c84f515175e8447795e4613a520494b91/minecraft/protocol/camera.go#L66C2-L66C2

Please let me know if there's anything else i can provide, thanks!

onebeastchris commented 7 months ago

Just noticed that you need to set camera definitions manually, proxypass doesnt seem to do so yet. Oops!