Dynamic Surroundings

Dynamic Surroundings

51M Downloads

1.12: Infinite loop when biomes aren't registered (OTG).

PG85 opened this issue ยท 9 comments

commented

Mod Version: DynamicSurroundings-1.12-3.4.6.1

Forge Version: 1.12

*Link to crash log (if applicable):

[01:03:27] [main/WARN] [dsurround/]: Biome [Desert] not detected during initialization - forcing reload (class com.pg85.otg.forge.generator.OTGBiome)
[01:03:27] [main/INFO] [dsurround/]: Resource pack DEFAULT: Presence by Ha3 (http://presencefootsteps.ha3.eu)
[01:03:27] [main/WARN] [dsurround/]: Unable to locate sound [@]
[01:03:27] [main/WARN] [dsurround/]: Unable to locate sound [@]
[01:03:27] [main/INFO] [dsurround/]: CLIENT: Executing script for mod [mcp]
[01:03:27] [main/WARN] [dsurround/]: Attempt to insert AIR into blockMap 'minecraft:air'
[01:03:27] [main/WARN] [dsurround/]: Unable to locate biome [Desert] (com.pg85.otg.forge.generator.OTGBiome) after reload
[01:03:27] [main/WARN] [dsurround/]: Biome [Desert] not detected during initialization - forcing reload (class com.pg85.otg.forge.generator.OTGBiome)
[01:03:27] [main/INFO] [dsurround/]: Resource pack DEFAULT: Presence by Ha3 (http://presencefootsteps.ha3.eu)
[01:03:27] [main/WARN] [dsurround/]: Unable to locate sound [@]
[01:03:27] [main/WARN] [dsurround/]: Unable to locate sound [@]
[01:03:27] [main/INFO] [dsurround/]: CLIENT: Executing script for mod [mcp]
[01:03:27] [main/WARN] [dsurround/]: Attempt to insert AIR into blockMap 'minecraft:air'
[01:03:27] [main/WARN] [dsurround/]: Unable to locate biome [Desert] (com.pg85.otg.forge.generator.OTGBiome) after reload

This repeats infinitely.*

Description: With OpenTerrainGenerator every world has a different set of user-made biomes, OTG registers and unregisters these biomes when an OTG world/dimension is loaded/unloaded. When a world with otg biomes is loaded DS apparently does not pick up the newly registered biomes, DS queries the id for an OTG biome via Biome.getIdForBiome(biome) and tries to find the accompanying biome in its own registry but it is never found and it looks like DS keeps retrying indefinitely. Could you make it so that when DS can't find a biome it A. Re-indexes biomes using ForgeRegistries.BIOMES and/or B. Make it so that if a biome isn't found a default biome is used instead (Plains/Ocean?). Also one observation, you're still using biome id's and Biome.getIdForBiome(biome), you could consider using ForgeRegistries.BIOMES and resourcelocations instead of id's since Forge is trying to move away from id's. I'm the OTG dev btw, let me know if you need anything, cheers!

commented

I just stumbled across the same problem. Any progress here?

I'm running Forge 1.12.2 14.23.1.2559 with
OpenTerrainGenerator-1.12.2 - v2.jar
DynamicSurroundings-1.12.2-3.4.7.2.jar

commented

OK. I will need to load up and trace the code to make sure of a proper fix. As for the registry going "empty" I had a similar problem with the sound registry. My mod can run 100% client side so I never bothered with registering sounds on the server side. With 1.12, though, the server synchronizes it's registry with the client. Because I never registered the sounds server side my sound registrations would disappear. For sounds I think this is kinda stupid, but what do I know.

commented

OTG has been a pain in this area. :) The register/unregister thing seems to run counter to how the other registries work. There is code already that detects an inconsistency and does a reload. Problem is even after the reload it cannot identify the biome for some reason. This does work in versions prior to 1.12 - so something in 1.12 is different.

Maybe you know this already - does Forge ENFORCE the resource location for a biome? Reason is that in 1.11.x and earlier it did not thus I could not rely on it. I encountered problems with other mods that registered biomes without specifying a resource location.

commented

Hey thanks, appreciate the trouble you've gone to for OTG :).

Earlier I took a quick look at the code that does the reload and I couldn't find a place where it actually re-indexes all the registered biomes from ForgeRegistries.BIOMES or Biome.REGISTRY, it looked like the registry was only indexed once at app start. I may be wrong about that though? And yeah, I think pretty much all other mods register all their stuff at app start. For OTG this is impossible since biomes are loaded only when a world is being loaded.

For 1.12 I had some problems too, Biome.REGISTRY seemed to be empty after registering biomes like I did before, I had to use ForgeRegistries.BIOMES instead. I'm still not exactly sure what happened there tbh. I don't think Forge enforces resource locations for biomes though, you can still use Biome.REGISTRY and some of the methods in the Biome class to work with id's as far as I can tell. If you take a look at ForgeRegistries.BIOMES though you'll notice that there are no methods for adding or querying by biome id. Also there used to be 2 registries for biomes, one for id<>biome and one for biome<>id, now there's only one that can be inverted. This means that each biome can only be linked to one id and each id can only be linked to one biome. Some OTG biomes actually inherit from normal biomes so they have the same id, so for instance some variations of Desert may all have id 2. Before 1.12 it was possible to register only the desert biome to id 2 to in the id>biome registry, and then register each desert variation biome to id 2 in the biome>id registry. That way, if you queried id 2 you'd get the desert biome and if you queried any of the desert biomes you'd get id 2. Since this is no longer possible I've had to make a core mod that changes the Biome.getIdForBiome(biome) method to return the proper id. I doubt that change (one registry instead of 2) is going to cause any problems for DS though.

commented

Ah, okay, that makes sense. Oh well, at least it's better than what it does for biomes! (It refuses the connection entirely because of missing biomes)

commented

@PG85 Where can I find the 1.12 download for OTG?

commented

Hey OreCruncher,

Thansk for the fix and sorry for the late reply, I'm finishing testing for OTG 1.12.1 atm, will get you a link a.s.a.p. I tried the newest build from curseforge but it still has the same problem, the game freezes when entering the world and in the logs I see a whole lot of:

[22:27:46] [main/WARN] [dsurround/]: Unable to locate biome [Birch Forest] (com.pg85.otg.forge.generator.OTGBiome) after reload
[22:27:46] [main/WARN] [dsurround/]: Biome [Birch Forest] not detected during initialization - forcing reload (class com.pg85.otg.forge.generator.OTGBiome)

commented

Pushed build to CurseForge with changes to biome sound registry. Uses the ResourceLocation of a biome as an index rather than ID/enum.

commented

I can't find a 1.12.x release of OTG on CurseForge. Are you referring to a different version? My biome registry changes were only made to the 1.12.x DS release.