OpenCubicChunks / CubicChunks

Infinite* height mod for Minecraft
MIT License
531 stars 68 forks source link

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

Open anatawa12 opened 2 years ago

anatawa12 commented 2 years ago

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.

https://github.com/OpenCubicChunks/CubicChunks/blob/dc16fef38129b86de11cd8a0c94069dd8eab56e4/src/main/java/io/github/opencubicchunks/cubicchunks/core/asm/mixin/core/common/MixinEntityTracker.java#L59-L60

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.

Barteks2x commented 2 years ago

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