Added support for texture and resource packs
Separated functions