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",
|
||||
"dependencies": {
|
||||
"chalk": "^4.1.2",
|
||||
"net": "^1.0.2"
|
||||
"net": "^1.0.2",
|
||||
"bufferstuff": "^1.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.16.3",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Console } from "../console";
|
||||
import { IReader } from "../bufferStuff/readers/IReader";
|
||||
import { IReader } from "bufferstuff";
|
||||
import { MinecraftServer } from "./MinecraftServer";
|
||||
import { Packet } from "./enums/Packet";
|
||||
import { PacketAnimation } from "./packets/Animation";
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { createWriter } from "../bufferStuff/index";
|
||||
import { Endian } from "../bufferStuff/Endian";
|
||||
import { createWriter, Endian } from "bufferstuff";
|
||||
import { FunkyArray } from "../funkyArray";
|
||||
import { MetadataFieldType } from "./enums/MetadataFieldType";
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import { Config } from "../config";
|
||||
import { Console } from "../console";
|
||||
import { createReader } from "../bufferStuff/index";
|
||||
import { createReader, IReader, Endian } from "bufferstuff";
|
||||
import { FunkyArray } from "../funkyArray";
|
||||
import { IReader } from "../bufferStuff/readers/IReader";
|
||||
import { Server, Socket, SocketAddress } from "net";
|
||||
import { MPClient } from "./MPClient";
|
||||
import { Packet } from "./enums/Packet";
|
||||
|
@ -18,7 +17,6 @@ import { Player } from "./entities/Player";
|
|||
import { SaveCompressionType } from "./enums/SaveCompressionType";
|
||||
import { WorldSaveManager } from "./WorldSaveManager";
|
||||
import { World } from "./World";
|
||||
import { Endian } from "../bufferStuff/Endian";
|
||||
|
||||
export class MinecraftServer {
|
||||
private static readonly PROTOCOL_VERSION = 14;
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
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 { Chunk } from "./Chunk";
|
||||
import { SaveCompressionType } from "./enums/SaveCompressionType";
|
||||
import { deflate, inflate } from "zlib";
|
||||
import { World } from "./World";
|
||||
import { Endian } from "../bufferStuff/Endian";
|
||||
|
||||
export class WorldSaveManager {
|
||||
private readonly worldFolderPath;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketAnimation implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketBlockChange implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketChat implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketDisconnectKick implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketEntity implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketEntityAction implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketEntityEquipment implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketEntityLook implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketEntityLookRelativeMove implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
const EMPTY_BUFFER = Buffer.alloc(0);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketEntityRelativeMove implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketEntityTeleport implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createReader, createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketHandshake implements IPacket {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { IReader } from "bufferstuff";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export interface IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketKeepAlive implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketLoginRequest implements IPacket {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { Chunk } from "../Chunk";
|
||||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { deflate } from "zlib";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketMapChunk implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketNamedEntitySpawn implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketPlayer implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketPlayerDigging implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketPlayerLook implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketPlayerPosition implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketPlayerPositionLook implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketPreChunk implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketRespawn implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketSpawnPosition implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketTimeUpdate implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketUpdateHealth implements IPacket {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { createWriter } from "../../bufferStuff/index";
|
||||
import { Endian } from "../../bufferStuff/Endian";
|
||||
import { createWriter, IReader, Endian } from "bufferstuff";
|
||||
import { IPacket } from "./IPacket";
|
||||
import { IReader } from "../../bufferStuff/readers/IReader";
|
||||
import { Packet } from "../enums/Packet";
|
||||
|
||||
export class PacketUseEntity implements IPacket {
|
||||
|
|
Loading…
Reference in a new issue