Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/replcraft/lib/client.ts>Client

A library to control special structures on the ReplCraft Minecraft server
Latest
class Client
extends EventEmitter<ClientEvents>
import { Client } from "https://deno.land/x/replcraft@v1.1.0/lib/client.ts";

Constructors

new
Client()

Create a new client, which can be connected to a server.

Properties

private
readonly
connected: boolean

Whether the client is currently connected to the server

private
handlers: Map<number, Handler>
private
nonce: number
private
timer: number
connection: StandardWebSocketClient | null
token: Token | null

Methods

private
wait(action: ActionType, nonce: number): Promise<ActionData>

Wait until the server has responded to an event with the specified identifier.

connect(unnamed 0: ConnectionOptions): Promise<void>

Connect to a ReplCraft server.

craft(output: Location, recipe: (SlotReference | null)[]): Promise<void>

Craft an item using its recipe.

disconnect(): void

Disconnect from the ReplCraft server, if the client is connected.

getBlock(unnamed 0: Location): Promise<Block>

Get the state of the block at the specified location inside of the structure.

getEntities(): Promise<Entity[]>

Get a list of entities inside of the structure.

getFuelInfo(): Promise<FuelInfo>

Get information about the current fuel usage of the structure and all connected clients.

getInventory(location: Location): Promise<ItemSlot[]>

Get the contents of a container within the structure.

getPowerLevel(location: Location): Promise<number>

Get the power level of a redstone source.

getSignText(location: Location): Promise<string[]>

Get the text of a sign.

getSize(): Promise<Location>

Get the size of the structure.

moveItem(unnamed 0: MoveItemOptions): Promise<void>

Move an item from one container to another.

pay(player: Player, amount: number): Promise<void>

Pay the player the specified amount of currency.

poll(unnamed 0: Location): Promise<void>

Poll a block for updates. This is way slower than Client#watch(), and not as reliable.

pollAll(): Promise<void>

Poll all of the structure's blocks for updates. This is way slower than Client#watch(), and not as reliable.

send(action: ActionType, data?: ActionData): Promise<ActionData>

Send a request to the ReplCraft server. You should not use this function directly.

setBlock(
unnamed 0: Location,
block: Block | null,
source?: Location,
target?: Location,
): Promise<void>

Set the state of the block at the specified location inside of the structure.

setSignText(location: Location, lines: string[]): Promise<void>

Update the text of a sign.

tell(player: Player, message: string): Promise<void>

Send the player a message privately.

transact(transaction: Transaction, status: boolean): Promise<void>

Respond to a transaction request.

unpoll(unnamed 0: Location): Promise<void>

Stop polling a block for updates.

unpollAll(): Promise<void>

Stop polling all of the structure's blocks for updates.

unwatch(unnamed 0: Location): Promise<void>

Stop watching a block for updates.

unwatchAll(): Promise<void>

Stop watching all of the structure's blocks for updates.

watch(unnamed 0: Location): Promise<void>

Watch a block for updates. This may not catch all possible block updates.

watchAll(): Promise<void>

Watch all of the structure's block for updates. This may not catch all possible block updates.