NBT-API

NBT-API

98.9k Downloads

Problem about ReadWriteItemNBT does not exist when use `NBT.modify()`

Morlinnn opened this issue ยท 1 comments

commented

I used Item-NBT-API 2.12.0 and tested it on paper-1.12.2-1620 and mohist-1.12.2-320.

When I load my plugin, they all throw the same error :
Plugin TestPlugin has failed to register events for class org.morlinnn.test.TestListener because de.tr7zw.nbtapi.iface.ReadWriteItemNBT does not exist.
But the interface really exist in the package.
package

this is the code:

@EventHandler
    public void onTest(PlayerDropItemEvent event) {
        Item item = event.getItemDrop();
        ItemStack itemStack = item.getItemStack();
        NBT.modify(itemStack, nbt-> {
            NBTCompoundList attribute = (NBTCompoundList) nbt.getCompoundList("AttributeModifiers");
            NBTListCompound mod1 = attribute.addCompound();
            mod1.setInteger("Amount", 10);
            mod1.setString("AttributeName", "generic.maxHealth");
            mod1.setString("Name", "generic.maxHealth");
            mod1.setInteger("Operation", 0);
            mod1.setInteger("UUIDLeast", 59664);
            mod1.setInteger("UUIDMost", 31453);
        });
    }
commented

When I created a new project, it worked normally. After checking the content, it was found that the jar does not contain this package.