use of com.mojang.authlib.properties.PropertyMap in project SkinsRestorerX by DoNotSpamPls.
the class SkinsGUI method setSkin.
private static ItemStack setSkin(ItemStack head, String b64stringtexture) {
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
PropertyMap propertyMap = profile.getProperties();
if (propertyMap == null) {
throw new IllegalStateException("Profile doesn't contain a property map");
}
propertyMap.put("textures", new Property("textures", b64stringtexture));
ItemMeta headMeta = head.getItemMeta();
Class<?> headMetaClass = headMeta.getClass();
try {
ReflectionUtil.getField(headMetaClass, "profile", GameProfile.class, 0).set(headMeta, profile);
} catch (IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
}
head.setItemMeta(headMeta);
return head;
}
use of com.mojang.authlib.properties.PropertyMap in project SpongeCommon by SpongePowered.
the class HumanEntity method setProfileName.
private void setProfileName(final net.minecraft.network.chat.@Nullable Component newName) {
final PropertyMap props = this.fakeProfile.getProperties();
this.fakeProfile = new GameProfile(this.fakeProfile.getId(), newName == null ? "" : newName.getString());
this.fakeProfile.getProperties().putAll(props);
}
use of com.mojang.authlib.properties.PropertyMap in project SpongeCommon by SpongePowered.
the class EntityHuman method renameProfile.
private void renameProfile(String newName) {
PropertyMap props = this.fakeProfile.getProperties();
this.fakeProfile = new GameProfile(this.fakeProfile.getId(), newName);
this.fakeProfile.getProperties().putAll(props);
}
use of com.mojang.authlib.properties.PropertyMap in project SpongeCommon by SpongePowered.
the class EntityHuman method updateFakeProfileWithSkin.
private boolean updateFakeProfileWithSkin(UUID skin) {
PropertyMap properties = PROPERTIES_CACHE.getUnchecked(skin);
if (properties.isEmpty()) {
return false;
}
this.fakeProfile.getProperties().replaceValues("textures", properties.get("textures"));
this.skinUuid = skin;
return true;
}
Aggregations