All versions
0.1-alpha.3
Alpha
ClassJS 0.1-alpha.3last year 25
Compatibility
Minecraft: Java Edition
1.20.1
Platform
Forge
Supported environments
Client and server
Required content
Any compatible version
Any compatible version
Any compatible version
Changes
Changes
codemethod ofMethodCreatorcan now accept aConsumer<MethodCodeBuilder>as argument. Previouslycode()method with no parameter can still be used, but is marked with@deprecated.- Every parameter that requires a full qualified name of a class can now also accept an already loaded class.
Before
let clazz = ClassCreator.create("TestClass")
.toPublic()
.defaultConstructor()
.createMethod("testMethod", ["java.lang.String", "char", "char"], "java.lang.String")
.toPublic()
.code()
.loadObject("arg0")
.loadInt("arg1")
.loadInt("arg2")
.invokeVirtual("java.lang.String", "replace", ["char", "char"], "java.lang.String")
.returnObject()
.build()
.defineClass();
Now
// You can load the needed class in advance
const $String = Java.loadClass("java.lang.String");
let clazz = ClassCreator.create("TestClass")
.toPublic()
.defaultConstructor()
// Use the loaded class instead of the long name of a class
.createMethod("testMethod", [$String, "char", "char"], $String)
.toPublic()
.code(builder => builder
.loadObject("arg0")
.loadInt("arg1")
.loadInt("arg2")
// Class names are still supported
.invokeVirtual($String, "replace", ["char", "char"], "java.lang.String")
.returnObject()
)
.defineClass();
Optional dependencies
Any compatible version
Projects on Modrinth are automatically available through a Maven repository for use with JVM build tools such as Gradle. To learn more about the Modrinth Maven API, click here.
Note: When available, you should use the creator's maven repo instead as it will have transitive dependency information that the Modrinth Maven API does not. You may also end up with duplicate dependencies if you use a mix of Modrinth and non-Modrinth Maven repositories for your dependencies, because the group identifier will be different when served through the Modrinth Maven API.
Maven coordinates:
Version ID:
build.gradle:
repositories {
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
// forRepositories(fg.repository) // Uncomment when using ForgeGradle
filter {
includeGroup "maven.modrinth"
}
}
}
// Standard Gradle dependency
dependencies {
implementation "maven.modrinth:AR7tLpwK:gdgLgLto"
}
// Legacy Loom dependency
dependencies {
modImplementation "maven.modrinth:AR7tLpwK:gdgLgLto"
}

