use of net.minecraft.server.v1_16_R3.NBTTagCompound in project acidisland by tastybento.
the class NMSHandler method isPotion.
/* (non-Javadoc)
* @see com.wasteofplastic.askyblock.nms.NMSAbstraction#isPotion(org.bukkit.inventory.ItemStack)
*/
@Override
public boolean isPotion(ItemStack item) {
// Bukkit.getLogger().info("DEBUG:item = " + item);
if (item.getType().equals(Material.POTION)) {
net.minecraft.server.v1_10_R1.ItemStack stack = CraftItemStack.asNMSCopy(item);
NBTTagCompound tag = stack.getTag();
/*
for (String list : tag.c()) {
Bukkit.getLogger().info("DEBUG: list = " + list);
}*/
if (tag != null && (!tag.getString("Potion").equalsIgnoreCase("minecraft:water") || tag.getString("Potion").isEmpty())) {
return true;
}
}
return false;
}
use of net.minecraft.server.v1_16_R3.NBTTagCompound in project acidisland by tastybento.
the class NMSHandler method isPotion.
/* (non-Javadoc)
* @see com.wasteofplastic.askyblock.nms.NMSAbstraction#isPotion(org.bukkit.inventory.ItemStack)
*/
@Override
public boolean isPotion(ItemStack item) {
// Bukkit.getLogger().info("DEBUG:item = " + item);
if (item.getType().equals(Material.POTION)) {
net.minecraft.server.v1_12_R1.ItemStack stack = CraftItemStack.asNMSCopy(item);
NBTTagCompound tag = stack.getTag();
/*
for (String list : tag.c()) {
Bukkit.getLogger().info("DEBUG: list = " + list);
}*/
if (tag != null && (!tag.getString("Potion").equalsIgnoreCase("minecraft:water") || tag.getString("Potion").isEmpty())) {
return true;
}
}
return false;
}
use of net.minecraft.server.v1_16_R3.NBTTagCompound in project solinia3-core by mixxit.
the class ItemStackUtils method IsDisplayItem.
public static boolean IsDisplayItem(ItemStack itemStack) {
// Also check nbttag
if (itemStack == null)
return false;
boolean isDisplayItem = itemStack.getItemMeta().getDisplayName().startsWith("Display Item: ");
if (isDisplayItem)
return isDisplayItem;
// Classic method
net.minecraft.server.v1_15_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound compound = (nmsStack.hasTag()) ? nmsStack.getTag() : new NBTTagCompound();
String isMerchant = compound.getString("merchant");
return Boolean.parseBoolean(isMerchant);
}
use of net.minecraft.server.v1_16_R3.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();
}
use of net.minecraft.server.v1_16_R3.NBTTagCompound in project MyPet by xXKeyleXx.
the class ConfigItem method load.
public void load(MaterialHolder material, String data) {
MinecraftKey key = new MinecraftKey(material.getLegacyName().getName());
Item item = Item.REGISTRY.get(key);
if (item == null) {
return;
}
net.minecraft.server.v1_8_R3.ItemStack is = new net.minecraft.server.v1_8_R3.ItemStack(item, 1, material.getLegacyName().getData());
if (data != null) {
NBTTagCompound tag = null;
String nbtString = data.trim();
if (nbtString.startsWith("{") && nbtString.endsWith("}")) {
try {
tag = MojangsonParser.parse(nbtString);
} catch (Exception e) {
MyPetApi.getLogger().warning("Error" + ChatColor.RESET + " in config: " + ChatColor.UNDERLINE + e.getLocalizedMessage() + ChatColor.RESET + " caused by:");
MyPetApi.getLogger().warning(item.getName() + " " + nbtString);
}
if (tag != null) {
is.setTag(tag);
}
}
}
this.item = CraftItemStack.asCraftMirror(is);
}
Aggregations