Voxels
Warning
Official API Documentation: GameVoxels
Improvement Details
Background of Modification
In the original official d.ts file, the voxel data for this API interface was broadly defined as number or string type, which could lead to the following issues:
- Allowing input of arbitrary data.
- Potentially causing bugs at runtime due to the inability to retrieve the corresponding voxel.
Improvement Plan
Since the number of voxels in Box3 is finite, we have introduced custom types to strictly regulate the input data.
Effect of Improvement
- Ensures data validity.
- Improves code readability.
- Enhances error-checking capabilities.
Usage Guide
Example Demonstration
Normal Input

Abnormal Input

Data Type Definition
typescript
/**
* Voxels last updated: 2024/10/17
* 384 types of voxels have been included.
*/
type voxelName =
| "A"
| "B"
| "C"
| "D"
| "E"
| "F"
| "G"
| "H"
| "I"
| "J"
| "K"
| "L"
| "M"
| "N"
| "O"
| "P"
| "Q"
| "R"
| "S"
| "T"
| "U"
| "V"
| "W"
| "X"
| "Y"
| "Z"
| "acacia"
| "add"
| "air"
| "air_duct"
| "ampersand"
| "asterisk"
| "at"
| "backslash"
| "bamboo"
| "barrier"
| "bat_window"
| "bear_footprint"
| "biscuit"
| "black"
| "black_glass"
| "blue"
| "blue_decorative_light"
| "blue_gift"
| "blue_glass"
| "blue_grass"
| "blue_grass_all"
| "blue_light"
| "blue_surface_01"
| "blue_surface_02"
| "blueberry_juice"
| "board0"
| "board1"
| "board10"
| "board11"
| "board12"
| "board13"
| "board14"
| "board15"
| "board2"
| "board3"
| "board4"
| "board5"
| "board6"
| "board7"
| "board8"
| "board9"
| "board_01"
| "board_02"
| "board_03"
| "board_04"
| "board_05"
| "board_06"
| "board_07"
| "bookshelf"
| "bounce_pad"
| "bracket_close"
| "bracket_open"
| "brick_01"
| "brick_02"
| "brick_red"
| "button"
| "cadet_blue"
| "candy"
| "caret"
| "carpet_01"
| "carpet_02"
| "carpet_03"
| "carpet_04"
| "carpet_05"
| "carpet_06"
| "carpet_07"
| "carpet_08"
| "carpet_09"
| "carpet_10"
| "carpet_11"
| "carpet_12"
| "carpet_13"
| "coffee"
| "coffee_gray"
| "colon"
| "color_glass"
| "comma"
| "conveyor"
| "crane_lantern"
| "crane_roof_01"
| "crane_roof_02"
| "cross_window"
| "dark_blue_grass"
| "dark_blue_grass_all"
| "dark_brick_00"
| "dark_brick_01"
| "dark_brick_02"
| "dark_grass"
| "dark_grass_all"
| "dark_grass_rock"
| "dark_grass_sand"
| "dark_gray"
| "dark_orchid"
| "dark_purple_grass"
| "dark_purple_grass_all"
| "dark_red"
| "dark_red_grass"
| "dark_red_grass_all"
| "dark_salmon"
| "dark_sand"
| "dark_slate_blue"
| "dark_stone"
| "dark_surface"
| "dark_volcanic_rock"
| "dark_yellow_grass"
| "dark_yellow_grass_all"
| "dirt"
| "divide"
| "eight"
| "equal"
| "exclamation_mark"
| "express_box"
| "fan"
| "firecracker"
| "five"
| "four"
| "fu"
| "geometric_window_01"
| "geometric_window_02"
| "glass"
| "gold_trim_brick"
| "grape_juice"
| "grass"
| "grass_all"
| "grass_rock"
| "grass_sand"
| "greater_than"
| "green_decorative_light"
| "green_glass"
| "green_leaf"
| "green_light"
| "greenbelt_L"
| "greenbelt_L1"
| "grey_stone_brick"
| "honeycomb_01"
| "honeycomb_02"
| "ice"
| "ice_brick"
| "ice_wall"
| "indigo_light"
| "lab_lamp_01"
| "lab_lamp_02"
| "lab_lamp_03"
| "lab_material_01"
| "lab_material_02"
| "lab_material_03"
| "lab_material_04"
| "lab_material_05"
| "lab_material_06"
| "lab_material_07"
| "lab_material_08"
| "lab_material_09"
| "lab_material_10"
| "lab_material_11"
| "lab_material_12"
| "lab_material_13"
| "lab_material_14"
| "lab_material_15"
| "lab_screen"
| "lab_wire"
| "lantern_01"
| "lantern_02"
| "lava01"
| "lava02"
| "leaf_01"
| "leaf_02"
| "leaf_03"
| "leaf_04"
| "leaf_05"
| "leaf_06"
| "ledfloor01"
| "ledfloor02"
| "lemon"
| "lemon_juice"
| "less_than"
| "light_blue_grass"
| "light_blue_grass_all"
| "light_dirt"
| "light_gray"
| "light_sand"
| "light_stone"
| "light_yellow_grass"
| "light_yellow_grass_all"
| "lime_green"
| "log"
| "logo"
| "lunar_module"
| "m"
| "mat_01"
| "mat_02"
| "mat_03"
| "mat_04"
| "mat_05"
| "mat_06"
| "mat_07"
| "mat_08"
| "minus"
| "moon"
| "moss"
| "multiply"
| "nine"
| "note_block"
| "npc_spawn_location"
| "number_sign"
| "one"
| "orange"
| "orange_juice"
| "pale_green"
| "parentheses_close"
| "parentheses_open"
| "peach"
| "percent"
| "period"
| "pink_surface_01"
| "pink_surface_02"
| "pipe"
| "plus"
| "polished_dark_stone"
| "question_mark"
| "quotation_mark"
| "red_brick_00"
| "red_brick_01"
| "red_brick_02"
| "red_decorative_light"
| "red_gift"
| "red_glass"
| "red_light"
| "sand"
| "sandy_brown"
| "semicolon"
| "seven"
| "six"
| "slash"
| "snow"
| "snow_all"
| "snow_grass"
| "snow_rock"
| "space_floor_01"
| "space_floor_02"
| "space_floor_03"
| "space_floor_04"
| "space_lamp_01"
| "space_lamp_02"
| "space_lamp_03"
| "space_material_01"
| "space_material_02"
| "space_material_03"
| "space_material_04"
| "space_material_05"
| "space_material_06"
| "space_material_07"
| "space_material_08"
| "space_material_09"
| "space_material_10"
| "space_material_11"
| "space_material_12"
| "space_material_13"
| "space_material_14"
| "space_material_15"
| "spawn_location"
| "steel_blue"
| "stone"
| "stone_brick"
| "stump"
| "surface_01"
| "surface_02"
| "surface_03"
| "surface_04"
| "surface_05"
| "surface_06"
| "sweet_potato"
| "tatami"
| "tech_floor_01"
| "tech_floor_02"
| "tech_floor_03"
| "tech_floor_04"
| "tech_lamp_01"
| "tech_lamp_02"
| "tech_lamp_03"
| "tech_material_01"
| "tech_material_02"
| "tech_material_03"
| "tech_material_04"
| "tech_material_05"
| "tech_material_06"
| "tech_material_07"
| "tech_material_08"
| "tech_material_09"
| "tech_material_10"
| "tech_material_11"
| "tech_material_12"
| "tech_material_13"
| "tech_material_14"
| "tech_material_15"
| "tech_screen"
| "three"
| "tile"
| "tile_floor"
| "two"
| "underscore"
| "up"
| "up_down"
| "volcanic_rock"
| "wall_01"
| "wall_02"
| "wall_03"
| "wall_04"
| "wall_05"
| "wall_06"
| "wall_07"
| "wall_08"
| "wall_09"
| "wall_10"
| "wall_11"
| "wall_12"
| "wall_13"
| "wall_14"
| "wall_15"
| "watermelon_juice"
| "white"
| "white_glass"
| "window_01"
| "window_02"
| "window_03"
| "window_04"
| "window_05"
| "window_06"
| "window_07"
| "window_08"
| "wood"
| "wood_00"
| "wood_01"
| "wood_02"
| "wood_03"
| "wood_04"
| "wood_05"
| "wood_06"
| "wood_floor"
| "yellow_decorative_light"
| "yellow_glass"
| "yellow_light"
| "zero";The voxelName type includes a comprehensive list of all available voxels, ensuring that only valid voxel names can be used in your code.