why do you want to have a custom inventory if you want to use the default vanilla?
Instead of using ur own inventory just use the vanilla one (in case u are using a gui)
if(held == new ItemStack(Items.bone)){
ItemStack out = new ItemStack(Items.iron_ingot);
EntityItem entity = new EntityItem(world, player.posX, player.posY, player.posZ, out);
world.spawnEntityInWorld(entity);
}
Im not sure what you are triing to do there.
if(held.getItem()==Items.bone);
jesus christ what is up with that error log?
try some basic debugging. u got a NPE in ur shouldExecute method, either theEntity or theEntity.getAttackTarget() is null