start datatypes
This commit is contained in:
parent
e5e3e34042
commit
f88be868fd
4 changed files with 44 additions and 10 deletions
12
README.md
12
README.md
|
|
@ -1,4 +1,4 @@
|
|||
pocket-minecraft-protocol
|
||||
pocket-minecraft-protocol
|
||||
=========================
|
||||
|
||||
[](http://npmjs.com/package/pocket-minecraft-protocol)
|
||||
|
|
@ -7,21 +7,21 @@ pocket-minecraft-protocol
|
|||
Parse and serialize Minecraft PE packets.
|
||||
|
||||
## Features
|
||||
|
||||
|
||||
* Supports Minecraft PE `0.14.0`
|
||||
* Pure javascript
|
||||
* Pure JavaScript
|
||||
* Easily send and listen for any packet
|
||||
* RakNet support through node-raknet
|
||||
* RakNet support through [node-raknet](https://github.com/mhsjlw/node-raknet)
|
||||
|
||||
## Installation
|
||||
Simply run
|
||||
|
||||
npm install pocket-minecraft-protcol
|
||||
|
||||
|
||||
Then view our `examples` for inspiration!
|
||||
|
||||
## Contributors
|
||||
This project is run by these guys:
|
||||
|
||||
- [mhsjlw](https://github.com/mhsjlw) ([mhsjlw@aol.com](mailto:mhsjlw@aol.com))
|
||||
- [rom1504](https://github.com/rom1504)
|
||||
- [rom1504](https://github.com/rom1504)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
{
|
||||
"types": {
|
||||
"string": [
|
||||
"pstring"
|
||||
{
|
||||
"countType":"short"
|
||||
}
|
||||
],
|
||||
"packet": [
|
||||
"container",
|
||||
[
|
||||
|
|
@ -223,7 +229,7 @@
|
|||
},
|
||||
{
|
||||
"name": "payload",
|
||||
"type": "byte_array"
|
||||
"type":["buffer",{"countType":"i16"}]
|
||||
}
|
||||
]
|
||||
],
|
||||
|
|
@ -1135,7 +1141,7 @@
|
|||
},
|
||||
{
|
||||
"name": "chunk_data",
|
||||
"type": "byte_array"
|
||||
"type":["buffer",{"countType":"i16"}]
|
||||
}
|
||||
]
|
||||
],
|
||||
|
|
@ -1210,4 +1216,4 @@
|
|||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
index.js
2
index.js
|
|
@ -1 +1 @@
|
|||
module.exports = require('./dist/index.js');
|
||||
module.exports = require('./index.js');
|
||||
|
|
|
|||
28
src/datatypes.js
Normal file
28
src/datatypes.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
function readUUID(buffer, offset) {
|
||||
if(offset+16>buffer.length)
|
||||
throw new PartialReadError();
|
||||
return {
|
||||
value: UUID.stringify(buffer.slice(offset,16+offset)),
|
||||
size: 16
|
||||
};
|
||||
}
|
||||
|
||||
function writeUUID(value, buffer, offset) {
|
||||
const buf=UUID.parse(value);
|
||||
buf.copy(buffer,offset);
|
||||
return offset + 16;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
'uuid': [readUUID, writeUUID, 16], // done
|
||||
'vector3': [readVector3, writeVector3, sizeOfVector3]
|
||||
|
||||
'metadatadictionary': [readLTriad, writeLTriad, 3],
|
||||
'skin': [readIpAddress, writeIpAddress, 4],
|
||||
'entitylocations': [readRestBuffer, writeRestBuffer, sizeOfRestBuffer],
|
||||
'blockrecords':[readEndOfArray,writeEndOfArray,sizeOfEndOfArray],
|
||||
'records':[readToByte,writeToByte,sizeOfToByte],
|
||||
'playerattributes': [],
|
||||
'item': [],
|
||||
'blockcoordinates': []
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue