Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

So I have a block that acts like soil and can have plants planted on it but I would like to know how to make my block accelerate the growth speed of the plants on it. Sapling, crops and pumpkins/melons.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.