Hi! I'm new to MC modding, so I'm not too sure whether the format of this post is correct or not - if it isn't, please let me know how to change it in the future.
I'm working on a mod that generates one structure (16*y*16, y is anywhere between 4 and 32) in every chunk(it's supposed to completely fill the chunk on the surface from 0,0 to 16,16), which is why it's 16 blocks wide and 16 blocks long). The structures are in .nbt files that load like they're supposed to and show up in-game - sometimes. However, the structures aren't showing up in every chunk; rather, they show up only close to the chunk 0, 0 and are randomly scattered all over. When I teleport myself over, it says that my mod is causing "cascading worldgen" issues. I'm pretty sure it's because my structures aren't spawning in the chunks like they're supposed to and instead are overlapping into other chunks. My problem is that I don't know why this happens and how to fix it.
Below is the code snippet from my ChunkGenerator class (yes, it implements IChunkGenerator). I overrode the generateStructures function and added my own code. I am aware that this is probably a terrible way to do this (it's probably in the wrong function and class), but I'm not sure how to make it better. Can I have some advice?
@Override
public boolean generateStructures(Chunk chunkIn, int x, int z) {//chunkIn isn't used.
PlacementSettings ps = new PlacementSettings().setRotation(BuildingGenerator.getRotation(x, z));//getRotation returns a random Rotation (EX Rotation.NONE, Rotation.CLOCKWISE_90)
buildingGenerator.getBuilding(x, z).addBlocksToWorldChunk(world, new BlockPos(x * 16, BUILDING_Y_VALUE, z * 16), ps);//buildingGenerator.getBuilding(x, z) returns an object of class Template that is read from a .nbt file created by a structure block.
return false;//It crashes when I return true...? I'm not sure why.
}
If you need more clarification, I can always provide more information. The crash log is attached. Thanks in advance!