Shrines Structures

Shrines Structures

12M Downloads

Failed chunk saves in any of your structures

Kaleidio opened this issue ยท 3 comments

commented

Describe the bug
https://pastebin.com/P6YCKHLq

this gets spammed in the logs every time a structure of yours gens. Happens in SNAPSHOT 9, has been seen as early as SNAPSHOT 6, maybe even earlier. can reoccur even if the chunk is still loaded.

Version (please complete the following information):

  • OS: Windows 10
  • Forge Version 36.2.0
  • Mod Version 2.0.0 SNAPSHOT 9
commented

The issue appears to be due to a processor called com.silverminer.shrines.structures.processors.RemoveBlocksProcessor is returning null for it's getType method. Here's the log output with 2.0.0 SNAPSHOT 9 Shrines on and a beta version of the mod called Blame
https://paste.ee/p/FbEq0

The reason getType should never return null is because that method is how minecraft converts the processor to nbt and read from the json/nbt back to a java object. I have a very basic processor you can check out for how to properly make a codec for it, register it, and return it for the getType method. This is my processor class. Codec.unit(...) is used to make a codec for any processor that doesn't have any parameters in its constructor. For parameter constructors, see my other processors for examples.
https://github.com/TelepathicGrunt/RepurposedStructures/blob/latest-released/src/main/java/com/telepathicgrunt/repurposedstructures/world/processors/StructureVoidProcessor.java

Notice in the above example how in the getType() method, I return an instance of that processor. This is what that processor instance looks like. A IStructureProcessorType is just a lambda () -> that returns the codec for the processor. With that processor instance done, I register it in FMLCommonSetupEvent as show in the bottom half of my class.
https://github.com/TelepathicGrunt/RepurposedStructures/blob/d1b166fd8af8f8ade6ce6d2fcb45857fbcbe787c/src/main/java/com/telepathicgrunt/repurposedstructures/modinit/RSProcessors.java#L32

Do all that and the processor should be safe and won't blow up during saving. Let me know if you get stuck or need help!

commented

Thank you for your help TelepathicGrunt!
I've noticed that I had written everything already, but forgot to use it ....
Anyways that you for you're help and also thank you for reporting Kaleidio!
Blame is a nice mod. Great work

I'll do some quick tests and then publish SNAPSHOT 10

commented

Fix was functional in SNAPSHOT 10. closing.