SciCraft/server_pack/kubejs/server_scripts/02_events.js
MiTHRAL 2fdd487786
All checks were successful
Build & Release Pack / build (push) Successful in 1m40s
fix: singleplayer join crash (mekanismcovers sodium mixin) + KubeJS/LootJS API migration
FATAL fix — mekanismcovers Sodium mixin crash:
- mekanismcovers 1.3-BETA targets an old Sodium BlockRenderer API that
  doesn't exist in Sodium 0.8.13 → 'No refMap loaded' InjectionError.
- Add config/mekanismcovers.json with disableAdvancedCoverRendering=true
  (the mod's documented workaround for Sodium/Iris/Embeddium crashes).
  Also set enableShaderCompatibleRendering=true.

KubeJS 2101.x API migration (global assignment no longer allowed):
- Remove 00_lore.js (it only set global.SCICRAFT, which is now forbidden)
- Inline the config object into 01_corruption_tide/02_events/03_recipes
  (global.SCICRAFT → local const SC per script)
- Remove unused 'const SC = global.SCICRAFT' from registry_blocks.js

LootJS 3.x API migration:
- addEntityLootModifier → addEntityModifier (04_loot.js, 7 call sites)

Pack validates: client 140 / server 118 mods, 57 story keys.
2026-08-19 21:32:35 -04:00

48 lines
No EOL
1.6 KiB
JavaScript

// SCICRAFT — The Dark Photon Protocol
// Player-side lore events: the Resonance, void exposure, and held-item powers.
const SC = {
items: {
photon_core: 'scicraft:photon_core',
void_stabilizer: 'scicraft:void_stabilizer'
},
dimensions: {
void_dim: 'thevoiddimension:overworld',
darker_dim: 'deeperdarker:otherside'
}
}
// Proto-Time-Lord: holding a Photon Core or Stabilizer lets you feel the seals.
PlayerEvents.tick(event => {
if (event.player.server.ticks % 40 !== 0) return
const held = event.player.mainHandItem
if (held.id === SC.items.photon_core) {
event.player.potionEffects.add('minecraft:night_vision', 140, 0, true, false)
}
if (held.id === SC.items.void_stabilizer) {
event.player.potionEffects.add('minecraft:speed', 120, 0, true, false)
event.player.potionEffects.add('minecraft:regeneration', 120, 0, true, false)
}
})
// The wound is physically hostile. Being inside it costs you.
PlayerEvents.tick(event => {
const dim = String(event.player.level.dimension)
if (dim === SC.dimensions.void_dim) {
if (event.player.server.ticks % 100 === 0) {
event.player.hurt('minecraft:generic', 1.0)
}
} else if (dim === SC.dimensions.darker_dim) {
if (event.player.server.ticks % 200 === 0) {
event.player.potionEffects.add('minecraft:wither', 80, 0, true, false)
}
}
})
// Arrival in the wound triggers the first vision.
PlayerEvents.loggedIn(event => {
event.player.tell(Text.translate('scicraft.phrases.signal'))
})
// Note: Warden fragment drops are handled in 04_loot.js (LootJS) — do not
// duplicate them here or players get double drops.