Migrate to bufferstuff module
This commit is contained in:
parent
5fd4f50b1a
commit
055627bb63
35 changed files with 35 additions and 97 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,3 +0,0 @@
|
||||||
[submodule "bufferStuff"]
|
|
||||||
path = bufferStuff
|
|
||||||
url = https://github.com/tgpholly/bufferStuff.git
|
|
|
@ -24,7 +24,8 @@
|
||||||
"homepage": "https://github.com/tgpholly/mc-beta-server#readme",
|
"homepage": "https://github.com/tgpholly/mc-beta-server#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chalk": "^4.1.2",
|
"chalk": "^4.1.2",
|
||||||
"net": "^1.0.2"
|
"net": "^1.0.2",
|
||||||
|
"bufferstuff": "^1.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^18.16.3",
|
"@types/node": "^18.16.3",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Console } from "../console";
|
import { Console } from "../console";
|
||||||
import { IReader } from "../bufferStuff/readers/IReader";
|
import { IReader } from "bufferstuff";
|
||||||
import { MinecraftServer } from "./MinecraftServer";
|
import { MinecraftServer } from "./MinecraftServer";
|
||||||
import { Packet } from "./enums/Packet";
|
import { Packet } from "./enums/Packet";
|
||||||
import { PacketAnimation } from "./packets/Animation";
|
import { PacketAnimation } from "./packets/Animation";
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { createWriter } from "../bufferStuff/index";
|
import { createWriter, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../bufferStuff/Endian";
|
|
||||||
import { FunkyArray } from "../funkyArray";
|
import { FunkyArray } from "../funkyArray";
|
||||||
import { MetadataFieldType } from "./enums/MetadataFieldType";
|
import { MetadataFieldType } from "./enums/MetadataFieldType";
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import { Config } from "../config";
|
import { Config } from "../config";
|
||||||
import { Console } from "../console";
|
import { Console } from "../console";
|
||||||
import { createReader } from "../bufferStuff/index";
|
import { createReader, IReader, Endian } from "bufferstuff";
|
||||||
import { FunkyArray } from "../funkyArray";
|
import { FunkyArray } from "../funkyArray";
|
||||||
import { IReader } from "../bufferStuff/readers/IReader";
|
|
||||||
import { Server, Socket, SocketAddress } from "net";
|
import { Server, Socket, SocketAddress } from "net";
|
||||||
import { MPClient } from "./MPClient";
|
import { MPClient } from "./MPClient";
|
||||||
import { Packet } from "./enums/Packet";
|
import { Packet } from "./enums/Packet";
|
||||||
|
@ -18,7 +17,6 @@ import { Player } from "./entities/Player";
|
||||||
import { SaveCompressionType } from "./enums/SaveCompressionType";
|
import { SaveCompressionType } from "./enums/SaveCompressionType";
|
||||||
import { WorldSaveManager } from "./WorldSaveManager";
|
import { WorldSaveManager } from "./WorldSaveManager";
|
||||||
import { World } from "./World";
|
import { World } from "./World";
|
||||||
import { Endian } from "../bufferStuff/Endian";
|
|
||||||
|
|
||||||
export class MinecraftServer {
|
export class MinecraftServer {
|
||||||
private static readonly PROTOCOL_VERSION = 14;
|
private static readonly PROTOCOL_VERSION = 14;
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import { readFileSync, readFile, writeFile, existsSync, mkdirSync, writeFileSync, readdirSync } from "fs";
|
import { readFileSync, readFile, writeFile, existsSync, mkdirSync, writeFileSync, readdirSync } from "fs";
|
||||||
import { createWriter, createReader } from "../bufferStuff/index";
|
import { createWriter, createReader, Endian } from "bufferstuff";
|
||||||
import { Config } from "../config";
|
import { Config } from "../config";
|
||||||
import { Chunk } from "./Chunk";
|
import { Chunk } from "./Chunk";
|
||||||
import { SaveCompressionType } from "./enums/SaveCompressionType";
|
import { SaveCompressionType } from "./enums/SaveCompressionType";
|
||||||
import { deflate, inflate } from "zlib";
|
import { deflate, inflate } from "zlib";
|
||||||
import { World } from "./World";
|
import { World } from "./World";
|
||||||
import { Endian } from "../bufferStuff/Endian";
|
|
||||||
|
|
||||||
export class WorldSaveManager {
|
export class WorldSaveManager {
|
||||||
private readonly worldFolderPath;
|
private readonly worldFolderPath;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketAnimation implements IPacket {
|
export class PacketAnimation implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketBlockChange implements IPacket {
|
export class PacketBlockChange implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketChat implements IPacket {
|
export class PacketChat implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketDisconnectKick implements IPacket {
|
export class PacketDisconnectKick implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketEntity implements IPacket {
|
export class PacketEntity implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketEntityAction implements IPacket {
|
export class PacketEntityAction implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketEntityEquipment implements IPacket {
|
export class PacketEntityEquipment implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketEntityLook implements IPacket {
|
export class PacketEntityLook implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketEntityLookRelativeMove implements IPacket {
|
export class PacketEntityLookRelativeMove implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
const EMPTY_BUFFER = Buffer.alloc(0);
|
const EMPTY_BUFFER = Buffer.alloc(0);
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketEntityRelativeMove implements IPacket {
|
export class PacketEntityRelativeMove implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketEntityTeleport implements IPacket {
|
export class PacketEntityTeleport implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createReader, createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketHandshake implements IPacket {
|
export class PacketHandshake implements IPacket {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
import { IReader } from "bufferstuff";
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export interface IPacket {
|
export interface IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketKeepAlive implements IPacket {
|
export class PacketKeepAlive implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketLoginRequest implements IPacket {
|
export class PacketLoginRequest implements IPacket {
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Chunk } from "../Chunk";
|
import { Chunk } from "../Chunk";
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
|
||||||
import { deflate } from "zlib";
|
import { deflate } from "zlib";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketMapChunk implements IPacket {
|
export class PacketMapChunk implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketNamedEntitySpawn implements IPacket {
|
export class PacketNamedEntitySpawn implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketPlayer implements IPacket {
|
export class PacketPlayer implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketPlayerDigging implements IPacket {
|
export class PacketPlayerDigging implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketPlayerLook implements IPacket {
|
export class PacketPlayerLook implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketPlayerPosition implements IPacket {
|
export class PacketPlayerPosition implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketPlayerPositionLook implements IPacket {
|
export class PacketPlayerPositionLook implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketPreChunk implements IPacket {
|
export class PacketPreChunk implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketRespawn implements IPacket {
|
export class PacketRespawn implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketSpawnPosition implements IPacket {
|
export class PacketSpawnPosition implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketTimeUpdate implements IPacket {
|
export class PacketTimeUpdate implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketUpdateHealth implements IPacket {
|
export class PacketUpdateHealth implements IPacket {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createWriter } from "../../bufferStuff/index";
|
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||||
import { Endian } from "../../bufferStuff/Endian";
|
|
||||||
import { IPacket } from "./IPacket";
|
import { IPacket } from "./IPacket";
|
||||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
|
||||||
import { Packet } from "../enums/Packet";
|
import { Packet } from "../enums/Packet";
|
||||||
|
|
||||||
export class PacketUseEntity implements IPacket {
|
export class PacketUseEntity implements IPacket {
|
||||||
|
|
Loading…
Reference in a new issue