mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-25 14:24:42 +00:00
Use generics for Chromosome type, begin unifying code
This commit is contained in:
1 parent
a8270ef365
commit
43e41034f6
217 files changed
+3148
-2417
No files matched your search
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
@@ -17,6 +18,7 @@ import java.util.Random;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeChromosome;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.DefaultBeeModifier;
|
||||
import forestry.api.apiculture.IBee;
|
||||
@@ -24,6 +26,7 @@ import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.api.genetics.IGenome;
|
||||
|
||||
public class BeekeepingMode implements IBeekeepingMode {
|
||||
|
||||
@@ -34,24 +37,34 @@ public class BeekeepingMode implements IBeekeepingMode {
|
||||
public static final IBeekeepingMode insane = new BeekeepingMode("INSANE", 0.2f, 10.0f, 0.6f, true, true);
|
||||
|
||||
private final Random rand;
|
||||
@Nonnull
|
||||
private final String name;
|
||||
private final boolean reducesFertility;
|
||||
private final boolean canFatigue;
|
||||
private final float mutationModifier;
|
||||
@Nonnull
|
||||
private final IBeeModifier beeModifier;
|
||||
|
||||
public BeekeepingMode(String name, float mutationModifier, float lifespanModifier, float speedModifier, boolean reducesFertility, boolean canFatigue) {
|
||||
private BeekeepingMode(@Nonnull String name, float mutationModifier, float lifespanModifier, float speedModifier, boolean reducesFertility, boolean canFatigue) {
|
||||
this.rand = new Random();
|
||||
this.name = name;
|
||||
this.reducesFertility = reducesFertility;
|
||||
this.canFatigue = canFatigue;
|
||||
this.beeModifier = new BeekeepingModeBeeModifier(mutationModifier, lifespanModifier, speedModifier);
|
||||
this.mutationModifier = mutationModifier;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(IGenome<BeeChromosome> genome, IGenome<BeeChromosome> mate) {
|
||||
return mutationModifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getDescription() {
|
||||
ArrayList<String> ret = new ArrayList<>();
|
||||
@@ -118,17 +131,13 @@ public class BeekeepingMode implements IBeekeepingMode {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNaturalOffspring(IBee queen) {
|
||||
return queen.isNatural();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mayMultiplyPrincess(IBee queen) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeModifier getBeeModifier() {
|
||||
return beeModifier;
|
||||
|
||||
Reference in new issue
Block a user