pw-js-world
Version:
An optional package for PW-JS-Api, aims to serve world purposes.
23 lines (22 loc) • 1.38 kB
TypeScript
import type { LayerType } from "../Constants.js";
import type { BlockArg, Point, SendableBlockPacket } from "../types";
import Block from "../Block.js";
import type { BlockKeys } from "pw-js-api";
export declare function uint8ArrayEquals(a: Uint8Array, b: Uint8Array): boolean;
export declare function map<T, U>(arr: Array<T> | Map<any, T>, cb: (value: T, index: number, obj: T[]) => U): U[];
export declare function find<T>(arr: Array<T> | Map<any, T>, pred: (value: T, index: number, obj: T[]) => boolean): T | undefined;
export declare function findIndex<T>(arr: Array<T> | Map<any, T>, pred: (value: T, index: number, obj: T[]) => boolean): number;
/**
* For now this is slightly limited, but this will ONLY create a sendable packet which you must then send it yourself.
*/
export declare function createBlockPacket(blockId: number | BlockKeys | string, layer: LayerType, pos: Point | Point[], ...args: BlockArg[]): SendableBlockPacket;
export declare function createBlockPacket(block: Block, layer: LayerType, pos: Point | Point[]): SendableBlockPacket;
/**
* Creates sendable packets from given blocks. Attempts to minimise packet count, so it's preferable
* to use it over creating packets with createBlockPacket multiple times.
*/
export declare function createBlockPackets(blocks: {
block: Block;
layer: LayerType;
pos: Point;
}[]): SendableBlockPacket[];