Jump to content

Recommended Posts

Posted

Ok, so I am trying to implement a dummy block so I can have an Item with a custom 3d model, and it crashes when I try running the game.

 

So first, the crash report: http://pastebin.com/0p2W9v8L

 

Second, the code I used to register the block(I have tried putting it in the PreInit and the Init):

GameRegistry.registerBlock(coal_gun, ItemBlockCoalGun.class, "coal_gun");

 

Third, the ItemBlock: http://pastebin.com/mvw3MN9r

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Posted

ItemBlock needs an ItemBlock(Block) constructor. Modify your ItemBlockCoalGun class and add an ItemBlockCoalGun(Block) constructor.

public ItemBlockCoalGun() {
                super(UnLogicII.coal_gun);
                
                setMaxStackSize(1);
                setUnlocalizedName("coal_gun");
        }

Does that not cover the superclass's need for a block? Or does it have to be that way for some other reason?

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Posted

That depends. What is

UnLogicII.coal_gun

?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Ah, I know what it is.

 

You need to have a constructor that takes a block in its constructor, because the method is called via Reflection and Forge doesn't know that you've given a 0-parameter constructor and passed the block yourself.

 

In other words: you thought you were being clever and instead Forge is saying, "no you idiot, that's bad!"

 

public ItemBlockCoalGun(Block b) {
                super(b);
               
                setMaxStackSize(1);
                setUnlocalizedName("coal_gun");
        }

 

It's to insure that the Block you're registering the ItemBlock for is actually passed to the ItemBlock class.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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