ModAPI.util provides and exposes a large number of utilities for interacting with ModAPI.
Properties:
StaticProps_ProxyConf: ProxyConfiguration
ModAPI.items
, ModAPI.blocks
, ModAPI.enchantments
and ModAPI.materials
TeaVM_to_BaseData_ProxyConf: ProxyConfiguration
TeaVM_to_Recursive_BaseData_ProxyConf: ProxyConfiguration
ModAPI.player
, ModAPI.mc
, ModAPI.world
, ModAPI.network
and more.TeaVMArray_To_Recursive_BaseData_ProxyConf: ProxyConfiguration
TeaVM_to_Recursive_BaseData_ProxyConf
Methods:
ModAPI.util.str(jsString: String) : java.lang.String
ModAPI.util.string()
ModAPI.util.unstr(jclString: java.lang.String) : String
ModAPI.util.ustr()
ModAPI.util.unstring()
ModAPI.util.jclStrToJsStr()
ModAPI.util.getMethodFromPackage(classId: String, methodName: String) : String
net.minecraft.client.Minecraft
) and a method name (eg: middleClickMouse
) and returns its key in ModAPI.hooks.methods
.ModAPI.util.stringToUint16Array(string: String) : Uint16Array
ModAPI.util.setStringContent(jclString: java.lang.String, contents: String) : void
ModAPI.util.getMethodFromPackage(classId: String, methodName: String) : String
net.minecraft.client.Minecraft
) and a method name (eg: middleClickMouse
) and returns its key in ModAPI.hooks.methods
.ModAPI.util.hashCode(string: String) : String
ModAPI.util.isCritical() : boolean
true
, to avoid stack implosions. (yes, those are real)ModAPI.util.bootstrap() : void
ModAPI.util.createArray(class, jsArray) : Object[]
ModAPI.reflect.getClassById("net.minecraft.util.BlockPos").class
ModAPI.util.wrap(obj: Object) : object
ModAPI.util.getNearestProperty(object: Object, property: string) : string
ModAPI.util.modifyFunction(fn: Function, patcherFunction: Function) : string
function add(a, b) {
return a + b;
}
var multiply = ModAPI.util.modifyFunction(add, (code)=>{
return code.replaceAll("a + b", "a * b");
});
console.log(multiply(2, 3));
//Logs 6