BiomeTweaker

BiomeTweaker

13M Downloads

Crash when using set("genWeight")

Kaelten opened this issue ยท 7 comments

commented

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

commented

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.

commented

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.

http://jenkins.superckl.me/job/BiomeTweaker/65/

commented

Awesome. I'll test it out as soon as I can, I've got to crash right now. Thanks for the quick turn around! :)

commented

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.

commented

actually on further inspection it seems like sub ten weights may be favored incorrectly :/

commented

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?

commented

If you edited the scripts, you can reload them either through the Forge config gui or through the in-game command. You'll have to do one of these for the changes to take effect.

Generation weights is a bit hard to test, but I'll try to find some time to setup some tests.