PrismarineJS / PrismarineJS/minecraft-data

bedrock: Incorrect NPC packet serialization

Open
#644 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

These packets and information were taken from version 1.19.31
It is possible, yet unlikely, that this is specific to this version

There is a possible packet with request type of 6:

{"runtime_entity_id":"13","request_type":6,"command":"","action_type":"set_actions","scene_name":""}

It appears to be the opening equivalent of execute_closing_commands execute_opening_commands
As NPC are capable of executing commands when they are interacted with

Additionally,
NPC packets with request type of 1 (or "execute_action") are parsed incorrectly, according to the documentation action type is an enum, however, when request_type is 1 (or "execute_action") it is actually an integer referring to the button which was pressed, starting from 0, which corresponds to the leftmost button

note: despite being an int, the client limits the number of possible buttons you can add to 6 buttons, so action_type will never be higher than 5 if the request_type is 1

Similar behaviour is observed when request_type equals 4 (or set_skin) in which the action_type actuall corresponds to the NPC's set skin (again, counting from 0, left to right) the highest action_type for setting the NPC's skin is 34 in the current update, however, this may change in the future

Lastly, I believe that the notes for the Command field name are somewhat misleading as it isn't necessarily a command
ie: when setting dialogue, it is equal to what is being typed and in set_actions it is equal to a JSON object containing all the possible NPC actions (it effectively override the action related entity data)

NOTE: All of this data is from the Bedrock edition of the game, while the Education Edition may behave in the same way, I have no way of confirming this, however, it is likely that it does

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

Start with the packet_npc_request documentation and the Bedrock 1.19.31 packet examples in the issue. Check how request_type 1, 4, and 6 interpret action_type and how Command is described. Done means the NPC packet data and notes represent these observed Bedrock behaviors without assuming they apply to other versions.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.