Jump to content

Custom Melon-like Block - Help needed


AvidPenguin

Recommended Posts

Hello Forgerers

 

i'm trying to add a crop to my mod (A tomato) which grows the same way a Melon/Pumpkin does (stem, block next to it etc)

 

I've tried everything and it simply won't work. I've looked everywhere for tutorials and whatnot, and I can't find anything. I've spent at least 3 hours looking at the vanilla code and copying it over, modifying where necessary, and it's still not working.

 

If anyone could point me in the right direction, that would be splendid

Link to comment
Share on other sites

what exactly isnt working? you cant plant your seed? your seed wont grow? or the stem wont spawn the tomato next to it?

 

The game won't load. It's saying NullPointerException. I'll post the source code for everything related, and the error stuff now (Should probably have done that first)

Link to comment
Share on other sites

Sorry but i didnt start modding until 1.7.2 so you will have to wait for someone who has had experience with 1.6 to help you.

 

But from what i can tell from your crash log it looks like the problem is in this line

public static Item tomatoseeds = new ItemSeed				(27547, BetterCraft.tomatostem.blockID, Block.tilledField.blockID).setUnlocalizedName("tomatoseeds").setTextureName("bettercraft:tomatoseeds");

I am the author of Draconic Evolution

Link to comment
Share on other sites

Sorry but i didnt start modding until 1.7.2 so you will have to wait for someone who has had experience with 1.6 to help you.

 

But from what i can tell from your crash log it looks like the problem is in this line

public static Item tomatoseeds = new ItemSeed				(27547, BetterCraft.tomatostem.blockID, Block.tilledField.blockID).setUnlocalizedName("tomatoseeds").setTextureName("bettercraft:tomatoseeds");

 

yeah, I know it's that line, but it's the exact same as the vanilla, well, not exact same obviously.

 

I don't know what I've done wrong, it's bugging me :/

Link to comment
Share on other sites

First of all: don't make a mod for 1.6.4. It's ages old.

Then: your class is a mess. Everything thrown into one class, that's ugly and you just can't read it, especially with no syntax highlighting.

 

The issue is that you use the "tomatostem" field before you create it's value, so the value is still null.

 

I know 1.6.4 is old, but I've been working on this mod at a slow rate, since 1.6.4 basically came out :/

I also know my class is a mess, but I know where everything is, I wanted to get everything working them start tidying it up.

 

And I don't follow, if you could identify where I create the value so I can move it, I get confused with the Java ordering...

 

(sorry for dorky understanding)

Link to comment
Share on other sites

Its simple

        tomatostem = new BlockStem(845, tomatoblock).setUnlocalizedName("tomatostem").setHardness(0.0F).setResistance(0.5F);

needs to be called before

public static Item tomatoseeds = new ItemSeed				(27547, BetterCraft.tomatostem.blockID, Block.tilledField.blockID).setUnlocalizedName("tomatoseeds").setTextureName("bettercraft:tomatoseeds");

I am the author of Draconic Evolution

Link to comment
Share on other sites

Its simple

        tomatostem = new BlockStem(845, tomatoblock).setUnlocalizedName("tomatostem").setHardness(0.0F).setResistance(0.5F);

needs to be called before

public static Item tomatoseeds = new ItemSeed				(27547, BetterCraft.tomatostem.blockID, Block.tilledField.blockID).setUnlocalizedName("tomatoseeds").setTextureName("bettercraft:tomatoseeds");

 

 

OH, YES I UNDERSTAND NOW

 

I've always grouped the registering of blocks and the creation (i think them terms are correct) because of a tutorial I watched waaaay back. Gonna fix now and report back. Thanks so much guys

Link to comment
Share on other sites

Well I give up now.

 

The client launched, but the tomato block doesn't exist. I tried to plant the tomato seeds, but the game crashed.

I'm going to start afresh, on 1.7.2, and slowly build my mod back up.

If you know of any tutorials that could help me with the block creation (as I believe that there is a crop api for crops and stuff idk) but that would be great

 

Thanks guys

Link to comment
Share on other sites

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.