Valhelsia Structures

Valhelsia Structures

21M Downloads

Crash for the latest version of 1.16.5

InteJason opened this issue ยท 7 comments

commented

Game crashed after traveling around for a few minutes

https://paste.ee/p/hnyps

commented

Fixed in release 0.1.4 on CurseForge.

commented

While Valhelsia Structures is mentioned in that log, there's also a lot of other mods there modifying the vanilla code being run (in NoiseChunkGenerator, you can see them in lines 29-31 of that crash report). It's unclear from that what/which the culprit is since I'm not familiar with the mixins that those other mods apply.

Because of that I'm concerned that it might potentially be a mod compatibility issue. Have you tried removing any other mods to see if it still crashes?

I'll investigate it myself as well soon, when I can.

commented

On its own it doesn't crash. But inside the modpack it crashes, I think it's with the caves and cliffs backport mod: https://www.curseforge.com/minecraft/mc-mods/caves-and-cliffs-backport

commented

A fix i found for version 0.13 is to revert to 0.12. I am not sure if going back to 0.13 will continue this bug but at least you can play until the mod is fixed without removing the mod out right.

commented

Since 0.12 works, I looked through the last commit on the file mentioned in the stack trace and may have found the culprit:

Are the bit shifts in this commit in the correct direction?

        int x = chunkX >> 4;
        int z = chunkZ >> 4;

11a0a42#diff-519140e551a86ba1fbe77bdb21e4d6ef165039b99d8b781b15cbf688843d9322R66-R67

If the aim was to convert chunk coordinates to block coordinates then shouldn't it have been:

        int x = chunkX << 4;
        int z = chunkZ << 4;

A miscalculated coordinate could result in an index out of bounds exception down the line.


This line will also need checking as well, as it uses the x and z variables:

11a0a42#diff-519140e551a86ba1fbe77bdb21e4d6ef165039b99d8b781b15cbf688843d9322R81

commented

not to intelligent when it comes to these things but some more information in my case is this is happening in chunks i already loaded. when i am in my base (which the door happens to be on a chunk border) when i step outside it crashes but when i rtp (random teleport) i am fine until i come back to my base.

commented

Are the bit shifts in this commit in the correct direction?
[...]
If the aim was to convert chunk coordinates to block coordinates then shouldn't it have been:
[...}

Good spotting there. I had glanced at that change before and had the same initial thoughts as you (although it was when looking at a different issue, but almost certainly caused by the same thing, since it would cause that entire block to function incorrectly even when the index is within valid bounds). I've mentioned it to the main developer over on Discord, since it certainly seems the wrong way around to me, I just haven't had a chance to change it + verify the fix.

Indeed, it could probably even be improved further since there's no point declaring the variables there at all when both are only used just once to create the BlockPos object a few lines later... might as well just change this:
11a0a42#diff-519140e551a86ba1fbe77bdb21e4d6ef165039b99d8b781b15cbf688843d9322R70
to
BlockPos centerOfChunk = new BlockPos(chunkX << 4 + 7, 0, chunkZ << 4 + 7);