emilyploszaj / trinkets

A data-driven accessory mod and API for Minecraft using Fabric.
https://www.curseforge.com/minecraft/mc-mods/trinkets
MIT License
165 stars 72 forks source link

class file for dev.onyxstudios.cca.api.v3.component.ComponentV3 not found when isEquiped and getEquiped use #281

Closed ArturViento closed 9 months ago

ArturViento commented 9 months ago

Moment in my code

    public ItemStack find( LivingEntity entity, Predicate< ItemStack > predicate ) {

    Optional< TrinketComponent > component = TrinketsApi.getTrinketComponent( entity );

    if( component.isPresent() ) {

        Optional< ItemStack > itemStack = component.get().getEquipped( predicate ).stream().map( Tuple::getB ).findFirst();

        if( itemStack.isPresent() ) {

            return itemStack.get();

        }

    }

    return ItemStack.EMPTY;

}

repositories: maven { url = "https://maven.terraformersmc.com/"} maven { url = https://maven.ladysnake.org/releases} maven { url "https://maven.shedaniel.me/" } maven { url "https://maven.wispforest.io/"} maven { url "https://maven.terraformersmc.com/"} maven { url "https://jitpack.io" } maven { url https://api.modrinth.com/maven content {includeGroup "maven.modrinth"}} maven {url "https://maven.jamieswhiteshirt.com/libs-release" content {includeGroup "com.jamieswhiteshirt"}}

dependencies:

minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "dev.emi:trinkets:$project.trinkets_version"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

I need to use getEquiped. that error....

Cheese-Curd commented 9 months ago

I've managed to fix this myself just now. What you need to do is go into your gradle.build file and add these 2 lines in the dependencies section

modImplementation include("dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cca_version}")
modImplementation include("dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cca_version}")

Then, in your gradle.properties file add

cca_version=<version>

(check Cardinal Components API's Releases for the versions) Then just refresh your dependencies delete the .gradle folder then do gradlew --refresh-dependencies

That should fix the issue.

Why this isn't in the readme, is beyond me. Then again, the wiki is outdated so.

emilyploszaj commented 9 months ago

This is caused by the cardinal components maven constantly changing, up to date versions should fix it but they move so often that my existing versions become broken. Posted fix will work.

ArturViento commented 9 months ago

Thanks all