use of forestry.apiculture.flowers.FlowerProvider in project ForestryMC by ForestryMC.
the class AlleleHelper method createAllele.
private static <K extends IAlleleValue<V>, V> IAllele createAllele(String category, K enumValue, IChromosomeType... types) {
V value = enumValue.getValue();
boolean isDominant = enumValue.isDominant();
String name = enumValue.toString().toLowerCase(Locale.ENGLISH);
Class<?> valueClass = value.getClass();
if (Float.class.isAssignableFrom(valueClass)) {
return AlleleManager.alleleFactory.createFloat(modId, category, name, (Float) value, isDominant, types);
} else if (Integer.class.isAssignableFrom(valueClass)) {
return AlleleManager.alleleFactory.createInteger(modId, category, name, (Integer) value, isDominant, types);
} else if (Vec3i.class.isAssignableFrom(valueClass)) {
Vec3i area = (Vec3i) value;
return AlleleManager.alleleFactory.createArea(modId, category, name, area, isDominant, types);
} else if (Boolean.class.isAssignableFrom(valueClass)) {
return AlleleManager.alleleFactory.createBoolean(modId, category, (Boolean) value, isDominant, types);
} else if (EnumTolerance.class.isAssignableFrom(valueClass)) {
IAlleleTolerance alleleTolerance = new AlleleTolerance(modId, category, name, (EnumTolerance) value, isDominant);
AlleleManager.alleleRegistry.registerAllele(alleleTolerance, types);
return alleleTolerance;
} else if (FlowerProvider.class.isAssignableFrom(valueClass)) {
return AlleleManager.alleleFactory.createFlowers(modId, category, name, (FlowerProvider) value, isDominant, types);
}
throw new RuntimeException("could not create allele for category: " + category + " and value " + valueClass);
}
Aggregations