FiberSprite Posted October 29, 2014 Posted October 29, 2014 So i'm new to coding and i am trying to make a simple block but i keep getting the error Reveal hidden contents 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 Quote
Eternaldoom Posted October 29, 2014 Posted October 29, 2014 What forge version are you using? Quote Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
FiberSprite Posted October 29, 2014 Author Posted October 29, 2014 On 10/29/2014 at 12:42 AM, Eternaldoom said: What forge version are you using? im using forge-1.7.10-10.13.2.1230 Quote
ryancpexpert Posted October 29, 2014 Posted October 29, 2014 Pretty sure that gameregistry is supposed to be inside the preinit function. Try GameRegistry.registerBlock(block, "stringName") inside your init function. Quote There's 10 types of people in this world; Those that understand binary and those that don't.
FiberSprite Posted October 29, 2014 Author Posted October 29, 2014 I added it to the preInit and it still isnt working. Heres My PreInit Reveal hidden contents // Block, Items, ETC... @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { //ModBlocks.init(); GameRegistry.registerBlock(testBlock , TestBlock.name); } Quote
ryancpexpert Posted October 29, 2014 Posted October 29, 2014 second parameter should be a string. Quote There's 10 types of people in this world; Those that understand binary and those that don't.
FiberSprite Posted October 29, 2014 Author Posted October 29, 2014 On 10/29/2014 at 1:16 AM, ryancpexpert said: second parameter should be a string. it is its the string name of the block in the block file Quote
Eternaldoom Posted October 29, 2014 Posted October 29, 2014 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. Quote Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
Eternaldoom Posted October 29, 2014 Posted October 29, 2014 ryancpexpert, yeah it is. Quote Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
FiberSprite Posted October 29, 2014 Author Posted October 29, 2014 On 10/29/2014 at 1:34 AM, Eternaldoom said: 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. Quote
Recommended Posts
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.