Trapdoors
This commit is contained in:
@@ -52,6 +52,9 @@ export interface BlockComponent<P = any> {
|
||||
// a block next to it (on any of the 6 sides) was placed, broken or changed its states, like minecraft's
|
||||
// updateShape. neighbor is where, and what's there now
|
||||
on_neighbor_change?(block: BlockRef, params: P, neighbor: Position & { readonly id: Id }): void;
|
||||
// the states it's placed with when a player places it, like minecraft's getStateForPlacement. states it doesn't
|
||||
// return keep their defaults, and a 2 bit "facing" faces the player
|
||||
state_for_placement?(placement: BlockPlacement, params: P): Record<string, number> | void;
|
||||
}
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
@@ -141,9 +144,19 @@ export interface BlockPlaceEvent {
|
||||
readonly player: Player;
|
||||
readonly block: { readonly id: Id } & Position;
|
||||
readonly face: Face;
|
||||
// where on the clicked block the player clicked, 0 to 1 on each axis
|
||||
readonly hit: readonly [number, number, number];
|
||||
readonly item: ItemStack | undefined;
|
||||
}
|
||||
|
||||
// a player placing a block at x y z by clicking face of the block next to it, at hit (0 to 1 on each axis of that
|
||||
// block), like minecraft's BlockPlaceContext
|
||||
export interface BlockPlacement extends Position {
|
||||
readonly player: Player;
|
||||
readonly face: Face;
|
||||
readonly hit: readonly [number, number, number];
|
||||
}
|
||||
|
||||
export interface BlockInteractEvent {
|
||||
readonly player: Player;
|
||||
readonly block: BlockRef;
|
||||
|
||||
+4
-3
@@ -7,7 +7,7 @@ export const AIR_ID = "bworld:air";
|
||||
|
||||
// bump when a client and server of different versions can't play together.
|
||||
// the server rejects a different version before the client downloads anything
|
||||
export const PROTOCOL_VERSION = 18;
|
||||
export const PROTOCOL_VERSION = 19;
|
||||
|
||||
export interface PlayerInfo {
|
||||
id: string;
|
||||
@@ -110,8 +110,9 @@ export type ClientMessage =
|
||||
| { type: "swing" }
|
||||
// right click without looking at a block, for items' on_use
|
||||
| { type: "use_item" }
|
||||
// right click on a block: interact with it, or place the held block against `face`
|
||||
| { type: "use_block"; x: number; y: number; z: number; face: Faces }
|
||||
// right click on a block: interact with it, or place the held block against `face`. hit is where on the block it
|
||||
// clicked, 0 to 1 on each axis, like minecraft's click location
|
||||
| { type: "use_block"; x: number; y: number; z: number; face: Faces; hit?: [number, number, number] }
|
||||
| { type: "select_slot"; slot: number }
|
||||
// a slot of the open menu, or of menu 0 when none is. shift moves the stack to the other part of the menu instead,
|
||||
// like minecraft's quick move. clicks for a menu that isn't open any more are ignored
|
||||
|
||||
Reference in New Issue
Block a user