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);
}
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);
}
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;
}
}
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);
}
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);
}
Aggregations