public static int[] getIntArraySafe(NBTTagCompound tagCompound, String name) { if (!tagCompound.hasKey(name)) { return new int[0]; } NBTBase tag = tagCompound.getTag(name); if (tag instanceof NBTTagIntArray) { return tagCompound.getIntArray(name); } else { return new int[0]; } }