Jump to content

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


Recommended Posts

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

Posted

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.

Posted

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);

 

    }

 

 

Posted

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!

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.