mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-28 05:35:56 -04:00
Merge pull request #207 from rom1504/use-minecraft-data
use protocol.json from minecraft-data
This commit is contained in:
commit
ebf9d431a5
@ -36,7 +36,6 @@
|
||||
"mocha": "~1.8.2",
|
||||
"rimraf": "~2.1.1",
|
||||
"batch": "~0.3.1",
|
||||
"jsonschema": "~1.0.1",
|
||||
"zfill": "0.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
@ -46,7 +45,8 @@
|
||||
"prismarine-nbt": "0.0.1",
|
||||
"readable-stream": "^1.1.0",
|
||||
"superagent": "~0.10.0",
|
||||
"ursa-purejs": "0.0.3"
|
||||
"ursa-purejs": "0.0.3",
|
||||
"minecraft-data": "0.4.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"ursa": "~0.8.0"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,135 +0,0 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "protocol",
|
||||
"definitions": {
|
||||
"directions": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"toClient": {"$ref": "#/definitions/packets"},
|
||||
"toServer": {"$ref": "#/definitions/packets"}
|
||||
},
|
||||
"required": [
|
||||
"toClient",
|
||||
"toServer"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"packets": {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
"^[a-z_]+$": {"$ref": "#/definitions/packet"}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"packet": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {"$ref": "#/definitions/id"},
|
||||
"fields": {"$ref": "#/definitions/fields"}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"fields"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^0x[0-9a-f]{2}$"
|
||||
},
|
||||
"fields": {
|
||||
"type": "array",
|
||||
"items": {"$ref": "#/definitions/field"},
|
||||
"additionalItems": false
|
||||
},
|
||||
"field": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"$ref": "#/definitions/fieldName"},
|
||||
"type": {"$ref": "#/definitions/fieldType"},
|
||||
"typeArgs": {"$ref": "#/definitions/fieldTypeArgs"}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"type"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"fieldName": {
|
||||
"type": "string",
|
||||
"pattern": "^[a-zA-Z0-9_]+$"
|
||||
},
|
||||
"fieldType": {
|
||||
"type": "string",
|
||||
"pattern": "^[a-zA-Z]+$"
|
||||
},
|
||||
"fieldTypeArgs": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {"$ref": "#/definitions/fieldType"},
|
||||
"countFor": {"$ref": "#/definitions/fieldTypeArgsCountFor"},
|
||||
"count": {"$ref": "#/definitions/fieldTypeArgsCount"},
|
||||
"fields": {"$ref": "#/definitions/fields"},
|
||||
"typeArgs": {"$ref": "#/definitions/fieldTypeArgs"},
|
||||
"field": {"$ref": "#/definitions/fieldName"},
|
||||
"values": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": [
|
||||
"integer",
|
||||
"boolean",
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"additionalItems": false,
|
||||
"minItems": 1
|
||||
},
|
||||
"different": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"this": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"fieldTypeArgsCountFor": {
|
||||
"type": "string",
|
||||
"pattern": "^(this\\.)?[a-zA-Z0-9_]+$"
|
||||
},
|
||||
"fieldTypeArgsCount": {
|
||||
"oneOf": [
|
||||
{"$ref": "#/definitions/fieldTypeArgsCountFor"},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"field": {"$ref": "#/definitions/fieldName"},
|
||||
"map": {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
"^[0-9]+$": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"default": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"field",
|
||||
"map",
|
||||
"default"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
"^[a-z]+$": {"$ref": "#/definitions/directions"}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
var packets = require("../protocol/protocol");
|
||||
var packets = require('minecraft-data').protocol;
|
||||
var readPackets = require("./packets").readPackets;
|
||||
var packetIndexes = readPackets(packets, states);
|
||||
var utils = require("./utils");
|
||||
|
@ -8,7 +8,7 @@ var EventEmitter = require('events').EventEmitter
|
||||
, states = serializer.states
|
||||
;
|
||||
|
||||
var packets = require("../protocol/protocol");
|
||||
var packets = require('minecraft-data').protocol;
|
||||
var readPackets = require("./packets").readPackets;
|
||||
var packetIndexes = readPackets(packets, states);
|
||||
|
||||
|
@ -4,7 +4,7 @@ var Yggdrasil = require('./yggdrasil.js');
|
||||
var serializer = require("./transforms/serializer");
|
||||
var utils = require("./utils");
|
||||
var version = require("./version");
|
||||
var packets = require("../protocol/protocol");
|
||||
var packets = require('minecraft-data').protocol;
|
||||
var readPackets = require("./packets").readPackets;
|
||||
var packetIndexes = readPackets(packets, serializer.states);
|
||||
var createClient = require("./createClient");
|
||||
|
@ -47,7 +47,7 @@ proto.addTypes(conditional);
|
||||
module.exports.types = proto.types;
|
||||
|
||||
var evalCondition = require("../utils").evalCondition;
|
||||
var packets = require("../../protocol/protocol");
|
||||
var packets = require('minecraft-data').protocol;
|
||||
var readPackets = require("../packets").readPackets;
|
||||
var packetIndexes = readPackets(packets, states);
|
||||
|
||||
|
@ -1,16 +0,0 @@
|
||||
var assert = require('assert');
|
||||
|
||||
var Validator = require('jsonschema').Validator;
|
||||
var v = new Validator();
|
||||
|
||||
Error.stackTraceLimit = 0;
|
||||
|
||||
describe("protocol schema", function() {
|
||||
this.timeout(60 * 1000);
|
||||
it("protocol.json is valid", function() {
|
||||
var instance = require('../protocol/protocol.json');
|
||||
var schema = require('../protocol/protocol_schema.json');
|
||||
var result = v.validate(instance, schema);
|
||||
assert.strictEqual(result.errors.length, 0, require('util').inspect(result.errors, {'depth': 4}));
|
||||
});
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user