CraftTweaker

CraftTweaker

151M Downloads

CrtScriptLoadingEvent.Post isn't fired for all scripts

TheSilkMiner opened this issue ยท 1 comments

commented

Intro:

In my CraftTweaker integration, I make heavy usage of the script loading events so that I can assign the correct file properties (specified via a pre-processor directive) to the file, avoiding having some functionality enabled even in scripts that didn't request it.

Issue Description:

Whenever a script loads, the CrtScriptLoadingEvent.Pre event is fired. On the other hand, though, there are some instances where the corresponding CrtScriptLoadingEvent.Post event isn't. This leads to some instances where a certain script file starts loading but, according to events, never finishes, and to an external usage this seems to be the case.

The occurrences I've this happen are:

  • /ct syntax
  • a script has some parsing errors

As the integration developer, I set the mod to print out a (rather big) message in the logs when this happens and I also try to recover to a safe state by setting the current loading script to "none" and then to the actual file as soon as I know which script is currently loading. Is this how it's supposed to work or am I missing something?

What happens:

The CrtScriptLoadingEvent.Post doesn't fire in certain circumstances.

What you expected to happen:

The event to fire.

Affected Versions (Do not use "latest"):

  • Minecraft: 1.12.2
  • Forge: 14.23.5.2847
  • Crafttweaker: 4.1.20.555

Logs aren't really applicable since event firing is not shown in the logs

commented

This should be fixed via 59a1d40