invokeMethod

@JvmName(name = "invokeMethod")
fun invokeMethod(obj: Any, name: String, vararg args: Any?): Any?

Invoke method(PUBLIC ONLY) based on method name on an object, match overloaded methods based on number and type of arguments, does NOT handle null arguments

Return

  • result of invoking method

Parameters

obj
  • object to be invoked

name
  • method name in yarn mapping

args
  • arguments of method

Throws

  • throw IllegalArgumentException when an argument is null

Example when used in js:

mod.on("overlayRender", (event) => {
if (!mc.player || !mc.world)
return;

ReflectionUtil.invokeMethod(event.context, "fill", 100, 100, 200, 200, -1);
})