Fix Fisk and Nashorn

Quick rating

Community listing page, reviews may not be monitored by the author.

Fix Fisk and Nashorn

No reviews yet

Runs Fisk's Superheroes on Java 17+ (lwjgl3ify) by redirecting it to standalone Nashorn, without modifying Fisk's jar.

Mod Loaders
Minecraft

About

Description

FiskNashornFix

Run Fisk's Superheroes on modern Java (17 to 25) with lwjgl3ify, on Minecraft 1.7.10.

The problem

Fisk's Superheroes runs its hero packs with Nashorn, the JavaScript engine that shipped with Java 8. Nashorn was removed from Java in version 15. When a 1.7.10 pack runs on modern Java through lwjgl3ify, Fisk's Superheroes crashes during mod loading:

Caused by: java.lang.IllegalStateException: Nashorn JavaScript engine == null
Caused by: java.lang.ClassNotFoundException: Class bytes are null for jdk.nashorn.api.scripting.NashornScriptEngineFactory

lwjgl3ify can redirect Nashorn class references, but Fisk loads Nashorn by name (as plain text), which that redirect does not cover.

What this mod does

FiskNashornFix is a small coremod with everything bundled inside it. It never connects to the internet.

  1. Redirects Fisk to standalone Nashorn at load time. When Fisk's classes load, the names jdk.nashorn.* are rewritten to org.openjdk.nashorn.* (the standalone OpenJDK Nashorn). Fisk's jar file is never modified.
  2. Ships standalone Nashorn inside the jar. On the first launch, before lwjgl3ify restarts the game on modern Java, it copies the bundled Nashorn 15.7 and ASM 9.11 (official, unmodified Maven Central releases) into the lwjgl3ify-nashorn folder of your instance. Every file is checked against a pinned SHA-1 hash.
  3. Keeps older coremods working. It copies five legacy ASM classes (Remapping*Adapter) from your installed lwjgl3ify jar into lwjgl3ify-nashorn-patch, so mods that still use them (for example Entity Culling Unofficial) keep working once ASM is loaded as a Java module.

On Java 8 it does nothing: Fisk keeps using the Nashorn built into Java 8, so it is safe to leave installed.

Requirements

  • Minecraft 1.7.10 with Forge 10.13.4.1614
  • Fisk's Superheroes 2.4.0
  • lwjgl3ify (relauncher mode) and UniMixins
  • Java 17 or newer (other mods in your pack may require a newer version)

Setup

Add these options to the lwjgl3ify relauncher.

From the "Lwjgl3ify settings" window (shown when the game starts): paste them into Custom options, one per line:

--module-path
lwjgl3ify-nashorn
--add-modules
org.openjdk.nashorn
--patch-module
org.objectweb.asm.commons=lwjgl3ify-nashorn-patch/asm-commons-legacy.jar

Or in config/lwjgl3ify-relauncher.json:

"customOptions": [
  "--module-path", "lwjgl3ify-nashorn",
  "--add-modules", "org.openjdk.nashorn",
  "--patch-module", "org.objectweb.asm.commons=lwjgl3ify-nashorn-patch/asm-commons-legacy.jar"
]

The paths are relative to the instance folder, so they work on any computer.

Modpack authors: ship this config file with your pack (without your personal javaInstallationsCache entry). Your players then only have to pick their Java version in the lwjgl3ify window.

Tested with

  • Minecraft 1.7.10, Forge 10.13.4.1614
  • Fisk's Superheroes 2.4.0
  • lwjgl3ify 3.0.38, UniMixins 0.3.1
  • Java 25.0.4 (Eclipse Temurin) on Windows 11
  • A 139-mod pack including Beddium, FalseTweaks, Hodgepodge, ArchaicFix, Lumi and SwanSong

Troubleshooting

  • "Nashorn JavaScript engine == null": the custom options above are missing, or the game was not relaunched through lwjgl3ify.
  • "Module org.openjdk.nashorn not found", or the game does not start after choosing Java: the libraries could not be copied (for example a read-only instance folder). Look for [FiskNashornFix] lines in the log.
  • Corrupted files: delete the lwjgl3ify-nashorn and lwjgl3ify-nashorn-patch folders; they are recreated on the next launch.
  • Dedicated servers: not tested. The lwjgl3ify relauncher is client-only; on a server you would have to provide Nashorn through your own JVM arguments.

Uninstall

Remove the jar, the three custom options, and the lwjgl3ify-nashorn and lwjgl3ify-nashorn-patch folders.

Credits and license

  • Fisk's Superheroes by FiskFille. This project is not affiliated with Fisk's Superheroes and does not include or redistribute any of its files.
  • lwjgl3ify by GTNewHorizons.
  • Standalone Nashorn 15.7 by OpenJDK, GPL v2 with the Classpath Exception. Bundled unmodified, with its license (META-INF/LICENSE_Nashorn.txt) and its complete source code (fisknashornfix/libs/nashorn-core-15.7-sources.jar).
  • ASM 9.11 by OW2, BSD 3-Clause. Bundled unmodified, with its license (META-INF/LICENSE_ASM.txt).
  • FiskNashornFix's own code is released under the MIT license. See META-INF/THIRD_PARTY_NOTICES.txt in the jar.