Skip to content

Conversation

@Chitasa
Copy link

@Chitasa Chitasa commented Jun 8, 2023

@extremeheat
Copy link
Member

Is the client_command payload the same on 1.8 and 1.9? It sounds "payload" should be corrected to "actionId" in the 1.8 JSON if so

@Chitasa Chitasa force-pushed the statistics-feature branch from 6fa1f2e to 729f0e3 Compare June 13, 2023 22:55
@extremeheat
Copy link
Member

Information on adding statistics data...

This is the protocol schema on 1.8

 "packet_statistics": [
          "container",
          [
            {
              "name": "entries",
              "type": [
                "array",
                {
                  "countType": "varint",
                  "type": [
                    "container",
                    [
                      {
                        "name": "name",
                        "type": "string"
                      },
                      {
                        "name": "value",
                        "type": "varint"
                      }
                    ]
                  ]
                }
              ]
            }
          ]

On 1.12

       "packet_statistics": [
          "container",
          [
            {
              "name": "entries",
              "type": [
                "array",
                {
                  "countType": "varint",
                  "type": [
                    "container",
                    [
                      {
                        "name": "name",
                        "type": "string"
                      },
                      {
                        "name": "value",
                        "type": "varint"
                      }
                    ]
                  ]
                }
              ]
            }
          ]
        ],

1.13

"packet_statistics": [
          "container",
          [
            {
              "name": "entries",
              "type": [
                "array",
                {
                  "countType": "varint",
                  "type": [
                    "container",
                    [
                      {
                        "name": "categoryId",
                        "type": "varint"
                      },
                      {
                        "name": "statisticId",
                        "type": "varint"
                      },
                      {
                        "name": "value",
                        "type": "varint"
                      }
                    ]
                  ]
                }
              ]
            }

1.16

"packet_statistics": [
          "container",
          [
            {
              "name": "entries",
              "type": [
                "array",
                {
                  "countType": "varint",
                  "type": [
                    "container",
                    [
                      {
                        "name": "categoryId",
                        "type": "varint"
                      },
                      {
                        "name": "statisticId",
                        "type": "varint"
                      },
                      {
                        "name": "value",
                        "type": "varint"
                      }
                    ]
                  ]
                }
              ]
            }

1.19.4

"packet_statistics": [
          "container",
          [
            {
              "name": "entries",
              "type": [
                "array",
                {
                  "countType": "varint",
                  "type": [
                    "container",
                    [
                      {
                        "name": "categoryId",
                        "type": "varint"
                      },
                      {
                        "name": "statisticId",
                        "type": "varint"
                      },
                      {
                        "name": "value",
                        "type": "varint"
                      }
                    ]
                  ]
                }
              ]

Per above: 1.13 went from string stat => value to (int category, int statId) => value;

From the discord, minecraft storage went from

{
   "stat.walkOneCm":311,
   "stat.playOneMinute":78,
   "stat.leaveGame":1,
   "stat.timeSinceDeath":78,
   "stat.useItem.minecraft.dirt":1,
   "stat.sprintOneCm":136,
   "stat.mineBlock.minecraft.dirt":1,
   "achievement.exploreAllBiomes":{
      "value":0,
      "progress":[
         "Plains"
      ]
   }

to

{
   "stats":{
      "minecraft:dropped":{
         "minecraft:oak_log":12
      },
      "minecraft:custom":{
         "minecraft:time_since_rest":2327,
         "minecraft:leave_game":2,
         "minecraft:play_time":2327,
         "minecraft:time_since_death":2327,
         "minecraft:walk_one_cm":102,
         "minecraft:total_world_time":2495,
         "minecraft:drop":12,
         "minecraft:jump":5
      },
      "minecraft:picked_up":{
         "minecraft:oak_log":12
      }
   },
   "DataVersion":3218
}

So, to account for both, the schema should look like this on old versions:

[
{id: 4, name: 'walk_one_cm', protocolName: 'stat.walkOneCm' } // 1.8
]

and on 1.13+,

[
{id: 4, name: 'walk_one_cm', protocolName: 'minecraft:walk_one_cm', category: 'minecraft:custom', protocolId: 2, categoryId: 3  }
] // protocolId and categoryId are the integers that correspond to protocolName, categoryName

The category field on new versions could be optional on older versions, or backported to old versions

@Chitasa
Copy link
Author

Chitasa commented Jun 14, 2023

[
{id: 4, name: 'walk_one_cm', protocolName: 'minecraft:walk_one_cm', category: 'minecraft:custom', protocolId: 2, categoryId: 3  }
] // protocolId and categoryId are the integers that correspond to protocolName, categoryName

I'll probably change protocolId -> actionId and protocolName -> actionName to make things more consistent with the packet.

I'll need to make name to be consistent across versions as well

@Chitasa
Copy link
Author

Chitasa commented Jun 16, 2023

I'll need to add datapaths for the new statistics

@rom1504
Copy link
Member

rom1504 commented Aug 5, 2023

@Chitasa do you intend to finish this?

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

Labels

None yet

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

3 participants