KasugaLibGroup / KasugaLib

MIT License
23 stars 1 forks source link

Feature: Add self-reference constructor supporting for Registry #9

Open TimeBather opened 6 days ago

TimeBather commented 6 days ago

Describe the problem related to the feature request

static final Reg<XXX> XXX = Reg().xxxType(XXXObject::new).submitTo(registry);

class XXX{
    XXX(){
        super(XXX.getType());
    }
}

It's bad to have a circular reference in our class constructor.

Self-reference constructor Example:

static final Reg<XXX> XXX = Reg().xxxType(XXXObject::new).submitTo(registry);

class XXX{
    XXX(XXXType type){
        super(type); // No Reference to Registry!
    }
}

Describe the solution you'd like

None

Describe alternatives you've considered

No response

Additional context

No response

TimeBather commented 6 days ago

WIP, BlockReg.withItem self-reference-constructor supporting added in 9f7f5a10 because Create's TrackTargetingBlockItem