mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-30 06:30:39 -04:00
Merge branch 'master' into feature-addErrorHandler
This commit is contained in:
commit
beeea8978d
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,3 @@
|
||||
node_modules
|
||||
test/npm-debug.log
|
||||
test/server
|
||||
dist/
|
||||
|
10
HISTORY.md
10
HISTORY.md
@ -1,9 +1,17 @@
|
||||
# History
|
||||
|
||||
## 1.1.2 (UNRELEASED)
|
||||
## 1.1.4 (UNRELEASED)
|
||||
|
||||
* Added a errorHandler option to createServer.
|
||||
|
||||
## 1.1.3
|
||||
|
||||
* requires node 6
|
||||
|
||||
## 1.1.2
|
||||
|
||||
* use last protodef
|
||||
|
||||
## 1.1.1
|
||||
|
||||
* update to yggdrasil 0.2.0
|
||||
|
@ -1 +0,0 @@
|
||||
module.exports = require('./dist/browser.js');
|
@ -2,7 +2,7 @@ machine:
|
||||
environment:
|
||||
MC_SERVER_JAR_DIR: /home/ubuntu/node-minecraft-protocol/minecraft-server/
|
||||
node:
|
||||
version: 4
|
||||
version: 6
|
||||
java:
|
||||
version: openjdk7
|
||||
dependencies:
|
||||
|
31
gulpfile.js
31
gulpfile.js
@ -1,31 +0,0 @@
|
||||
var gulp = require('gulp');
|
||||
|
||||
var plumber = require('gulp-plumber');
|
||||
var babel = require('gulp-babel');
|
||||
var options = {
|
||||
presets: ['es2015']
|
||||
};
|
||||
|
||||
var sourcemaps = require('gulp-sourcemaps');
|
||||
|
||||
gulp.task('compile', function() {
|
||||
return gulp
|
||||
.src('src/**/*.js')
|
||||
.pipe(plumber({
|
||||
errorHandler: function(err) {
|
||||
console.error(err.stack);
|
||||
this.emit('end');
|
||||
}
|
||||
}))
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(babel(options))
|
||||
.pipe(plumber.stop())
|
||||
.pipe(sourcemaps.write('maps/'))
|
||||
.pipe(gulp.dest('dist/'));
|
||||
});
|
||||
|
||||
gulp.task('watch', function() {
|
||||
return gulp.watch('src/**/*.js', ['compile']);
|
||||
});
|
||||
|
||||
gulp.task('default', ['compile']);
|
20
package.json
20
package.json
@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "minecraft-protocol",
|
||||
"version": "1.1.1",
|
||||
"version": "1.1.3",
|
||||
"description": "Parse and serialize minecraft packets, plus authentication and encryption.",
|
||||
"main": "index.js",
|
||||
"main": "src/index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/PrismarineJS/node-minecraft-protocol.git"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "gulp && require-self",
|
||||
"prepublish": "require-self",
|
||||
"test": "mocha --recursive --reporter spec"
|
||||
},
|
||||
"keywords": [
|
||||
@ -24,22 +24,16 @@
|
||||
"author": "Andrew Kelley",
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
"node": ">=6"
|
||||
},
|
||||
"browser": "browser.js",
|
||||
"browser": "src/browser.js",
|
||||
"devDependencies": {
|
||||
"babel-preset-es2015": "^6.3.13",
|
||||
"espower-loader": "^1.0.0",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-babel": "^6.1.1",
|
||||
"gulp-plumber": "^1.0.1",
|
||||
"gulp-sourcemaps": "^2.0.0",
|
||||
"intelli-espower-loader": "^1.0.0",
|
||||
"minecraft-wrap": "^1.0.0",
|
||||
"mocha": "^3.0.2",
|
||||
"power-assert": "^1.0.0",
|
||||
"require-self": "^0.1.0",
|
||||
"source-map-support": "^0.4.0"
|
||||
"require-self": "^0.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"buffer-equal": "^1.0.0",
|
||||
@ -49,7 +43,7 @@
|
||||
"lodash.merge": "^4.3.0",
|
||||
"minecraft-data": "^2.11.0",
|
||||
"prismarine-nbt": "^1.0.0",
|
||||
"protodef": "^1.2.3",
|
||||
"protodef": "^1.3.0",
|
||||
"readable-stream": "^2.0.5",
|
||||
"ursa-purejs": "^0.0.3",
|
||||
"uuid-1345": "^0.99.6",
|
||||
|
@ -7,7 +7,7 @@ module.exports = function(client, options) {
|
||||
var proto = new ProtoDef();
|
||||
proto.addTypes(mcdata.protocol.types);
|
||||
proto.addTypes(minecraft);
|
||||
proto.addTypes({'registerarr': [readDumbArr, writeDumbArr, sizeOfDumbArr]});
|
||||
proto.addType('registerarr',[readDumbArr, writeDumbArr, sizeOfDumbArr]);
|
||||
|
||||
client.registerChannel = registerChannel;
|
||||
client.unregisterChannel = unregisterChannel;
|
||||
|
@ -18,12 +18,18 @@ function recursiveAddTypes(protocol,protocolData,path)
|
||||
recursiveAddTypes(protocol,get(protocolData,path.shift()),path);
|
||||
}
|
||||
|
||||
const protocols={};
|
||||
|
||||
function createProtocol(state,direction,version,customPackets)
|
||||
{
|
||||
const key=state+";"+direction+";"+version;
|
||||
if(protocols[key])
|
||||
return protocols[key];
|
||||
const proto = new ProtoDef();
|
||||
proto.addTypes(minecraft);
|
||||
const mcData=require("minecraft-data")(version);
|
||||
recursiveAddTypes(proto,merge(mcData.protocol,get(customPackets,[mcData.version.majorVersion])),[state,direction]);
|
||||
protocols[key]=proto;
|
||||
return proto;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user