Make the fishing loot table be generated from the fish items

This commit is contained in:
2026-10-11 11:40:44 -03:00
parent 5a59a63862
commit ab2b8e6545
9 changed files with 86 additions and 47 deletions
+6
View File
@@ -1,6 +1,7 @@
// what server scripts get, see docs/modding/
import type { EventSignal, Face, Id, ItemStack, ModInfo, Position, Season, TagApi } from "./shared.ts";
import type { ArgumentType, CommandNode } from "../commands.ts";
import type { LootTableJson } from "../loot.ts";
export type { ArgumentType, CommandContext, CommandNode, Suggestion } from "../commands.ts";
@@ -375,6 +376,8 @@ export interface ContainerApi {
export interface ItemApi {
exists(id: Id): boolean;
// every item, in load order
ids(): Id[];
// how many fit in one slot
max_stack(id: Id): number;
// the tool type it is, like "pickaxe" or "shovel", from the item's "tool"
@@ -443,6 +446,9 @@ export interface LootApi {
// changes what a table gives every time it's rolled, or every table's with "*", like neoforge's global loot
// modifiers. return the new items, or change the list. only during setup
modify(table: Id | "*", fn: (items: ItemStack[], context: LootContext, table: Id) => ItemStack[] | void): void;
// a table made by the script instead of a file, like the base game's fishing table built from its fish. the json
// is what a file's "loot_table" is, the id is in the mod's namespace. only during setup
register_table(id: Id, table: Omit<LootTableJson, "id">): void;
}
// forms, not built yet: menus whose screens the engine provides, see docs/modding_plan.md