public static SkullMeta applyTextureToMeta(SkullMeta 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;
}
HeadTextureChanger.java 文件源码
java
阅读 18
收藏 0
点赞 0
评论 0
项目:SoundMuffler
作者:
评论列表
文章目录