Cocos 3.1 support and warning fix