EntityUtils.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:metamorph 作者:
/**
 * Compare two {@link NBTTagCompound}s for morphing acquiring
 */
public static boolean compareData(NBTTagCompound a, NBTTagCompound b)
{
    /* Different count of tags? They're different */
    if (a.getSize() != b.getSize())
    {
        return false;
    }

    for (String key : a.getKeySet())
    {
        NBTBase aTag = a.getTag(key);
        NBTBase bTag = b.getTag(key);

        /* Supporting condition for size check above, in case if the size 
         * the same, but different keys are missing */
        if (bTag == null)
        {
            return false;
        }

        /* We check only strings and primitives, lists and compounds aren't 
         * concern of mine */
        if (!(aTag instanceof NBTPrimitive) && !(aTag instanceof NBTTagString))
        {
            continue;
        }

        if (!aTag.equals(bTag))
        {
            return false;
        }
    }

    return true;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号