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 am currently trying to update a mod from 1.8 to 1.9, and in the process I saw that the method for making a block drop a custom item isn't working. The method I am using is just plainly overriding the quantityDropped and getItemDropped functions from the Block class and making them return variables I have predefined in my custom block class.

 

    private int dropamountmax;
    private Item dropsOnHarvest;

    @Override
    public int quantityDropped(Random random) {
        return dropamountmax;
    }

    @Override
    public Item getItemDropped(IBlockState state, Random rand, int fortune) {
        return dropsOnHarvest;
    }

 

Now, instead of dropping the Item dropsOnHarvest, it drops nothing when I break it with the correct tools and harvest level. Is there anything I might've missed in doing so?

  • Author

I am currently trying to update a mod from 1.8 to 1.9, and in the process I saw that the method for making a block drop a custom item isn't working. The method I am using is just plainly overriding the quantityDropped and getItemDropped functions from the Block class and making them return variables I have predefined in my custom block class.

 

    private int dropamountmax;
    private Item dropsOnHarvest;

    @Override
    public int quantityDropped(Random random) {
        return dropamountmax;
    }

    @Override
    public Item getItemDropped(IBlockState state, Random rand, int fortune) {
        return dropsOnHarvest;
    }

 

Now, instead of dropping the Item dropsOnHarvest, it drops nothing when I break it with the correct tools and harvest level. Is there anything I might've missed in doing so?

Have you checked if your "private Item dropsOnHarvest" is not null? You might be setting it before you have item initilized.

1.7.10 is no longer supported by forge, you are on your own.

Have you checked if your "private Item dropsOnHarvest" is not null? You might be setting it before you have item initilized.

1.7.10 is no longer supported by forge, you are on your own.

  • Author

Yes, that was it! In my init function where I register my items and blocks the item was being registered last. Thank you.

  • Author

Yes, that was it! In my init function where I register my items and blocks the item was being registered last. Thank you.

Guest
This topic is now closed to further replies.

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.