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.

Featured Replies

Posted

Hello,

I'm trying to add a structure to my mod, following this example, but the Registry.register function gives me an error. I know it's not the same forge version, but I kinda hoped it would still work.

I get 2 errors : first "String is not a functional interface" when I try to pass my Piece just like in the example, second I get "init\ModBusEvents.java:21: error: 'void' type not allowed here
                args.getRegistry().register(new Tower(NoFeatureConfig::deserialize) void type not authorized here"

 

Here's my repo, the important files are in the structures and init packages.

 

I hope you'll be able to help me,

thanks anyway,

Best regards,
Elsopéen

 

Nevermind, I failed to correctly match what's in the example...

Edited by Elsopeen
Found the problem

Look closer at the registry event code, you've got 2 lines of code from my example smashed together into 1 line of code.

Mine:

@SubscribeEvent
public static void registerFeatures(RegistryEvent.Register<Feature<?>> args) {
	 StrucTest.BRICK_HOUSE_PIECE = Registry.register(Registry.STRUCTURE_PIECE, StrucTest.HOUSE_LOC, BrickHousePiece.Piece::new);
	 args.getRegistry().register(new BrickHouse(NoFeatureConfig::deserialize).setRegistryName(StrucTest.HOUSE_LOC));
}

 

Yours:

public static void registerFeatures(RegistryEvent.Register<Feature<?>> args) {
    ModStructurePieceTypes.TOWER_PIECE = Registry.register(Registry.STRUCTURE_PIECE,
            ModStructurePieceTypes.TOWER_LOC,
            TowerPiece.Piece::new,
            args.getRegistry().register(new Tower(NoFeatureConfig::deserialize)
                    .setRegistryName(ModStructurePieceTypes.TOWER_LOC)));
}

 

Also please post your debug.log (pref. as a github gist), it will provide more info than summarized error messages :)

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.