Integration with Ridiculous World might be breaking
Sunconure11 opened this issue ยท 26 comments
Affected Mod Versions:
(Please list other mods and their versions if you feel they are relevant to this issue. i.e. Biomes O' Plenty)
Ridiculous World, version 0.4
- Forge version:
1614
- RTG version:
1.7.10-1.1.1
Issue Description:
(Please provide screenshots if neccessary/possible. Images can be dragged & dropped into this window.)
Game will crash if you attempt to step foot in a spooky forest or rocky candy mountain. It appears to be related to RTG and Ridiculous World
Steps to reproduce the issue: (If it's easily reproducible.)
- Generate a world with a bubblegum forest or spooky forest (known biomes to cause issues)
- ???
- Crash
Extra Information:
- If you have a crashlog, please provide it by using http://pastebin.com/ or https://gist.github.com/
- You can also provide your client log file: /.minecraft/logs/fml-client-latest.log
- If your client log file is too big for pastebin you can use https://gist.github.com/
Quick correction from before... RTG has always supported 0.4 - the reason I said 0.1 is because that's the version number string inside the actual RW mod, so even though externally RW is at 0.4, internally it's still at 0.1
The 1st crash report points to something going wrong here: https://github.com/SpitefulFox/RidiculousWorld/blob/master/src/main/java/fox/spiteful/ridiculous/biomes/BiomeGenSpooky.java#L79
And the 2nd crash report points to more or less the same place in the other biome: https://github.com/SpitefulFox/RidiculousWorld/blob/master/src/main/java/fox/spiteful/ridiculous/biomes/BiomeGenCandy.java#L81
So it seems that world.getHeightValue(x, z) * 2
is returning a non-positive integer (probably 0) and causing rand.nextInt(world.getHeightValue(x, z) * 2)
to crash.
Which means that world.getHeightValue(x, z)
must be returning 0, which... well... I'm not sure yet what that means, but that's what's happening.
So either we need to figure out why world.getHeightValue(x, z)
is returning 0, or the author of RW needs to put in a check to make sure it's a positive integer before using as the bound for rand.nextInt()
The crash reports suggest that it's an issue with the RW biomes, but I'll need to take a proper look to be certain.
0.1
Have these two biomes been added since then? If so, I would expect to see a different crash because RTG won't have realistic versions of them.
Do you have biome patching enabled in the configs?
- I have patching enabled, it is set to biome 1 (plains, which is overriden by settings in BoP)
- These biomes have existed since the first version. All of the biomes as of 0.4 are accounted for by this mod. (Botanical Garden was added in 0.4)
- There was another crash like this (sometime after I encountered it the first time) that is somehow tied to ore gen from CoFHCore if it is to be believed. http://pastebin.com/SKg1mHJm
- Would a full client log from when one of these crashes happened help at all? https://gist.github.com/Sunconure11/fa91f7f25ad8871922eb7882e3049c88
RW Dev is not convinced it is something on his end. Is there anything I can do to patch it on my end? License appears very permissive so I could get away with a build holding the appropriate fixes. But before I resort to that, is there anything else I can do if I wish to use his mod still?
@Sunconure11 You could try replacing this:
int y = rand.nextInt(world.getHeightValue(x, z) * 2);
with this:
int y = rand.nextInt(((world.getHeightValue(x, z)>0) ? world.getHeightValue(x, z) : 1) * 2);
or you could wrap that line with a try/catch like this:
try {
int y = rand.nextInt(world.getHeightValue(x, z) * 2);
}
catch (Exception e) {
FMLLog.info("Could not get height value at %d %d", x, z);
return false;
}
If you use the latter approach, it will likely throw lots of console spam, but it would be helpful to see what the values of x & z are when it fails.
Both approaches should prevent the crash, but they're also both quick fixes only and will be looked into properly the next time we're in 1.7.10 doing maintenance.
I was able to reproduce this using only RTG + Lonely Biome set to the Candy biome. I also tried Spooky Forest, but that didn't crash for me (although maybe I just didn't fly around long enough).
Now that we can reproduce it, we should be able to figure out what's going on and hopefully either fix it in RTG, or at least provide some additional insight into what's causing the crash.w
@Zeno410 Any idea why world.getHeightValue() would be returning 0? Only thing I can think of is that maybe the chunk hasn't been loaded yet when RW's biome tries to decorate itself?
rand.nextInt(((world.getHeightValue(x, z)>0) ? world.getHeightValue(x, z) : 1) * 2)
move all functionality of chunkExists(IChunkProvider, int, int)
to chunkExists(int, int)
and remove the former.
Cartman!! :)
Does this actually work? I mean, it makes sense, but... did you try it out?
no, it's untested. However, I just matched the functionality of the other method that RTG uses internally. 99% sure there won't be an issue with it.
@Sunconure11 -> #990
I saw, but I mean when do you plan to implement it in a release? Sorry if I shouldn't ask, but I would rather wait for you guys to do something first before I go ahead and do it myself.
@Sunconure11 Realistically, it probably won't be for another 2 weeks (not this weekend, but the weekend after).
How long do PR Reviews on average usually take around here? I know it has not been exactly two weeks, but I'm curious as to if any news regarding this has been made. I'm kind of antsy regarding this bug as I really wanted to play around with RW and RTG.
We're planning to release 1.10.2-4.1.1.3 this weekend, along with the first alpha release of Appalachia, so... if all goes according to plan, I'll try to do a 1.7.10 release this weekend as well.
Decided to compile a build with the fix from in the pull request. I have not seen the crash since.
https://www.dropbox.com/s/2qq3zz8hkv3r5g2/RTG-1.7.10-1.1.2-UNOFFICIAL.jar?dl=0
What is your policy on distributing copies like this? I'm probably going to be using it in my modpack for a bit as I am using Ridiculous World.
Using that build, I managed to encounter the error again, but it took some time before I even found such an error.