AirBurn0 / am2playground

Public repository for AM2PlayGround (Ars Magica 2 1.7.10 addon) resources
6 stars 0 forks source link

compendium compatibility #25

Closed RubilaxXxx closed 1 month ago

RubilaxXxx commented 1 month ago

when using TCL ArsMagica2.5 the compendium doesn't show any entry from your mod. (unlocked all entry using command)

tested on v11.4 & v 0.11.3

AirBurn0 commented 1 month ago

when using TCL ArsMagica2.5 the compendium doesn't show any entry from your mod. (unlocked all entry using command)

tested on v11.4 & v 0.11.3

When I last checked - everything worked. Is there something about it in logs? Problem occurs on 1.6.7-LTS or some other version?

UPD: Reproduced successfully.

UPD2: wtf...

UPD3: Probably TCLProject-family specific bug. AM2PG registers all entries using AM2 API event RegisterCompendiumEntries which occurs on client loading only once. I did so: create world "A", enters -> no entries. Reload game, enters "A" -> entries exists. Create world "B", enters -> no entries, although world "A" do have them. And when I repeat same experiment but instead of entering world "A" first, I created&entered world "B" -> both worlds results having no AM2PG entries. AM2 stores compendium data localy in specific folder, so no matter what world you enter - data is synced among them all. Looks like AM2.5 does something different - there is no global folder, and something stored inside world folder. Not sure why all possible entries data isn't synced among worlds. It's extra weird.

AirBurn0 commented 1 month ago

TL;DR

Problem is on AM2.5 side. Cannot fix my myself because of common sense.

WTF

Okie, I got to figure out what the hell is going on here: Lets look on ArcaneCompendium.init method:

compendium.clear();

That's what caused this behaviour. Well, like I said, AM2 usually inits compendium ONCE, and then calls RegisterCompendiumEntries event.

But someone clearly does this more than once and does not call any event. IDK why this code even needed. Maybe it's cool if I, for example, change language and then I'll get translated compendium without reloading entire game, but I still must create new world or do some weird stuff with compendium entries to achieve that.

I do really hate how AM2 Compendium was made in comparsion with Thaumcraft Thaumonomicon, if someone asks me.

Solutions

So, since you seem to be the only living AM2.5 maintainer, I can see 3 ways to fix this: 1) You just need to insert that line: MinecraftForge.EVENT_BUS.post(new RegisterCompendiumEntries(ArcaneCompendium.instance)) after that line: ArcaneCompendium.instance.init(Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage()); And hope for problem solved.

2) Probably it's worth to unfuck this whole story about Compendium, and that's some good starting point. I have already described the problem itself, all that remains is to figure out why all these methods were needed in the first place and rewrite all related code to something adequate. Well, the flag is in your hands.

3) We will not touch the broken AM2.5 code and I'll just make another core-mod that will fix everything again. Well, yes, ASM is that simple, huh. Please have mercy on me, that's the worst solution ever.

RubilaxXxx commented 1 month ago

yup,

You just need to insert that line: MinecraftForge.EVENT_BUS.post(new RegisterCompendiumEntries(ArcaneCompendium.instance)) after that line: ArcaneCompendium.instance.init(Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage()); And hope for problem solved.

that fixed it, will be in next release. 😄