[Solved] Getting Willing State of EntityVillager (NBT tags are still confusing)

Discussion in 'Spigot Plugin Development' started by Kongolan, Jun 13, 2015.

  1. I'm pretty confused with NBT tags for a while now, but now i even get runtime errors.

    My CustomVillager class extends EntityVillager and i only want to check for the Willing state, which should be an Int. Though i can't get it to work at all.

    http://minecraft.gamepedia.com/Chunk_format#Villager

    Code (Text):
        if (getNBTTag().getInt("Willing") == 1)
    Code (Text):
    Caused by: org.bukkit.plugin.IllegalPluginAccessException: Plugin attempted to register task while disabled
    Please help me as fast as possible.
     
    #1 Kongolan, Jun 13, 2015
    Last edited: Jun 13, 2015
  2. Seems like the method getNBTTag() of EntityVillager just doesn't return anything and even refuses the call. Strange overall, also Willing is a byte :/
     
  3. Is it possible that the entity doesn't contain that NBT tag?
     
  4. Seems like it doesn't contain any NBT tags... How can i access them, then?
     
  5. Figured it finally thanks.

    Code (Text):

                int xp = new Random().nextInt(4) + 3;

                NBTTagCompound tag = new NBTTagCompound();

                // writes entity's nbt data to OUR tag object
                b(tag);
                if (tag.getBoolean("Willing"))
                    xp += 5;

                human.giveExp(xp);
    Only Question is have left is, if villagers actually give you always more exp when willing on the trade or if they give it only when you open that new trade so with 20% chance.