Use MemberRemapper to Rename Java Methods in Scripts
What MemberRemapper Does
MemberRemapper is a Graal Mod tool that lets you rename Java methods and fields when calling them from JavaScript. This is useful when Java naming conventions clash with JavaScript style, or when you want cleaner, more readable script code.
Setting Up Remapping
Create a remapping configuration (typically in a JSON or properties file in your mod's config folder) that defines old Java names and their JavaScript equivalents:
`
javaMethodName -> jsMethodName
`
Consult your mod loader's Graal configuration to see where remapping files are loaded.
Using Remapped Names
Once configured, call the remapped name in your scripts instead of the original Java method:
`javascript
// Instead of: javaObject.getSomeValue()
// Use: javaObject.getSomeValue() // if remapped
`
This makes scripts more maintainable and easier to read. Remapping is optional—you can always use original Java names if you prefer. Check your mod's specific remapping syntax, as it may vary by implementation.