-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.ts
More file actions
91 lines (85 loc) 路 4.06 KB
/
Copy pathconstants.ts
File metadata and controls
91 lines (85 loc) 路 4.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import { BlockType, ItemType, GameItemType } from './types';
export const CHUNK_SIZE = 16;
export const WORLD_HEIGHT = 48;
export const RENDER_DISTANCE = 3;
export const GRAVITY = 28;
export const JUMP_FORCE = 11;
export const PLAYER_SPEED = 6;
export const PLAYER_RUN_SPEED = 10;
export const PLAYER_SNEAK_SPEED = 3;
export const PLAYER_REACH = 5;
export const BLOCK_COLORS: Record<number, string> = {
[BlockType.AIR]: 'transparent',
[BlockType.GRASS]: '#4caf50', // More vibrant green
[BlockType.DIRT]: '#795548',
[BlockType.STONE]: '#9e9e9e',
[BlockType.WOOD]: '#5d4037',
[BlockType.LEAF]: '#388e3c',
[BlockType.WATER]: '#29b6f6',
[BlockType.SAND]: '#fff176',
[BlockType.COAL_ORE]: '#424242',
[BlockType.IRON_ORE]: '#d7ccc8',
[BlockType.DIAMOND_ORE]: '#84ffff',
[BlockType.GOLD_ORE]: '#ffeb3b',
[BlockType.LAPIS_ORE]: '#1a237e',
[BlockType.LAVA]: '#ff5722',
[BlockType.OBSIDIAN]: '#212121',
[BlockType.PLANKS]: '#a1887f',
[BlockType.CRAFTING_TABLE]: '#8d6e63',
[BlockType.FURNACE]: '#616161',
[BlockType.TORCH]: '#ffeb3b',
[BlockType.NETHER_PORTAL]: '#6a1b9a',
[BlockType.END_PORTAL]: '#1a237e', // Deep blue/black
[BlockType.NETHERRACK]: '#b71c1c',
[BlockType.END_STONE]: '#f0f4c3',
[BlockType.BEDROCK]: '#000000',
// Item Colors
[ItemType.BUCKET]: '#b0bec5',
[ItemType.WATER_BUCKET]: '#29b6f6',
[ItemType.LAVA_BUCKET]: '#ff5722',
};
// Loot Table: Block -> [Item, Min, Max]
export const LOOT_TABLE: Partial<Record<BlockType, { item: GameItemType, min: number, max: number }>> = {
[BlockType.COAL_ORE]: { item: ItemType.COAL, min: 1, max: 2 },
[BlockType.DIAMOND_ORE]: { item: ItemType.DIAMOND, min: 1, max: 1 },
[BlockType.LAPIS_ORE]: { item: ItemType.LAPIS, min: 4, max: 8 },
[BlockType.GRASS]: { item: BlockType.DIRT, min: 1, max: 1 },
[BlockType.STONE]: { item: BlockType.STONE, min: 1, max: 1 },
[BlockType.LEAF]: { item: ItemType.APPLE, min: 0, max: 1 },
[BlockType.IRON_ORE]: { item: ItemType.IRON_INGOT, min: 1, max: 1 },
[BlockType.GOLD_ORE]: { item: ItemType.GOLD_INGOT, min: 1, max: 1 },
[BlockType.TORCH]: { item: BlockType.TORCH, min: 1, max: 1 },
[BlockType.NETHER_PORTAL]: { item: BlockType.OBSIDIAN, min: 6, max: 6 },
[BlockType.WATER]: { item: BlockType.AIR, min: 0, max: 0 },
[BlockType.LAVA]: { item: BlockType.AIR, min: 0, max: 0 },
[BlockType.BEDROCK]: { item: BlockType.AIR, min: 0, max: 0 },
};
export interface Recipe {
output: GameItemType;
count: number;
ingredients: { item: GameItemType; count: number }[];
}
export const RECIPES: Recipe[] = [
{ output: BlockType.PLANKS, count: 4, ingredients: [{ item: BlockType.WOOD, count: 1 }] },
{ output: ItemType.STICK, count: 4, ingredients: [{ item: BlockType.PLANKS, count: 2 }] },
{ output: BlockType.CRAFTING_TABLE, count: 1, ingredients: [{ item: BlockType.PLANKS, count: 4 }] },
{ output: BlockType.TORCH, count: 4, ingredients: [{ item: ItemType.COAL, count: 1 }, { item: ItemType.STICK, count: 1 }] },
{ output: ItemType.WOOD_PICKAXE, count: 1, ingredients: [{ item: BlockType.PLANKS, count: 3 }, { item: ItemType.STICK, count: 2 }] },
{ output: ItemType.STONE_PICKAXE, count: 1, ingredients: [{ item: BlockType.STONE, count: 3 }, { item: ItemType.STICK, count: 2 }] },
{ output: ItemType.IRON_PICKAXE, count: 1, ingredients: [{ item: ItemType.IRON_INGOT, count: 3 }, { item: ItemType.STICK, count: 2 }] },
{ output: ItemType.DIAMOND_SWORD, count: 1, ingredients: [{ item: ItemType.DIAMOND, count: 2 }, { item: ItemType.STICK, count: 1 }] },
{ output: BlockType.FURNACE, count: 1, ingredients: [{ item: BlockType.STONE, count: 8 }] },
{ output: BlockType.NETHER_PORTAL, count: 1, ingredients: [{ item: BlockType.OBSIDIAN, count: 10 }] },
{ output: ItemType.MAP, count: 1, ingredients: [{ item: ItemType.PAPER, count: 3 }, { item: ItemType.COMPASS, count: 1 }] },
{ output: ItemType.BUCKET, count: 1, ingredients: [{ item: ItemType.IRON_INGOT, count: 3 }] },
];
export const CONTROLS = {
forward: ['KeyW'],
backward: ['KeyS'],
left: ['KeyA'],
right: ['KeyD'],
jump: ['Space'],
inventory: ['KeyE'],
run: ['ControlLeft'],
sneak: ['ShiftLeft'],
};