Merge pull request #2006 from temp1011/self-breeding

Add self-pollination of leaves near bees
This commit is contained in:
Nedelosk authored and GitHub committed 2018-03-14 17:06:24 +01:00
commit 0638822b74
4 files changed
+11 -3

No files matched your search

@@ -157,7 +157,9 @@ public class ModuleApiculture extends BlankForestryModule {
public static int ticksPerBeeWorkCycle = 550;
public static boolean hivesDamageOnPeaceful = false;
public static boolean doSelfPollination = true;
public static int maxFlowersSpawnedPerHive = 20;
@Nullable
public static VillagerRegistry.VillagerProfession villagerApiarist;
@@ -280,6 +282,8 @@ public class ModuleApiculture extends BlankForestryModule {
ticksPerBeeWorkCycle = config.getIntLocalized("beekeeping", "ticks.work", 550, 250, 850);
hivesDamageOnPeaceful = config.getBooleanLocalized("beekeeping", "hivedamage.peaceful", false);
doSelfPollination = config.getBooleanLocalized("beekeeping", "self.pollination", false);
config.save();
@@ -61,6 +61,7 @@ import forestry.api.genetics.IFlowerProvider;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IMutation;
import forestry.api.genetics.IPollinatable;
import forestry.apiculture.ModuleApiculture;
import forestry.core.config.Config;
import forestry.core.config.Constants;
import forestry.core.errors.EnumErrorCode;
@@ -13,6 +13,8 @@ package forestry.arboriculture.genetics;
import forestry.api.arboriculture.ITree;
import forestry.api.genetics.ICheckPollinatable;
import forestry.api.genetics.IIndividual;
import forestry.apiculture.ModuleApiculture;
import net.minecraftforge.common.EnumPlantType;
public class CheckPollinatableTree implements ICheckPollinatable {
@@ -36,7 +38,7 @@ public class CheckPollinatableTree implements ICheckPollinatable {
public boolean canMateWith(IIndividual pollen) {
return pollen instanceof ITree &&
tree.getMate() == null &&
!tree.isGeneticEqual(pollen);
(ModuleApiculture.doSelfPollination || !tree.isGeneticEqual(pollen));
}
@Override
@@ -53,6 +53,7 @@ import forestry.api.lepidopterology.ButterflyManager;
import forestry.api.lepidopterology.IButterfly;
import forestry.api.lepidopterology.IButterflyGenome;
import forestry.api.lepidopterology.IButterflyNursery;
import forestry.apiculture.ModuleApiculture;
import forestry.arboriculture.ModuleArboriculture;
import forestry.arboriculture.genetics.TreeDefinition;
import forestry.arboriculture.genetics.alleles.AlleleFruits;
@@ -309,7 +310,7 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
ITree tree = getTree();
return tree != null &&
tree.getMate() == null &&
!tree.isGeneticEqual(individual);
(ModuleApiculture.doSelfPollination ||!tree.isGeneticEqual(individual));
}
return false;
}