Search in sources :

Example 46 with NBTTagCompound

use of net.minecraft.server.v1_16_R2.NBTTagCompound in project Essentials by EssentialsX.

the class v1_8_R2SpawnerProvider method getEntityType.

@Override
public EntityType getEntityType(ItemStack is) {
    net.minecraft.server.v1_8_R2.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);
}
Also used : CraftItemStack(org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemStack) NBTTagCompound(net.minecraft.server.v1_8_R2.NBTTagCompound)

Example 47 with NBTTagCompound

use of net.minecraft.server.v1_16_R2.NBTTagCompound in project Ublisk by Derkades.

the class Item method setNBTValue.

public Item setNBTValue(final String key, final NBTBase value) {
    final NBTTagCompound nbt = this.getNBT();
    nbt.set(key, value);
    return this.setNBT(nbt);
}
Also used : NBTTagCompound(net.minecraft.server.v1_14_R1.NBTTagCompound)

Example 48 with NBTTagCompound

use of net.minecraft.server.v1_16_R2.NBTTagCompound in project Ublisk by Derkades.

the class Item method getNBT.

public NBTTagCompound getNBT() {
    final net.minecraft.server.v1_14_R1.ItemStack nms = CraftItemStack.asNMSCopy(this.item);
    final NBTTagCompound compound = nms.getTag();
    if (compound == null) {
        return new NBTTagCompound();
    } else {
        return compound;
    }
}
Also used : NBTTagCompound(net.minecraft.server.v1_14_R1.NBTTagCompound)

Example 49 with NBTTagCompound

use of net.minecraft.server.v1_16_R2.NBTTagCompound in project WildLoaders by BG-Software-LLC.

the class NMSAdapter_v1_16_R3 method getPlayerSkull.

@Override
public org.bukkit.inventory.ItemStack getPlayerSkull(org.bukkit.inventory.ItemStack itemStack, String texture) {
    ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
    NBTTagCompound nbtTagCompound = nmsItem.getOrCreateTag();
    NBTTagCompound skullOwner = nbtTagCompound.hasKey("SkullOwner") ? nbtTagCompound.getCompound("SkullOwner") : new NBTTagCompound();
    NBTTagCompound properties = new NBTTagCompound();
    NBTTagList textures = new NBTTagList();
    NBTTagCompound signature = new NBTTagCompound();
    signature.setString("Value", texture);
    textures.add(signature);
    properties.set("textures", textures);
    skullOwner.set("Properties", properties);
    skullOwner.setString("Id", UUID.randomUUID().toString());
    nbtTagCompound.set("SkullOwner", skullOwner);
    nmsItem.setTag(nbtTagCompound);
    return CraftItemStack.asBukkitCopy(nmsItem);
}
Also used : NBTTagList(net.minecraft.server.v1_16_R3.NBTTagList) NBTTagCompound(net.minecraft.server.v1_16_R3.NBTTagCompound) CraftItemStack(org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack) ItemStack(net.minecraft.server.v1_16_R3.ItemStack)

Example 50 with NBTTagCompound

use of net.minecraft.server.v1_16_R2.NBTTagCompound in project WildLoaders by BG-Software-LLC.

the class NMSAdapter_v1_16_R3 method setTag.

@Override
public org.bukkit.inventory.ItemStack setTag(org.bukkit.inventory.ItemStack itemStack, String key, String value) {
    ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
    NBTTagCompound tagCompound = nmsItem.getOrCreateTag();
    tagCompound.set(key, NBTTagString.a(value));
    nmsItem.setTag(tagCompound);
    return CraftItemStack.asBukkitCopy(nmsItem);
}
Also used : NBTTagCompound(net.minecraft.server.v1_16_R3.NBTTagCompound) CraftItemStack(org.bukkit.craftbukkit.v1_16_R3.inventory.CraftItemStack) ItemStack(net.minecraft.server.v1_16_R3.ItemStack)

Aggregations

NBTTagCompound (net.minecraft.server.v1_12_R1.NBTTagCompound)70 ItemStack (org.bukkit.inventory.ItemStack)61 Map (java.util.Map)42 NBTTagCompound (net.minecraft.server.v1_16_R3.NBTTagCompound)39 ArrayList (java.util.ArrayList)38 NBTTagCompound (net.minecraft.server.v1_8_R3.NBTTagCompound)38 ItemMeta (org.bukkit.inventory.meta.ItemMeta)35 CraftItemStack (org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack)34 CompoundTag (com.wasteofplastic.org.jnbt.CompoundTag)30 ListTag (com.wasteofplastic.org.jnbt.ListTag)30 StringTag (com.wasteofplastic.org.jnbt.StringTag)30 Tag (com.wasteofplastic.org.jnbt.Tag)30 NBTTagCompound (net.minecraft.server.v1_16_R2.NBTTagCompound)24 Nullable (javax.annotation.Nullable)21 NBTTagCompound (net.minecraft.server.v1_9_R2.NBTTagCompound)21 NBTTagCompound (net.minecraft.server.v1_10_R1.NBTTagCompound)20 NBTTagCompound (net.minecraft.server.v1_11_R1.NBTTagCompound)20 CraftItemStack (org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack)20 NBTTagList (net.minecraft.server.v1_12_R1.NBTTagList)19 NBTTagCompound (net.minecraft.server.v1_15_R1.NBTTagCompound)18