SciCraft/client_pack/kubejs/server_scripts/05_protocol_tome.js
MiTHRAL ff02f1df0c
All checks were successful
Build & Release Pack / build (push) Successful in 1m47s
feat(v1.0.8): realistic worldgen + bundled shader/resource packs + Protocol Tome + Lithium
- Worldgen (both packs): Terralith 2.6.2, Tectonic 3.0.26, Continents 1.1.12
  (realistic continent-based overworld; applies to NEW worlds)
- Client: bundle MakeUp Ultra Fast shaderpack (LGPL) + Vanilla Live resource
  pack (CC-BY-SA), force-enabled via Resource Pack Overrides
- FTB Quests: add Protocol Tome starter item (given on first login) that opens
  the quest book via KubeJS network -> FTBQuestsClient.openGui(); + lang keys
- Optimize: add Lithium 0.15.4 (NeoForge 1.21.1) to both packs
- Docs: mods.md updated with worldgen/shader/resource/quest notes
2026-08-20 16:11:22 -04:00

31 lines
1.1 KiB
JavaScript

// SCICRAFT — The Dark Photon Protocol
// Protocol Tome: starter item that makes the FTB Quests guidance unmissable.
// - Given to each player once on first login.
// - Right-clicking it opens the FTB Quests book on the client.
const TOME_SC = {
item: 'scicraft:protocol_tome',
channel: 'scicraft:open_quests',
give_flag: 'scicraft_got_tome'
}
// Give the Tome once per player on first login.
PlayerEvents.loggedIn(event => {
const player = event.player
if (player.persistentData.contains(TOME_SC.give_flag)) return
player.persistentData.putBoolean(TOME_SC.give_flag, true)
// Give on the next tick so the player is fully in-world first.
event.server.scheduleInTicks(10, () => {
if (!player.isOnline()) return
player.give(Item.of(TOME_SC.item))
player.tell(Text.translate('scicraft.phrases.tome_given'))
})
})
// Right-clicking the Tome asks the client to open the FTB Quests book.
ItemEvents.rightClicked(event => {
if (event.item.id !== TOME_SC.item) return
if (event.player.crouching) return
event.player.sendData(TOME_SC.channel, {})
event.cancel()
})