diff --git a/pack/overrides/kubejs/client_scripts/jei_hides.js b/pack/overrides/kubejs/client_scripts/jei_hides.js new file mode 100644 index 0000000..37ead8a --- /dev/null +++ b/pack/overrides/kubejs/client_scripts/jei_hides.js @@ -0,0 +1,52 @@ +// Brass & Sigil — JEI hides +// +// Hides all Waystones items + all Numismatics coin items from the JEI +// item list. Combined with the server-side recipe removal in +// economy_policy.js, players don't see crafting recipes OR the item +// icons in the JEI ingredient list -- they only ever encounter these +// items through the welcome grant or the bank exchange. + +const COLORS = [ + 'white', 'orange', 'magenta', 'light_blue', 'yellow', 'lime', + 'pink', 'gray', 'light_gray', 'cyan', 'purple', 'blue', + 'brown', 'green', 'red', 'black', +]; + +const WAYSTONE_ITEMS = [ + // regular waystone variants + 'waystones:waystone', + 'waystones:mossy_waystone', + 'waystones:sandy_waystone', + 'waystones:blackstone_waystone', + 'waystones:deepslate_waystone', + 'waystones:end_stone_waystone', + // handheld + plate + 'waystones:warp_stone', + 'waystones:warp_scroll', + 'waystones:bound_scroll', + 'waystones:return_scroll', + 'waystones:warp_plate', + // sharestones (16 colors) + shards + 'waystones:sharestone', // base id if registered +]; +COLORS.forEach(c => { + WAYSTONE_ITEMS.push(`waystones:${c}_sharestone`); + WAYSTONE_ITEMS.push(`waystones:${c}_portstone`); +}); + +const COIN_ITEMS = [ + 'numismatics:spur', + 'numismatics:bevel', + 'numismatics:sundial', + 'numismatics:sun', +]; + +JEIEvents.hideItems(event => { + [...WAYSTONE_ITEMS, ...COIN_ITEMS].forEach(id => { + try { event.hide(id); } catch (e) { + // Some IDs may not exist (e.g. base 'waystones:sharestone' isn't + // registered if only colored variants are). Swallow per-item + // failures so one bad id doesn't break the whole pass. + } + }); +}); diff --git a/pack/overrides/kubejs/server_scripts/economy_policy.js b/pack/overrides/kubejs/server_scripts/economy_policy.js new file mode 100644 index 0000000..eb099e4 --- /dev/null +++ b/pack/overrides/kubejs/server_scripts/economy_policy.js @@ -0,0 +1,24 @@ +// Brass & Sigil — economy policy (recipe removal) +// +// Players can't craft Waystones items (they're distributed by the welcome +// grant -- see welcome.js -- and any replacements come from the bank +// vendor in the future). Players also can't manufacture currency: coins +// only enter circulation through the bank exchange (item-in / coin-out). +// +// Other Numismatics blocks (piggy banks, bank tellers, vendor blocks) stay +// craftable -- those are infrastructure, not currency. + +ServerEvents.recipes(event => { + // Block ALL crafting of Waystones items. The welcome-grant script + // gives each new player exactly one regular waystone; any further + // recovery happens via OP /give or future bank vendor. + event.remove({ mod: 'waystones' }); + + // Block coin manufacturing only -- 4 denominations. + [ + 'numismatics:spur', + 'numismatics:bevel', + 'numismatics:sundial', + 'numismatics:sun', + ].forEach(coin => event.remove({ output: coin })); +}); diff --git a/pack/overrides/kubejs/server_scripts/welcome.js b/pack/overrides/kubejs/server_scripts/welcome.js new file mode 100644 index 0000000..d70f357 --- /dev/null +++ b/pack/overrides/kubejs/server_scripts/welcome.js @@ -0,0 +1,53 @@ +// Brass & Sigil — first-join welcome grant +// +// Gives each new player exactly 1 Waystone + 1 server manual book on +// first login. Gated by a per-player persistent flag so it fires once +// even if the player relogs. +// +// Future: replace the vanilla written book with a Patchouli book in a +// custom tweak jar once we have enough content to warrant the rich +// formatting. Patchouli is already in the pack so swapping later is +// purely a content+recipe change, no mod-add needed. + +const WELCOME_FLAG = 'bnsWelcomeGranted'; + +const MANUAL_PAGES = [ + 'Welcome to Brass & Sigil.\n\nThis manual covers the basics. Read it once, then keep it or toss it.', + 'WAYSTONES\n\nYou have one Waystone item. Place it at your base -- it is the only one you get.\n\nNeed to travel further? Build trains, roads, or Create Aeronautics planes.', + 'MONEY\n\nCoins cannot be crafted.\n\nTake valuables (diamonds etc.) to the bank at spawn. The exchange will trade them for coins.\n\nDynamic rates are planned.', + 'SPAWN PLOTS\n\nComing soon: buy a small commercial plot at spawn to set up your shop. One plot per player.\n\nYour home base goes OUT in the world -- claim it with FTB Chunks (free, anywhere).', + 'RULES\n\n- Be excellent to each other.\n- No griefing.\n- Lost your Waystone? Ask an OP or buy one from the bank (soon).\n- Report bugs to staff.\n\nHave fun.', +]; + +function giveManual(player) { + // 1.21 components-based written book: pages are filterable text + // components, title supports the same. Plain strings are accepted. + const book = Item.of('minecraft:written_book'); + book.set('minecraft:written_book_content', { + title: { raw: 'Brass & Sigil Manual' }, + author: 'Server Staff', + pages: MANUAL_PAGES.map(text => ({ raw: text })), + resolved: true, + }); + player.give(book); +} + +function giveStarterWaystone(player) { + player.give(Item.of('waystones:waystone')); +} + +PlayerEvents.loggedIn(event => { + const player = event.player; + const data = player.persistentData; + if (data.getBoolean(WELCOME_FLAG)) return; + + try { + giveStarterWaystone(player); + giveManual(player); + data.putBoolean(WELCOME_FLAG, true); + player.tell(Text.gold('Welcome to Brass & Sigil. Check your inventory for a Waystone and the server manual.')); + } catch (e) { + // If something goes wrong, don't set the flag -- player gets another chance. + console.error(`[bns/welcome] failed for ${player.username}: ${e}`); + } +}); diff --git a/pack/pack.lock.json b/pack/pack.lock.json index db37f49..b034c1b 100644 --- a/pack/pack.lock.json +++ b/pack/pack.lock.json @@ -1,7 +1,7 @@ { "$schema": "Brass-and-Sigil pack.lock.json - generated, do not edit by hand unless you know what you are doing", "name": "Brass and Sigil", - "version": "0.17.0", + "version": "0.18.0", "minecraft": "1.21.1", "loader": { "type": "neoforge", @@ -481,6 +481,28 @@ "sha1": "488bc70db3730f209e65cbda04c36dbc3918c448", "size": 878265, "side": "both" + }, + { + "source": "modrinth", + "slug": "numismatics", + "versionId": "guON3qvQ", + "version": "1.0.20+neoforge-mc1.21.1", + "path": "mods/CreateNumismatics-1.0.20+neoforge-mc1.21.1.jar", + "url": "https://cdn.modrinth.com/data/Jdbbtt0i/versions/guON3qvQ/CreateNumismatics-1.0.20%2Bneoforge-mc1.21.1.jar", + "sha1": "9883bfd6fef5bd5068f9174ddccba5047849c922", + "size": 693446, + "side": "both" + }, + { + "source": "modrinth", + "slug": "patchouli", + "versionId": "BIogJv2D", + "version": "1.21.1-93-neoforge", + "path": "mods/Patchouli-1.21.1-93-NEOFORGE.jar", + "url": "https://cdn.modrinth.com/data/nU0bVIaL/versions/BIogJv2D/Patchouli-1.21.1-93-NEOFORGE.jar", + "sha1": "5413bb9b8fc35ebe46b06b48bf9afafbd8471140", + "size": 646777, + "side": "both" } ], "defaultServer": {