Files
brass-and-sigil/pack/overrides/kubejs/server_scripts/welcome.js
Matt 9f0c9e262a pack: content + storage batch v0.24.0 -> v0.26.0
Mods added (in lockfile):
  v0.24.0  YUNG's structure mods (9):
           - Better Dungeons, Better Mineshafts, Better Ocean
             Monuments, Better Nether Fortresses, Better End Island,
             Better Witch Huts, Better Desert Temples, Better Jungle
             Temples, Bridges, Extras
  v0.24.1  Create: Radars (Aeronautics-compatible from v0.4.5.1+)
  v0.24.2  Ars Creo + Create Ars Compact (the latter removed in 0.25.0)
  v0.24.3  FallingTree (whole-tree chop on axe hit)
  v0.24.4  Copycats+, Create: Connected, Create: Interiors
  v0.24.5  Create: Power Loader (Aeronautics-airship chunkloading)
  v0.24.6  -- KubeJS bridges only (see below)
  v0.24.7  -- Patchouli welcome book attempt 1 (kubejs/data) -- failed
  v0.24.8  -- Patchouli attempt 2 (assets/data split) -- failed
  v0.24.9  -- Patchouli attempt 3 (patchouli_books/ root path) -- worked
  v0.25.0  REMOVED Create Ars Compact (broken sauce:source_fluid recipes,
           no public tracker, half-finished compat layer);
           added Create: Dragons Plus, Create: Enchantment Industry
  v0.26.0  Sophisticated Core/Storage/Backpacks/Create-Integration,
           Create: Additional Logistics

KubeJS additions:
  - supplementaries_bridges.js: flax -> 2x string via Create Press,
    Plunderer drops 1-3 spurs via EntityEvents.drops
  - recipes_numismatics.js: renamed COIN_IDS -> COIN_RECIPE_REMOVE_IDS
    to avoid Rhino global-scope collision with numismatics_tooltips.js,
    added sprocket to the removal list (was missing)
  - welcome.js: migrated from vanilla written_book (broken Filterable
    codec in 1.21) to Patchouli book at patchouli_books/manual/

Patchouli manual:
  - 5 entries (Welcome, Waystones, Money, Plots, Rules) under one
    "Server Basics" category
  - Lives at pack/overrides/patchouli_books/ (root path) -- this is
    the modpack-author path per Patchouli docs, NOT data/+assets/
    which is for mods bundled in jars
  - Book id: patchouli:manual (default namespace in this mode)

All v0.24-v0.26 work has been live on the server and tested.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 22:42:32 +00:00

48 lines
1.8 KiB
JavaScript

// Brass & Sigil -- first-join welcome grant
//
// Gives each new player exactly 1 Waystone + 1 Patchouli manual on
// first login. Gated by a per-player persistent flag so it fires once
// even if the player relogs.
//
// The manual is a Patchouli book ("patchouli:manual") shipped in the
// pack's root patchouli_books/ folder (the modpack-author path that
// Patchouli's docs recommend for non-mod books).
// Folder layout:
// patchouli_books/manual/book.json
// patchouli_books/manual/en_us/categories/<name>.json
// patchouli_books/manual/en_us/entries/<name>.json
// Namespace defaults to "patchouli" in this mode -- the book id is
// "patchouli:manual".
const WELCOME_FLAG = 'bnsWelcomeGranted';
function giveManual(player) {
// Patchouli's guide_book uses the "patchouli:book" data component
// (1.21 component system) to identify which book to open. Plain
// resource location string is the expected value type.
const book = Item.of('patchouli:guide_book');
book.set('patchouli:book', 'patchouli:manual');
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.'));
console.info(`[bns/welcome] granted starter packet to ${player.username}`);
} catch (e) {
// If something goes wrong, don't set the flag -- player gets another chance.
console.error(`[bns/welcome] failed for ${player.username}: ${e}`);
}
});