Jump to content

Recommended Posts

Posted

I think I was successful in creating custom crops with 1.7.2.

 

I did it as follows.

 

I extended BlockCrops with my own version (I usually do this when modding to allow more control where possible, but you should be able to do this with vanilla BlockCrops): https://gist.github.com/anonymous/9797206

 

Made a blueberry bush block with: https://gist.github.com/anonymous/9796922

 

I extended ItemSeedFood with my own version (I usually do this when modding to allow more control where possible, but you should be able to do this with vanilla ItemSeedFood): https://gist.github.com/anonymous/9796951

 

I made the blueberry seed food item with: https://gist.github.com/anonymous/9796968

 

Then in my main class of the mod I registered everything with: https://gist.github.com/anonymous/9797030

 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Thanks, I'll check it out. You really should add @Override to your methods though, you'll cry if you don't next time MC gets updated ;)

 

This method makes me think I won't be able to keep my current setup of multiple crops per block though:

 

    protected Item func_149866_i()

    {

        return Items.wheat_seeds;

    }

 

Ah well, I guess there's no point anymore anyway.

Posted
  Quote
You really should add @Override to your methods though, you'll cry if you don't next time MC gets updated ;)

 

Actually, I usually have Eclipse set up to automatically put those in on save, but I guess when I set up Eclipse on this new computer I forgot to set the preferences.  So now I've got them in there.  Thanks.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

  • 5 months later...
Posted
  On 3/27/2014 at 12:21 AM, jabelar said:

I think I was successful in creating custom crops with 1.7.2.

 

I did it as follows.

<snip>

 

I tried this code out, and minecraft crashed. Apparently it was from this line?

 

return this.field_149867_a[p_149691_2_];

 

Which was inside the getIcon method in your custom BlockCrops class.

 

So I suppose it was a problem with getting the textures? How was this line supposed to go?

 

It would be very helpful if you responded. Everyone else's posts/tutorials about crops are extremely outdated.

 

Thanks!

Posted
  On 9/22/2014 at 10:18 PM, jabelar said:

  Quote

Everyone else's posts/tutorials about crops are extremely outdated.

 

You might want to look at my tutorial on crops for 1.7.x: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-creating-custom.html

 

It's the same problem, except with more human readable names. The crash now hapens in this line:

 

return iIcon[parGrowthStage];

 

Within the getIcon method. What's going on with getIcon? Is nothing ever put in the iIcon array?

Posted

Here is a file that i use, it works great and all you have to do is just extend the file for your new crop and fill in the blanks :)

 

 

  Reveal hidden contents

 

 

After you read the code, you should know how to use it.

Former developer for DivineRPG, Pixelmon and now the maker of Essence of the Gods

Posted
  On 9/23/2014 at 2:06 AM, The_SlayerMC said:

Here is a file that i use, it works great and all you have to do is just extend the file for your new crop and fill in the blanks :)

 

 

  Reveal hidden contents

 

 

After you read the code, you should know how to use it.

 

This is pretty good. I just have to add and mess with getRenderType and it should be working fine. Also, I'm not sure why you felt the need to register the block within the custom crop class. Don't people usually do that in the main? Anyway, a bit unconventional, but it works.

 

So how do I add the texture?

 

EDIT: Oh, never mind. I saw "MODID:" in registerBlockIcons and didn't notice the quotes, so I assumed that was a variable. So I just replaced that part with my mod id and it works fine. Thanks!

Posted
  On 9/23/2014 at 4:19 AM, The_SlayerMC said:

You can register it either way, but i like to do it inside of the blocks/item class because it saves so much code haha

 

Oh, I know you CAN, but I've never seen anyone do that before. I figured it was against convention or something.

Anyway, thanks for the help!

Posted
  On 9/23/2014 at 4:25 AM, snuffysam said:

  Quote

You can register it either way, but i like to do it inside of the blocks/item class because it saves so much code haha

 

Oh, I know you CAN, but I've never seen anyone do that before. I figured it was against convention or something.

Anyway, thanks for the help!

 

I think the issue with registering your block (or item or entity, etc) in their own constructor is that you potentially lose control of the order of registration, or at least you have to be more conscious of how the instantiation order will affect registration order.

 

Sometimes you'll need to control the order.  For example with ItemSeeds it is important to have the related blocks registered first.  You can control it with instantiation, but many people might be tempted to still instantiate in the field declaration area of the main class.

 

Anyway, just something to keep in mind if you go the route of registering classes within their own constructors.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Please see this article on why it is bad to pass 'this' outside the constructor.

 

You should not call registry or any method that uses 'this' when constructing.

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.