Cardinal Components API

Cardinal Components API

21M Downloads

Static Components Feedback

Pyrofab opened this issue ยท 2 comments

commented

#23 added statically declared components as an experimental feature. This issue is for sharing observations and thoughts about that new system.

Annotations

Update: annotations are no more

What is your stance on magical annotations to declare component factories ? Would you rather declare them entirely in fabric.mod.json ?

For example, replacing

{
    "custom": {
        "cardinal-components-api:component-factories": [
            "io.github.mymod.MyComponents"
        ]
    }
}
    @EntityComponentFactory(value = "mymod:mycomponent", target = LivingEntity.class)
    public static MyComponent create(LivingEntity e /* optional arg */) {
        return new MyEntityComponent(e);
    }

with

{
    "custom": {
        "cardinal-components-api:component-factories": [
            {
                "type": "entity",
                "target": "net.minecraft.class_1309",
                "factory": "io.github.mymod.MyComponents::create"
             }
        ]
    }
}
    public static MyComponent create(LivingEntity e /* optional arg */) {
        return new MyEntityComponent(e);
    }
commented

Problems may arise when working with non-Java projects (Kotlin, Scala, etc.)

commented

The 3.0 API having entered its stable stage, I believe this is a good time to close this issue. Thanks for the bit of feedback.