diff --git a/src/main/java/net/fabricmc/loom/api/fmj/FabricModJsonV1Spec.java b/src/main/java/net/fabricmc/loom/api/fmj/FabricModJsonV1Spec.java index 801c9b4e..a48df1d0 100644 --- a/src/main/java/net/fabricmc/loom/api/fmj/FabricModJsonV1Spec.java +++ b/src/main/java/net/fabricmc/loom/api/fmj/FabricModJsonV1Spec.java @@ -122,6 +122,19 @@ public abstract class FabricModJsonV1Spec { entrypoint(entrypoint, value, metadata -> { }); } + /** + * Add a new entrypoint with the given name, value, and language adapter. + * + * @param entrypoint The name of the entrypoint, such as "main" or "client" + * @param value The value of the entrypoint, typically a fully qualified class name + * @param adapter The language adapter of the entrypoint, such as "kotlin" or "scala" + */ + public void entrypoint(String entrypoint, String value, String adapter) { + entrypoint(entrypoint, value, metadata -> { + metadata.getAdapter().set(adapter); + }); + } + /** * Add a new entrypoint with the given name and value, and configure it with the given action. * diff --git a/src/test/groovy/net/fabricmc/loom/test/unit/fmj/FabricModJsonV1GeneratorTest.groovy b/src/test/groovy/net/fabricmc/loom/test/unit/fmj/FabricModJsonV1GeneratorTest.groovy index e58d42d0..38c0edd7 100644 --- a/src/test/groovy/net/fabricmc/loom/test/unit/fmj/FabricModJsonV1GeneratorTest.groovy +++ b/src/test/groovy/net/fabricmc/loom/test/unit/fmj/FabricModJsonV1GeneratorTest.groovy @@ -303,6 +303,7 @@ class FabricModJsonV1GeneratorTest extends Specification { spec.entrypoint("client", "com.example.KotlinClient::init") { it.adapter.set("kotlin") } + spec.entrypoint("client", "com.example.KotlinClient", "kotlin") spec.entrypoint("client") { it.value.set("com.example.Client") } @@ -322,6 +323,10 @@ class FabricModJsonV1GeneratorTest extends Specification { "value": "com.example.KotlinClient::init", "adapter": "kotlin" }, + { + "value": "com.example.KotlinClient", + "adapter": "kotlin" + }, "com.example.Client" ], "main": [