CubicChunks

CubicChunks

840k Downloads

What's the best & stable way to detect if OCC is installed or not?

anatawa12 opened this issue ยท 1 comments

commented

Relates: fixrtm/fixRTM#365

Request

Can you let me know and dodunent the best & stable way to detect if OCC is installed before initialization of OCC's class transformers?

Context

fixRTM, a mod my me is currently incompatible with OCC because OCC depends on instantiation of EntityTrackerEntry in EntityTracker#track method (according to the following code) but fixrtm replaces it.

@Redirect(method = "track(Lnet/minecraft/entity/Entity;IIZ)V", at = @At(value = "NEW",
target = "net/minecraft/entity/EntityTrackerEntry"))

Fixrtm's replation of instantiation of EntityTrackerEntry is not depends on place so I want to suppress replacion in EntityTracker#track if OCC is installed and replace instantiation of EntityTrackerEntry of your mixin.
That's why I want to know how should I do to detect the OCC.

I want to detect between instantiation of OCC's coremod main class and initialization of OCC's class transformers. So I cannot use FML mod list and modid.

My Opinion

In my opinion, It's a good to check if the coremod main class is existing but I don't know if the io.github.opencubicchunks.cubicchunks.core.asm.coremod.CubicChunksCoreMod is stable for 1.12.2 so I don't want to use this way without clarification by developers of OCC.

commented

Since you are going to depend on implementation details of CC anyway it's fine to just check whether that class exists. It's definitely more stable than the CC mixin you are interacting with. That said i probably can fix it on my side by replacing redirect with inject.

Leaving it open for now because i would like to attempt to fix it. I should be able to do it in about 2 weeks