Posted June 19, 20205 yr 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 June 19, 20205 yr by Elsopeen Found the problem
June 19, 20205 yr 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.