Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[1.17.1] Description: Exception initializing level java.lang.NoClassDefFoundError: Could not initialize class

Featured Replies

  • 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? 

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

  • 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.

  • 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!

  • 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 by DireTook

  • 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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.