getGain() method errors?

  • Hi, I was making a cropcard add on and i came to a snag when returning the new ItemStack using the folowing code i get an error

    Code
    return new ItemStack(Item.appleRed, 3, 0);

    but the code (mod_JTCrops.itemname, 3, 0); for instance will drop the correct item and not error and i also get the same error when returning items using the IC2 API getItem();

    Error:

    Display Spoiler


    java.lang.NullPointerException
    at JTCrops.ScrapCrop.getGain(ScrapCrop.java:71)
    at ic2.common.TileEntityCrop.harvest(TileEntityCrop.java:761)
    at JTCrops.ScrapCrop.rightclick(ScrapCrop.java:104)
    at ic2.common.TileEntityCrop.rightclick(TileEntityCrop.java:629)
    at ic2.common.BlockCrop.b(BlockCrop.java:221)
    at aes.a(PlayerControllerSP.java:213)
    at net.minecraft.client.Minecraft.c(Minecraft.java:1357)
    at net.minecraft.client.Minecraft.k(Minecraft.java:1800)
    at net.minecraft.client.Minecraft.x(Minecraft.java:822)
    at net.minecraft.client.Minecraft.run(Minecraft.java:750)
    at java.lang.Thread.run(Unknown Source)

    Thanks Jordan30001

  • Quote

    return new ItemStack(Item.appleRed, mod_ForTheTrees.random.nextInt(2) + 1);


    That's what I have for my crop that drops apples. Just the item ID and the amount (which is random 1-2).

    Try cutting out that third argument, just to be sure.

    I don't suffer from insanity, I enjoy it!

  • Didn't work :(

    same error

    Display Spoiler
    Code
    2012-07-20 08:36:21 [SEVERE] A critical error has occurred.java.lang.NullPointerException        at JTCrops.AppleCrop.getGain(AppleCrop.java:67)        at ic2.common.TileEntityCrop.harvest(TileEntityCrop.java:761)        at JTCrops.AppleCrop.rightclick(AppleCrop.java:116)        at ic2.common.TileEntityCrop.rightclick(TileEntityCrop.java:629)        at ic2.common.BlockCrop.b(BlockCrop.java:221)        at aes.a(PlayerControllerSP.java:213)        at net.minecraft.client.Minecraft.c(Minecraft.java:1357)        at net.minecraft.client.Minecraft.k(Minecraft.java:1800)        at net.minecraft.client.Minecraft.x(Minecraft.java:822)        at net.minecraft.client.Minecraft.run(Minecraft.java:750)        at java.lang.Thread.run(Unknown Source)