Jump to content

Recommended Posts

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?

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?

Posted

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.

Posted

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.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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