fixed species converter not being registered for bees

also simplified generic forestry converter
This commit is contained in:
repo_alt 2021-09-15 01:21:43 +03:00
parent 17cfaf5e40
commit ccdd480453
2 changed files with 13 additions and 49 deletions

View File

@ -34,7 +34,7 @@ public class ConverterIAlleles implements Converter {
}
}
private void convertAlleleSpecies(final IAlleleSpecies value, final Map<Object, Object> output) {
static void convertAlleleSpecies(final IAlleleSpecies value, final Map<Object, Object> output) {
output.put("name", value.getName());
output.put("uid", value.getUID());
output.put("humidity", value.getHumidity().name);

View File

@ -15,19 +15,7 @@ import forestry.api.arboriculture.IAlleleLeafEffect;
import forestry.api.arboriculture.IAlleleTreeSpecies;
import forestry.api.arboriculture.ITree;
import forestry.api.arboriculture.ITreeGenome;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleArea;
import forestry.api.genetics.IAlleleBoolean;
import forestry.api.genetics.IAlleleFloat;
import forestry.api.genetics.IAlleleFlowers;
import forestry.api.genetics.IAlleleInteger;
import forestry.api.genetics.IAllelePlantType;
import forestry.api.genetics.IAlleleTolerance;
import forestry.api.genetics.IChromosome;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IIndividualLiving;
import forestry.api.genetics.*;
import forestry.api.lepidopterology.EnumButterflyChromosome;
import forestry.api.lepidopterology.IAlleleButterflyEffect;
import forestry.api.lepidopterology.IAlleleButterflySpecies;
@ -35,6 +23,7 @@ import forestry.api.lepidopterology.IButterfly;
import forestry.api.lepidopterology.IButterflyGenome;
import li.cil.oc.api.driver.Converter;
import java.util.HashMap;
import java.util.Map;
/*
@ -73,41 +62,16 @@ public class ConverterIIndividual implements Converter {
private static final Map<Class<? extends IAllele>, IAlleleConverter<?>> converters =
ImmutableMap.<Class<? extends IAllele>, IAlleleConverter<?>>builder()
.put(IAlleleFloat.class, new IAlleleConverter<IAlleleFloat>() {
@Override
public Object convert(IAlleleFloat allele) {
return allele.getValue();
}
})
.put(IAlleleInteger.class, new IAlleleConverter<IAlleleInteger>() {
@Override
public Object convert(IAlleleInteger allele) {
return allele.getValue();
}
})
.put(IAlleleBoolean.class, new IAlleleConverter<IAlleleBoolean>() {
@Override
public Object convert(IAlleleBoolean allele) {
return allele.getValue();
}
})
.put(IAlleleArea.class, new IAlleleConverter<IAlleleArea>() {
@Override
public Object convert(IAlleleArea allele) {
return allele.getValue();
}
})
.put(IAllelePlantType.class, new IAlleleConverter<IAllelePlantType>() {
@Override
public Object convert(IAllelePlantType allele) {
return allele.getPlantTypes();
}
})
.put(IAlleleGrowth.class, new IAlleleConverter<IAlleleGrowth>() {
@Override
public Object convert(IAlleleGrowth allele) {
return allele.getProvider().getInfo();
}
.put(IAlleleFloat.class, (IAlleleConverter<IAlleleFloat>) IAlleleFloat::getValue)
.put(IAlleleInteger.class, (IAlleleConverter<IAlleleInteger>) IAlleleInteger::getValue)
.put(IAlleleBoolean.class, (IAlleleConverter<IAlleleBoolean>) IAlleleBoolean::getValue)
.put(IAlleleArea.class, (IAlleleConverter<IAlleleArea>) IAlleleArea::getValue)
.put(IAllelePlantType.class, (IAlleleConverter<IAllelePlantType>) IAllelePlantType::getPlantTypes)
.put(IAlleleGrowth.class, (IAlleleConverter<IAlleleGrowth>) allele -> allele.getProvider().getInfo())
.put(IAlleleBeeSpecies.class, (IAlleleConverter<IAlleleBeeSpecies>) allele -> {
Map<Object, Object> output = new HashMap<>();
ConverterIAlleles.convertAlleleSpecies(allele, output);
return output;
})
.build();