mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2025-05-13 14:50:25 -04:00
add ushort writer
This commit is contained in:
parent
a95fe18a4d
commit
8a6d4bc725
1 changed files with 10 additions and 0 deletions
|
@ -450,6 +450,7 @@ var packets = {
|
|||
var writers = {
|
||||
'int': IntWriter,
|
||||
'short': ShortWriter,
|
||||
'ushort': UShortWriter,
|
||||
'byte': ByteWriter,
|
||||
'ubyte': UByteWriter,
|
||||
'string': StringWriter,
|
||||
|
@ -963,6 +964,15 @@ ShortWriter.prototype.write = function(buffer, offset) {
|
|||
buffer.writeInt16BE(this.value, offset);
|
||||
}
|
||||
|
||||
function UShortWriter(value) {
|
||||
this.value = value;
|
||||
this.size = 2;
|
||||
}
|
||||
|
||||
UShortWriter.prototype.write = function(buffer, offset) {
|
||||
buffer.writeUInt16BE(this.value, offset);
|
||||
}
|
||||
|
||||
function IntWriter(value) {
|
||||
this.value = value;
|
||||
this.size = 4;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue