Melon and pumpkin
This commit is contained in:
@@ -306,3 +306,28 @@ Deno.test("beetroots, cotton and strawberries grow, and strawberries and cotton
|
||||
}
|
||||
assertEquals(t.state(2, 101, 0, "age"), 7);
|
||||
});
|
||||
|
||||
Deno.test("a pumpkin plant becomes a pumpkin the morning it's grown, and a melon breaks into slices", async () => {
|
||||
const t = await setup(["bworld:bone_meal 64"]);
|
||||
// pumpkins grow in autumn, from day 99
|
||||
t.game.set_time(98 * CYCLE_TICKS);
|
||||
t.game.tick();
|
||||
// every stage shows, the last the day before
|
||||
const ages = grow(t, 0, "bworld:pumpkin_plant", 11);
|
||||
assertEquals(ages, [0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7]);
|
||||
t.game.set_block_state(0, 100, 0, 1);
|
||||
t.next_morning();
|
||||
assertEquals(t.game.world.get_block_id(0, 101, 0), "bworld:pumpkin");
|
||||
assertEquals(t.game.world.get_tile(0, 101, 0), undefined, "no crop data left behind");
|
||||
|
||||
// bone meal ripens it too
|
||||
t.game.set_block(1, 100, 0, "bworld:hoed_dirt");
|
||||
t.game.set_block(1, 101, 0, "bworld:melon_plant");
|
||||
t.hold("bworld:bone_meal");
|
||||
for (let i = 0; i < 12; i++) t.use(1, 101, 0);
|
||||
assertEquals(t.game.world.get_block_id(1, 101, 0), "bworld:melon");
|
||||
t.send(1, { type: "break_block", x: 1, y: 101, z: 0 });
|
||||
const slices = t.game.item_entities().map((e) => e.item.to_data());
|
||||
assertEquals(slices.map((item) => item.id), ["bworld:melon_slice"]);
|
||||
assert(slices[0].count >= 3 && slices[0].count <= 7);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user