Improve tools system

This commit is contained in:
2026-09-29 17:54:17 -03:00
parent ad7f34a99e
commit 8fe581ea93
39 changed files with 225 additions and 49 deletions
+16 -1
View File
@@ -122,6 +122,8 @@ export interface BlockRegistry {
toughness?: number;
requires_tool?: boolean;
tool_to_break?: string;
// the lowest tool tier it drops for when requires_tool, like minecraft's incorrect_for_*_tool tags. 0 when not set
tool_tier?: number;
drop_table?: string;
states?: BlockStateDefinition[];
@@ -147,6 +149,18 @@ export interface BlockRegistry {
compiled_states?: CompiledStateDefinition[];
}
// what a tool is made of, like fabric's ToolMaterial
export interface ToolProperties {
// like "pickaxe", matched against blocks' tool_to_break
type: string;
// blocks that need a tool only drop for tools of their tool_tier or higher. wood and gold are 0, stone 1, iron 2
tier: number;
// how many times faster than a hand it breaks blocks of its type
speed: number;
// how much use it can take. nothing uses it up yet
durability: number;
}
// what eating an item does, like minecraft's food properties
export interface FoodProperties {
// hunger points it restores, a bar is 20
@@ -166,7 +180,8 @@ export interface ItemRegistry<T = unknown | undefined> {
// what players see, like "Iron Ingot". made from the id when not set, see display_name in common/utils.ts
name?: string;
block_id?: string;
tool_type?: string;
tool?: ToolProperties;
// 1 for tools and 64 for everything else when not set
max_stack?: number;
lore?: string;
food?: FoodProperties;