This project demonstrates how to create a Minecraft proxy plugin for Infrarust using Java and the WebAssembly Component Model (WASI P2).
This repository includes the necessary patched toolchain components to ensure a reproducible build:
tools/teavm-fermyon-m2.zip: A pre-packaged local Maven repository containing the Fermyon TeaVM fork (0.2.7-SNAPSHOT) with WASI support.tools/wit-bindgen: The patchedwit-bindgenbinary (0e191cc) with Java/TeaVM backend support.tools/wasi_snapshot_preview1.reactor.wasm: The WASI P1->P2 reactor adapter.
- Java 11 or 17
- Maven
wasm-tools(automatically handled by GitHub Actions)
-
Restore TeaVM Artifacts:
mkdir -p ~/.m2/repository/com/fermyon unzip tools/teavm-fermyon-m2.zip -d ~/.m2/repository/com/fermyon/
-
Run Build Script:
./build.sh
The output will be a Wasm Component at target/infrarust-plugin.wasm.
The repository includes a GitHub Actions workflow (.github/workflows/build.yml) that automatically builds the Wasm component on every push. It uses the pre-packaged TeaVM artifacts to ensure the build succeeds in a clean CI environment.
- WIT Bindings: We use the patched
wit-bindgenbinary included intools/. - TeaVM-WASI: We use the Fermyon fork of TeaVM which targets WASI P1.
- Component Conversion: We use
wasm-toolswith the local P1->P2 reactor adapter to convert the Core Wasm into a WASI P2 Component.
Currently, System.out.println is used for logging verification. In production, you should use the Infrarust Logging API defined in the WIT interfaces.