Remove duplicate code

This commit is contained in:
2026-10-13 11:57:43 -03:00
parent dfc6a6d77b
commit 5165698fe3
50 changed files with 307 additions and 812 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ import { assert, assertEquals, assertStringIncludes } from "@std/assert";
import { entity_model_from_geo, validate_entity } from "$/common/mod_data.ts";
import { Mob } from "$/server/game/entity/mob.ts";
import { create_entity } from "$/server/game/entity/entity_types.ts";
import { test_game } from "./helpers.ts";
import { container_items, test_game } from "./helpers.ts";
Deno.test("a bedrock geo.json becomes an entity model with only what the engine uses", () => {
const geo = JSON.parse(Deno.readTextFileSync("mods/bworld/models/chicken.geo.json"));
@@ -95,7 +95,7 @@ Deno.test("solid blocks can't be placed where a mob or player is", async () => {
game.set_block(1, 100, 1, "bworld:stone");
send(1, { type: "move", x: 3.5, y: 101, z: 3.5, yaw: 0, pitch: 0 });
send(1, { type: "chat", text: "/give bworld:stone 2" });
const inventory = take(1).filter((m) => m.type === "container" && m.container === "inventory").at(-1).items;
const inventory = container_items(take(1), "inventory");
send(1, { type: "select_slot", slot: inventory.findIndex((i: { id: string } | null) => i?.id === "bworld:stone") });
// the chicken's box pokes into the block above the stone, even from the one next to it