use of net.minecraft.server.v1_15_R1.NBTTagCompound in project MyPet by xXKeyleXx.
the class ItemStackComparator method compareTagData.
public static boolean compareTagData(ItemStack i1, ItemStack i2) {
if (i1.hasItemMeta() && i2.hasItemMeta()) {
NBTTagCompound tag1 = CraftItemStack.asNMSCopy(i1).getTag();
NBTTagCompound tag2 = CraftItemStack.asNMSCopy(i2).getTag();
return tag1 != null && tag2 != null && tag1.equals(tag2);
}
return i1.hasItemMeta() == i2.hasItemMeta();
}
use of net.minecraft.server.v1_15_R1.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_15_R1.NBTTagCompound in project Ublisk by Derkades.
the class Item method setNBTValue.
public Item setNBTValue(String key, NBTBase value) {
NBTTagCompound nbt = this.getNBT();
nbt.set(key, value);
return this.setNBT(nbt);
}
use of net.minecraft.server.v1_15_R1.NBTTagCompound in project Ublisk by Derkades.
the class Item method getNBT.
public NBTTagCompound getNBT() {
net.minecraft.server.v1_12_R1.ItemStack nms = CraftItemStack.asNMSCopy(item);
NBTTagCompound compound = nms.getTag();
if (compound == null) {
return new NBTTagCompound();
} else {
return compound;
}
}
use of net.minecraft.server.v1_15_R1.NBTTagCompound in project MyPet by xXKeyleXx.
the class ItemStackComparator method compareTagData.
public static boolean compareTagData(ItemStack i1, ItemStack i2) {
if (i1 == null || i2 == null) {
return false;
}
if (i1.hasItemMeta() && i2.hasItemMeta()) {
NBTTagCompound tag1 = CraftItemStack.asNMSCopy(i1).getTag();
NBTTagCompound tag2 = CraftItemStack.asNMSCopy(i2).getTag();
if (tag1 != null) {
if (tag1.equals(tag2)) {
return true;
} else {
i1 = CraftItemStack.asBukkitCopy(CraftItemStack.asNMSCopy(i1));
tag1 = CraftItemStack.asNMSCopy(i1).getTag();
return tag1.equals(tag2);
}
}
return false;
}
return i1.hasItemMeta() == i2.hasItemMeta();
}
Aggregations