-2
public static ItemStack[] OreMelterAccept;
private static int arraySlot = 0;

public static addOreMelterRecipe(ItemStack itemStack) {
OreMelterAccept[arraySlot] = itemStack;
arraySlot++;
 }

Compiler says that the code is ok but everytime I try to execute it... it gives me an error. What am I doing wrong?

Samuel Olekšák
  • 117
  • 2
  • 10

1 Answers1

1

You never initialized your array. You must explicitly initialize the array like so:

public static ItemStack[] OreMelterAccept = new ItemStack[10];//10 is just an example
brso05
  • 12,634
  • 1
  • 17
  • 37
  • 2
    The comments were getting a little out of hand here, so I purged them. If you want to continue the discussion about voting behavior, I recommend taking that to chat or to Meta. – Brad Larson Jul 27 '15 at 19:12