HeadTextureChanger.java 文件源码

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

项目:VoxelGamesLibv2 作者:
public static SkullMeta applyTextureToMeta(Object meta, Object profile) throws Exception {
    if (meta == null) {
        throw new IllegalArgumentException("meta cannot be null");
    }
    if (profile == null) {
        throw new IllegalArgumentException("profile cannot be null");
    }
    Object baseNBTTag = NBTTagCompound.newInstance();
    Object ownerNBTTag = NBTTagCompound.newInstance();

    GameProfileSerializerMethodResolver.resolve(new ResolverQuery("serialize", NBTTagCompound, GameProfile)).invoke(null, ownerNBTTag, profile);
    NBTTagCompoundMethodResolver.resolve(new ResolverQuery("set", String.class, NBTBase)).invoke(baseNBTTag, "SkullOwner", ownerNBTTag);

    SkullMeta newMeta = (SkullMeta) CraftMetaSkullConstructorResolver.resolve(new Class[]{NBTTagCompound}).newInstance(baseNBTTag);

    Field profileField = CraftMetaSkullFieldResolver.resolve("profile");
    profileField.set(meta, profile);
    profileField.set(newMeta, profile);

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


问题


面经


文章

微信
公众号

扫码关注公众号