use of net.minecraft.server.v1_15_R1.NBTTagCompound in project Denizen-For-Bukkit by DenizenScript.
the class ItemHelper_v1_9_R2 method addNbtData.
@Override
public ItemStack addNbtData(ItemStack itemStack, String key, Tag value) {
net.minecraft.server.v1_9_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound tag = nmsItemStack.hasTag() ? nmsItemStack.getTag() : new NBTTagCompound();
CompoundTag compound = CompoundTag_v1_9_R2.fromNMSTag(tag).createBuilder().put(key, value).build();
nmsItemStack.setTag(((CompoundTag_v1_9_R2) compound).toNMSTag());
return CraftItemStack.asBukkitCopy(nmsItemStack);
}
use of net.minecraft.server.v1_15_R1.NBTTagCompound in project Denizen-For-Bukkit by DenizenScript.
the class ItemHelper_v1_9_R2 method setSkullSkin.
@Override
public ItemStack setSkullSkin(ItemStack itemStack, PlayerProfile playerProfile) {
GameProfile gameProfile = new GameProfile(playerProfile.getUniqueId(), playerProfile.getName());
if (playerProfile.hasTexture()) {
gameProfile.getProperties().get("textures").clear();
if (playerProfile.getTextureSignature() != null) {
gameProfile.getProperties().put("textures", new Property("textures", playerProfile.getTexture(), playerProfile.getTextureSignature()));
} else {
gameProfile.getProperties().put("textures", new Property("textures", playerProfile.getTexture()));
}
}
net.minecraft.server.v1_9_R2.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound tag = nmsItemStack.hasTag() ? nmsItemStack.getTag() : new NBTTagCompound();
tag.set("SkullOwner", GameProfileSerializer.serialize(new NBTTagCompound(), gameProfile));
nmsItemStack.setTag(tag);
return CraftItemStack.asBukkitCopy(nmsItemStack);
}
use of net.minecraft.server.v1_15_R1.NBTTagCompound in project Denizen-For-Bukkit by DenizenScript.
the class ItemHelper_v1_10_R1 method setSkullSkin.
@Override
public ItemStack setSkullSkin(ItemStack itemStack, PlayerProfile playerProfile) {
GameProfile gameProfile = new GameProfile(playerProfile.getUniqueId(), playerProfile.getName());
if (playerProfile.hasTexture()) {
gameProfile.getProperties().get("textures").clear();
if (playerProfile.getTextureSignature() != null) {
gameProfile.getProperties().put("textures", new Property("textures", playerProfile.getTexture(), playerProfile.getTextureSignature()));
} else {
gameProfile.getProperties().put("textures", new Property("textures", playerProfile.getTexture()));
}
}
net.minecraft.server.v1_10_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound tag = nmsItemStack.hasTag() ? nmsItemStack.getTag() : new NBTTagCompound();
tag.set("SkullOwner", GameProfileSerializer.serialize(new NBTTagCompound(), gameProfile));
nmsItemStack.setTag(tag);
return CraftItemStack.asBukkitCopy(nmsItemStack);
}
use of net.minecraft.server.v1_15_R1.NBTTagCompound in project Denizen-For-Bukkit by DenizenScript.
the class ItemHelper_v1_10_R1 method addNbtData.
@Override
public ItemStack addNbtData(ItemStack itemStack, String key, Tag value) {
net.minecraft.server.v1_10_R1.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound tag = nmsItemStack.hasTag() ? nmsItemStack.getTag() : new NBTTagCompound();
CompoundTag compound = CompoundTag_v1_10_R1.fromNMSTag(tag).createBuilder().put(key, value).build();
nmsItemStack.setTag(((CompoundTag_v1_10_R1) compound).toNMSTag());
return CraftItemStack.asBukkitCopy(nmsItemStack);
}
use of net.minecraft.server.v1_15_R1.NBTTagCompound in project Essentials by drtshock.
the class v1_8_R1SpawnerProvider method getEntityType.
@Override
public EntityType getEntityType(ItemStack is) {
net.minecraft.server.v1_8_R1.ItemStack itemStack;
CraftItemStack craftStack = CraftItemStack.asCraftCopy(is);
itemStack = CraftItemStack.asNMSCopy(craftStack);
NBTTagCompound tag = itemStack.getTag();
if (tag == null || !tag.hasKey("BlockEntityTag")) {
throw new IllegalArgumentException();
}
String name = tag.getCompound("BlockEntityTag").getString("EntityId");
return EntityType.fromName(name);
}
Aggregations