This mod requires any version of JsMacros and is currently in beta.
Graal Bridge supports various mapping formats. Supported mappings include:
- Official
- Mojmap
- Srg
- Intermediary
- Yarn
- Hashed
- Quilt
- Custom mappings
Mappings must be placed in the ${mappings}/${mcVersion}
folder with the specified name and an optional file extension.
If no mappings are found, they will be automatically downloaded.
Graal Bridge provides seamless support for TypeScript.
Files with a .ts
extension are transpiled automatically.
function add(a: number, b: number): number {
return a + b;
}
Chat.log(add(1, 2));
When importing other TypeScript files, the file extension must be specified.
import {add, sub} from "./math.ts";
Simplify your code with advanced import capabilities:
- Multiple Class Imports: Import multiple classes from a package, including mapped classes.
import {AzaleaBlock, AnvilBlock, BellBlock} from "net.minecraft.block";
- Import Aliases: Assign custom names to imported classes.
import {class_2199 as AnvilBlock, class_3709 as BellBlock} from "net.minecraft";
- Static Value Imports: Import static values directly from a class.
import {err, out} from "java.lang.System";
Unlock multithreading capabilities in GraalJS for better performance. Note that this feature may cause instability in some cases.
Graal.setMultithreading(true);
new Thread(() => {
Chat.log("Hello there");
}).start();
- Ensure you have any version JsMacros installed.
- Download the Kotlin library of the mod loader.
- Download the latest version of Graal Bridge from the release page.
- Place the downloaded file into the mods folder of your Minecraft instance.
- Place your mappings in the
${mappings}/${mcVersion}
folder. - Use the
Graal.loadMappings()
method to load the desired mapping.
- Create
.ts
files for your scripts. - Include them in your project, ensuring all imports use the
.ts
extension.
- Call
Graal.setMultithreading(true)
to enable multithreading in your scripts.
- Java 8 Support: Compatibility for older Java versions.
- Forge Compatibility: Fix issues with class mapping functionality in Forge.
- Enhanced Mapping Options:
- Specify versions for mappings.
- Support for custom mappings.
- Remove JsMacros dependency.
Contributions are welcome! To get started:
- Fork the repository.
- Create a feature branch:
git checkout -b feature-name
. - Commit your changes:
git commit -m "Add new feature"
. - Push to the branch:
git push origin feature-name
. - Open a pull request.
Make sure you are using Java 21 and that you are also using Java 21 for Gradle. Intellij: File | Settings | Build, Execution, Deployment | Build Tools | Gradle
This project is licensed under the GPLv3.