MysticMods / Roots

Home of the Roots Minecraft Mod
GNU Lesser General Public License v3.0
44 stars 33 forks source link

Client-side player occasionally null in Minecraft instance when processing Invalidate Container packet #744

Closed DrTasslehoff closed 3 years ago

DrTasslehoff commented 3 years ago

General Information

Describe the bug: When trying to edit modifiers on any Roots spell when the staff has any spell with additional modifiers in any slot results in a crash. I've gotten this to happen with "Augment" and "Growth Infusion" spells, when they had only a few modifiers unlocked. Not sure the full list of spells this may impact, but using all possible modifiers on a spell seems to alleviate the crashing

To Reproduce:

  1. Place a staff into the Imposer
  2. Right click with a knife to open the interface
  3. Open a spell and add any number of modifiers to a spell, this works fine
  4. Attempt to repeat steps 1-3 and you will see a crash on step 3

Expected behavior: opening of the spell modifier editor


Environment Versions

Roots 1.12.2-3.1.1

Mystic Mods Versions

Other Versions:


Logging Information

Please Use gist, paste.ee, pastebin or some other log sharing service

Crash Report (if available): https://pastebin.com/f4sSupYz


Additional Information

Additional context (optional): This seems to happen with "Growth Infusion" and "Augment" and after applying all modifiers to another spell the issue seems to not happen anymore? I can't say I've tested all spells, but those are the two I've encountered crashing with trying to shift-click herbs without opening the interface results in errors as well, though not a full crash.

noobanidus commented 3 years ago

This appears to be a mod conflict of some kind, as I'm unable to reproduce it in a development environment.

The relevant line of code:

      EntityPlayer player = Minecraft.getMinecraft().player;
      if (player.openContainer instanceof IInvalidatingContainer) {
        ((IInvalidatingContainer) player.openContainer).invalidate();
      }

The only thing being dereferenced here is the player... which implies that, for whatever reason, the Minecraft instance has a null player. Which should never happen.

I can add in a null check but it won't really resolve the issue...

DrTasslehoff commented 3 years ago

It's incredibly weird because at some point the crashes just stopped completely. The last thing I did was take a staff/spell with no modifiers on it and applied all possible modifiers to a spell. After that I've never run into the crashes again. What's even weirder is this persisted across all worlds I created afterwards.

noobanidus commented 3 years ago

I suspect this is a side-effect of another mod doing stuff. Yes, there is a chance for the player in Minecraft to be null, but usually that's only during the initialisation phase. There do appear to be other bugs, especially with runed wood, so I'll merge a "fix" anyway that just does nothing when the player is null.

Alexthehuman3 commented 2 years ago

It's incredibly weird because at some point the crashes just stopped completely. The last thing I did was take a staff/spell with no modifiers on it and applied all possible modifiers to a spell. After that I've never run into the crashes again. What's even weirder is this persisted across all worlds I created afterwards.

A different crash log behaving exactly the same way (disappears after first use). Happens when you add spell to your book, apply it to staff

Log: https://pastebin.com/TXecGpS6

noobanidus commented 2 years ago

Oh, that's very interesting. Thank you so much for that crash report, it finally fills in some blanks. I'm going to make a new issue out of it.