Grubs for seashrooms

This commit is contained in:
2026-10-12 02:32:54 -03:00
parent df26248f4a
commit 726a52b91a
6 changed files with 73 additions and 12 deletions
@@ -0,0 +1,27 @@
{
"format_version": 1,
"loot_table": {
"pools": [
{
"entries": [
{ "item": "bworld:white_seashroom" },
{ "item": "bworld:light_gray_seashroom" },
{ "item": "bworld:gray_seashroom" },
{ "item": "bworld:black_seashroom" },
{ "item": "bworld:brown_seashroom" },
{ "item": "bworld:red_seashroom" },
{ "item": "bworld:orange_seashroom" },
{ "item": "bworld:yellow_seashroom" },
{ "item": "bworld:lime_seashroom" },
{ "item": "bworld:green_seashroom" },
{ "item": "bworld:cyan_seashroom" },
{ "item": "bworld:light_blue_seashroom" },
{ "item": "bworld:blue_seashroom" },
{ "item": "bworld:purple_seashroom" },
{ "item": "bworld:magenta_seashroom" },
{ "item": "bworld:pink_seashroom" }
]
}
]
}
}
@@ -0,0 +1,14 @@
{
"format_version": 1,
"loot_table": {
"pools": [
{
"entries": [
{ "item": "bworld:crayfish" },
{ "item": "bworld:chorus_snail" },
{ "item": "bworld:leech" }
]
}
]
}
}
+9 -8
View File
@@ -269,12 +269,13 @@ const ADDITION = 2;
const RESULT = 3;
// the crab pot's menu: its bait slot at the top, and a row of 9 slots under it for what it catches, which players can
// only take from. every morning a crab pot in water with worms in it uses one up to catch something: from the
// saltwater table in an ocean, the freshwater one anywhere else. a catch that doesn't fit is let go, and keeps the
// worm
// only take from. every morning a crab pot in water with bait in it uses one up to catch something: from the bait's
// saltwater table in an ocean, its freshwater one anywhere else. a catch that doesn't fit is let go, and keeps the
// bait
const CRABPOT_BAIT = 0;
const CRABPOT_OUTPUT = 9;
const CRABPOT_WORMS = "bworld:worms";
// each bait's loot tables, bworld:gameplay/crabpot_<name>_saltwater and _freshwater
const CRABPOT_BAITS: Record<string, string> = { "bworld:worms": "worms", "bworld:grubs": "grubs" };
function register_crabpot(ctx: ServerContext) {
const menu_type = ctx.menus.register<BlockRef>("bworld:crabpot", (menu, block) => {
@@ -304,13 +305,13 @@ function register_crabpot(ctx: ServerContext) {
// one that's never been opened has nothing in it
const container = block.data?.container && ctx.containers.get(block.data.container);
const bait = container && container.get(CRABPOT_BAIT);
if (!bait || bait.id !== CRABPOT_WORMS) {
const bait_name = bait && CRABPOT_BAITS[bait.id];
if (!bait || !bait_name) {
return;
}
const table = ctx.tags.has("biomes", "bworld:is_ocean", block.biome)
? "bworld:gameplay/crabpot_saltwater"
: "bworld:gameplay/crabpot_freshwater";
const water = ctx.tags.has("biomes", "bworld:is_ocean", block.biome) ? "saltwater" : "freshwater";
const table = `bworld:gameplay/crabpot_${bait_name}_${water}`;
const position = { x: x + 0.5, y: y + 0.5, z: z + 0.5 };
for (const item of ctx.loot.roll(table, { position })) {
// onto a stack of it with room, or into an empty output slot