Wiki 9Minecraft Wiki 9Minecraft

Graal Mod FAQ

10 questions players actually ask, answered.

How do I start writing scripts for Graal Mod?
Create a JavaScript file in your mod's script directory and use the Graal runtime to load it—the mod will execute ECMAScript-compliant code directly in your game environment. Check the 'Write Your First JavaScript Script for Graal Mod' guide for a step-by-step walkthrough with example code.
Can I call Java methods from my JavaScript scripts?
Yes, Graal Mod lets you interact with Java directly from JavaScript, allowing your scripts to access game objects and methods. Use MemberRemapper if you want to rename Java methods or fields to make them more convenient in your scripts.
What's the difference between Graal Mod and just using GraalJS?
Graal Mod bundles a stripped-down version of GraalJS that removes unnecessary files, cutting the total size roughly in half while keeping full ECMAScript compliance. This keeps your game lighter without sacrificing functionality.
How do I make multiple mods communicate using Graal scripts?
Graal Mod allows different mods to share a common scripting layer where they can call each other's functions and pass data through the JavaScript runtime. See 'Communicate Between Multiple Mods Using Graal Scripts' for patterns and examples.
My script is running slowly—how do I optimize it?
Avoid unnecessary Java calls in tight loops, cache frequently-accessed objects, and use native JavaScript operations where possible. The 'Optimize Script Performance and Reduce File Size' guide covers profiling and best practices.
Can I rename Java methods to make them easier to use in scripts?
Yes, use the MemberRemapper tool included with Graal Mod to create aliases for Java methods and fields, making your JavaScript code cleaner and more readable. The 'Use MemberRemapper to Rename Java Methods in Scripts' guide shows how to set this up.
Does Graal Mod work with other scripting mods?
Graal Mod is designed as a lightweight foundation for script-driven mods and can coexist with other mods, though direct script communication between different scripting systems depends on how those mods are built.
What JavaScript features does Graal Mod support?
Graal Mod delivers full ECMAScript standards compliance, so you can use modern JavaScript features like arrow functions, promises, destructuring, and more—just as you would in a browser or Node.js environment.
Can I use npm packages or external libraries in my scripts?
Graal Mod runs JavaScript in the game environment, so you're limited to libraries that don't depend on browser or Node.js APIs; however, you can bundle compatible libraries directly into your mod's script files.
Why is my script not loading or executing?
Check that your script file is in the correct directory, uses valid ECMAScript syntax, and that any Java interop calls reference classes that actually exist. Enable debug logging to see error messages from the Graal runtime.