From 26a9fe775d7d30fd67fae80cb70da7e080287561 Mon Sep 17 00:00:00 2001 From: MiTHRAL Date: Wed, 19 Aug 2026 22:14:35 -0400 Subject: [PATCH] fix: KubeJS redeclaration of const SC across server scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three server scripts each declared 'const SC' at top level, but KubeJS 2101 shares a single global scope across all server scripts → 'redeclaration of const SC' TypeError. Rename per-file to unique consts: - 01_corruption_tide.js → const TIDE_SC - 02_events.js → const EVENTS_SC - 03_recipes_tags.js → const RECIPES_SC (The IP warnings in the log — Iris portal artifacts + HAR 1010 wrong-mods — are informational from the IPSable fork, not errors.) --- .../server_scripts/01_corruption_tide.js | 8 ++++---- .../kubejs/server_scripts/02_events.js | 10 +++++----- .../kubejs/server_scripts/03_recipes_tags.js | 20 +++++++++---------- .../server_scripts/01_corruption_tide.js | 8 ++++---- .../kubejs/server_scripts/02_events.js | 10 +++++----- .../kubejs/server_scripts/03_recipes_tags.js | 20 +++++++++---------- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/client_pack/kubejs/server_scripts/01_corruption_tide.js b/client_pack/kubejs/server_scripts/01_corruption_tide.js index 0292e04..a6607dc 100644 --- a/client_pack/kubejs/server_scripts/01_corruption_tide.js +++ b/client_pack/kubejs/server_scripts/01_corruption_tide.js @@ -2,7 +2,7 @@ // GLOBAL CORRUPTION TIDE. Shared by all players via server persistent data. // Rises while the Doors stay unsealed. Re-seal them at the Lattice to push it back. -const SC = { +const TIDE_SC = { items: { quantum_lattice: 'scicraft:quantum_lattice' }, tide: { key: 'scicraft_corruption', @@ -18,7 +18,7 @@ const SC = { darker_dim: 'deeperdarker:otherside' } } -const T = SC.tide +const T = TIDE_SC.tide function getTide(server) { const data = server.persistentData @@ -38,7 +38,7 @@ ServerEvents.tick(event => { // Every sealed Lattice pushes the tide back, once per stabilizer use. BlockEvents.rightClicked(event => { - if (event.block.id !== SC.items.quantum_lattice) return + if (event.block.id !== TIDE_SC.items.quantum_lattice) return const held = event.player.mainHandItem if (!held.hasTag('scicraft:stabilizer')) return if (event.player.crouching) return @@ -62,7 +62,7 @@ PlayerEvents.tick(event => { } // Inside the wound itself, the dark is absolute. - if (dim === SC.dimensions.void_dim || dim === SC.dimensions.darker_dim) { + if (dim === TIDE_SC.dimensions.void_dim || dim === TIDE_SC.dimensions.darker_dim) { event.player.potionEffects.add('minecraft:darkness', 120, 1, true, false) } }) diff --git a/client_pack/kubejs/server_scripts/02_events.js b/client_pack/kubejs/server_scripts/02_events.js index c9e844c..df658c2 100644 --- a/client_pack/kubejs/server_scripts/02_events.js +++ b/client_pack/kubejs/server_scripts/02_events.js @@ -1,7 +1,7 @@ // SCICRAFT — The Dark Photon Protocol // Player-side lore events: the Resonance, void exposure, and held-item powers. -const SC = { +const EVENTS_SC = { items: { photon_core: 'scicraft:photon_core', void_stabilizer: 'scicraft:void_stabilizer' @@ -17,10 +17,10 @@ PlayerEvents.tick(event => { if (event.player.server.ticks % 40 !== 0) return const held = event.player.mainHandItem - if (held.id === SC.items.photon_core) { + if (held.id === EVENTS_SC.items.photon_core) { event.player.potionEffects.add('minecraft:night_vision', 140, 0, true, false) } - if (held.id === SC.items.void_stabilizer) { + if (held.id === EVENTS_SC.items.void_stabilizer) { event.player.potionEffects.add('minecraft:speed', 120, 0, true, false) event.player.potionEffects.add('minecraft:regeneration', 120, 0, true, false) } @@ -29,11 +29,11 @@ PlayerEvents.tick(event => { // 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 (dim === EVENTS_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) { + } else if (dim === EVENTS_SC.dimensions.darker_dim) { if (event.player.server.ticks % 200 === 0) { event.player.potionEffects.add('minecraft:wither', 80, 0, true, false) } diff --git a/client_pack/kubejs/server_scripts/03_recipes_tags.js b/client_pack/kubejs/server_scripts/03_recipes_tags.js index ff9e675..ac60846 100644 --- a/client_pack/kubejs/server_scripts/03_recipes_tags.js +++ b/client_pack/kubejs/server_scripts/03_recipes_tags.js @@ -1,7 +1,7 @@ // SCICRAFT — The Dark Photon Protocol // The Protocol's crafting chain. Soft-gates the story items behind mod content. -const SC = { +const RECIPES_SC = { items: { photon_fragment: 'scicraft:photon_fragment', photon_core: 'scicraft:photon_core', @@ -14,44 +14,44 @@ const SC = { ServerEvents.recipes(event => { // --- Photon Fragment: harvested from the Darker's own remains. // (LootJS also adds these; this gives a deterministic in-world path.) - event.shapeless(SC.items.photon_fragment, ['minecraft:echo_shard', 'minecraft:glowstone_dust']) + event.shapeless(RECIPES_SC.items.photon_fragment, ['minecraft:echo_shard', 'minecraft:glowstone_dust']) .id('scicraft:photon_fragment_from_echo') // --- Photon Core: compress fragments in a Mekanism-grade press. - event.recipes.create.pressing(SC.items.photon_core, '3x ' + SC.items.photon_fragment) + event.recipes.create.pressing(RECIPES_SC.items.photon_core, '3x ' + RECIPES_SC.items.photon_fragment) .id('scicraft:photon_core_pressing') - event.smelting(SC.items.photon_core, 'minecraft:ender_pearl', 0.5) + event.smelting(RECIPES_SC.items.photon_core, 'minecraft:ender_pearl', 0.5) .id('scicraft:photon_core_smelting') // --- Void Stabilizer: the tool of the Flight — needs a door's key, not ore. - event.shaped(SC.items.void_stabilizer, [ + event.shaped(RECIPES_SC.items.void_stabilizer, [ ' P ', 'PEP', ' P ' ], { - P: SC.items.photon_core, + P: RECIPES_SC.items.photon_core, E: 'minecraft:ender_eye' }).id('scicraft:void_stabilizer') // --- Quantum Lattice: the emitter. Dense, expensive, ongoing. - event.shaped(SC.items.quantum_lattice, [ + event.shaped(RECIPES_SC.items.quantum_lattice, [ 'SCS', 'CPC', 'SCS' ], { S: 'c:ingots/steel', C: 'c:circuits', - P: SC.items.photon_core + P: RECIPES_SC.items.photon_core }).id('scicraft:quantum_lattice') // --- Renegade Glass: the Flight's TARDIS-blue pane. Purely decorative. - event.shaped('8x ' + SC.items.renegade_glass, [ + event.shaped('8x ' + RECIPES_SC.items.renegade_glass, [ 'GGG', 'GPG', 'GGG' ], { G: 'c:glass_blocks', - P: SC.items.photon_fragment + P: RECIPES_SC.items.photon_fragment }).id('scicraft:renegade_glass') }) diff --git a/server_pack/kubejs/server_scripts/01_corruption_tide.js b/server_pack/kubejs/server_scripts/01_corruption_tide.js index 0292e04..a6607dc 100644 --- a/server_pack/kubejs/server_scripts/01_corruption_tide.js +++ b/server_pack/kubejs/server_scripts/01_corruption_tide.js @@ -2,7 +2,7 @@ // GLOBAL CORRUPTION TIDE. Shared by all players via server persistent data. // Rises while the Doors stay unsealed. Re-seal them at the Lattice to push it back. -const SC = { +const TIDE_SC = { items: { quantum_lattice: 'scicraft:quantum_lattice' }, tide: { key: 'scicraft_corruption', @@ -18,7 +18,7 @@ const SC = { darker_dim: 'deeperdarker:otherside' } } -const T = SC.tide +const T = TIDE_SC.tide function getTide(server) { const data = server.persistentData @@ -38,7 +38,7 @@ ServerEvents.tick(event => { // Every sealed Lattice pushes the tide back, once per stabilizer use. BlockEvents.rightClicked(event => { - if (event.block.id !== SC.items.quantum_lattice) return + if (event.block.id !== TIDE_SC.items.quantum_lattice) return const held = event.player.mainHandItem if (!held.hasTag('scicraft:stabilizer')) return if (event.player.crouching) return @@ -62,7 +62,7 @@ PlayerEvents.tick(event => { } // Inside the wound itself, the dark is absolute. - if (dim === SC.dimensions.void_dim || dim === SC.dimensions.darker_dim) { + if (dim === TIDE_SC.dimensions.void_dim || dim === TIDE_SC.dimensions.darker_dim) { event.player.potionEffects.add('minecraft:darkness', 120, 1, true, false) } }) diff --git a/server_pack/kubejs/server_scripts/02_events.js b/server_pack/kubejs/server_scripts/02_events.js index c9e844c..df658c2 100644 --- a/server_pack/kubejs/server_scripts/02_events.js +++ b/server_pack/kubejs/server_scripts/02_events.js @@ -1,7 +1,7 @@ // SCICRAFT — The Dark Photon Protocol // Player-side lore events: the Resonance, void exposure, and held-item powers. -const SC = { +const EVENTS_SC = { items: { photon_core: 'scicraft:photon_core', void_stabilizer: 'scicraft:void_stabilizer' @@ -17,10 +17,10 @@ PlayerEvents.tick(event => { if (event.player.server.ticks % 40 !== 0) return const held = event.player.mainHandItem - if (held.id === SC.items.photon_core) { + if (held.id === EVENTS_SC.items.photon_core) { event.player.potionEffects.add('minecraft:night_vision', 140, 0, true, false) } - if (held.id === SC.items.void_stabilizer) { + if (held.id === EVENTS_SC.items.void_stabilizer) { event.player.potionEffects.add('minecraft:speed', 120, 0, true, false) event.player.potionEffects.add('minecraft:regeneration', 120, 0, true, false) } @@ -29,11 +29,11 @@ PlayerEvents.tick(event => { // 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 (dim === EVENTS_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) { + } else if (dim === EVENTS_SC.dimensions.darker_dim) { if (event.player.server.ticks % 200 === 0) { event.player.potionEffects.add('minecraft:wither', 80, 0, true, false) } diff --git a/server_pack/kubejs/server_scripts/03_recipes_tags.js b/server_pack/kubejs/server_scripts/03_recipes_tags.js index ff9e675..ac60846 100644 --- a/server_pack/kubejs/server_scripts/03_recipes_tags.js +++ b/server_pack/kubejs/server_scripts/03_recipes_tags.js @@ -1,7 +1,7 @@ // SCICRAFT — The Dark Photon Protocol // The Protocol's crafting chain. Soft-gates the story items behind mod content. -const SC = { +const RECIPES_SC = { items: { photon_fragment: 'scicraft:photon_fragment', photon_core: 'scicraft:photon_core', @@ -14,44 +14,44 @@ const SC = { ServerEvents.recipes(event => { // --- Photon Fragment: harvested from the Darker's own remains. // (LootJS also adds these; this gives a deterministic in-world path.) - event.shapeless(SC.items.photon_fragment, ['minecraft:echo_shard', 'minecraft:glowstone_dust']) + event.shapeless(RECIPES_SC.items.photon_fragment, ['minecraft:echo_shard', 'minecraft:glowstone_dust']) .id('scicraft:photon_fragment_from_echo') // --- Photon Core: compress fragments in a Mekanism-grade press. - event.recipes.create.pressing(SC.items.photon_core, '3x ' + SC.items.photon_fragment) + event.recipes.create.pressing(RECIPES_SC.items.photon_core, '3x ' + RECIPES_SC.items.photon_fragment) .id('scicraft:photon_core_pressing') - event.smelting(SC.items.photon_core, 'minecraft:ender_pearl', 0.5) + event.smelting(RECIPES_SC.items.photon_core, 'minecraft:ender_pearl', 0.5) .id('scicraft:photon_core_smelting') // --- Void Stabilizer: the tool of the Flight — needs a door's key, not ore. - event.shaped(SC.items.void_stabilizer, [ + event.shaped(RECIPES_SC.items.void_stabilizer, [ ' P ', 'PEP', ' P ' ], { - P: SC.items.photon_core, + P: RECIPES_SC.items.photon_core, E: 'minecraft:ender_eye' }).id('scicraft:void_stabilizer') // --- Quantum Lattice: the emitter. Dense, expensive, ongoing. - event.shaped(SC.items.quantum_lattice, [ + event.shaped(RECIPES_SC.items.quantum_lattice, [ 'SCS', 'CPC', 'SCS' ], { S: 'c:ingots/steel', C: 'c:circuits', - P: SC.items.photon_core + P: RECIPES_SC.items.photon_core }).id('scicraft:quantum_lattice') // --- Renegade Glass: the Flight's TARDIS-blue pane. Purely decorative. - event.shaped('8x ' + SC.items.renegade_glass, [ + event.shaped('8x ' + RECIPES_SC.items.renegade_glass, [ 'GGG', 'GPG', 'GGG' ], { G: 'c:glass_blocks', - P: SC.items.photon_fragment + P: RECIPES_SC.items.photon_fragment }).id('scicraft:renegade_glass') })