Jump to content

Recommended Posts

Posted (edited)

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
Posted

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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