Use new bee API for species and mutations. For Forestry 4.2.1 (future)

This commit is contained in:
mezz committed 2015-11-22 09:15:51 -08:00
1 parent ab70d8aec2
commit ab5b7c7532
27 files changed
+715 -1162

No files matched your search

@@ -0,0 +1,48 @@
package magicbees.bees;
import net.minecraft.world.World;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.MoonPhase;
// There is a bonus to this mutation during moon phases...
public class MoonPhaseMutationBonus implements IMutationCondition {
private final MoonPhase moonPhaseStart;
private final MoonPhase moonPhaseEnd;
private final float mutationBonus;
public MoonPhaseMutationBonus(MoonPhase phase, float bonus) {
this.moonPhaseStart = phase;
this.moonPhaseEnd = phase;
this.mutationBonus = bonus;
}
public MoonPhaseMutationBonus(MoonPhase start, MoonPhase end, float bonus) {
this.moonPhaseStart = start;
this.moonPhaseEnd = end;
this.mutationBonus = bonus;
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
if (MoonPhase.getMoonPhase(world).isBetween(this.moonPhaseStart, this.moonPhaseEnd)) {
return this.mutationBonus;
}
return 1;
}
@Override
public String getDescription() {
if (this.moonPhaseStart != this.moonPhaseEnd) {
return String.format(LocalizationManager.getLocalizedString("research.bonusPhase"),
moonPhaseStart.getLocalizedNameAlt(), moonPhaseEnd.getLocalizedNameAlt());
} else {
return String.format(LocalizationManager.getLocalizedString("research.bonusPhaseSingle"),
moonPhaseStart.getLocalizedName());
}
}
}