This commit is contained in:
2026-10-11 23:10:28 -03:00
parent 935c0df7af
commit fbef1d96d2
8 changed files with 139 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
{
"format_version": 1,
"block": {
"id": "bworld:worm_bin",
"name": "Worm Bin",
"textures": {
"front": "bworld:worm_bin_front",
"side": "bworld:worm_bin_side",
"top": "bworld:worm_bin_top"
},
"states": [
{
"name": "facing",
"bits": 2,
"default": 0
}
],
"variants": {
"facing=1": { "y": 90 },
"facing=2": { "y": 180 },
"facing=3": { "y": 270 }
},
"mining": {
"toughness": 2
},
"drops": "bworld:worm_bin",
"interactive": true,
"components": {
"bworld:worm_bin": {}
}
}
}
@@ -0,0 +1,20 @@
{
"format_version": 1,
"recipe": {
"type": "shaped",
"pattern": [
"CWC",
"CDC",
"CCC"
],
"key": {
"C": "#c:ingots/copper",
"D": "bworld:dirt",
"W": "bworld:worms"
},
"result": {
"id": "bworld:worm_bin",
"count": 1
}
}
}
+1
View File
@@ -10,6 +10,7 @@ export function setup(ctx: ClientContext) {
ctx.ui.register_menu_screen("bworld:storage", chest_screen);
ctx.ui.register_menu_screen("bworld:furnace", furnace_screen);
ctx.ui.register_menu_screen("bworld:crabpot", (menu) => container_screen(menu, HEIGHT));
ctx.ui.register_menu_screen("bworld:worm_bin", (menu) => container_screen(menu, HEIGHT));
ctx.ui.register_menu_screen("bworld:smithing_table", smithing_screen);
ctx.ui.register_menu_screen("bworld:fishing_minigame", fishing_minigame_screen);
}
+35
View File
@@ -10,6 +10,7 @@ export function setup(ctx: ServerContext) {
register_shipping_bin(ctx, storage_menu);
register_furnace(ctx);
register_crabpot(ctx);
register_worm_bin(ctx);
register_smithing_table(ctx);
register_farming(ctx);
register_fishing(ctx);
@@ -328,6 +329,40 @@ function register_crabpot(ctx: ServerContext) {
});
}
// the worm bin makes worms every morning, for the crab pot's bait, into its one slot, which players can only take from.
// they pile up to a full stack
const WORMS_A_DAY = 5;
function register_worm_bin(ctx: ServerContext) {
const menu_type = ctx.menus.register<BlockRef>("bworld:worm_bin", (menu, block) => {
menu.title = "Worm Bin";
menu.add_slot(block_container(ctx, block, 1), 0, { x: 79, y: 34, output_only: true });
menu.add_player_inventory(7, INVENTORY_Y);
menu.still_valid_near(block);
});
ctx.components.register_block("bworld:worm_bin", {
// its container is its tile data, so its mornings come anywhere in the world, like a crop's
on_create(block) {
block_container(ctx, block, 1);
},
on_interact(block, _params, player) {
menu_type.open(player, block);
return true;
},
on_break(block) {
drop_contents(ctx, block);
},
on_new_day(block) {
const container = block_container(ctx, block, 1);
const worms = container.get(0);
const max = ctx.items.max_stack(CRABPOT_WORMS);
if (!worms) container.set(0, { id: CRABPOT_WORMS, count: WORMS_A_DAY });
else if (worms.id === CRABPOT_WORMS) worms.count = Math.min(max, worms.count + WORMS_A_DAY);
},
});
}
function register_smithing_table(ctx: ServerContext) {
const menu_type = ctx.menus.register<BlockRef>("bworld:smithing_table", (menu, block, player) => {
const container = ctx.containers.create(4);
Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B