Skip to content

fix: encode CameraFovInstruction ease type as string - #8

Open
Nyrok wants to merge 1 commit into
PowerNukkitX:mainfrom
Nyrok:fix/camera-fov-easetype-string
Open

fix: encode CameraFovInstruction ease type as string#8
Nyrok wants to merge 1 commit into
PowerNukkitX:mainfrom
Nyrok:fix/camera-fov-easetype-string

Conversation

@Nyrok

@Nyrok Nyrok commented Aug 14, 2026

Copy link
Copy Markdown

Bug

CameraInstructionSerializer_v827 writes the FOV instruction's ease type as a byte enum ordinal. Bedrock clients read it as a length-prefixed string, so any CameraInstructionPacket carrying a CameraFovInstruction desyncs the client's packet reader and disconnects it (disconnect.closed, no server-side error). Every codec from v827 up to v2168 inherits this write, which currently makes FOV instructions unusable on PNX.

The same string encoding is already used for spline easing in CameraInstructionSerializer_v924, and PMMP's BedrockProtocol matches it for FOV: https://github.com/pmmp/BedrockProtocol/blob/master/src/types/camera/CameraFovInstruction.php

I fixed this once on the 2.x server in PowerNukkitX/PowerNukkitX#2528, when the encoding still lived in cn.nukkit.network.protocol.CameraInstructionPacket. The 3.x migration moved serialization into this library, which never got the equivalent change.

Fix

Two lines in CameraInstructionSerializer_v827: write with helper.writeString(buf, easeType.getSerializeName()), read with EasingType.fromName(helper.readString(buf)). All later codecs inherit it.

Tested in game on 1.26.42 (protocol 2168): before, every FOV instruction kicked the client; with the string encoding, FOV and easing work normally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant