A mod allowing its users to write, compile and run code during a Minecraft runtime.
Given a String representing a class, record, enum or interface, this mod leverages OpenHFT's Chronicle Runtime Compiler to compile the user's Java code, and cache it for the entire runtime.
A user can then use the classes they've written by writing some entrypoint code, and hitting the 'Run Entrypoint' button. Concurrently, this will compile the entrypoint class, and reflectively invoke its 'execute' method to run the code.
- Download the latest release.
- With a Fabric Loader configuration or a compatible client, launch the mod. Important: Include the required JVM arguments listed in the Please Note section.
- Join a world or server.
- Open the command menu and type
/concurrentexecutor
After step 4, you should see a screen similar to this:
5. In the rightmost text box, define a class such as the following:
package redot.executor.context;
import redot.executor.helper.Helper;
public class UntakenClassName {
public static void anyMethodName() {
// Sends 'Hello World!' to your player in chat
Helper.sendMessage("Hello World!");
}
}
- Compile the class.
- In the entrypoint text boxes, enter some code such as the following:
// In the entrypoint imports box
import redot.executor.context.UntakenClassName;
// In the entrypoint code box
UntakenClassName.anyMethodName();
- Click Run Entrypoint.
Observe the output in your chat window.
- Classes are immutable after compilation for the runtime. Re-compiling a class with the same name will not override the original.
- Changing package names for custom classes is unsupported. If you try this, you will receive a ClassNotFoundException.
- This mod does NOT attempt to remap user code from Yarn to Intermediary. To write functional code, refer to the Intermediary mappings on Linkie.
- Compiled classes are limited to the current runtime. There is no serialization or persistence.
- The logging output box has limited functionality and may not display all information clearly.
- Use the Helper class's static methods to minimize dealing with Intermediary code.
- Make sure to launch Minecraft with the following JVM arguments to avoid an InaccessibleObjectException on launch:
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
- This project is a proof of concept and is designed for experimental use.
- A mod software with this level of capability clearly has the potential for misuse, as it grants the user near-full access to the client's functionalities. It is the user's responsibility to handle these capabilities with respect and to refrain from abusing them.