EMI

EMI

1M Downloads

1.21 crash when mod has clickable areas in jei plugin

JaisDK opened this issue · 10 comments

commented

Can you please include a full client log? Something may have broken the recipe category earlier and logged some errors.

commented

Thanks for the extra info!
It looks like productive bees tried to optimize their JEI plugin when they added EMI support, so it skips a step:
JDKDigital/productive-bees@5b05f03#diff-3a7973f566b89a4b4d15b7c9a8493a403b40531493df9e246c1d94ec6b49694aL112-R117

Unfortunately this unintentionally breaks things, because the BEE_INGREDIENT is no longer registered and everything that depends on it later is crashing.
Please report this problem to productive bees and link back to this issue.

@emilyploszaj is there some deeper integration we can work on to support this kind of loading optimization in a way that works safely?

commented

image
this is with both plugins registering ingredients

I can now click the area but it will display recipes using JEI not EMI which looks fine but it's inconsistent from what you see when you interact with the bee ingredient in the ingredient list. Also the ingredient registered with JEI is not usable, it doesn't do anything if you looks up uses or recipes for it.

commented

Disabling the clickable area would be the correct solution.

Is there a way to implement the same with EMI?

commented

It's not an optimization, if I don't disable the ingredient registration for JEI when EMI I added I get double the ingredients showing up.

commented

Really I should just be disabling clickable area registration full stop when EMI is present, JEI doesn't give any runtime handler control to it and EMI has no analog.

commented

For now I can register an empty list of ingredients, it stops the crash and won't duplicate the ingredients. However it gives access to the underlying JEI plugin 🤷

        if (!ModList.get().isLoaded("emi")) {
            Collection<BeeIngredient> ingredients = BeeIngredientFactory.getOrCreateList(true).values();
            registration.register(BEE_INGREDIENT, new ArrayList<>(ingredients), new BeeIngredientHelper(), new BeeIngredientRenderer());
        } else {
            registration.register(BEE_INGREDIENT, new ArrayList<>(), new BeeIngredientHelper(), new BeeIngredientRenderer());
        }
commented

Looking at the log, unfortunately a lot more was breaking and crashing than just the clickable areas.
For now, registering an empty list of ingredients seems like the right solution.
I'd like to figure out if there's something better we can do here though.

commented

JEI plugins for mods with dedicated EMI integration are now properly suppressed by EMI and this issue should no longer occur, broadly.