Glass bottle, buckets and juice !

This commit is contained in:
2026-10-25 15:22:50 -03:00
parent 436f68ce33
commit 583cce88c1
9 changed files with 170 additions and 10 deletions
+18
View File
@@ -361,6 +361,24 @@ Deno.test("a bucket picks up a water source but not flowing water, and a water b
assertEquals(t.game.world.get_block_value(-2, 100, 0) >>> 16, 0);
});
Deno.test("only an empty bucket picks up water, and from a stack the water bucket goes in the inventory", async () => {
const t = await setup();
const player = t.game.players()[0];
const slots = () => player.inventory.to_data().flatMap((item) => item ? [[item.id, item.count]] : []);
t.game.set_block(1, 100, 0, "bworld:water");
t.game.give(player, "bworld:bucket", 1, { fluid: { id: "bworld:juice" } });
t.send(1, { type: "use_block", x: 1, y: 100, z: 0, face: "top" });
assertEquals(t.game.world.get_block_id(1, 100, 0), "bworld:water");
assertEquals(slots(), [["bworld:bucket", 1]]);
player.inventory.set_item(0, undefined);
t.game.give(player, "bworld:bucket", 3);
t.send(1, { type: "use_block", x: 1, y: 100, z: 0, face: "top" });
assertEquals(t.game.world.get_block_id(1, 100, 0), "bworld:air");
assertEquals(slots(), [["bworld:bucket", 2], ["bworld:water_bucket", 1]]);
});
Deno.test("a bucket picks up a lava source too, and a lava bucket puts one back", async () => {
const t = await setup([["bworld:bucket", 1]]);
const held = () => t.game.players()[0].held_item?.type_id;