Files
bworld/common/constants.ts
T
2026-09-24 19:34:07 -03:00

35 lines
899 B
TypeScript

export const TEXTURE_SIZE = 16;
export const TICKS_PER_SECOND = 20;
export const TICK_DELTA = 1 / TICKS_PER_SECOND;
export const SLOT_SIZE = 18 * 3;
export interface SpriteRegion {
x: number;
y: number;
}
export const faces = ["west", "east", "bottom", "top", "north", "south"] as const;
export type Faces = typeof faces[number];
export const AIR = 0;
export const VOID = 0xFFFFFFFF;
export const ID_MASK = 0xFFFF;
export const STATE_SHIFT = 16;
export const CHUNK_SIZE = 16;
export const CHUNK_HEIGHT = 128;
export const CHUNK_AREA = CHUNK_SIZE * CHUNK_SIZE;
// where a block placed against each face of another block goes
export const FACE_OFFSETS: Record<Faces, { x: number; y: number; z: number }> = {
top: { x: 0, y: 1, z: 0 },
bottom: { x: 0, y: -1, z: 0 },
north: { x: 0, y: 0, z: -1 },
south: { x: 0, y: 0, z: 1 },
west: { x: -1, y: 0, z: 0 },
east: { x: 1, y: 0, z: 0 },
};