Posted August 13, 20214 yr Hey! I'm trying to create a custom structure and get the title error a little after clicking create world. I've attached the crash log, thanks in advance for any help. crash-2021-08-12_22.46.33-server.txt
August 14, 20214 yr Author I been further trying to figure this out and believe I've narrowed it down to my FMLCommonSetupEvent event. Quote private void setup(final FMLCommonSetupEvent event) { event.enqueueWork(() -> { StructureInit.setupStructures(); StructureInit.registerConfiguredStructures(); }); } It seems to call setup but not actually call either method inside the event.enqueueWork() at any point. So my configured structure is never actually registered before my BiomeLoadingEvent event? Do anyone know what would be causing this?
August 14, 20214 yr 1 hour ago, DireTook said: It seems to call setup but not actually call either method inside the event.enqueueWork() at any point. So my configured structure is never actually registered before my BiomeLoadingEvent event? answer: do not use event.enqueueWork
August 14, 20214 yr Author So I've essentially been trying to replicate this tutorial code as its the best info I could find on custom structures: https://github.com/TelepathicGrunt/StructureTutorialMod and it makes use of event.enqueueWork. I've tried replacing it but can't find anything else that would work. You can see my methods in this gist: https://gist.github.com/DireTook/dd13728e54cc58a2615d8ebf9f7ed167 registerConfiguredStructures() should just register my structure as a configured structure whilst setupStructures() should add the separation settings. What made me think it doesn't actually call the methods, is that I was simply putting a System.out.println("REACHED HERE"); and seeing if it printed. It did print if placed above event.enqueueWork but not when placed in the Structure methods.
August 15, 20214 yr Author Definitely my bad for not realising I didn't register my STRUCTURES DeferredRegister. I've moved the Configured Structure code to its own class so it should only be accessed after registry. Not sure if that's the best solution? But it does work now. Thanks very much for the help!
August 15, 20214 yr Author But since I'm using CONFIGURED_EXAMPLE_STRUCTURE in the biomeModification method and calling my new Configured Structure class using the setup method with event.enqueueWork, is a static initializer not the most efficient way? Quote public void setup(final FMLCommonSetupEvent event) { event.enqueueWork(() -> { StructureInit.setupStructures(); ConfiguredStructureInit.registerConfiguredStructures(); }).whenComplete((v, err) -> { err.printStackTrace(); }); } public void biomeModification(final BiomeLoadingEvent event) { event.getGeneration().getStructures().add(() -> ConfiguredStructureInit.CONFIGURED_EXAMPLE_STRUCTURE); } Edited August 15, 20214 yr by DireTook
August 15, 20214 yr Author I guess I mean neater. This way I don't have to potentially use return CONFIGURED_EXAMPLE_STRUCTURE and possibly merging methods together in one class or... tbh I'm not entirely sure how I'd successfully go about not doing it as a static initializer whilst still functioning but I'm after attempting to for bit, it seems like it'd be a lot messier
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.