MCCTeam / Minecraft-Console-Client

Lightweight console for Minecraft chat and automated scripts
https://mccteam.github.io
Other
1.63k stars 395 forks source link

[Idea] WebSocketBot API to query item and entity ID mapping #2805

Open DGCK81LNN opened 20 hours ago

DGCK81LNN commented 20 hours ago

Prerequisites

Console Client Version

20240906-276

Describe your problem

I'd like to control the client using WebSocketBot. Currently EntityType and ItemType are sent as numeric IDs, but the client of the socket, MCC.js for example, needs to know the names (AcaciaBoat as opposed to 0). The mappings between names and IDs are currently hardcoded into MCC.js but this is bad for compatibility across MCC versions.

Suggest a possible solution

WebSocketBot could provide an API to get the list of names for every ItemType and EntityType.

Alternatively, ItemType, EntityType, and possibly other enums, could be simply sent as strings containing the name of the value instead of the numeric value itself, which actually makes them way easier to work with. See https://stackoverflow.com/questions/2441290/javascriptserializer-json-serialization-of-enum-as-string.

Attach screenshot here (If applicable)

No response

Minecraft Version

N/A

Device

Desktop

Operating System

Windows

milutinke commented 13 hours ago

This is one of the things I have on my todo, when I catch some free time, I could add it to be sent as a string and received as a string.