@SuppressWarnings("rawtypes")
 public void registerCustomEntity(Class entityClass, String name, int id) throws Exception {
   if (VersionUtils.isMCPCOrCauldron()) {
     // MCPC+ / Cauldron entity registration.
     Class<?> entityTypesClass = Class.forName("net.minecraft.server.v1_8_R3.EntityTypes");
     ReflectionUtils.putInPrivateStaticMap(entityTypesClass, "field_75626_c", entityClass, name);
     ReflectionUtils.putInPrivateStaticMap(
         entityTypesClass, "field_75624_e", entityClass, Integer.valueOf(id));
   } else {
     // Normal entity registration.
     ReflectionUtils.putInPrivateStaticMap(EntityTypes.class, "d", entityClass, name);
     ReflectionUtils.putInPrivateStaticMap(
         EntityTypes.class, "f", entityClass, Integer.valueOf(id));
   }
 }
  @Override
  public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
    if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
      // It should never dismount
      return;
    }

    Entity entity = (Entity) vehicleBase;

    try {
      if (super.bz() != null) {
        Entity oldVehicle = super.bz();
        ReflectionUtils.setPrivateField(Entity.class, this, "at", null);
        oldVehicle.passengers.remove(this);
      }

      ReflectionUtils.setPrivateField(Entity.class, this, "at", entity);
      entity.passengers.clear();
      entity.passengers.add(this);

    } catch (Exception ex) {
      DebugHandler.handleDebugException(ex);
    }
  }