Jump to content

Recommended Posts

Posted

When I'm modding I usually try to find the vanilla code that does similar effect.  It sounds like you want an effect maybe like same as if bonemeal was added to the plant above your block?

 

I dug around a little bit.  Note I'm using 1.7.2 -- you might have better luck with 1.6.4 since the code is less obfuscated there.

 

The first thing that makes it a bit difficult to find is that bonemeal is also used sort of as a dye, so it looks like the code for applying bonemeal is actually in ItemDye class.  There you will find an applyBoneMeal() method and you can see code where it is checking if the block applied implements IGrowable.

 

The interesting part of the code seems to be:

 

        if (block instanceof IGrowable)

        {

            IGrowable igrowable = (IGrowable)block;

 

            if (igrowable.func_149851_a(p_150919_1_, p_150919_2_, p_150919_3_, p_150919_4_, p_150919_1_.isRemote))

            {

                if (!p_150919_1_.isRemote)

                {

                    if (igrowable.func_149852_a(p_150919_1_, p_150919_1_.rand, p_150919_2_, p_150919_3_, p_150919_4_))

                    {

                        igrowable.func_149853_b(p_150919_1_, p_150919_1_.rand, p_150919_2_, p_150919_3_, p_150919_4_);

                    }

                }

            }

        }

 

 

As you can see, unfortunately much of that code is obfuscated (you should look at it in Eclipse or your IDE to follow the various parameters.

 

But it looks like the right place to start to me -- you can get the block above your grass (with additional code) then check to see if it is an instance of IGrowable and then update the growth.

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

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.