Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Waystone crashes villages if the second or third waystone is at end of village pieces. #16

Closed
TelepathicGrunt opened this issue Nov 25, 2020 · 1 comment

Comments

@TelepathicGrunt
Copy link
Contributor

Some people have been getting crashes that were super strange to figure out. https://pastebin.com/qr9iiaUT
Mapped showed that the issue lied in NoiseChunkGenerator due to some sort of array out of bounds issue.
image

After some debugging, we got a list of mods that mixin into that class.
image

From there, I went through each mod's mixin and found this line of code in Waystone. I had the user remove waystone and the crash went away.

for(int remove : toRemove) {
structures.getChildren().remove(remove);
}

So it seems that because this is removing by index, that means after 1 element is removed, all other indices are now incorrect and if any indices were pointing at the end of the array, those will cause the index out of bounds crash.

Hope this helps make it easy to fix the issue! For now, the solution is to remove Waystone, generate the village, and put it back on.

@TelepathicGrunt
Copy link
Contributor Author

Oh yeah, one more thing, could you try moving the logic out of the mixin into a non-mixin class? By that I mean, have the mixin call a method in your own class. Then do your stuff there so that if it crashes, your mod’s class will show in the stacktrace and make it much easier to debug crashes! I should do this myself more often as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant