Fabric API

Fabric API

106M Downloads

Structures crash in superflat if they use Structrue API and do special structure checking in shouldStartAt [1.16.3]

TelepathicGrunt opened this issue ยท 1 comments

commented

Ok so bear with me here lol. I register all my structures using Fabric API's structure api like so:
https://github.com/TelepathicGrunt/RepurposedStructures-Fabric/blob/fe4b301b5609404272858549e4df9cd4b5812e6c/src/main/java/com/telepathicgrunt/repurposedstructures/RSStructures.java#L142

Notice the .superflatFeature(CRIMSON_SHIPWRECK.configure(FeatureConfig.DEFAULT)) part which means superflat should have my structure in it and all. All the structures should be present in superflat's structure spacing map in its chunkgenerator right?

Well, it seems if you make a superflat world, exit, and re-enter it, doing chunkGenerator.getStructuresConfig().getForType(structureFeature)) will return null in shouldStartAt and this is usually used for making sure one structure cannot spawn near another structure (Pillager outposts do the same check to not spawn near villages). For me, I did not know this could be null and thus, it caused my mod to crash superflat worlds lol
https://github.com/TelepathicGrunt/RepurposedStructures-Fabric/blob/fe4b301b5609404272858549e4df9cd4b5812e6c/src/main/java/com/telepathicgrunt/repurposedstructures/world/structures/ShipwreckNetherStructure.java#L82

Log of the crash:
https://hatebin.com/kawrszjezw

Obviously I can add a fix to do null checks now as I realize this will be an issue with my dimension blacklisting config too but since all my structures are suppose to be a superflatFeature, they all should be present in superflat when this seems to show that the structure configs are cleared out when re-entering superflat for some reason. Very odd

commented

Likely inapplicable for 1.18.2+