Skip to content

Commit

Permalink
Merge pull request #80 from AnyBananaGAME/develop
Browse files Browse the repository at this point in the history
feat(protocol): add ClientToServerHandshakePacket
  • Loading branch information
PMK744 authored Aug 24, 2024
2 parents da231e2 + ca3cab3 commit 8cd7598
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/network/src/types/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ import type {
AvailableActorIdentifiersPacket,
StructureBlockUpdatePacket,
DimensionDataPacket,
PlayerEnchantOptionsPacket
PlayerEnchantOptionsPacket,
ClientToServerHandshakePacket
} from "@serenityjs/protocol";
import type { NetworkPacketEvent } from "./packet-event";

Expand All @@ -114,6 +115,9 @@ interface NetworkEvents {
[Packet.ServerToClientHandshake]: [
NetworkPacketEvent<ServerToClientHandshakePacket>
];
[Packet.ClientToServerHandshake]: [
NetworkPacketEvent<ClientToServerHandshakePacket>
]
[Packet.Disconnect]: [NetworkPacketEvent<DisconnectPacket>];
[Packet.ResourcePacksInfo]: [NetworkPacketEvent<ResourcePacksInfoPacket>];
[Packet.ResourcePackStack]: [NetworkPacketEvent<ResourcePackStackPacket>];
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/src/enums/packet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ enum Packet {
Login = 0x01, // 1
PlayStatus = 0x02, // 2
ServerToClientHandshake = 0x03, // 3
// ClientToServerHandshake = 0x04, // 4
ClientToServerHandshake = 0x04, // 4
Disconnect = 0x05, // 5
ResourcePacksInfo = 0x06, // 6
ResourcePackStack = 0x07, // 7
Expand Down
10 changes: 10 additions & 0 deletions packages/protocol/src/proto/data/client-to-server-handshake.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { DataPacket } from "./data-packet";

import { Proto } from "@serenityjs/raknet";

import { Packet } from "../../enums";

@Proto(Packet.ClientToServerHandshake)
class ClientToServerHandshakePacket extends DataPacket { }

export { ClientToServerHandshakePacket }
1 change: 1 addition & 0 deletions packages/protocol/src/proto/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,4 @@ export * from "./camera-instructions";
export * from "./structure-block-update";
export * from "./dimension-data";
export * from "./player-enchant-options";
export * from './client-to-server-handshake'
2 changes: 2 additions & 0 deletions packages/protocol/src/proto/data/packets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,13 @@ import { AvailableActorIdentifiersPacket } from "./available-actor-identifiers";
import { StructureBlockUpdatePacket } from "./structure-block-update";
import { DimensionDataPacket } from "./dimension-data";
import { PlayerEnchantOptionsPacket } from "./player-enchant-options";
import { ClientToServerHandshakePacket } from "./client-to-server-handshake";

const Packets = {
[Packet.Login]: LoginPacket, // 1
[Packet.PlayStatus]: PlayStatusPacket, // 2
[Packet.ServerToClientHandshake]: ServerToClientHandshakePacket, // 3
[Packet.ClientToServerHandshake]: ClientToServerHandshakePacket, // 4
[Packet.Disconnect]: DisconnectPacket, // 5
[Packet.ResourcePacksInfo]: ResourcePacksInfoPacket, // 6
[Packet.ResourcePackStack]: ResourcePackStackPacket, // 7
Expand Down

0 comments on commit 8cd7598

Please sign in to comment.