#include "NativeMethodEnvironment.h" void myNativeMethod(NativeMethodEnvironment* env) { // Your code here } JNIEXPORT void JNICALL Java_NativeBindings_myNativeMethod(JNIEnv* env, jclass clazz) { static NativeMethodEnvironment* nativeEnv = new NativeMethodEnvironment(env, clazz); myNativeMethod(nativeEnv); }
#include "NativeMethodEnvironment.h" JNIEXPORT void JNICALL Java_NativeBindings_onStart(JNIEnv* env, jclass clazz) { NativeMethodEnvironment nativeEnv(env, clazz); nativeEnv.executeMethod("myCustomMethod", "(I)V", 10); }In this example, the `NativeMethodEnvironment` class is used to execute a custom native method called `myCustomMethod` with an integer parameter of `10`. This method is triggered when the Minecraft game starts. Package/library: Minecraft Forge.