Rename everything "tile" to "block"

This commit is contained in:
2026-03-14 19:16:25 -03:00
parent e73cbcf5db
commit ea6a6acfbe
23 changed files with 74 additions and 75 deletions
+18
View File
@@ -0,0 +1,18 @@
import { BlockRegistry, EverythingRegistry } from "$/common/everything_registry.ts";
import { ItemStack } from "../inventory.ts";
import { PlayerComponent } from "../player.ts";
EverythingRegistry.register<BlockRegistry>("blocks", "bworld:tree", {
texture_id: "bworld:tree",
has_collision: false,
on_click(world, tile) {
const [player] = world.get_tag("player")!;
const player_inventory = player.get(PlayerComponent)!.player_inventory;
const maybe_item = player_inventory.container.get_item(player_inventory.hotbar_selected);
if (maybe_item && maybe_item.type_id === "bworld:axe") {
tile.id = "bworld:grass";
player_inventory.container.add_item(new ItemStack("bworld:log", 7));
}
},
});