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

I have just created a crop(strawberry plant) but the only way to get the drops from the fully grown crop is to destroy the dirt under it.  How can I fix this?

 

Crop class:

package com.puplet.blocks;

import java.util.Random;

import com.puplet.items.PupletItems;

import net.minecraft.block.BlockCrops;
import net.minecraft.init.Items;
import net.minecraft.item.Item;

public class PupletCrop extends BlockCrops{

/**
 * seeds
 */
@Override
protected Item func_149866_i()
    {
        return PupletItems.pupletSeeds;
    }

/**
 * crop
 */
@Override
    protected Item func_149865_P()
    {
        return PupletItems.Strawberry;
    }


}

Don't tell me to learn the basics of java, I already know.

Hi

 

Do you mean - you can't destroy the crop by clicking on it?  Or do you mean- if you destroy the block by clicking on it, it gives you nothing? 

You have to use the appropriate tool to harvest a crop...

The code from 1.6.4 has a couple of relevant functions in it, you could perhaps find the corresponding ones in 1.7.2, place a breakpoint in them, and see why you're not getting strawberries.

 

Alternatively a breakpoint in Block.harvestBlock and/or ItemInWorldManager.tryHarvestBlock will also narrow things down a lot.

 

-TGG

 

    @Override

    public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)

    {

        ArrayList<ItemStack> ret = super.getBlockDropped(world, x, y, z, metadata, fortune);

 

        if (metadata >= 7)

        {

            for (int n = 0; n < 3 + fortune; n++)

            {

                if (world.rand.nextInt(15) <= metadata)

                {

                    ret.add(new ItemStack(this.getSeedItem(), 1, 0));

                }

            }

        }

 

        return ret;

    }

 

    /**

    * Returns the ID of the items to drop on destruction.

    */

    public int idDropped(int par1, Random par2Random, int par3)

    {

        return par1 == 7 ? this.getCropItem() : this.getSeedItem();

    }

 

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.