Iron's Spells 'n Spellbooks

Iron's Spells 'n Spellbooks

18M Downloads

[Bug] raycastForBlock never ends when Bumblezone's Stinger Spear spawns as part of a structure

TelepathicGrunt opened this issue · 2 comments

commented

Observed behaviour

When a player tries to play Iron's Spells and Bumblezone together, they will find that the world locks up and stops loading chunks and doing server logic forever when they explore enough. My investigation with using only Bumblezone and Iron's Spells together and doing a thread dump when issue happens has lead to Iron's Spell's raytracing being the culprit.

Here's the thread dump: https://pastebin.com/raw/S2e0Aqit

I have my Stinger Spear projectile (a throwable weapon) stuck in a block and saved as persistent in my structure nbt file. Then when the structure spawns, it spawns the projectile there in the block and players can walk up and pick up the weapon. That is the intended use. Here, it seems when the weapon projectile is spawned, __GuidingBoltManager_onProjectileShot_EntityJoinLevelEvent is ran which calls GuidingBoltManager.onProjectileShot and then calls Utils.raycastForBlock. This raytrace is likely running forever to cause the issue I am seeing and players are experiencing. That or doing the raytrace at this point in time in projectile loading from structures is not safe and deadlocking the game as a result.

Expected behaviour

Players can reach this structure without any issue:
image

Steps to reproduce

  1. Put on Iron's Spells and Bumblezone.

  2. Teleport to Bumblezone dimension by throwing Enderpearl at a Beehive.
    Or use /execute in the_bumblezone:the_bumblezone run tp ~ 90 ~

  3. Run /locate structure the_bumblezone:stinger_spear_shrine command

  4. Click on the resultant coordinate to generate teleport command and run that.

  5. Notice nothing happens forever, entities are stuck, various things stops responding, chunks stop loading. game is stuck. Using VisualVM, you can perform a thread dump and see the cause that I linked above.

Server Type

Single Player

Crashlog

https://pastebin.com/raw/kBZM89L9 (Full thread dump)

Iron's Spells N Spellbooks version

1.20.1-2.2.0

Forge version

1.20.1-47.2.0

Other mods

No response

commented

I can reproduce this, although I'm not sure what the specific cause of this is. Adding a check for whether or not the chunk is loaded before raycasting does not work either. This is surprising since Utils.raycastForBlock is just a helper that wraps level.clip. Additionally, I've seen structures like this work, namely Yung's better ocean monument, where he does the same thing with a trident. I will continue to look deeper into this.
image

commented

The issue was caused by the raycast attempting to raycast before the entity was loaded into the world, causing a chunkload deadlock. Fixed in 2.2.1