Juicer
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"format_version": 1,
|
||||||
|
"block": {
|
||||||
|
"id": "bworld:juicer",
|
||||||
|
"name": "Juicer",
|
||||||
|
"textures": {},
|
||||||
|
"model": "bworld:juicer",
|
||||||
|
"item_model": "bworld:juicer",
|
||||||
|
"render_layer": "cutout",
|
||||||
|
"mining": {
|
||||||
|
"toughness": 2,
|
||||||
|
"tool": "pickaxe"
|
||||||
|
},
|
||||||
|
"drops": "bworld:juicer",
|
||||||
|
"interactive": true,
|
||||||
|
"components": {
|
||||||
|
"bworld:juicer": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,6 +11,6 @@
|
|||||||
"toughness": 1.5,
|
"toughness": 1.5,
|
||||||
"tool": "axe"
|
"tool": "axe"
|
||||||
},
|
},
|
||||||
"loot_table": "bworld:blocks/melon"
|
"drops": "bworld:melon"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,9 @@
|
|||||||
"saturation_modifier": 0.6
|
"saturation_modifier": 0.6
|
||||||
},
|
},
|
||||||
"places": "bworld:beetroots",
|
"places": "bworld:beetroots",
|
||||||
"base_sell_value": 25
|
"base_sell_value": 25,
|
||||||
|
"components": {
|
||||||
|
"bworld:juiceable": { "juice": 200, "color": "#e84c6e" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,9 @@
|
|||||||
"saturation_modifier": 0.6
|
"saturation_modifier": 0.6
|
||||||
},
|
},
|
||||||
"places": "bworld:carrots",
|
"places": "bworld:carrots",
|
||||||
"base_sell_value": 12
|
"base_sell_value": 12,
|
||||||
|
"components": {
|
||||||
|
"bworld:juiceable": { "juice": 200, "color": "#c87f4b" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
"format_version": 1,
|
"format_version": 1,
|
||||||
"item": {
|
"item": {
|
||||||
"id": "bworld:melon",
|
"id": "bworld:melon",
|
||||||
"base_sell_value": 60
|
"base_sell_value": 60,
|
||||||
|
"components": {
|
||||||
|
"bworld:juiceable": { "juice": 1000, "color": "#aa3d33" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,9 @@
|
|||||||
"saturation_modifier": 0.3
|
"saturation_modifier": 0.3
|
||||||
},
|
},
|
||||||
"places": "bworld:potatoes",
|
"places": "bworld:potatoes",
|
||||||
"base_sell_value": 20
|
"base_sell_value": 20,
|
||||||
|
"components": {
|
||||||
|
"bworld:juiceable": { "juice": 200, "color": "#c48a3f" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
"format_version": 1,
|
"format_version": 1,
|
||||||
"item": {
|
"item": {
|
||||||
"id": "bworld:pumpkin",
|
"id": "bworld:pumpkin",
|
||||||
"base_sell_value": 80
|
"base_sell_value": 80,
|
||||||
|
"components": {
|
||||||
|
"bworld:juiceable": { "juice": 1000, "color": "#ea8734" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,9 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.3
|
"saturation_modifier": 0.3
|
||||||
},
|
},
|
||||||
"base_sell_value": 30
|
"base_sell_value": 30,
|
||||||
|
"components": {
|
||||||
|
"bworld:juiceable": { "juice": 200, "color": "#ff2840" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
{
|
||||||
|
"format_version": 1,
|
||||||
|
"model": {
|
||||||
|
"id": "bworld:juicer",
|
||||||
|
"textures": {
|
||||||
|
"0": "bworld:juicer_side",
|
||||||
|
"1": "bworld:juicer_bottom",
|
||||||
|
"2": "bworld:juicer_top",
|
||||||
|
"particle": "bworld:juicer_side"
|
||||||
|
},
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"from": [0, 0, 0],
|
||||||
|
"to": [16, 2, 16],
|
||||||
|
"faces": {
|
||||||
|
"north": { "texture": "#0", "uv": [0, 0, 16, 2] },
|
||||||
|
"east": { "texture": "#0", "uv": [0, 0, 16, 2] },
|
||||||
|
"south": { "texture": "#0", "uv": [0, 0, 16, 2] },
|
||||||
|
"west": { "texture": "#0", "uv": [0, 0, 16, 2] },
|
||||||
|
"top": { "texture": "#1", "uv": [0, 0, 16, 16] },
|
||||||
|
"bottom": { "texture": "#1", "uv": [0, 0, 16, 16] }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [0, 2, 0],
|
||||||
|
"to": [2, 14, 2],
|
||||||
|
"faces": {
|
||||||
|
"north": { "texture": "#0", "uv": [0, 0, 2, 12] },
|
||||||
|
"east": { "texture": "#0", "uv": [0, 0, 2, 12] },
|
||||||
|
"south": { "texture": "#0", "uv": [0, 0, 2, 12] },
|
||||||
|
"west": { "texture": "#0", "uv": [0, 0, 2, 12] },
|
||||||
|
"top": { "texture": "#0", "uv": [0, 0, 2, 2] },
|
||||||
|
"bottom": { "texture": "#0", "uv": [0, 0, 2, 2] }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [14, 2, 0],
|
||||||
|
"to": [16, 14, 2],
|
||||||
|
"faces": {
|
||||||
|
"north": { "texture": "#0", "uv": [0, 0, 2, 12] },
|
||||||
|
"east": { "texture": "#0", "uv": [0, 0, 2, 12] },
|
||||||
|
"south": { "texture": "#0", "uv": [0, 0, 2, 12] },
|
||||||
|
"west": { "texture": "#0", "uv": [0, 0, 2, 12] },
|
||||||
|
"top": { "texture": "#0", "uv": [0, 0, 2, 2] },
|
||||||
|
"bottom": { "texture": "#0", "uv": [0, 0, 2, 2] }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [14, 2, 14],
|
||||||
|
"to": [16, 14, 16],
|
||||||
|
"faces": {
|
||||||
|
"north": { "texture": "#0", "uv": [0, 0, 2, 12] },
|
||||||
|
"east": { "texture": "#0", "uv": [0, 0, 2, 12] },
|
||||||
|
"south": { "texture": "#0", "uv": [0, 0, 2, 12] },
|
||||||
|
"west": { "texture": "#0", "uv": [0, 0, 2, 12] },
|
||||||
|
"top": { "texture": "#0", "uv": [0, 0, 2, 2] },
|
||||||
|
"bottom": { "texture": "#0", "uv": [0, 0, 2, 2] }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [0, 2, 14],
|
||||||
|
"to": [2, 14, 16],
|
||||||
|
"faces": {
|
||||||
|
"north": { "texture": "#0", "uv": [0, 0, 2, 12] },
|
||||||
|
"east": { "texture": "#0", "uv": [0, 0, 2, 12] },
|
||||||
|
"south": { "texture": "#0", "uv": [0, 0, 2, 12] },
|
||||||
|
"west": { "texture": "#0", "uv": [0, 0, 2, 12] },
|
||||||
|
"top": { "texture": "#0", "uv": [0, 0, 2, 2] },
|
||||||
|
"bottom": { "texture": "#0", "uv": [0, 0, 2, 2] }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [0, 14, 0],
|
||||||
|
"to": [16, 16, 16],
|
||||||
|
"faces": {
|
||||||
|
"north": { "texture": "#0", "uv": [0, 0, 16, 2] },
|
||||||
|
"east": { "texture": "#0", "uv": [0, 0, 16, 2] },
|
||||||
|
"south": { "texture": "#0", "uv": [0, 0, 16, 2] },
|
||||||
|
"west": { "texture": "#0", "uv": [0, 0, 16, 2] },
|
||||||
|
"top": { "texture": "#2", "uv": [0, 0, 16, 16] },
|
||||||
|
"bottom": { "texture": "#1", "uv": [0, 0, 16, 16] }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [5, 8, 5],
|
||||||
|
"to": [11, 10, 11],
|
||||||
|
"faces": {
|
||||||
|
"north": { "texture": "#0", "uv": [5, 0, 11, 2] },
|
||||||
|
"east": { "texture": "#0", "uv": [5, 0, 11, 2] },
|
||||||
|
"south": { "texture": "#0", "uv": [5, 0, 11, 2] },
|
||||||
|
"west": { "texture": "#0", "uv": [5, 0, 11, 2] },
|
||||||
|
"top": { "texture": "#2", "uv": [5, 5, 11, 11] },
|
||||||
|
"bottom": { "texture": "#1", "uv": [5, 5, 11, 11] }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [7, 10, 7],
|
||||||
|
"to": [9, 14, 9],
|
||||||
|
"faces": {
|
||||||
|
"north": { "texture": "#0", "uv": [0, 0, 2, 4] },
|
||||||
|
"east": { "texture": "#0", "uv": [0, 0, 2, 4] },
|
||||||
|
"south": { "texture": "#0", "uv": [0, 0, 2, 4] },
|
||||||
|
"west": { "texture": "#0", "uv": [0, 0, 2, 4] },
|
||||||
|
"top": { "texture": "#0", "uv": [0, 0, 2, 2] },
|
||||||
|
"bottom": { "texture": "#0", "uv": [0, 0, 2, 2] }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
// the base game's block and item behavior, written against the same api as any other mod
|
// the base game's block and item behavior, written against the same api as any other mod
|
||||||
import type { BlockRef, Container, Player, Season, ServerContext } from "bworld/server";
|
import type { BlockRef, Container, FluidVariant, Player, Season, ServerContext } from "bworld/server";
|
||||||
import { register_curios } from "./curios.ts";
|
import { register_curios } from "./curios.ts";
|
||||||
import { register_effects } from "./effects.ts";
|
import { register_effects } from "./effects.ts";
|
||||||
import { register_fishing } from "./fishing.ts";
|
import { register_fishing } from "./fishing.ts";
|
||||||
@@ -25,9 +25,7 @@ export function setup(ctx: ServerContext) {
|
|||||||
register_door(ctx);
|
register_door(ctx);
|
||||||
register_trapdoor(ctx);
|
register_trapdoor(ctx);
|
||||||
register_buckets(ctx);
|
register_buckets(ctx);
|
||||||
// what juice is made from, read by whatever makes it, like create's press. the juice's name and color are in
|
register_juicer(ctx);
|
||||||
// shared.ts
|
|
||||||
ctx.components.register_item<JuiceableParams>("bworld:juiceable", {});
|
|
||||||
register_curios(ctx);
|
register_curios(ctx);
|
||||||
register_effects(ctx);
|
register_effects(ctx);
|
||||||
register_growable_block(ctx);
|
register_growable_block(ctx);
|
||||||
@@ -850,6 +848,76 @@ function register_buckets(ctx: ServerContext) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the juicer has no screen. right clicking it with something juiceable puts that in, one kind at a time, and
|
||||||
|
// pressing it (sneaking with an empty hand) JUICER_PRESSES times turns one of it into its juice, while that fits in the
|
||||||
|
// tank. right clicking it with an empty fluid container fills it from the tank. breaking it drops what's in it, and the
|
||||||
|
// juice is lost
|
||||||
|
const JUICE = "bworld:juice";
|
||||||
|
const JUICER_PRESSES = 4;
|
||||||
|
const JUICER_CAPACITY = 1000;
|
||||||
|
|
||||||
|
interface JuicerData {
|
||||||
|
container?: string;
|
||||||
|
// how many times it's been pressed toward the next juice
|
||||||
|
presses?: number;
|
||||||
|
tank?: { fluid: FluidVariant; amount: number };
|
||||||
|
}
|
||||||
|
|
||||||
|
function register_juicer(ctx: ServerContext) {
|
||||||
|
// what juice is made from, read by whatever makes it, like the juicer. the juice's name and color are in shared.ts
|
||||||
|
ctx.components.register_item<JuiceableParams>("bworld:juiceable", {});
|
||||||
|
const juiceable = (id: string) => ctx.items.components(id)["bworld:juiceable"] as JuiceableParams | undefined;
|
||||||
|
|
||||||
|
ctx.components.register_block("bworld:juicer", {
|
||||||
|
on_interact(block, _params, player) {
|
||||||
|
const held = player.held_item;
|
||||||
|
const container = block_container(ctx, block, 1);
|
||||||
|
const data = block.data as JuicerData;
|
||||||
|
if (held && juiceable(held.id)) {
|
||||||
|
held.count = container.add(held)?.count ?? 0;
|
||||||
|
// true even when none fit, so the fruit isn't eaten instead
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const capacity = held && ctx.items.fluid_capacity(held.id);
|
||||||
|
if (held && capacity !== undefined) {
|
||||||
|
if ((held.data as { fluid?: unknown } | undefined)?.fluid !== undefined) return false;
|
||||||
|
const tank = data.tank;
|
||||||
|
if (!tank || tank.amount < capacity) return false;
|
||||||
|
const amount = tank.amount - capacity;
|
||||||
|
block.data = { ...data, tank: amount > 0 ? { ...tank, amount } : undefined } satisfies JuicerData;
|
||||||
|
player.exchange_held({ id: held.id, count: 1, data: { fluid: tank.fluid } });
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (held || !player.is_sneaking()) return false;
|
||||||
|
const item = container.get(0);
|
||||||
|
const params = item && juiceable(item.id);
|
||||||
|
if (!item || !params) return false;
|
||||||
|
const juice: FluidVariant = { id: JUICE, data: { item: item.id } };
|
||||||
|
const tank = data.tank;
|
||||||
|
const fits = (tank ? tank.amount : 0) + params.juice <= JUICER_CAPACITY &&
|
||||||
|
(!tank || ctx.fluids.same(tank.fluid, juice));
|
||||||
|
if (!fits) return false;
|
||||||
|
const presses = (data.presses ?? 0) + 1;
|
||||||
|
if (presses < JUICER_PRESSES) {
|
||||||
|
block.data = { ...data, presses } satisfies JuicerData;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
item.count -= 1;
|
||||||
|
block.data = {
|
||||||
|
...data,
|
||||||
|
presses: 0,
|
||||||
|
tank: { fluid: juice, amount: (tank?.amount ?? 0) + params.juice },
|
||||||
|
} satisfies JuicerData;
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
on_break(block) {
|
||||||
|
drop_contents(ctx, block);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
interface GrowableBlockParams {
|
interface GrowableBlockParams {
|
||||||
// what grows on top of it
|
// what grows on top of it
|
||||||
block_id: string;
|
block_id: string;
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 304 B |
Binary file not shown.
|
After Width: | Height: | Size: 217 B |
Binary file not shown.
|
After Width: | Height: | Size: 344 B |
@@ -7,6 +7,9 @@
|
|||||||
"nutrition": 2,
|
"nutrition": 2,
|
||||||
"saturation_modifier": 0.4
|
"saturation_modifier": 0.4
|
||||||
},
|
},
|
||||||
"base_sell_value": 35
|
"base_sell_value": 35,
|
||||||
|
"components": {
|
||||||
|
"bworld:juiceable": { "juice": 500, "color": "#7ab244" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,9 @@
|
|||||||
"nutrition": 1,
|
"nutrition": 1,
|
||||||
"saturation_modifier": 0.3
|
"saturation_modifier": 0.3
|
||||||
},
|
},
|
||||||
"base_sell_value": 15
|
"base_sell_value": 15,
|
||||||
|
"components": {
|
||||||
|
"bworld:juiceable": { "juice": 250, "color": "#c0341f" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+71
-6
@@ -1,12 +1,14 @@
|
|||||||
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
// SPDX-FileCopyrightText: 2026 Paula Wisnievski
|
||||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
// juice: one fluid named and colored after the bworld:juiceable item in its data
|
// juice: one fluid named and colored after the bworld:juiceable item in its data, and the juicer that makes it
|
||||||
import { assert, assertEquals } from "@std/assert";
|
import { assert, assertEquals } from "@std/assert";
|
||||||
import { EverythingRegistry, type ItemRegistry } from "$/common/everything_registry.ts";
|
import { EverythingRegistry, type ItemRegistry } from "$/common/everything_registry.ts";
|
||||||
import type { FluidJson } from "$/common/mod_data.ts";
|
import type { FluidJson } from "$/common/mod_data.ts";
|
||||||
import { display_name } from "$/common/utils.ts";
|
import { display_name } from "$/common/utils.ts";
|
||||||
import { copy_dir, test_game } from "./helpers.ts";
|
import { copy_dir, stone_floor, test_game } from "./helpers.ts";
|
||||||
|
|
||||||
|
const CLOUDBERRY = "testberries:cloudberry";
|
||||||
|
|
||||||
// mods/bworld and another mod with a juiceable berry, so there's always one whatever bworld's items have
|
// mods/bworld and another mod with a juiceable berry, so there's always one whatever bworld's items have
|
||||||
async function setup() {
|
async function setup() {
|
||||||
@@ -26,18 +28,18 @@ async function setup() {
|
|||||||
write("items/cloudberry.json", {
|
write("items/cloudberry.json", {
|
||||||
format_version: 1,
|
format_version: 1,
|
||||||
item: {
|
item: {
|
||||||
id: "testberries:cloudberry",
|
id: CLOUDBERRY,
|
||||||
texture: "engine:missing",
|
texture: "engine:missing",
|
||||||
components: { "bworld:juiceable": { juice: 100, color: "#e0a030" } },
|
components: { "bworld:juiceable": { juice: 100, color: "#e0a030" } },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const { game } = await test_game(dir);
|
const t = await test_game(dir);
|
||||||
Deno.removeSync(dir, { recursive: true });
|
Deno.removeSync(dir, { recursive: true });
|
||||||
return game.mods.fluid_rules.api();
|
return { ...t, fluids: t.game.mods.fluid_rules.api() };
|
||||||
}
|
}
|
||||||
|
|
||||||
Deno.test("juice made from any item with bworld:juiceable is named after it, in the component's color", async () => {
|
Deno.test("juice made from any item with bworld:juiceable is named after it, in the component's color", async () => {
|
||||||
const fluids = await setup();
|
const { fluids } = await setup();
|
||||||
const juiceable = EverythingRegistry.entries<ItemRegistry>("items")
|
const juiceable = EverythingRegistry.entries<ItemRegistry>("items")
|
||||||
.filter(([, item]) => item.components?.["bworld:juiceable"]);
|
.filter(([, item]) => item.components?.["bworld:juiceable"]);
|
||||||
assert(juiceable.length > 0);
|
assert(juiceable.length > 0);
|
||||||
@@ -54,3 +56,66 @@ Deno.test("juice made from any item with bworld:juiceable is named after it, in
|
|||||||
plain.color,
|
plain.color,
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Deno.test("the juicer takes juiceable items, juices one every 4 presses, and fills empty containers from it", async () => {
|
||||||
|
const t = await setup();
|
||||||
|
t.join(1, "alice");
|
||||||
|
stone_floor(t.game);
|
||||||
|
const move = (sneaking: boolean) =>
|
||||||
|
t.send(1, { type: "move", x: 0.5, y: 100, z: 0.5, yaw: 0, pitch: 0, ...(sneaking && { sneaking }) });
|
||||||
|
move(false);
|
||||||
|
const player = t.game.players()[0];
|
||||||
|
const api = t.game.mods.player(player);
|
||||||
|
api.give_item(CLOUDBERRY, 4);
|
||||||
|
api.give_item("bworld:glass_bottle", 2);
|
||||||
|
// selects the slot with id, or an empty one without
|
||||||
|
const hold = (id?: string) =>
|
||||||
|
t.send(1, {
|
||||||
|
type: "select_slot",
|
||||||
|
slot: player.inventory.to_data().findIndex((item) => (item?.id ?? null) === (id ?? null)),
|
||||||
|
});
|
||||||
|
const use = () => t.send(1, { type: "use_block", x: 1, y: 100, z: 0, face: "top" });
|
||||||
|
const press = (times: number) => {
|
||||||
|
hold();
|
||||||
|
move(true);
|
||||||
|
for (let i = 0; i < times; i++) use();
|
||||||
|
move(false);
|
||||||
|
};
|
||||||
|
// the bottles, empty ones first
|
||||||
|
const bottles = () =>
|
||||||
|
player.inventory.to_data().filter((item) => item?.id === "bworld:glass_bottle")
|
||||||
|
.sort((a, b) => Number(a!.data !== undefined) - Number(b!.data !== undefined));
|
||||||
|
t.game.set_block(1, 100, 0, "bworld:juicer");
|
||||||
|
|
||||||
|
hold(CLOUDBERRY);
|
||||||
|
use();
|
||||||
|
assertEquals(player.inventory.to_data().filter((item) => item?.id === CLOUDBERRY), []);
|
||||||
|
// right clicking with an empty hand without sneaking doesn't press it
|
||||||
|
hold();
|
||||||
|
use();
|
||||||
|
|
||||||
|
// 2 cloudberries and 3 presses toward the next are 200 mB, not a bottle's 250
|
||||||
|
press(11);
|
||||||
|
hold("bworld:glass_bottle");
|
||||||
|
use();
|
||||||
|
assertEquals(bottles(), [{ id: "bworld:glass_bottle", count: 2 }]);
|
||||||
|
|
||||||
|
// the 3rd makes 300 mB, a bottle and 50 mB left, which isn't another
|
||||||
|
press(1);
|
||||||
|
hold("bworld:glass_bottle");
|
||||||
|
use();
|
||||||
|
use();
|
||||||
|
const juice = { id: "bworld:juice", data: { item: CLOUDBERRY } };
|
||||||
|
assertEquals(bottles(), [
|
||||||
|
{ id: "bworld:glass_bottle", count: 1 },
|
||||||
|
{ id: "bworld:glass_bottle", count: 1, data: { fluid: juice } },
|
||||||
|
]);
|
||||||
|
|
||||||
|
// the cloudberry it didn't press yet comes out when it's broken
|
||||||
|
t.send(1, { type: "break_block", x: 1, y: 100, z: 0 });
|
||||||
|
const dropped = t.game.item_entities().map((entity) => entity.item.to_data());
|
||||||
|
assertEquals(dropped.sort((a, b) => a.id.localeCompare(b.id)), [
|
||||||
|
{ id: "bworld:juicer", count: 1 },
|
||||||
|
{ id: CLOUDBERRY, count: 1 },
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user