Interface in @minecraft/server-net
A packet about to go to a player in a batch.
import type { PacketSendBeforeEvent } from '@minecraft/server-net';Subscribe to it with beforeEvents.packetSend.
Example
Section titled “Example”import { beforeEvents, type PacketSendBeforeEvent } from '@minecraft/server-net';
beforeEvents.packetSend.subscribe((event: PacketSendBeforeEvent) => { console.log('packetSend', event.packetId, event.packetSize);
// Uncomment to stop it from happening. // event.cancel = true;});import { beforeEvents } from '@minecraft/server-net';
beforeEvents.packetSend.subscribe((event) => { console.log('packetSend', event.packetId, event.packetSize);
// Uncomment to stop it from happening. // event.cancel = true;});Properties
Section titled “Properties”cancel
Section titled “cancel”cancel: boolean;Set to true to leave it out of the batch.
packetId
Section titled “packetId”read-only
readonly packetId: PacketId;Types
packetSize
Section titled “packetSize”read-only
readonly packetSize: number;recipients
Section titled “recipients”read-only
readonly recipients: (Player | undefined)[];Who it goes to; Basalt fires once for each, so this holds one.
Types