mcenderdragon / Futurepack-API

A small Api for the Futurepack
21 stars 4 forks source link

[1.18.2]Crafttweaker support Research,but Research System has not been initialisated yet! #986

Open xiakkto opened 9 months ago

xiakkto commented 9 months ago

When I create a Research with Crafttweaker, every time I reopen the game, this error message appears. Although this can be resolved by using the /reload command, it has caused significant trouble for my mod.

image image

Dinerell commented 9 months ago

You can trigger it later on PlayerLoggedIn-Event. Crafttweaker can only check if a mod is loaded via a preprocessor and preprocessors can be mandatory but it helps preventing it from executing the scripts in an unwanted manner resulting in many errors.

Something like this:

priority 80

modloaded futurepack

Still, to change at which time this code will be triggered, I decided it would be best to use the PlayerLoggedIN-Event from Crafttweaker.

These imports

import crafttweaker.api.events.CTEventManager; import crafttweaker.api.event.entity.player.PlayerLoggedInEvent;

using this code copying your actual code into it

CTEventManager.register((event) => {

});

at least triggers it later although /reload won't trigger the execution anymore. You can basicly ignore the error and just /reload the game until it is final and you need to use this event for the final version.