code: @SuppressWarnings("unchecked")
     public static <T> T unwrap(Object object)
     {
        T result = (T) object;
  
        if (object != null)
        {
           while (isForgeProxy(result))
           {
              try
              {
                 Method method = result.getClass().getMethod("getDelegate");
                 method.setAccessible(true);
                 result = (T) method.invoke(result);
              }
              catch (Exception e)
              {
                 break;
              }
           }
  
           if (result == null)
              result = (T) object;
        }
        return result;
     }
docs: Returns the delegate object, if the given object was created via {@link Proxies}, otherwise it returns the given
  object, unchanged.