A more reliable code. [small improvement]

If the food uses metadata, then your old code would not work. If your system was only meant for vanilla food, then this might not be needed.

Also, you should consider moving this to client/renderers/ as it is a client-side renderer