Blocks with sides !
This commit is contained in:
@@ -8,7 +8,7 @@ interface TileChestData {
|
||||
}
|
||||
|
||||
EverythingRegistry.register<BlockRegistry<TileChestData>>("blocks", "bworld:chest", {
|
||||
texture_id: "bworld:chest",
|
||||
textures: "bworld:chest",
|
||||
has_collision: false,
|
||||
|
||||
on_interact(world, tile) {
|
||||
|
||||
@@ -67,7 +67,7 @@ interface TileCropData {
|
||||
current_stage: number;
|
||||
growth_time: number;
|
||||
}
|
||||
|
||||
/*
|
||||
function create_crop_tile(crop_id: string) {
|
||||
const crop_info = EverythingRegistry.get<CropsRegistry>("crops", crop_id);
|
||||
|
||||
@@ -144,3 +144,4 @@ EverythingRegistry.register<BlockRegistry<TileCropData>>(
|
||||
"bworld:pumpkin_crop",
|
||||
create_crop_tile("bworld:pumpkin"),
|
||||
);
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,7 @@ import { WateringCanData } from "../items/watering_can.ts";
|
||||
import { PlayerComponent } from "../player.ts";
|
||||
|
||||
EverythingRegistry.register<BlockRegistry>("blocks", "bworld:dirt", {
|
||||
texture_id: "bworld:dirt",
|
||||
textures: "bworld:dirt",
|
||||
has_collision: false,
|
||||
|
||||
on_interact(world, tile) {
|
||||
@@ -17,7 +17,7 @@ EverythingRegistry.register<BlockRegistry>("blocks", "bworld:dirt", {
|
||||
});
|
||||
|
||||
EverythingRegistry.register<BlockRegistry>("blocks", "bworld:hoed_dirt", {
|
||||
texture_id: "bworld:hoed_dirt",
|
||||
textures: "bworld:hoed_dirt",
|
||||
has_collision: false,
|
||||
|
||||
on_click(world, tile) {
|
||||
@@ -51,7 +51,7 @@ EverythingRegistry.register<BlockRegistry>("blocks", "bworld:hoed_dirt", {
|
||||
});
|
||||
|
||||
EverythingRegistry.register<BlockRegistry>("blocks", "bworld:hoed_watered_dirt", {
|
||||
texture_id: "bworld:hoed_watered_dirt",
|
||||
textures: "bworld:hoed_watered_dirt",
|
||||
has_collision: false,
|
||||
|
||||
on_click(world, tile) {
|
||||
|
||||
@@ -67,7 +67,7 @@ interface TileChestData {
|
||||
}
|
||||
|
||||
EverythingRegistry.register<BlockRegistry<TileChestData>>("blocks", "bworld:furnace", {
|
||||
texture_id: "bworld:furnace",
|
||||
textures: "bworld:furnace",
|
||||
has_collision: false,
|
||||
|
||||
on_interact(world, tile) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { BlockRegistry, EverythingRegistry } from "$/common/everything_registry.
|
||||
import { PlayerComponent } from "../player.ts";
|
||||
|
||||
EverythingRegistry.register<BlockRegistry>("blocks", "bworld:grass", {
|
||||
texture_id: "bworld:grass",
|
||||
textures: { top: "bworld:grass_top", bottom: "bworld:dirt", "side": "bworld:grass_side" },
|
||||
has_collision: false,
|
||||
|
||||
on_interact(world, tile) {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { BlockRegistry, EverythingRegistry } from "$/common/everything_registry.ts";
|
||||
|
||||
EverythingRegistry.register<BlockRegistry>("blocks", "bworld:log", {
|
||||
texture_id: "bworld:log_side",
|
||||
textures: { side: "bworld:log_side", top: "bworld:log_top", bottom: "bworld:log_top" },
|
||||
has_collision: true,
|
||||
});
|
||||
|
||||
EverythingRegistry.register<BlockRegistry>("blocks", "bworld:leaves", {
|
||||
texture_id: "bworld:leaves",
|
||||
textures: "bworld:leaves",
|
||||
has_collision: true,
|
||||
transparent: true,
|
||||
});
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import "./grass.ts";
|
||||
import "./dirt.ts";
|
||||
import "./tree.ts";
|
||||
import "./crops.ts";
|
||||
import "./water.ts";
|
||||
import "./chest.ts";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BlockRegistry, EverythingRegistry } from "$/common/everything_registry.ts";
|
||||
|
||||
EverythingRegistry.register<BlockRegistry>("blocks", "bworld:sand", {
|
||||
texture_id: "bworld:sand",
|
||||
textures: "bworld:sand",
|
||||
has_collision: true,
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BlockRegistry, EverythingRegistry } from "$/common/everything_registry.ts";
|
||||
|
||||
EverythingRegistry.register<BlockRegistry>("blocks", "bworld:snow", {
|
||||
texture_id: "bworld:snow",
|
||||
textures: "bworld:snow",
|
||||
has_collision: true,
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BlockRegistry, EverythingRegistry } from "$/common/everything_registry.ts";
|
||||
|
||||
EverythingRegistry.register<BlockRegistry>("blocks", "bworld:stone", {
|
||||
texture_id: "bworld:stone",
|
||||
textures: "bworld:stone",
|
||||
has_collision: true,
|
||||
});
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
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));
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BlockRegistry, EverythingRegistry } from "$/common/everything_registry.ts";
|
||||
|
||||
EverythingRegistry.register<BlockRegistry>("blocks", "bworld:water", {
|
||||
texture_id: "bworld:water",
|
||||
textures: "bworld:water",
|
||||
has_collision: false,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user