#[RESOLVED] Importing Jars/Building Libs

5 messages · Page 1 of 1 (latest)

limpid osprey
#

I'm currently working on the release of my Player Persistence tool, but I'm running into an issue where when i load the .jar into a new Project it cannot resolve the ServerPlayerEntity class, but tries to use an obfuscated one called class_3222.
Is there anything I'm missing with either building the .jar or importing it?

#

The code from the .jar:

class PlayerPersistence : ModInitializer {


    fun syncInventoryData(player: ServerPlayerEntity) {
        val invQuery = "SELECT inventory_data FROM player_inventories WHERE uuid = ?"
        Database.connection.prepareStatement(invQuery).use { statement: PreparedStatement ->
            statement.setObject(1, player.uuid)
            val resultSet = statement.executeQuery()
            if (resultSet.next()) {
                val inventoryData = resultSet.getString("inventory_data")
                deserializeInventory(player, inventoryData)
            }
        }
    }

Where I'd like to use it:

object PlayerPersistenceEvents {
    var pp = PlayerPersistence()

    fun registerEvents() {
        ServerPlayConnectionEvents.JOIN.register(ServerPlayConnectionEvents.Join { handler, _, _ ->
            onPlayerJoin(handler.player)
        })
    }

    private fun onPlayerJoin(player: ServerPlayerEntity) {
        pp.syncInventoryData(player)
    }
#

My Dependencies for the .jar:

dependencies {
    // To change the versions see the gradle.properties file
    minecraft("com.mojang:minecraft:${project.property("minecraft_version")}")
    mappings("net.fabricmc:yarn:${project.property("yarn_mappings")}:v2")
    modImplementation("net.fabricmc:fabric-loader:${project.property("loader_version")}")
    modImplementation("net.fabricmc:fabric-language-kotlin:${project.property("kotlin_loader_version")}")

    // Fabric API. This is technically optional, but you probably want it anyway.
    modImplementation("net.fabricmc.fabric-api:fabric-api:${project.property("fabric_version")}")
    // Database
    include("org.postgresql:postgresql:42.7.4")?.let { implementation(it) }
}

My dependencies for the Mod:

dependencies {
    // To change the versions see the gradle.properties file
    minecraft("com.mojang:minecraft:${project.property("minecraft_version")}")
    mappings("net.fabricmc:yarn:${project.property("yarn_mappings")}:v2")
    modImplementation("net.fabricmc:fabric-loader:${project.property("loader_version")}")
    modImplementation("net.fabricmc:fabric-language-kotlin:${project.property("kotlin_loader_version")}")

    // Fabric API. This is technically optional, but you probably want it anyway.
    modImplementation("net.fabricmc.fabric-api:fabric-api:${project.property("fabric_version")}")

    // Polymer
    include("eu.pb4:polymer-core:0.9.12+1.21.1")?.let { modImplementation(it) }
    include("eu.pb4:polymer-virtual-entity:0.9.12+1.21.1")?.let { modImplementation(it) }

    // Placeholder API
    include("eu.pb4:placeholder-api:2.4.1+1.21")?.let { modImplementation(it) }

    // Database
    include(files("libs/playerpersistence-0.0.2.jar"))?.let { implementation(it) }
}
tulip storm
#

I think you have to use modImplementation for mod dependencies. Currently you are using implementation.