#Can't run java add-on for kotlin mod

36 messages · Page 1 of 1 (latest)

wise mural
#

I am currently trying to make an add-on mod for Cobblemon. Cobblemon is made in kotlin. When I build and run an empty kotlin add-on, everything is fine, but when I convert everything to java (using another working template), building is okay but I get mapping problems at runtime.
Every dependency and plugin is the same version as Cobblemon's. Here is the error (shortened) :

#
java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'cobblemon' at 'com.cobblemon.mod.fabric.FabricBootstrap'!
    at net.fabricmc.loader.impl.FabricLoaderImpl.lambda$invokeEntrypoints$2(FabricLoaderImpl.java:403)
......    net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
    at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)
#
Caused by: java.lang.ClassNotFoundException: net.minecraft.class_2960
...
kotlin.reflect stuff
...
com.cobblemon.mod.common.pokemon.SpeciesAdditions$AdditionParameterAdapter.<clinit>(SpeciesAdditions.java:90)
#

I have tried using mojang mappings, yarn mappings, layered mapping. I have tried each of those after a complete cache and build flush.

#

I have checked with debug info and verified that each dependency and plugin has the correct version and is being used. Same for mappings, I can see it being used

#

Right now this is getting so technical and deep that I don't even have any idea of what to change or even try. Any fresh minds got some ?

dark elbow
#

Or send it as a file if you think the length is bothering anyone

dark elbow
wise mural
#

The main is literally empty, no code was added anywhere

wise mural
#

In case it's needed I'll paste relevant code

#

Main :

package net.matrixman.cobblemonutils;

import net.fabricmc.api.ModInitializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class CobblemonUtils implements ModInitializer {
    public static final String MOD_ID = "cobblemon-utils";
    public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);

    @Override
    public void onInitialize () {
        LOGGER.info("Hello Fabric world!");
    }
}
#

fabric.mod.json :

{
  "schemaVersion": 1,
  "id": "cobblemonutils",
  "version": "1.6-fabric-0.0.0",
  "name": "Cobblemon Utils",
  "description": "Adds a bunch of cool features (maybe).",
  "authors": [
    "matrixman aka matrixman"
  ],
  "license": "MIT",
  "environment": "*",
  "entrypoints": {
    "main": ["net.matrixman.cobblemonutils.CobblemonUtils"]
  },
  "depends": {
    "java": ">=21",
    "minecraft": "1.21.1",
    "fabric": "*",
    "cobblemon": ">=1.6.0 <1.7.0"
  }
}
#

gradle.properties :

# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx4G

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.1
loader_version=0.16.9
yarn_mappings=1.21.1+build.3

# Mod Properties
mod_version=1.6-fabric-0.0.0
maven_group=matrixman
archives_base_name=cobblemonutils

# Dependencies
fabric_version=0.114.0+1.21.1
fabric_kotlin_version=1.13.1+kotlin.2.1.10
cobblemon_version=1.6.1+1.21.1
#

build.gradle :

plugins {
    id 'java'
    id 'fabric-loom' version '1.9-SNAPSHOT'
}

group = project.property('maven_group')
version = project.property('mod_version')

java {
    toolchain { languageVersion = JavaLanguageVersion.of(21) }
    withSourcesJar()
}

repositories {
    mavenLocal()
    mavenCentral()
    maven { url 'https://maven.fabricmc.net/' }
    maven { url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/' }
    maven { url 'https://maven.impactdev.net/repository/development/' }
    maven { url 'https://api.modrinth.com/maven' }
}

dependencies {
    minecraft "com.mojang:minecraft:${property('minecraft_version')}"

    mappings loom.layered {
        mappings "net.fabricmc:intermediary:${property('minecraft_version')}"
        mappings "net.fabricmc:yarn:${property('yarn_mappings')}:v2"
    }
    modImplementation "net.fabricmc:fabric-loader:${property('loader_version')}"
    modImplementation "net.fabricmc.fabric-api:fabric-api:${property('fabric_version')}"
    modImplementation "com.cobblemon:fabric:${property('cobblemon_version')}"

    // Cobblemon is Kotlin -> need the Kotlin runtime in dev runs
    modRuntimeOnly "net.fabricmc:fabric-language-kotlin:${property('fabric_kotlin_version')}"
}

tasks.processResources {
    inputs.property('version', project.version)
    filesMatching('fabric.mod.json') {
        expand(version: project.version)
    }
}

tasks.jar {
    from('LICENSE')
}

// Optional: ensure Java compiler target is 21 (toolchain already handles this)
tasks.withType(JavaCompile).configureEach {
    options.release = 21
}
#

file hierarchy if needed :

dawn comet
#

Looks like a mappings problem

wise mural
#

Yep, but i've tried every mapping option I found, so now I seek eldritch knowledge

dawn comet
#

Okay wait that's incredibly cursed

#

Why are you layering yarn on top of intermediary

wise mural
#

I found someone doing it so I tried

dawn comet
#

If you nuke that part I think your problem will fix itself

#

*I hope

wise mural
#

As in let only yarn mappings ?

dawn comet
#

Yes

wise mural
#

I'm getting the exact same error message with this change

#

I've tried a bunch of stuff for mappings, but it did not change the error sadly

dawn comet
#

What if you modImplementation kotlin

wise mural
#

No change either

dawn comet
#

I have no idea

#

I recommend looking at existing cobblemon addons to see how they setup their project

wise mural
dawn comet
wise mural
#

Same error :/