Skip to content

Grabbing a creative scroll for a newly added great spell before running recalcPatterns causes crash loop #991

@Robotgiggle

Description

@Robotgiggle

Minecraft version

1.20.1

Hex Casting version

0.11.3

Issue description

When a creative-mode Ancient Scroll tries to load the stroke order for its spell, it checks to make sure the spell exists (on line 176) but it doesn’t check to make sure that the per-world pattern for that spell has actually been calculated. If it hasn’t (ie in any situation where recalcPatterns would be necessary) then the getCanonicalStrokesPerWorld call on line 182 returns null, causing the serializeToNBT call on the following line to crash the game. Since the scroll attempts to load its pattern every inventory tick, this effectively locks you out of the world unless you edit your player data to remove the problematic scroll.

Steps to reproduce

  1. Create a world
  2. Update or install an addon such that /hexcasting recalcPatterns is necessary
  3. Grab the Ancient Scroll for the new spell from the creative tab
  4. Observe that placing it in your inventory causes a crash
  5. Observe that rejoining the world instantly crashes you again### Other information

The fix for this would just be to add a second null-check after the getCanonicalStrokesPerWorld check, just like the existing one for the opID value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions