mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-29 14:13:45 -04:00
Fix a bunch of bugs in the packet defs
This commit is contained in:
parent
31f6d8380e
commit
9349774592
@ -201,17 +201,17 @@ var packets = {
|
||||
{ name: "count", type: "short" }
|
||||
]},
|
||||
entity_velocity: {id: 0x12, fields: [
|
||||
{ name: "entityId", type: "int" },
|
||||
{ name: "entityId", type: "varint" },
|
||||
{ name: "velocityX", type: "short" },
|
||||
{ name: "velocityY", type: "short" },
|
||||
{ name: "velocityZ", type: "short" }
|
||||
]},
|
||||
entity_destroy: {id: 0x13, fields: [
|
||||
{ name: "count", type: "count", typeArgs: { type: "byte", countFor: "entityIds" } }, /* TODO: Might not be correct */
|
||||
{ name: "entityIds", type: "array", typeArgs: { type: "int", count: "count" } }
|
||||
{ name: "count", type: "count", typeArgs: { type: "varint", countFor: "entityIds" } },
|
||||
{ name: "entityIds", type: "array", typeArgs: { type: "varint", count: "count" } }
|
||||
]},
|
||||
entity: {id: 0x14, fields: [
|
||||
{ name: "entityId", type: "int" }
|
||||
{ name: "entityId", type: "varint" }
|
||||
]},
|
||||
rel_entity_move: {id: 0x15, fields: [
|
||||
{ name: "entityId", type: "varint" },
|
||||
@ -284,7 +284,7 @@ var packets = {
|
||||
type: "container", typeArgs: { fields: [
|
||||
{ name: "key", type: "string" },
|
||||
{ name: "value", type: "double" },
|
||||
{ name: "listLength", type: "count", typeArgs: { type: "short", countFor: "this.modifiers" } },
|
||||
{ name: "listLength", type: "count", typeArgs: { type: "varint", countFor: "this.modifiers" } },
|
||||
{ name: "modifiers", type: "array", typeArgs: { count: "this.listLength",
|
||||
type: "container", typeArgs: { fields: [
|
||||
{ name: "UUID", type: "UUID" },
|
||||
@ -307,8 +307,11 @@ var packets = {
|
||||
{ name: "chunkZ", type: "int" },
|
||||
{ name: "recordCount", type: "varint" },
|
||||
/* TODO: Is dataLength needed? */
|
||||
{ name: "dataLength", type: "count", typeArgs: { type: "int", countFor: "data" } },
|
||||
{ name: "data", type: "buffer", typeArgs: { count: "dataLength" } },
|
||||
{ name: "records", type: "array", typeArgs: { count: "recordsCount", type: "container", typeArgs: { fields: [
|
||||
{ name: "horizontalPos", type: "ubyte" },
|
||||
{ name: "y", type: "ubyte" },
|
||||
{ name: "blockId", type: "varint" }
|
||||
]}}}
|
||||
]},
|
||||
block_change: {id: 0x23, fields: [
|
||||
{ name: "location", type: "position" },
|
||||
@ -376,8 +379,8 @@ var packets = {
|
||||
{ name: "offsetY", type: "float" },
|
||||
{ name: "offsetZ", type: "float" },
|
||||
{ name: "particleData", type: "float" },
|
||||
{ name: "particles", type: "int" }
|
||||
/* TODO: Create an Array of VarInts */
|
||||
{ name: "particles", type: "count", typeArgs: { countFor: "data" } },
|
||||
{ name: "data", type: "array", typeArgs: { count: "particles", type: "varint" } }
|
||||
]},
|
||||
game_state_change: {id: 0x2b, fields: [
|
||||
{ name: "reason", type: "ubyte" },
|
||||
@ -458,8 +461,7 @@ var packets = {
|
||||
tile_entity_data:{id: 0x35, fields: [
|
||||
{ name: "location", type: "position" },
|
||||
{ name: "action", type: "ubyte" },
|
||||
{ name: "nbtDataLength", type: "count", typeArgs: { type: "short", countFor: "nbtData" } },
|
||||
{ name: "nbtData", type: "buffer", typeArgs: { count: "nbtDataLength" } },
|
||||
{ name: "nbtData", type: "restBuffer" }
|
||||
]},
|
||||
open_sign_entity: {id: 0x36, fields: [
|
||||
{ name: "location", type: "position" },
|
||||
@ -520,14 +522,18 @@ var packets = {
|
||||
scoreboard_objective: {id: 0x3b, fields: [
|
||||
{ name: "name", type: "string" },
|
||||
{ name: "action", type: "byte" },
|
||||
{ name: "displayText", type: "string" },
|
||||
{ name: "type", type: "string"}
|
||||
{ name: "displayText", type: "string", condition: function(field_values) {
|
||||
return field_values["action"] == 0 || field_values["action"] == 2;
|
||||
}},
|
||||
{ name: "type", type: "string", condition: function(field_values) {
|
||||
return field_values["action"] == 0 || field_values["action"] == 2;
|
||||
}}
|
||||
]},
|
||||
scoreboard_score: {id: 0x3c, fields: [ /* TODO: itemName and scoreName may need to be switched */
|
||||
{ name: "itemName", type: "string" },
|
||||
{ name: "action", type: "byte" },
|
||||
{ name: "scoreName", type: "string" },
|
||||
{ name: "value", type: "int", condition: function(field_values) {
|
||||
{ name: "value", type: "varint", condition: function(field_values) {
|
||||
return field_values['action'] != 1;
|
||||
} }
|
||||
]},
|
||||
@ -550,6 +556,12 @@ var packets = {
|
||||
{ name: "friendlyFire", type: "byte", condition: function(field_values) {
|
||||
return field_values['mode'] == 0 || field_values['mode'] == 2;
|
||||
} },
|
||||
{ name: "nameTagVisibility", type: "string", condition: function(field_values) {
|
||||
return field_values['mode'] == 0 || field_values['mode'] == 2;
|
||||
} },
|
||||
{ name: "color", type: "byte", condition: function(field_values) {
|
||||
return field_values['mode'] == 0 || field_values['mode'] == 2;
|
||||
} },
|
||||
{ name: "playerCount", type: "count", condition: function(field_values) {
|
||||
return field_values['mode'] == 0 || field_values['mode'] == 3 || field_values['mode'] == 4;
|
||||
}, typeArgs: { type: "short", countFor: "players" } },
|
||||
@ -572,14 +584,11 @@ var packets = {
|
||||
{ name: "duration", type: "varint", condition: function(field_values) {
|
||||
return field_values['event'] == 1;
|
||||
} },
|
||||
{ name: "entityId", type: "int", condition: function(field_values) {
|
||||
return field_values['event'] == 1;
|
||||
} },
|
||||
{ name: "playerId", type: "varint", condition: function(field_values) {
|
||||
return field_values['event'] == 2;
|
||||
} },
|
||||
{ name: "entityId", type: "int", condition: function(field_values) {
|
||||
return field_values['event'] == 2;
|
||||
return field_values['event'] == 1 || field_values['event'] == 2;
|
||||
} },
|
||||
{ name: "message", type: "string", condition: function(field_values) {
|
||||
return field_values['event'] == 2;
|
||||
@ -658,10 +667,16 @@ var packets = {
|
||||
]},
|
||||
use_entity: {id: 0x02, fields: [
|
||||
{ name: "target", type: "varint" },
|
||||
{ name: "mouse", type: "byte" },
|
||||
{ name: "x", type: "float"},
|
||||
{ name: "y", type: "float"},
|
||||
{ name: "size", type: "float"}
|
||||
{ name: "mouse", type: "varint" },
|
||||
{ name: "x", type: "float", condition: function(field_values) {
|
||||
return field_values["mouse"] == 2;
|
||||
}},
|
||||
{ name: "y", type: "float", condition: function(field_values) {
|
||||
return field_values["mouse"] == 2;
|
||||
}},
|
||||
{ name: "z", type: "float", condition: function(field_values) {
|
||||
return field_values["mouse"] == 2;
|
||||
}},
|
||||
]},
|
||||
flying: {id: 0x03, fields: [
|
||||
{ name: "onGround", type: "bool" }
|
||||
@ -701,10 +716,7 @@ var packets = {
|
||||
held_item_slot: {id: 0x09, fields: [
|
||||
{ name: "slotId", type: "short" }
|
||||
]},
|
||||
arm_animation: {id: 0x0a, fields: [
|
||||
{ name: "entityId", type: "int" }, /* TODO: wiki.vg says this is empty? */
|
||||
{ name: "animation", type: "byte" }
|
||||
]},
|
||||
arm_animation: {id: 0x0a, fields: []},
|
||||
entity_action: {id: 0x0b, fields: [
|
||||
{ name: "entityId", type: "varint" },
|
||||
{ name: "actionId", type: "varint" },
|
||||
|
Loading…
x
Reference in New Issue
Block a user