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,45 @@
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;
public class MoonPhaseMutationRestriction implements IMutationCondition {
private final MoonPhase moonPhaseStart;
private final MoonPhase moonPhaseEnd;
public MoonPhaseMutationRestriction(MoonPhase phase) {
this.moonPhaseStart = phase;
this.moonPhaseEnd = phase;
}
public MoonPhaseMutationRestriction(MoonPhase start, MoonPhase end) {
this.moonPhaseStart = start;
this.moonPhaseEnd = end;
}
@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 1;
}
return 0;
}
@Override
public String getDescription() {
if (moonPhaseStart != moonPhaseEnd) {
return String.format(LocalizationManager.getLocalizedString("research.requiresPhase"),
moonPhaseStart.getLocalizedNameAlt(), moonPhaseEnd.getLocalizedNameAlt());
}
else {
return String.format(LocalizationManager.getLocalizedString("research.requiresPhaseSingle"),
moonPhaseStart.getLocalizedName());
}
}
}