Crash when using set("genWeight")
Kaelten opened this issue ยท 7 comments
Was just testing out the genWeight commands with this script.
allBiomes = forAllBiomes()
allBiomes.set("genWeight", 1)
plains = forBiomesOfTypes("PLAINS")
plains.set("genWeight", 50)
Crash report here: https://gist.github.com/Kaelten/4b482c74ed3faf253b5e
My tests have been inconclusive, and I have not seen any other reports of this. If you can provide me some examples, I'll look into it more. for now I'm going to close this issue.
A build with a fix is now available on my Jenkins server. I've only tested it a bit. Let me know if it works for you.
Awesome. I'll test it out as soon as I can, I've got to crash right now. Thanks for the quick turn around! :)
How dare you divide by 0! This is happening because you've set all the weights to 1. When Minecraft attempts to grab a random integer, it divides an integer < 10 by 10, which results in 0. A modulus is then calculated with that value, throwing the error.
A fix for this will require telling the TrackedLists that they are modded, so the division does not occur. Since this class is private, some fairly heavy reflection will need to be done to access the arrays and classes. Something similar to this has already been done for BiomeDictionary types though.
A temporary fix is to increase the genWeight until the crash no longer occurs. I'll have a fix ready by tomorrow evening.
actually on further inspection it seems like sub ten weights may be favored incorrectly :/
New build works great it seems. Also do I need to reload the game to make sure the new script is loaded or just gen a new world?