// SPDX-FileCopyrightText: 2026 Paula Wisnievski // SPDX-License-Identifier: AGPL-3.0-or-later // the pixels across a block face or an item sprite. block models and item models are made in these units, a texture of // another size is stretched to fit export const TEXTURE_SIZE = 16; // the most a texture can be on either side, entity sprites are bigger than blocks' export const MAX_TEXTURE_SIZE = 256; // the most an animated texture's png can be on either side, all its frames together. each frame is a texture, at most // MAX_TEXTURE_SIZE export const MAX_ANIMATED_TEXTURE_SIZE = 4096; // the game's version, what mods' game_version is checked against. mods with engine_access are tied to its minor version export const GAME_VERSION = "0.1.0"; export const TICKS_PER_SECOND = 20; export const TICK_DELTA = 1 / TICKS_PER_SECOND; export const SLOT_SIZE = 18 * 3; // where a texture is in the atlas, in pixels export interface SpriteRegion { x: number; y: number; width: number; height: 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 = 256; // the top of oceans and rivers export const SEA_LEVEL = 64; export const CHUNK_AREA = CHUNK_SIZE * CHUNK_SIZE; // the player's collision box, position is the middle of its feet export const PLAYER_WIDTH = 0.6; export const PLAYER_HEIGHT = 1.79; export const PLAYER_EYE_HEIGHT = 1.69; // while swimming they lie flat in a shorter box, like voxelibre's, so they fit through 1 block gaps export const PLAYER_SWIM_HEIGHT = 0.8; export const PLAYER_SWIM_EYE_HEIGHT = 0.6; // the stages of cracks on a block being broken, 0 to this, each drawn with cubi:break_ export const BREAK_STAGES = 8; // where a block placed against each face of another block goes export const FACE_OFFSETS: Record = { 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 }, };