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.

[SOLVED] Can't Add The Name (TestBlock) Without A Prefix? [SOLVED]

Featured Replies

Posted

So i'm new to coding and i am trying to make a simple block but i keep getting the error

Caused by: java.lang.IllegalArgumentException: Can't add the name (testBlock) without a prefix, object com.FiberSprite.SampleMod.blocks.TestBlock@3e94a6f6

at cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry.add(FMLControlledNamespacedRegistry.java:356)

at cpw.mods.fml.common.registry.GameData.registerBlock(GameData.java:883)

at cpw.mods.fml.common.registry.GameData.registerBlock(GameData.java:858)

at cpw.mods.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:223)

 

 

Here is my code:

 

Core Class: http://pastebin.com/faU9vSeQ

Core Blocks Class:  http://pastebin.com/fRTei7RV

TestBlock: http://pastebin.com/D200Uabb

What forge version are you using?

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Pretty sure that gameregistry is supposed to be inside the preinit function. Try GameRegistry.registerBlock(block, "stringName") inside your init function.

There's 10 types of people in this world; Those that understand binary and those that don't.

  • Author

I added it to the preInit and it still isnt working.

 

Heres My PreInit

 

 

 

// Block, Items, ETC...

    @Mod.EventHandler

    public void preInit(FMLPreInitializationEvent event)

    {

   

    //ModBlocks.init();

   

    GameRegistry.registerBlock(testBlock , TestBlock.name);

 

    }

 

 

second parameter should be a string.

There's 10 types of people in this world; Those that understand binary and those that don't.

It was in preInit, that wasn't the problem. Why did you comment out mod blocks.init? As a test try putting modid: before the name when you register the block.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

  • Author

ryancpexpert, yeah it is.

Fixed it. I didnt check constants and the file got reset some how and there wasnt a MOD_ID set lol . Im dumb sorry.

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.