mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-19 03:39:09 +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
+14
-4
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Locale;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
@@ -22,7 +23,7 @@ import forestry.api.genetics.ISpeciesRoot;
|
||||
*
|
||||
* @author SirSengir
|
||||
*/
|
||||
public enum EnumBeeChromosome implements IChromosomeType {
|
||||
public enum BeeChromosome implements IChromosomeType<BeeChromosome> {
|
||||
/**
|
||||
* Species of the bee. Alleles here must implement {@link IAlleleBeeSpecies}.
|
||||
*/
|
||||
@@ -75,25 +76,34 @@ public enum EnumBeeChromosome implements IChromosomeType {
|
||||
* Determines the bee's effect.
|
||||
*/
|
||||
EFFECT(IAlleleBeeEffect.class);
|
||||
|
||||
|
||||
@Nonnull
|
||||
private final Class<? extends IAllele> alleleClass;
|
||||
|
||||
EnumBeeChromosome(Class<? extends IAllele> alleleClass) {
|
||||
BeeChromosome(@Nonnull Class<? extends IAllele> alleleClass) {
|
||||
this.alleleClass = alleleClass;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<? extends IAllele> getAlleleClass() {
|
||||
return alleleClass;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
public ISpeciesRoot<BeeChromosome> getSpeciesRoot() {
|
||||
return BeeManager.beeRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getUid() {
|
||||
return (byte) ordinal();
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
|
||||
/**
|
||||
* Easily extendable default IBeeListener.
|
||||
@@ -24,7 +24,7 @@ public class DefaultBeeListener implements IBeeListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPollenRetrieved(IIndividual pollen) {
|
||||
public boolean onPollenRetrieved(ITree pollen) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
|
||||
public interface IAlleleBeeSpecies extends IAlleleSpecies {
|
||||
public interface IAlleleBeeSpecies extends IAlleleSpecies<BeeChromosome> {
|
||||
|
||||
/**
|
||||
* @return the IBeeRoot
|
||||
|
||||
+11
-8
@@ -7,37 +7,40 @@ package forestry.api.apiculture;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.genetics.IAlleleSpeciesCustom;
|
||||
import forestry.api.genetics.IAlleleSpeciesBuilder;
|
||||
|
||||
public interface IAlleleBeeSpeciesCustom extends IAlleleBeeSpecies, IAlleleSpeciesCustom {
|
||||
public interface IAlleleBeeSpeciesBuilder extends IAlleleSpeciesBuilder<BeeChromosome> {
|
||||
|
||||
@Override
|
||||
IAlleleBeeSpecies build();
|
||||
|
||||
/**
|
||||
* Add a product for this bee species.
|
||||
* Chance is between 0 and 1.
|
||||
*/
|
||||
IAlleleBeeSpeciesCustom addProduct(ItemStack product, Float chance);
|
||||
IAlleleBeeSpeciesBuilder addProduct(ItemStack product, Float chance);
|
||||
|
||||
/**
|
||||
* Add a specialty product for this bee species.
|
||||
* Bees only produce their specialty when they are Jubilant (see IJubilanceProvider)
|
||||
* Chance is between 0 and 1.
|
||||
*/
|
||||
IAlleleBeeSpeciesCustom addSpecialty(ItemStack specialty, Float chance);
|
||||
IAlleleBeeSpeciesBuilder addSpecialty(ItemStack specialty, Float chance);
|
||||
|
||||
/**
|
||||
* Set the Jubilance Provider for this bee species.
|
||||
* Bees only produce their specialty when they are Jubilant (see IJubilanceProvider)
|
||||
*/
|
||||
IAlleleBeeSpeciesCustom setJubilanceProvider(IJubilanceProvider provider);
|
||||
IAlleleBeeSpeciesBuilder setJubilanceProvider(IJubilanceProvider provider);
|
||||
|
||||
/**
|
||||
* Make this species only active at night.
|
||||
*/
|
||||
IAlleleBeeSpeciesCustom setNocturnal();
|
||||
IAlleleBeeSpeciesBuilder setNocturnal();
|
||||
|
||||
/** Use this if you have custom icons for bees. */
|
||||
IAlleleBeeSpeciesCustom setCustomBeeModelProvider(IBeeModelProvider beeIconProvider);
|
||||
IAlleleBeeSpeciesBuilder setCustomBeeModelProvider(IBeeModelProvider beeIconProvider);
|
||||
|
||||
/** Use this if you have custom icon colours for bees (other than the default static primary + secondary colours). */
|
||||
IAlleleBeeSpeciesCustom setCustomBeeSpriteColourProvider(IBeeSpriteColourProvider beeIconColourProvider);
|
||||
IAlleleBeeSpeciesBuilder setCustomBeeSpriteColourProvider(IBeeSpriteColourProvider beeIconColourProvider);
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import forestry.api.genetics.IIndividual;
|
||||
*
|
||||
* @author SirSengir
|
||||
*/
|
||||
public interface IApiaristTracker extends IBreedingTracker {
|
||||
public interface IApiaristTracker extends IBreedingTracker<BeeChromosome> {
|
||||
|
||||
/**
|
||||
* Register the birth of a queen. Will mark species as discovered.
|
||||
@@ -21,7 +21,7 @@ public interface IApiaristTracker extends IBreedingTracker {
|
||||
* @param queen
|
||||
* Created queen.
|
||||
*/
|
||||
void registerQueen(IIndividual queen);
|
||||
void registerQueen(IIndividual<BeeChromosome> queen);
|
||||
|
||||
/**
|
||||
* @return Amount of queens bred with this tracker.
|
||||
@@ -34,7 +34,7 @@ public interface IApiaristTracker extends IBreedingTracker {
|
||||
* @param princess
|
||||
* Created princess.
|
||||
*/
|
||||
void registerPrincess(IIndividual princess);
|
||||
void registerPrincess(IIndividual<BeeChromosome> princess);
|
||||
|
||||
/**
|
||||
* @return Amount of princesses bred with this tracker.
|
||||
@@ -47,7 +47,7 @@ public interface IApiaristTracker extends IBreedingTracker {
|
||||
* @param drone
|
||||
* Created drone.
|
||||
*/
|
||||
void registerDrone(IIndividual drone);
|
||||
void registerDrone(IIndividual<BeeChromosome> drone);
|
||||
|
||||
/**
|
||||
* @return Amount of drones bred with this tracker.
|
||||
|
||||
@@ -13,9 +13,9 @@ import java.util.Set;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IIndividualLiving;
|
||||
|
||||
/**
|
||||
@@ -23,7 +23,7 @@ import forestry.api.genetics.IIndividualLiving;
|
||||
*
|
||||
* @author SirSengir
|
||||
*/
|
||||
public interface IBee extends IIndividualLiving {
|
||||
public interface IBee extends IIndividualLiving<BeeChromosome> {
|
||||
|
||||
/**
|
||||
* @return Bee's genetic information.
|
||||
@@ -79,14 +79,16 @@ public interface IBee extends IIndividualLiving {
|
||||
|
||||
ItemStack[] produceStacks(IBeeHousing housing);
|
||||
|
||||
@Nullable
|
||||
IBee spawnPrincess(IBeeHousing housing);
|
||||
|
||||
@Nullable
|
||||
IBee[] spawnDrones(IBeeHousing housing);
|
||||
|
||||
void plantFlowerRandom(IBeeHousing housing);
|
||||
|
||||
IIndividual retrievePollen(IBeeHousing housing);
|
||||
ITree retrievePollen(IBeeHousing housing);
|
||||
|
||||
boolean pollinateRandom(IBeeHousing housing, IIndividual pollen);
|
||||
boolean pollinateRandom(IBeeHousing housing, ITree pollen);
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@ public interface IBeeFactory {
|
||||
/**
|
||||
* Creates a new bee species.
|
||||
* Automatically registered with AlleleManager.alleleRegistry.registerAllele()
|
||||
* See IAlleleBeeSpeciesCustom and IAlleleSpeciesCustom for adding additional properties to the returned species.
|
||||
* See IAlleleBeeSpeciesBuilder and IAlleleSpeciesBuilder for adding additional properties to the returned species.
|
||||
*
|
||||
* @param uid Unique Identifier for this species
|
||||
* @param dominant Whether this species is genetically dominant (false means it is recessive)
|
||||
@@ -25,7 +25,7 @@ public interface IBeeFactory {
|
||||
* @param secondaryColor The body color of this species
|
||||
* @return a new bee species allele.
|
||||
*/
|
||||
IAlleleBeeSpeciesCustom createSpecies(String uid, boolean dominant, String authority, String unlocalizedName, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor);
|
||||
IAlleleBeeSpeciesBuilder createSpecies(String uid, boolean dominant, String authority, String unlocalizedName, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor);
|
||||
|
||||
/**
|
||||
* Creates a new bee branch.
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IGenome;
|
||||
@@ -15,11 +17,13 @@ import forestry.api.genetics.IGenome;
|
||||
* @author SirSengir
|
||||
*
|
||||
*/
|
||||
public interface IBeeGenome extends IGenome {
|
||||
public interface IBeeGenome extends IGenome<BeeChromosome> {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
IAlleleBeeSpecies getPrimary();
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
IAlleleBeeSpecies getSecondary();
|
||||
|
||||
@@ -29,8 +33,10 @@ public interface IBeeGenome extends IGenome {
|
||||
|
||||
int getFertility();
|
||||
|
||||
@Nonnull
|
||||
EnumTolerance getToleranceTemp();
|
||||
|
||||
@Nonnull
|
||||
EnumTolerance getToleranceHumid();
|
||||
|
||||
boolean getNocturnal();
|
||||
@@ -39,12 +45,17 @@ public interface IBeeGenome extends IGenome {
|
||||
|
||||
boolean getCaveDwelling();
|
||||
|
||||
@Nonnull
|
||||
IFlowerProvider getFlowerProvider();
|
||||
|
||||
int getFlowering();
|
||||
|
||||
int[] getTerritory();
|
||||
|
||||
@Nonnull
|
||||
IAlleleBeeEffect getEffect();
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
IBeeRoot getSpeciesRoot();
|
||||
}
|
||||
@@ -6,11 +6,8 @@
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
@@ -44,12 +41,8 @@ public interface IBeeHousing extends IHousing, IErrorLogicSource {
|
||||
|
||||
boolean canBlockSeeTheSky();
|
||||
|
||||
World getWorld();
|
||||
|
||||
BiomeGenBase getBiome();
|
||||
|
||||
GameProfile getOwner();
|
||||
|
||||
/**
|
||||
* @since Forestry 4.2
|
||||
* @return exact coordinates where bee FX should spawn from
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
|
||||
public interface IBeeListener {
|
||||
|
||||
@@ -24,6 +24,6 @@ public interface IBeeListener {
|
||||
* Called when the bees have retrieved some pollen.
|
||||
* @return true if this bee listener handled the pollen.
|
||||
*/
|
||||
boolean onPollenRetrieved(IIndividual pollen);
|
||||
boolean onPollenRetrieved(ITree pollen);
|
||||
|
||||
}
|
||||
@@ -5,10 +5,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.genetics.IMutation;
|
||||
|
||||
public interface IBeeMutation extends IMutation {
|
||||
|
||||
public interface IBeeMutation extends IMutation<BeeChromosome> {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
IBeeRoot getRoot();
|
||||
|
||||
|
||||
+6
-2
@@ -5,8 +5,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import forestry.api.genetics.IMutationCustom;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public interface IBeeMutationCustom extends IBeeMutation, IMutationCustom {
|
||||
import forestry.api.genetics.IMutationBuilder;
|
||||
|
||||
public interface IBeeMutationBuilder extends IMutationBuilder<BeeChromosome> {
|
||||
@Nonnull
|
||||
@Override
|
||||
IBeeMutation build();
|
||||
}
|
||||
@@ -5,13 +5,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
public interface IBeeMutationFactory {
|
||||
/**
|
||||
* Creates a new bee mutation.
|
||||
* Automatically registered with BeeManager.beeRoot.registerMutation()
|
||||
* See IBeeMutationCustom and IMutationCustom for adding additional properties to the returned mutation.
|
||||
* See IBeeMutationBuilder and IMutationBuilder for adding additional properties to the returned mutation.
|
||||
*
|
||||
* @param parentBee0 A parent bee for this mutation
|
||||
* @param parentBee1 A parent bee for this mutation
|
||||
@@ -19,5 +21,5 @@ public interface IBeeMutationFactory {
|
||||
* @param chance The chance that breeding the two parent bees will result in this mutation
|
||||
* @return a new bee mutation.
|
||||
*/
|
||||
IBeeMutationCustom createMutation(IAlleleBeeSpecies parentBee0, IAlleleBeeSpecies parentBee1, IAllele[] result, int chance);
|
||||
IBeeMutationBuilder createMutation(IAlleleBeeSpecies parentBee0, IAlleleBeeSpecies parentBee1, ImmutableMap<BeeChromosome, IAllele> result, int chance);
|
||||
}
|
||||
@@ -5,8 +5,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -15,9 +18,10 @@ import net.minecraft.world.World;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public interface IBeeRoot extends ISpeciesRoot {
|
||||
public interface IBeeRoot extends ISpeciesRoot<BeeChromosome> {
|
||||
|
||||
/**
|
||||
* @return true if passed item is a Forestry bee. Equal to getType(ItemStack stack) != EnumBeeType.NONE
|
||||
@@ -35,17 +39,23 @@ public interface IBeeRoot extends ISpeciesRoot {
|
||||
IBee getMember(NBTTagCompound compound);
|
||||
|
||||
/* GENOME CONVERSION */
|
||||
@Nonnull
|
||||
@Override
|
||||
IBee templateAsIndividual(IAllele[] template);
|
||||
IBee templateAsIndividual(ImmutableMap<BeeChromosome, IAllele> template);
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
IBee templateAsIndividual(ImmutableMap<BeeChromosome, IAllele> templateActive, ImmutableMap<BeeChromosome, IAllele> templateInactive);
|
||||
|
||||
@Override
|
||||
IBee templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
IBeeGenome templateAsGenome(ImmutableMap<BeeChromosome, IAllele> template);
|
||||
|
||||
@Override
|
||||
IBeeGenome templateAsGenome(IAllele[] template);
|
||||
IBeeGenome templateAsGenome(ImmutableMap<BeeChromosome, IAllele> templateActive, ImmutableMap<BeeChromosome, IAllele> templateInactive);
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
IBeeGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
IBeeGenome chromosomesAsGenome(ImmutableMap<BeeChromosome, IChromosome> chromosomes);
|
||||
|
||||
/* BREEDING TRACKER */
|
||||
|
||||
@@ -54,7 +64,8 @@ public interface IBeeRoot extends ISpeciesRoot {
|
||||
* @return {@link IApiaristTracker} associated with the passed world.
|
||||
*/
|
||||
@Override
|
||||
IApiaristTracker getBreedingTracker(World world, GameProfile player);
|
||||
@Nonnull
|
||||
IApiaristTracker getBreedingTracker(@Nonnull World world, @Nonnull GameProfile player);
|
||||
|
||||
/* BEE SPECIFIC */
|
||||
|
||||
@@ -94,24 +105,26 @@ public interface IBeeRoot extends ISpeciesRoot {
|
||||
|
||||
/* TEMPLATES */
|
||||
@Override
|
||||
ArrayList<IBee> getIndividualTemplates();
|
||||
List<IBee> getIndividualTemplates();
|
||||
|
||||
/* MUTATIONS */
|
||||
@Override
|
||||
Collection<IBeeMutation> getMutations(boolean shuffle);
|
||||
|
||||
/* GAME MODE */
|
||||
void resetBeekeepingMode();
|
||||
void registerMode(@Nonnull IBeekeepingMode mode);
|
||||
|
||||
ArrayList<IBeekeepingMode> getBeekeepingModes();
|
||||
@Nonnull
|
||||
@Override
|
||||
List<IBeekeepingMode> getModes();
|
||||
|
||||
IBeekeepingMode getBeekeepingMode(World world);
|
||||
@Nonnull
|
||||
@Override
|
||||
IBeekeepingMode getMode(@Nonnull World world);
|
||||
|
||||
IBeekeepingMode getBeekeepingMode(String name);
|
||||
|
||||
void registerBeekeepingMode(IBeekeepingMode mode);
|
||||
|
||||
void setBeekeepingMode(World world, String name);
|
||||
@Nonnull
|
||||
@Override
|
||||
IBeekeepingMode getMode(@Nonnull String name);
|
||||
|
||||
/* MISC */
|
||||
|
||||
|
||||
@@ -5,18 +5,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IBeekeepingMode {
|
||||
|
||||
/**
|
||||
* @return Localized name of this beekeeping mode.
|
||||
*/
|
||||
String getName();
|
||||
import forestry.api.genetics.ISpeciesMode;
|
||||
|
||||
public interface IBeekeepingMode extends ISpeciesMode<BeeChromosome> {
|
||||
/**
|
||||
* @return Localized list of strings outlining the behaviour of this beekeeping mode.
|
||||
*/
|
||||
@@ -55,12 +52,6 @@ public interface IBeekeepingMode {
|
||||
*/
|
||||
boolean isDegenerating(IBee queen, IBee offspring, IBeeHousing housing);
|
||||
|
||||
/**
|
||||
* @param queen
|
||||
* @return true if an offspring of this queen is considered a natural
|
||||
*/
|
||||
boolean isNaturalOffspring(IBee queen);
|
||||
|
||||
/**
|
||||
* @param queen
|
||||
* @return true if this mode allows the passed queen or princess to be multiplied
|
||||
@@ -70,5 +61,6 @@ public interface IBeekeepingMode {
|
||||
/**
|
||||
* @return the bee modifier for this mode
|
||||
*/
|
||||
@Nonnull
|
||||
IBeeModifier getBeeModifier();
|
||||
}
|
||||
@@ -18,7 +18,7 @@ import forestry.api.core.IModelManager;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
|
||||
public interface IAlleleTreeSpecies extends IAlleleSpecies, Comparable<IAlleleTreeSpecies> {
|
||||
public interface IAlleleTreeSpecies extends IAlleleSpecies<TreeChromosome>, Comparable<IAlleleTreeSpecies> {
|
||||
|
||||
@Override
|
||||
ITreeRoot getRoot();
|
||||
|
||||
+6
-4
@@ -7,15 +7,17 @@ package forestry.api.arboriculture;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.genetics.IAlleleSpeciesCustom;
|
||||
import forestry.api.genetics.IAlleleSpeciesBuilder;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
|
||||
public interface IAlleleTreeSpeciesCustom extends IAlleleSpeciesCustom, IAlleleTreeSpecies {
|
||||
public interface IAlleleTreeSpeciesBuilder extends IAlleleSpeciesBuilder<TreeChromosome> {
|
||||
@Override
|
||||
IAlleleTreeSpecies build();
|
||||
|
||||
/** Add a fruit family for this tree. Trees can have multiple fruit families. */
|
||||
IAlleleTreeSpeciesCustom addFruitFamily(IFruitFamily family);
|
||||
IAlleleTreeSpeciesBuilder addFruitFamily(IFruitFamily family);
|
||||
|
||||
/** Set the minecraft plant type for this tree. Default is Plains. */
|
||||
IAlleleTreeSpeciesCustom setPlantType(EnumPlantType type);
|
||||
IAlleleTreeSpeciesBuilder setPlantType(EnumPlantType type);
|
||||
|
||||
}
|
||||
@@ -7,6 +7,6 @@ package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
|
||||
public interface IArboristTracker extends IBreedingTracker {
|
||||
public interface IArboristTracker extends IBreedingTracker<TreeChromosome> {
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -22,7 +23,7 @@ import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.world.ITreeGenData;
|
||||
|
||||
public interface ITree extends IIndividual, ITreeGenData {
|
||||
public interface ITree extends IIndividual<TreeChromosome>, ITreeGenData {
|
||||
|
||||
void mate(ITree other);
|
||||
|
||||
@@ -38,10 +39,7 @@ public interface ITree extends IIndividual, ITreeGenData {
|
||||
|
||||
EnumSet<EnumPlantType> getPlantTypes();
|
||||
|
||||
/**
|
||||
* @since Forestry 4.0
|
||||
*/
|
||||
ITree[] getSaplings(World world, GameProfile playerProfile, BlockPos pos, float modifier);
|
||||
Collection<ITree> getSaplings(World world, GameProfile playerProfile, BlockPos pos, float modifier);
|
||||
|
||||
ItemStack[] getProduceList();
|
||||
|
||||
@@ -86,7 +84,8 @@ public interface ITree extends IIndividual, ITreeGenData {
|
||||
@Override
|
||||
ITree copy();
|
||||
|
||||
boolean isPureBred(EnumTreeChromosome chromosome);
|
||||
@Override
|
||||
boolean isPureBred(TreeChromosome chromosome);
|
||||
|
||||
boolean canBearFruit();
|
||||
}
|
||||
@@ -13,7 +13,7 @@ public interface ITreeFactory {
|
||||
/**
|
||||
* Creates a new tree species.
|
||||
* Automatically registered with AlleleManager.alleleRegistry.registerAllele()
|
||||
* See IAlleleTreeSpeciesCustom and IAlleleSpeciesCustom for adding additional properties to the returned species.
|
||||
* See IAlleleTreeSpeciesBuilder and IAlleleSpeciesBuilder for adding additional properties to the returned species.
|
||||
*
|
||||
* @param uid Unique Identifier for this species
|
||||
* @param unlocalizedName Unlocalized name for this species
|
||||
@@ -28,7 +28,7 @@ public interface ITreeFactory {
|
||||
* @param generator The tree generator
|
||||
* @return a new tree species allele.
|
||||
*/
|
||||
IAlleleTreeSpeciesCustom createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, String mdoelName, ILeafSpriteProvider leafSpriteProvider, IGermlingModelProvider germlingModelProvider, ITreeGenerator generator);
|
||||
IAlleleTreeSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, String mdoelName, ILeafSpriteProvider leafSpriteProvider, IGermlingModelProvider germlingModelProvider, ITreeGenerator generator);
|
||||
|
||||
/** Get one of the built-in Forestry leaf types. Default type is deciduous. */
|
||||
ILeafSpriteProvider getLeafIconProvider(EnumLeafType enumLeafType, Color color, Color colorPollinated);
|
||||
|
||||
@@ -5,17 +5,20 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.genetics.IGenome;
|
||||
|
||||
public interface ITreeGenome extends IGenome {
|
||||
public interface ITreeGenome extends IGenome<TreeChromosome> {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
IAlleleTreeSpecies getPrimary();
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
IAlleleTreeSpecies getSecondary();
|
||||
|
||||
@@ -45,4 +48,8 @@ public interface ITreeGenome extends IGenome {
|
||||
int getGirth();
|
||||
|
||||
IAlleleLeafEffect getEffect();
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
ITreeRoot getSpeciesRoot();
|
||||
}
|
||||
@@ -34,12 +34,4 @@ public interface ITreeModifier {
|
||||
* @return Float used to modify the maturation.
|
||||
*/
|
||||
float getMaturationModifier(ITreeGenome genome, float currentModifier);
|
||||
|
||||
/**
|
||||
* @param genome0
|
||||
* @param genome1
|
||||
* @return Float used to modify the base mutation chance.
|
||||
*/
|
||||
float getMutationModifier(ITreeGenome genome0, ITreeGenome genome1, float currentModifier);
|
||||
|
||||
}
|
||||
@@ -5,23 +5,24 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public interface ITreeMutation extends IMutation {
|
||||
public interface ITreeMutation extends IMutation<TreeChromosome> {
|
||||
|
||||
/**
|
||||
* @return {@link ISpeciesRoot} this mutation is associated with.
|
||||
*/
|
||||
@Nonnull
|
||||
@Override
|
||||
ITreeRoot getRoot();
|
||||
|
||||
/**
|
||||
* @return float representing the percent chance for mutation to occur, from 0.0 to 100.0.
|
||||
* @since Forestry 4.0
|
||||
*/
|
||||
float getChance(World world, BlockPos pos, IAlleleTreeSpecies allele0, IAlleleTreeSpecies allele1, ITreeGenome genome0, ITreeGenome genome1);
|
||||
// /**
|
||||
// * @return float representing the percent chance for mutation to occur, from 0.0 to 100.0.
|
||||
// * @since Forestry 4.0
|
||||
// */
|
||||
// @Override
|
||||
// float getChance(World world, BlockPos pos, IAlleleTreeSpecies allele0, IAlleleTreeSpecies allele1, ITreeGenome genome0, ITreeGenome genome1);
|
||||
}
|
||||
+6
-2
@@ -5,8 +5,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.genetics.IMutationCustom;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public interface ITreeMutationCustom extends ITreeMutation, IMutationCustom {
|
||||
import forestry.api.genetics.IMutationBuilder;
|
||||
|
||||
public interface ITreeMutationBuilder extends IMutationBuilder<TreeChromosome> {
|
||||
@Nonnull
|
||||
@Override
|
||||
ITreeMutation build();
|
||||
}
|
||||
@@ -5,13 +5,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
public interface ITreeMutationFactory {
|
||||
/**
|
||||
* Creates a new tree mutation.
|
||||
* Automatically registered with TreeManager.treeRoot.registerMutation()
|
||||
* See ITreeMutationCustom and IMutationCustom for adding additional properties to the returned mutation.
|
||||
* See ITreeMutationBuilder and IMutationBuilder for adding additional properties to the returned mutation.
|
||||
*
|
||||
* @param parentTree0 A parent tree for this mutation
|
||||
* @param parentTree1 A parent tree for this mutation
|
||||
@@ -19,5 +21,5 @@ public interface ITreeMutationFactory {
|
||||
* @param chance The chance that breeding the two parent trees will result in this mutation
|
||||
* @return a new tree mutation.
|
||||
*/
|
||||
ITreeMutationCustom createMutation(IAlleleTreeSpecies parentTree0, IAlleleTreeSpecies parentTree1, IAllele[] result, int chance);
|
||||
ITreeMutationBuilder createMutation(IAlleleTreeSpecies parentTree0, IAlleleTreeSpecies parentTree1, ImmutableMap<TreeChromosome, IAllele> result, int chance);
|
||||
}
|
||||
@@ -5,8 +5,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -19,7 +23,7 @@ import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public interface ITreeRoot extends ISpeciesRoot {
|
||||
public interface ITreeRoot extends ISpeciesRoot<TreeChromosome> {
|
||||
|
||||
@Override
|
||||
boolean isMember(ItemStack itemstack);
|
||||
@@ -30,24 +34,30 @@ public interface ITreeRoot extends ISpeciesRoot {
|
||||
@Override
|
||||
ITree getMember(NBTTagCompound compound);
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
ITree templateAsIndividual(IAllele[] template);
|
||||
ITree templateAsIndividual(ImmutableMap<TreeChromosome, IAllele> template);
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
ITree templateAsIndividual(ImmutableMap<TreeChromosome, IAllele> templateActive, ImmutableMap<TreeChromosome, IAllele> templateInactive);
|
||||
|
||||
@Override
|
||||
ITree templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
ITreeGenome templateAsGenome(ImmutableMap<TreeChromosome, IAllele> template);
|
||||
|
||||
@Override
|
||||
ITreeGenome templateAsGenome(IAllele[] template);
|
||||
ITreeGenome templateAsGenome(ImmutableMap<TreeChromosome, IAllele> templateActive, ImmutableMap<TreeChromosome, IAllele> templateInactive);
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
ITreeGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
ITreeGenome chromosomesAsGenome(ImmutableMap<TreeChromosome, IChromosome> chromosomes);
|
||||
|
||||
/**
|
||||
* @param world
|
||||
* @return {@link IArboristTracker} associated with the passed world.
|
||||
*/
|
||||
@Nonnull
|
||||
@Override
|
||||
IArboristTracker getBreedingTracker(World world, GameProfile player);
|
||||
IArboristTracker getBreedingTracker(@Nonnull World world, @Nonnull GameProfile player);
|
||||
|
||||
/* TREE SPECIFIC */
|
||||
|
||||
@@ -72,23 +82,27 @@ public interface ITreeRoot extends ISpeciesRoot {
|
||||
boolean plantSapling(World world, ITree tree, GameProfile owner, BlockPos pos);
|
||||
|
||||
@Override
|
||||
IChromosome[] templateAsChromosomes(IAllele[] template);
|
||||
ImmutableMap<TreeChromosome, IChromosome> templateAsChromosomes(ImmutableMap<TreeChromosome, IAllele> template);
|
||||
|
||||
@Override
|
||||
IChromosome[] templateAsChromosomes(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
ImmutableMap<TreeChromosome, IChromosome> templateAsChromosomes(ImmutableMap<TreeChromosome, IAllele> templateActive, ImmutableMap<TreeChromosome, IAllele> templateInactive);
|
||||
|
||||
boolean setFruitBlock(World world, IAlleleFruit allele, float sappiness, short[] indices, BlockPos pos);
|
||||
|
||||
/* GAME MODE */
|
||||
ArrayList<ITreekeepingMode> getTreekeepingModes();
|
||||
@Nonnull
|
||||
@Override
|
||||
List<ITreekeepingMode> getModes();
|
||||
|
||||
ITreekeepingMode getTreekeepingMode(World world);
|
||||
@Nonnull
|
||||
@Override
|
||||
ITreekeepingMode getMode(@Nonnull World world);
|
||||
|
||||
ITreekeepingMode getTreekeepingMode(String name);
|
||||
@Nonnull
|
||||
@Override
|
||||
ITreekeepingMode getMode(@Nonnull String name);
|
||||
|
||||
void registerTreekeepingMode(ITreekeepingMode mode);
|
||||
|
||||
void setTreekeepingMode(World world, String name);
|
||||
void registerMode(@Nonnull ITreekeepingMode mode);
|
||||
|
||||
/* TEMPLATES */
|
||||
@Override
|
||||
|
||||
@@ -5,18 +5,18 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
public interface ITreekeepingMode extends ITreeModifier {
|
||||
import forestry.api.genetics.ISpeciesMode;
|
||||
|
||||
/**
|
||||
* @return Localized name of this treekeeping mode.
|
||||
*/
|
||||
String getName();
|
||||
public interface ITreekeepingMode extends ISpeciesMode<TreeChromosome> {
|
||||
|
||||
/**
|
||||
* @return Localized list of strings outlining the behaviour of this treekeeping mode.
|
||||
*/
|
||||
ArrayList<String> getDescription();
|
||||
List<String> getDescription();
|
||||
|
||||
@Nonnull
|
||||
ITreeModifier getTreeModifier();
|
||||
}
|
||||
+14
-7
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
@@ -17,9 +18,8 @@ import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IAllelePlantType;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public enum EnumTreeChromosome implements IChromosomeType {
|
||||
public enum TreeChromosome implements IChromosomeType<TreeChromosome> {
|
||||
|
||||
/**
|
||||
* Determines the following: - WorldGen, including the used wood blocks - {@link IFruitFamily}s supported. Limits which {@link IFruitProvider}
|
||||
@@ -73,25 +73,32 @@ public enum EnumTreeChromosome implements IChromosomeType {
|
||||
*/
|
||||
FIREPROOF(IAlleleBoolean.class),;
|
||||
|
||||
Class<? extends IAllele> clss;
|
||||
Class<? extends IAllele> alleleClass;
|
||||
|
||||
EnumTreeChromosome(Class<? extends IAllele> clss) {
|
||||
this.clss = clss;
|
||||
TreeChromosome(Class<? extends IAllele> alleleClass) {
|
||||
this.alleleClass = alleleClass;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<? extends IAllele> getAlleleClass() {
|
||||
return clss;
|
||||
return alleleClass;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
public ITreeRoot getSpeciesRoot() {
|
||||
return TreeManager.treeRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getUid() {
|
||||
return (byte) ordinal();
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public interface INbtWritable {
|
||||
void writeToNBT(NBTTagCompound nbt);
|
||||
void writeToNBT(@Nonnull NBTTagCompound nbt);
|
||||
}
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* An {@link IIndividual}'s {@link IGenome} is composed of {@link IChromosome}s consisting each of a primary and secondary {@link IAllele}.
|
||||
*
|
||||
@@ -19,6 +21,7 @@ public interface IAllele {
|
||||
/**
|
||||
* @return A unique string identifier for this allele.
|
||||
*/
|
||||
@Nonnull
|
||||
String getUID();
|
||||
|
||||
/**
|
||||
@@ -29,11 +32,13 @@ public interface IAllele {
|
||||
/**
|
||||
* @return Localized short, human-readable identifier used in tooltips and beealyzer.
|
||||
*/
|
||||
@Nonnull
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @return The unlocalized identifier
|
||||
*/
|
||||
@Nonnull
|
||||
String getUnlocalizedName();
|
||||
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public interface IAlleleFactory {
|
||||
* @param valueName allele value name for uid and localization (i.e. "smallest")
|
||||
* @param value allele float value
|
||||
* @param isDominant allele dominance
|
||||
* @param types allele chromosome type for registration (i.e. EnumTreeChromosome.HEIGHT)
|
||||
* @param types allele chromosome type for registration (i.e. TreeChromosome.HEIGHT)
|
||||
* @return a new IAlleleFloat, registered with the allele registry.
|
||||
* @since Forestry 4.2
|
||||
*/
|
||||
@@ -45,7 +45,7 @@ public interface IAlleleFactory {
|
||||
* @param yDimValue allele area Y Size
|
||||
* @param zDimValue allele area Z Size
|
||||
* @param isDominant allele dominance
|
||||
* @param types allele chromosome type for registration (i.e. EnumBeeChromosome.TERRITORY)
|
||||
* @param types allele chromosome type for registration (i.e. BeeChromosome.TERRITORY)
|
||||
* @return a new IAlleleArea, registered with the allele registry.
|
||||
* @since Forestry 4.2
|
||||
*/
|
||||
@@ -57,7 +57,7 @@ public interface IAlleleFactory {
|
||||
* @param valueName allele value name for uid and localization (i.e. "low")
|
||||
* @param value allele int value
|
||||
* @param isDominant allele dominance
|
||||
* @param types allele chromosome type for registration (i.e. EnumBeeChromosome.FERTILITY)
|
||||
* @param types allele chromosome type for registration (i.e. BeeChromosome.FERTILITY)
|
||||
* @return a new IAlleleInteger, registered with the allele registry.
|
||||
* @since Forestry 4.2
|
||||
*/
|
||||
@@ -68,7 +68,7 @@ public interface IAlleleFactory {
|
||||
* @param category allele category for uid and localization (i.e. "fireproof")
|
||||
* @param value allele boolean value
|
||||
* @param isDominant allele dominance
|
||||
* @param types allele chromosome type for registration (i.e. EnumTreeChromosome.FIREPROOF)
|
||||
* @param types allele chromosome type for registration (i.e. TreeChromosome.FIREPROOF)
|
||||
* @return a new IAlleleBoolean, registered with the allele registry.
|
||||
* Note that valueName will always be "true" or "false"
|
||||
* @since Forestry 4.2
|
||||
@@ -81,7 +81,7 @@ public interface IAlleleFactory {
|
||||
* @param valueName allele value name for uid (i.e. "vanilla")
|
||||
* @param value allele IFlowerProvider value
|
||||
* @param isDominant allele dominance
|
||||
* @param types allele chromosome type for registration (i.e. EnumBeeChromosome.FLOWER_PROVIDER)
|
||||
* @param types allele chromosome type for registration (i.e. BeeChromosome.FLOWER_PROVIDER)
|
||||
* @return a new IAlleleFlowers, registered with the allele registry.
|
||||
* IAlleleFlowers localization is handled by the IFlowerProvider.getDescription(), unlike the other alleles.
|
||||
* @since Forestry 4.2
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -27,7 +28,7 @@ public interface IAlleleRegistry {
|
||||
* Register a {@link ISpeciesRoot}.
|
||||
* @param root {@link ISpeciesRoot} to register.
|
||||
*/
|
||||
void registerSpeciesRoot(ISpeciesRoot root);
|
||||
void registerSpeciesRoot(ISpeciesRoot<?> root);
|
||||
|
||||
/**
|
||||
* @return Map of all registered {@link ISpeciesRoot}.
|
||||
@@ -39,21 +40,21 @@ public interface IAlleleRegistry {
|
||||
* @param uid Unique id for the species class, i.e. "rootBees", "rootTrees", "rootButterflies".
|
||||
* @return {@link ISpeciesRoot} if it exists, null otherwise.
|
||||
*/
|
||||
ISpeciesRoot getSpeciesRoot(String uid);
|
||||
ISpeciesRoot<?> getSpeciesRoot(String uid);
|
||||
|
||||
/**
|
||||
* Retrieve a matching {@link ISpeciesRoot} for the given itemstack.
|
||||
* @param stack An itemstack possibly containing NBT data which can be converted by a species root.
|
||||
* @return {@link ISpeciesRoot} if found, null otherwise.
|
||||
*/
|
||||
ISpeciesRoot getSpeciesRoot(ItemStack stack);
|
||||
ISpeciesRoot<?> getSpeciesRoot(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Retrieve a matching {@link ISpeciesRoot} for the given {@link IIndividual}-class.
|
||||
* @param clz Class extending {@link IIndividual}.
|
||||
* @param individualClass Class extending {@link IIndividual}.
|
||||
* @return {@link ISpeciesRoot} if found, null otherwise.
|
||||
*/
|
||||
ISpeciesRoot getSpeciesRoot(Class<? extends IIndividual> clz);
|
||||
ISpeciesRoot<?> getSpeciesRoot(Class<? extends IIndividual> individualClass);
|
||||
|
||||
/* INDIVIDUAL */
|
||||
|
||||
@@ -72,7 +73,8 @@ public interface IAlleleRegistry {
|
||||
* Stack to retrieve genetic information for.
|
||||
* @return IIndividual containing genetic information, null if none could be extracted.
|
||||
*/
|
||||
IIndividual getIndividual(ItemStack stack);
|
||||
@Nullable
|
||||
IIndividual<?> getIndividual(ItemStack stack);
|
||||
|
||||
/* ALLELES */
|
||||
|
||||
@@ -91,7 +93,7 @@ public interface IAlleleRegistry {
|
||||
* @param chromosomeTypes valid chromosomeTypes for this allele.
|
||||
* @since Forestry 4.2
|
||||
*/
|
||||
void registerAllele(IAllele allele, IChromosomeType... chromosomeTypes);
|
||||
void registerAllele(IAllele allele, IChromosomeType<?>... chromosomeTypes);
|
||||
|
||||
/**
|
||||
* @return HashMap of all registered deprecated alleles and their corresponding replacements
|
||||
@@ -121,7 +123,9 @@ public interface IAlleleRegistry {
|
||||
* @return unmodifiable collection of all the known allele variations for the given chromosome type.
|
||||
* @since Forestry 4.2
|
||||
*/
|
||||
Collection<IAllele> getRegisteredAlleles(IChromosomeType type);
|
||||
Collection<IAllele> getRegisteredAlleles(IChromosomeType<?> type);
|
||||
|
||||
Collection<IChromosomeType<?>> getChromosomeTypes(IAllele allele);
|
||||
|
||||
/* CLASSIFICATIONS */
|
||||
|
||||
|
||||
@@ -20,12 +20,12 @@ import forestry.api.core.IModelProvider;
|
||||
/**
|
||||
* Basic species allele.
|
||||
*/
|
||||
public interface IAlleleSpecies extends IAllele {
|
||||
public interface IAlleleSpecies<C extends IChromosomeType> extends IAllele {
|
||||
|
||||
/**
|
||||
* @return the {@link ISpeciesRoot} associated with this species.
|
||||
*/
|
||||
ISpeciesRoot getRoot();
|
||||
ISpeciesRoot<C> getRoot();
|
||||
|
||||
/**
|
||||
* @return Localized short description of this species. (May be null.)
|
||||
@@ -74,7 +74,7 @@ public interface IAlleleSpecies extends IAllele {
|
||||
* @param bountyLevel
|
||||
* @return Array of itemstacks representing the bounty for this research success.
|
||||
*/
|
||||
ItemStack[] getResearchBounty(World world, GameProfile gameProfile, IIndividual individual, int bountyLevel);
|
||||
ItemStack[] getResearchBounty(World world, GameProfile gameProfile, IIndividual<C> individual, int bountyLevel);
|
||||
|
||||
/* CLIMATE */
|
||||
|
||||
|
||||
+8
-6
@@ -8,17 +8,19 @@ package forestry.api.genetics;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
|
||||
public interface IAlleleSpeciesCustom extends IAlleleSpecies {
|
||||
public interface IAlleleSpeciesBuilder<C extends IChromosomeType<C>> {
|
||||
|
||||
IAlleleSpeciesCustom setTemperature(EnumTemperature temperature);
|
||||
IAlleleSpecies<C> build();
|
||||
|
||||
IAlleleSpeciesCustom setHumidity(EnumHumidity humidity);
|
||||
IAlleleSpeciesBuilder<C> setTemperature(EnumTemperature temperature);
|
||||
|
||||
IAlleleSpeciesCustom setHasEffect();
|
||||
IAlleleSpeciesBuilder<C> setHumidity(EnumHumidity humidity);
|
||||
|
||||
IAlleleSpeciesBuilder<C> setHasEffect();
|
||||
|
||||
/** Secret species are not shown in creative mode. */
|
||||
IAlleleSpeciesCustom setIsSecret();
|
||||
IAlleleSpeciesBuilder<C> setIsSecret();
|
||||
|
||||
/** Uncounted species do not count toward total species discovered. */
|
||||
IAlleleSpeciesCustom setIsNotCounted();
|
||||
IAlleleSpeciesBuilder<C> setIsNotCounted();
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import forestry.api.apiculture.IBeekeepingMode;
|
||||
*
|
||||
* @author SirSengir
|
||||
*/
|
||||
public interface IBreedingTracker {
|
||||
public interface IBreedingTracker<C extends IChromosomeType> {
|
||||
|
||||
/**
|
||||
* @return Name of the current {@link IBeekeepingMode}.
|
||||
@@ -37,28 +37,28 @@ public interface IBreedingTracker {
|
||||
*
|
||||
* @param individual
|
||||
*/
|
||||
void registerBirth(IIndividual individual);
|
||||
void registerBirth(IIndividual<C> individual);
|
||||
|
||||
/**
|
||||
* Register the pickup of an individual.
|
||||
*
|
||||
* @param individual
|
||||
*/
|
||||
void registerPickup(IIndividual individual);
|
||||
void registerPickup(IIndividual<C> individual);
|
||||
|
||||
/**
|
||||
* Marks a species as discovered. Should only be called from registerIndividual normally.
|
||||
*
|
||||
* @param species
|
||||
*/
|
||||
void registerSpecies(IAlleleSpecies species);
|
||||
void registerSpecies(IAlleleSpecies<C> species);
|
||||
|
||||
/**
|
||||
* Register a successful mutation. Will mark it as discovered.
|
||||
*
|
||||
* @param mutation
|
||||
*/
|
||||
void registerMutation(IMutation mutation);
|
||||
void registerMutation(IMutation<C> mutation);
|
||||
|
||||
/**
|
||||
* Queries the tracker for discovered species.
|
||||
@@ -67,7 +67,7 @@ public interface IBreedingTracker {
|
||||
* Mutation to query for.
|
||||
* @return true if the mutation has been discovered.
|
||||
*/
|
||||
boolean isDiscovered(IMutation mutation);
|
||||
boolean isDiscovered(IMutation<C> mutation);
|
||||
|
||||
/**
|
||||
* Queries the tracker for discovered species.
|
||||
@@ -76,7 +76,7 @@ public interface IBreedingTracker {
|
||||
* Species to check.
|
||||
* @return true if the species has been bred.
|
||||
*/
|
||||
boolean isDiscovered(IAlleleSpecies species);
|
||||
boolean isDiscovered(IAlleleSpecies<C> species);
|
||||
|
||||
/**
|
||||
* Register a successfully researched mutation.
|
||||
@@ -84,12 +84,12 @@ public interface IBreedingTracker {
|
||||
* Researched mutations may have bonuses such as occurring at a higher rate.
|
||||
* Researched mutations count as discovered.
|
||||
*/
|
||||
void researchMutation(IMutation mutation);
|
||||
void researchMutation(IMutation<C> mutation);
|
||||
|
||||
/**
|
||||
* @return true if the mutation has been researched.
|
||||
*/
|
||||
boolean isResearched(IMutation mutation);
|
||||
boolean isResearched(IMutation<C> mutation);
|
||||
|
||||
/**
|
||||
* Synchronizes the tracker to the client side.
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.core.INbtWritable;
|
||||
|
||||
/**
|
||||
@@ -14,12 +16,16 @@ import forestry.api.core.INbtWritable;
|
||||
*/
|
||||
public interface IChromosome extends INbtWritable {
|
||||
|
||||
@Nonnull
|
||||
IAllele getPrimaryAllele();
|
||||
|
||||
@Nonnull
|
||||
IAllele getSecondaryAllele();
|
||||
|
||||
@Nonnull
|
||||
IAllele getInactiveAllele();
|
||||
|
||||
@Nonnull
|
||||
IAllele getActiveAllele();
|
||||
|
||||
}
|
||||
@@ -5,20 +5,25 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/*
|
||||
* Interface to be implemented by the enums representing the various chromosomes
|
||||
*/
|
||||
public interface IChromosomeType {
|
||||
public interface IChromosomeType<C extends IChromosomeType<C>> {
|
||||
|
||||
/*
|
||||
* Get class which all alleles on this chromosome must interface
|
||||
*/
|
||||
@Nonnull
|
||||
Class<? extends IAllele> getAlleleClass();
|
||||
|
||||
@Nonnull
|
||||
String getName();
|
||||
|
||||
ISpeciesRoot getSpeciesRoot();
|
||||
@Nonnull
|
||||
ISpeciesRoot<C> getSpeciesRoot();
|
||||
|
||||
int ordinal();
|
||||
byte getUid();
|
||||
|
||||
}
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Biological classifications from domain down to genus.
|
||||
*
|
||||
@@ -74,7 +76,7 @@ public interface IClassification {
|
||||
/**
|
||||
* @return Member groups of this one.
|
||||
*/
|
||||
IClassification[] getMemberGroups();
|
||||
Collection<IClassification> getMemberGroups();
|
||||
|
||||
/**
|
||||
* Adds subgroups to this group.
|
||||
@@ -84,14 +86,14 @@ public interface IClassification {
|
||||
/**
|
||||
* @return Member species of this group.
|
||||
*/
|
||||
IAlleleSpecies[] getMemberSpecies();
|
||||
Collection<IAlleleSpecies<?>> getMemberSpecies();
|
||||
|
||||
/**
|
||||
* Used by the allele registry to populate internal collection of branch members on the fly.
|
||||
*
|
||||
* @param species
|
||||
*/
|
||||
void addMemberSpecies(IAlleleSpecies species);
|
||||
void addMemberSpecies(IAlleleSpecies<?> species);
|
||||
|
||||
/**
|
||||
* @return Parent classification, null if this is root.
|
||||
|
||||
@@ -5,23 +5,27 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IFlowerProvider {
|
||||
|
||||
boolean isAcceptedPollinatable(World world, IPollinatable pollinatable);
|
||||
boolean isAcceptedPollinatable(@Nonnull World world, @Nonnull IPollinatable pollinatable);
|
||||
|
||||
/**
|
||||
* @return The unique type used for the IFlowerRegistry
|
||||
* @since Forestry 4.0.0
|
||||
*/
|
||||
@Nonnull
|
||||
String getFlowerType();
|
||||
|
||||
/**
|
||||
* @return Short, human-readable identifier used in the beealyzer.
|
||||
*/
|
||||
@Nonnull
|
||||
String getDescription();
|
||||
|
||||
/**
|
||||
@@ -29,5 +33,6 @@ public interface IFlowerProvider {
|
||||
* If this flowerProvider does not affect the products, it should return the products unchanged.
|
||||
* @return Array of itemstacks being the (modified or unmodified) produce.
|
||||
*/
|
||||
@Nonnull
|
||||
ItemStack[] affectProducts(World world, IIndividual individual, BlockPos pos, ItemStack[] products);
|
||||
}
|
||||
@@ -5,6 +5,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.core.INbtWritable;
|
||||
|
||||
/**
|
||||
@@ -12,19 +16,25 @@ import forestry.api.core.INbtWritable;
|
||||
*
|
||||
* Only the default implementation is supported.
|
||||
*/
|
||||
public interface IGenome extends INbtWritable {
|
||||
public interface IGenome<C extends IChromosomeType> extends INbtWritable {
|
||||
|
||||
IAlleleSpecies getPrimary();
|
||||
@Nonnull
|
||||
IAlleleSpecies<C> getPrimary();
|
||||
|
||||
IAlleleSpecies getSecondary();
|
||||
@Nonnull
|
||||
IAlleleSpecies<C> getSecondary();
|
||||
|
||||
IChromosome[] getChromosomes();
|
||||
@Nonnull
|
||||
ImmutableMap<C, IChromosome> getChromosomes();
|
||||
|
||||
IAllele getActiveAllele(IChromosomeType chromosomeType);
|
||||
@Nonnull
|
||||
IAllele getActiveAllele(C chromosomeType);
|
||||
|
||||
IAllele getInactiveAllele(IChromosomeType chromosomeType);
|
||||
@Nonnull
|
||||
IAllele getInactiveAllele(C chromosomeType);
|
||||
|
||||
boolean isGeneticEqual(IGenome other);
|
||||
|
||||
ISpeciesRoot getSpeciesRoot();
|
||||
boolean isGeneticEqual(IGenome<C> other);
|
||||
|
||||
@Nonnull
|
||||
ISpeciesRoot<C> getSpeciesRoot();
|
||||
}
|
||||
@@ -6,6 +6,9 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
/**
|
||||
* Any housing, hatchery or nest with a location in the world.
|
||||
@@ -14,4 +17,8 @@ public interface IHousing {
|
||||
|
||||
BlockPos getCoordinates();
|
||||
|
||||
World getWorld();
|
||||
|
||||
GameProfile getOwner();
|
||||
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import forestry.api.core.INbtWritable;
|
||||
*
|
||||
* Only the default implementation is supported.
|
||||
*/
|
||||
public interface IIndividual extends INbtWritable {
|
||||
public interface IIndividual<C extends IChromosomeType> extends INbtWritable {
|
||||
|
||||
String getIdent();
|
||||
|
||||
@@ -36,20 +36,20 @@ public interface IIndividual extends INbtWritable {
|
||||
boolean isSecret();
|
||||
|
||||
@Nonnull
|
||||
IGenome getGenome();
|
||||
IGenome<C> getGenome();
|
||||
|
||||
/**
|
||||
* Check whether the genetic makeup of two IIndividuals is identical. Ignores additional data like generations, irregular mating, etc..
|
||||
* @param other
|
||||
* @return true if the given other IIndividual has the amount of chromosomes and their alleles are identical.
|
||||
*/
|
||||
boolean isGeneticEqual(IIndividual other);
|
||||
boolean isGeneticEqual(IIndividual<C> other);
|
||||
|
||||
/**
|
||||
* @return A deep copy of this individual.
|
||||
*/
|
||||
IIndividual copy();
|
||||
IIndividual<C> copy();
|
||||
|
||||
boolean isPureBred(IChromosomeType chromosomeType);
|
||||
boolean isPureBred(C chromosomeType);
|
||||
|
||||
}
|
||||
@@ -7,7 +7,7 @@ package forestry.api.genetics;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IIndividualLiving extends IIndividual {
|
||||
public interface IIndividualLiving<C extends IChromosomeType> extends IIndividual<C> {
|
||||
|
||||
/**
|
||||
* @return Genetic information of the mate, null if unmated.
|
||||
|
||||
@@ -5,8 +5,17 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.INbtWritable;
|
||||
|
||||
/**
|
||||
* Individuals can be seeded either as hive drops or as mutation results.
|
||||
*
|
||||
@@ -14,38 +23,43 @@ import java.util.Collection;
|
||||
*
|
||||
* @author SirSengir
|
||||
*/
|
||||
public interface IMutation {
|
||||
public interface IMutation<C extends IChromosomeType> extends INbtWritable {
|
||||
|
||||
/**
|
||||
* @return {@link ISpeciesRoot} this mutation is associated with.
|
||||
*/
|
||||
ISpeciesRoot getRoot();
|
||||
@Nonnull
|
||||
ISpeciesRoot<C> getRoot();
|
||||
|
||||
/**
|
||||
* @return first of the alleles implementing IAlleleSpecies required for this mutation.
|
||||
*/
|
||||
IAlleleSpecies getAllele0();
|
||||
@Nonnull
|
||||
IAlleleSpecies<C> getSpecies0();
|
||||
|
||||
/**
|
||||
* @return second of the alleles implementing IAlleleSpecies required for this mutation.
|
||||
*/
|
||||
IAlleleSpecies getAllele1();
|
||||
@Nonnull
|
||||
IAlleleSpecies<C> getSpecies1();
|
||||
|
||||
/**
|
||||
* @return Array of {@link IAllele} representing the full default genome of the mutated side.
|
||||
*
|
||||
* Make sure to return a proper array for the species class. Returning an allele of the wrong type will cause cast errors on runtime.
|
||||
* @return The full default genome of the mutated side.
|
||||
*/
|
||||
IAllele[] getTemplate();
|
||||
@Nonnull
|
||||
ImmutableMap<C, IAllele> getResultTemplate();
|
||||
|
||||
/**
|
||||
* @return Unmodified base chance for mutation to fire.
|
||||
*/
|
||||
float getBaseChance();
|
||||
|
||||
float getChance(World world, BlockPos pos, IAlleleSpecies<C> species0, IAlleleSpecies<C> species1, IGenome<C> genome0, IGenome<C> genome1);
|
||||
|
||||
/**
|
||||
* @return Collection of localized, human-readable strings describing special mutation conditions, if any.
|
||||
*/
|
||||
@Nonnull
|
||||
Collection<String> getSpecialConditions();
|
||||
|
||||
/**
|
||||
@@ -58,6 +72,7 @@ public interface IMutation {
|
||||
* @param allele
|
||||
* @return the other allele which was not passed as argument.
|
||||
*/
|
||||
@Nullable
|
||||
IAllele getPartner(IAllele allele);
|
||||
|
||||
/**
|
||||
|
||||
+17
-13
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
@@ -13,40 +15,42 @@ import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
|
||||
/** Set custom mutation requirements */
|
||||
public interface IMutationCustom extends IMutation {
|
||||
public interface IMutationBuilder<C extends IChromosomeType<C>> {
|
||||
@Nonnull
|
||||
IMutation<C> build();
|
||||
|
||||
/** Prevent this mutation from being shown in the analyzers */
|
||||
IMutationCustom setIsSecret();
|
||||
IMutationBuilder<C> setIsSecret();
|
||||
|
||||
/** Require a specific temperature for this mutation to occur */
|
||||
IMutationCustom restrictTemperature(EnumTemperature temperature);
|
||||
IMutationBuilder<C> restrictTemperature(EnumTemperature temperature);
|
||||
|
||||
IMutationCustom restrictTemperature(EnumTemperature minTemperature, EnumTemperature maxTemperature);
|
||||
IMutationBuilder<C> restrictTemperature(EnumTemperature minTemperature, EnumTemperature maxTemperature);
|
||||
|
||||
/** Require a specific humidity for this mutation to occur */
|
||||
IMutationCustom restrictHumidity(EnumHumidity humidity);
|
||||
IMutationBuilder<C> restrictHumidity(EnumHumidity humidity);
|
||||
|
||||
IMutationCustom restrictHumidity(EnumHumidity minHumidity, EnumHumidity maxHumidity);
|
||||
IMutationBuilder<C> restrictHumidity(EnumHumidity minHumidity, EnumHumidity maxHumidity);
|
||||
|
||||
/**
|
||||
* Restrict this mutation to certain types of biomes.
|
||||
* @param types The types of biomes this mutation can occur.
|
||||
*/
|
||||
IMutationCustom restrictBiomeType(BiomeDictionary.Type... types);
|
||||
IMutationBuilder<C> restrictBiomeType(BiomeDictionary.Type... types);
|
||||
|
||||
/** Restrict the days of the year that this mutation can occur */
|
||||
IMutationCustom restrictDateRange(int startMonth, int startDay, int endMonth, int endDay);
|
||||
IMutationBuilder<C> restrictDateRange(int startMonth, int startDay, int endMonth, int endDay);
|
||||
|
||||
/** Restrict the time of day that this mutation can occur */
|
||||
IMutationCustom requireDay();
|
||||
IMutationBuilder<C> requireDay();
|
||||
|
||||
IMutationCustom requireNight();
|
||||
IMutationBuilder<C> requireNight();
|
||||
|
||||
/** Require a specific resource to be under the location of the mutation */
|
||||
IMutationCustom requireResource(Block block, int meta);
|
||||
IMutationBuilder<C> requireResource(Block block, int meta);
|
||||
|
||||
IMutationCustom requireResource(String oreDictName);
|
||||
IMutationBuilder<C> requireResource(String oreDictName);
|
||||
|
||||
/** Require some other custom mutation condition */
|
||||
IMutationCustom addMutationCondition(IMutationCondition mutationCondition);
|
||||
IMutationBuilder<C> addMutationCondition(IMutationCondition mutationCondition);
|
||||
}
|
||||
@@ -15,7 +15,7 @@ public interface IMutationCondition {
|
||||
* Most will return 1 if the condition is met and 0 otherwise,
|
||||
* but the float offers flexibility for more advanced conditions.
|
||||
*/
|
||||
float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
|
||||
<C extends IChromosomeType> float getChance(World world, BlockPos pos, IAlleleSpecies<C> species0, IAlleleSpecies<C> species1, IGenome<C> genome0, IGenome<C> genome1);
|
||||
|
||||
/**
|
||||
* A localized description of the mutation condition. (i.e. "A temperature of HOT is required.")
|
||||
|
||||
@@ -9,6 +9,8 @@ import java.util.EnumSet;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
|
||||
/**
|
||||
* Can be implemented by tile entities, if they wish to be pollinatable.
|
||||
*
|
||||
@@ -24,7 +26,7 @@ public interface IPollinatable {
|
||||
/**
|
||||
* @return IIndividual containing the genetic information of this IPollinatable
|
||||
*/
|
||||
IIndividual getPollen();
|
||||
ITree getPollen();
|
||||
|
||||
/**
|
||||
* Checks whether this {@link IPollinatable} can mate with the given pollen.
|
||||
@@ -35,7 +37,7 @@ public interface IPollinatable {
|
||||
* IIndividual representing the pollen.
|
||||
* @return true if mating is possible, false otherwise.
|
||||
*/
|
||||
boolean canMateWith(IIndividual pollen);
|
||||
boolean canMateWith(ITree pollen);
|
||||
|
||||
/**
|
||||
* Pollinates this entity.
|
||||
@@ -43,7 +45,7 @@ public interface IPollinatable {
|
||||
* @param pollen
|
||||
* IIndividual representing the pollen.
|
||||
*/
|
||||
void mateWith(IIndividual pollen);
|
||||
void mateWith(ITree pollen);
|
||||
|
||||
/**
|
||||
* @return true if this IPollinatable has already been pollinated.
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public interface ISpeciesMode<C extends IChromosomeType> {
|
||||
|
||||
/**
|
||||
* @return Localized name of this mode.
|
||||
*/
|
||||
@Nonnull
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @return Float used to modify the base mutation chance.
|
||||
*/
|
||||
float getMutationModifier(IGenome<C> genome, IGenome<C> mate);
|
||||
}
|
||||
@@ -5,7 +5,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -20,7 +23,7 @@ import com.mojang.authlib.GameProfile;
|
||||
/**
|
||||
* Describes a class of species (i.e. bees, trees, butterflies), provides helper functions and access to common functionality.
|
||||
*/
|
||||
public interface ISpeciesRoot {
|
||||
public interface ISpeciesRoot<C extends IChromosomeType> {
|
||||
|
||||
/**
|
||||
* @return A unique identifier for the species class. Should consist of "root" + a common name for the species class in camel-case, i.e. "rootBees", "rootTrees", "rootButterflies".
|
||||
@@ -30,7 +33,7 @@ public interface ISpeciesRoot {
|
||||
/**
|
||||
* @return Class of the sub-interface inheriting from {@link IIndividual}.
|
||||
*/
|
||||
Class<? extends IIndividual> getMemberClass();
|
||||
Class<? extends IIndividual<C>> getMemberClass();
|
||||
|
||||
/**
|
||||
* @return Integer denoting the number of (counted) species of this type in the world.
|
||||
@@ -59,29 +62,38 @@ public interface ISpeciesRoot {
|
||||
*/
|
||||
boolean isMember(IIndividual individual);
|
||||
|
||||
IIndividual getMember(ItemStack stack);
|
||||
@Nullable
|
||||
IIndividual<C> getMember(ItemStack stack);
|
||||
|
||||
IIndividual getMember(NBTTagCompound compound);
|
||||
@Nullable
|
||||
IIndividual<C> getMember(NBTTagCompound compound);
|
||||
|
||||
@Nullable
|
||||
ISpeciesType getType(ItemStack itemStack);
|
||||
|
||||
ItemStack getMemberStack(IIndividual individual, int type);
|
||||
ItemStack getMemberStack(IIndividual<C> individual, int type);
|
||||
|
||||
/* BREEDING TRACKER */
|
||||
IBreedingTracker getBreedingTracker(World world, GameProfile player);
|
||||
@Nonnull
|
||||
IBreedingTracker<C> getBreedingTracker(@Nonnull World world, @Nonnull GameProfile player);
|
||||
|
||||
/* GENOME MANIPULATION */
|
||||
IIndividual templateAsIndividual(IAllele[] template);
|
||||
@Nonnull
|
||||
IIndividual<C> templateAsIndividual(ImmutableMap<C, IAllele> template);
|
||||
|
||||
IIndividual templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
@Nonnull
|
||||
IIndividual<C> templateAsIndividual(ImmutableMap<C, IAllele> templateActive, ImmutableMap<C, IAllele> templateInactive);
|
||||
|
||||
IChromosome[] templateAsChromosomes(IAllele[] template);
|
||||
ImmutableMap<C, IChromosome> templateAsChromosomes(ImmutableMap<C, IAllele> template);
|
||||
|
||||
IChromosome[] templateAsChromosomes(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
ImmutableMap<C, IChromosome> templateAsChromosomes(ImmutableMap<C, IAllele> templateActive, ImmutableMap<C, IAllele> templateInactive);
|
||||
|
||||
IGenome templateAsGenome(IAllele[] template);
|
||||
IGenome<C> templateAsGenome(ImmutableMap<C, IAllele> template);
|
||||
|
||||
IGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
IGenome<C> templateAsGenome(ImmutableMap<C, IAllele> templateActive, ImmutableMap<C, IAllele> templateInactive);
|
||||
|
||||
@Nonnull
|
||||
IGenome<C> chromosomesAsGenome(ImmutableMap<C, IChromosome> chromosomes);
|
||||
|
||||
/* TEMPLATES */
|
||||
|
||||
@@ -90,37 +102,38 @@ public interface ISpeciesRoot {
|
||||
*
|
||||
* @param template
|
||||
*/
|
||||
void registerTemplate(IAllele[] template);
|
||||
void registerTemplate(ImmutableMap<C, IAllele> template);
|
||||
|
||||
/**
|
||||
* Registers a bee template using the passed identifier.
|
||||
*
|
||||
* @param template
|
||||
*/
|
||||
void registerTemplate(String identifier, IAllele[] template);
|
||||
void registerTemplate(String identifier, ImmutableMap<C, IAllele> template);
|
||||
|
||||
/**
|
||||
* Retrieves a registered template using the passed identifier.
|
||||
*
|
||||
* @param identifier
|
||||
* @return Array of {@link IAllele} representing a genome.
|
||||
* @return Map of {@link IAllele} representing a genome.
|
||||
*/
|
||||
IAllele[] getTemplate(String identifier);
|
||||
@Nullable
|
||||
ImmutableMap<C, IAllele> getTemplate(String identifier);
|
||||
|
||||
/**
|
||||
* @return Default individual template for use when stuff breaks.
|
||||
*/
|
||||
IAllele[] getDefaultTemplate();
|
||||
ImmutableMap<C, IAllele> getDefaultTemplate();
|
||||
|
||||
/**
|
||||
* @param rand Random to use.
|
||||
* @return A random template from the pool of registered species templates.
|
||||
*/
|
||||
IAllele[] getRandomTemplate(Random rand);
|
||||
ImmutableMap<C, IAllele> getRandomTemplate(Random rand);
|
||||
|
||||
Map<String, IAllele[]> getGenomeTemplates();
|
||||
Map<String, ImmutableMap<C, IAllele>> getGenomeTemplates();
|
||||
|
||||
ArrayList<? extends IIndividual> getIndividualTemplates();
|
||||
List<? extends IIndividual<C>> getIndividualTemplates();
|
||||
|
||||
/* MUTATIONS */
|
||||
|
||||
@@ -129,26 +142,26 @@ public interface ISpeciesRoot {
|
||||
*
|
||||
* @param mutation
|
||||
*/
|
||||
void registerMutation(IMutation mutation);
|
||||
void registerMutation(IMutation<C> mutation);
|
||||
|
||||
/**
|
||||
* @return All registered mutations.
|
||||
*/
|
||||
Collection<? extends IMutation> getMutations(boolean shuffle);
|
||||
Collection<? extends IMutation<C>> getMutations(boolean shuffle);
|
||||
|
||||
/**
|
||||
* @param other Allele to match mutations against.
|
||||
* @return All registered mutations the given allele is part of.
|
||||
*/
|
||||
Collection<? extends IMutation> getCombinations(IAllele other);
|
||||
List<IMutation<C>> getCombinations(IAllele other);
|
||||
|
||||
/**
|
||||
* @since Forestry 3.7
|
||||
* @return all possible mutations that result from breeding two species
|
||||
*/
|
||||
List<IMutation> getCombinations(IAlleleSpecies parentSpecies0, IAlleleSpecies parentSpecies1, boolean shuffle);
|
||||
List<IMutation<C>> getCombinations(IAlleleSpecies<C> parentSpecies0, IAlleleSpecies<C> parentSpecies1, boolean shuffle);
|
||||
|
||||
Collection<? extends IMutation> getPaths(IAllele result, IChromosomeType chromosomeType);
|
||||
Collection<? extends IMutation<C>> getPaths(IAllele result, C chromosomeType);
|
||||
|
||||
/* RESEARCH */
|
||||
|
||||
@@ -167,10 +180,29 @@ public interface ISpeciesRoot {
|
||||
/**
|
||||
* @return Array of {@link IChromosomeType} which are in this species genome
|
||||
*/
|
||||
IChromosomeType[] getKaryotype();
|
||||
@Nonnull
|
||||
C[] getKaryotype();
|
||||
|
||||
/**
|
||||
* @return {@link IChromosomeType} which is the "key" for this species class, usually the species chromosome.
|
||||
*/
|
||||
IChromosomeType getKaryotypeKey();
|
||||
@Nonnull
|
||||
C getKaryotypeKey();
|
||||
|
||||
C getChromosomeTypeForUid(byte uid);
|
||||
|
||||
/* GAME MODE */
|
||||
void resetMode();
|
||||
|
||||
@Nonnull
|
||||
List<? extends ISpeciesMode<C>> getModes();
|
||||
|
||||
@Nonnull
|
||||
ISpeciesMode<C> getMode(@Nonnull World world);
|
||||
|
||||
@Nonnull
|
||||
ISpeciesMode<C> getMode(@Nonnull String name);
|
||||
|
||||
void setMode(@Nonnull World world, @Nonnull String name);
|
||||
|
||||
}
|
||||
+17
-7
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Locale;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
@@ -16,7 +17,7 @@ import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public enum EnumButterflyChromosome implements IChromosomeType {
|
||||
public enum ButterflyChromosome implements IChromosomeType<ButterflyChromosome> {
|
||||
/**
|
||||
* Species of the bee. Alleles here must implement {@link IAlleleButterflySpecies}.
|
||||
*/
|
||||
@@ -69,25 +70,34 @@ public enum EnumButterflyChromosome implements IChromosomeType {
|
||||
* Extra effect to surroundings. (?)
|
||||
*/
|
||||
EFFECT(IAlleleButterflyEffect.class);
|
||||
|
||||
@Nonnull
|
||||
private final Class<? extends IAllele> alleleClass;
|
||||
|
||||
Class<? extends IAllele> clss;
|
||||
|
||||
EnumButterflyChromosome(Class<? extends IAllele> clss) {
|
||||
this.clss = clss;
|
||||
ButterflyChromosome(@Nonnull Class<? extends IAllele> alleleClass) {
|
||||
this.alleleClass = alleleClass;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Class<? extends IAllele> getAlleleClass() {
|
||||
return clss;
|
||||
return alleleClass;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
public ISpeciesRoot<ButterflyChromosome> getSpeciesRoot() {
|
||||
return ButterflyManager.butterflyRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getUid() {
|
||||
return (byte) ordinal();
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import net.minecraftforge.common.BiomeDictionary;
|
||||
import forestry.api.core.ISpriteProvider;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
|
||||
public interface IAlleleButterflySpecies extends IAlleleSpecies {
|
||||
public interface IAlleleButterflySpecies extends IAlleleSpecies<ButterflyChromosome> {
|
||||
|
||||
/**
|
||||
* @return the IBeeRoot
|
||||
|
||||
+9
-5
@@ -10,12 +10,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
import forestry.api.genetics.IAlleleSpeciesCustom;
|
||||
import forestry.api.genetics.IAlleleSpeciesBuilder;
|
||||
|
||||
public interface IAlleleButterflySpeciesCustom extends IAlleleButterflySpecies, IAlleleSpeciesCustom {
|
||||
IAlleleButterflySpeciesCustom setRarity(float rarity);
|
||||
public interface IAlleleButterflySpeciesBuilder extends IAlleleSpeciesBuilder<ButterflyChromosome> {
|
||||
|
||||
IAlleleButterflySpeciesCustom setFlightDistance(float flightDistance);
|
||||
@Override
|
||||
IAlleleButterflySpecies build();
|
||||
|
||||
IAlleleButterflySpeciesCustom setNocturnal();
|
||||
IAlleleButterflySpeciesBuilder setRarity(float rarity);
|
||||
|
||||
IAlleleButterflySpeciesBuilder setFlightDistance(float flightDistance);
|
||||
|
||||
IAlleleButterflySpeciesBuilder setNocturnal();
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IIndividualLiving;
|
||||
|
||||
public interface IButterfly extends IIndividualLiving {
|
||||
public interface IButterfly extends IIndividualLiving<ButterflyChromosome> {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
|
||||
@@ -18,7 +18,7 @@ public interface IButterflyFactory {
|
||||
/**
|
||||
* Creates a new butterfly species.
|
||||
* Automatically registered with AlleleManager.alleleRegistry.registerAllele()
|
||||
* See IAlleleButterflySpeciesCustom and IAlleleSpeciesCustom for adding additional properties to the returned species.
|
||||
* See IAlleleButterflySpeciesBuilder and IAlleleSpeciesBuilder for adding additional properties to the returned species.
|
||||
*
|
||||
* @param uid Unique Identifier for this species
|
||||
* @param unlocalizedName Unlocalized name for this species
|
||||
@@ -31,5 +31,5 @@ public interface IButterflyFactory {
|
||||
* @param serumColour The color of this butterfly's serum.
|
||||
* @return a new butterfly species allele.
|
||||
*/
|
||||
IAlleleButterflySpeciesCustom createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, String texturePath, boolean dominant, IClassification branch, String binomial, Color serumColour);
|
||||
IAlleleButterflySpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, String texturePath, boolean dominant, IClassification branch, String binomial, Color serumColour);
|
||||
}
|
||||
@@ -5,15 +5,19 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IGenome;
|
||||
|
||||
public interface IButterflyGenome extends IGenome {
|
||||
|
||||
public interface IButterflyGenome extends IGenome<ButterflyChromosome> {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
IAlleleButterflySpecies getPrimary();
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
IAlleleButterflySpecies getSecondary();
|
||||
|
||||
@@ -31,7 +35,7 @@ public interface IButterflyGenome extends IGenome {
|
||||
|
||||
EnumTolerance getToleranceHumid();
|
||||
|
||||
boolean getNocturnal();
|
||||
boolean getNeverSleeps();
|
||||
|
||||
boolean getTolerantFlyer();
|
||||
|
||||
@@ -41,4 +45,7 @@ public interface IButterflyGenome extends IGenome {
|
||||
|
||||
IAlleleButterflyEffect getEffect();
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
IButterflyRoot getSpeciesRoot();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
import forestry.api.genetics.ISpeciesMode;
|
||||
|
||||
public interface IButterflyMode extends ISpeciesMode<ButterflyChromosome> {
|
||||
}
|
||||
@@ -9,6 +9,6 @@ import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IMutation;
|
||||
|
||||
public interface IButterflyMutation extends IMutation {
|
||||
public interface IButterflyMutation extends IMutation<ButterflyChromosome> {
|
||||
float getChance(IButterflyNursery housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
|
||||
}
|
||||
@@ -5,14 +5,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.genetics.IHousing;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
public interface IButterflyNursery extends IHousing {
|
||||
|
||||
IButterfly getCaterpillar();
|
||||
|
||||
IIndividual getNanny();
|
||||
ITree getNanny();
|
||||
|
||||
void setCaterpillar(IButterfly butterfly);
|
||||
|
||||
|
||||
@@ -5,8 +5,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -16,10 +19,11 @@ import net.minecraft.world.World;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public interface IButterflyRoot extends ISpeciesRoot {
|
||||
public interface IButterflyRoot extends ISpeciesRoot<ButterflyChromosome> {
|
||||
|
||||
@Override
|
||||
boolean isMember(ItemStack stack);
|
||||
@@ -31,24 +35,31 @@ public interface IButterflyRoot extends ISpeciesRoot {
|
||||
IButterfly getMember(NBTTagCompound compound);
|
||||
|
||||
@Override
|
||||
ItemStack getMemberStack(IIndividual butterfly, int type);
|
||||
ItemStack getMemberStack(IIndividual<ButterflyChromosome> butterfly, int type);
|
||||
|
||||
/* GENOME CONVERSION */
|
||||
@Nonnull
|
||||
@Override
|
||||
IButterfly templateAsIndividual(IAllele[] template);
|
||||
IButterfly templateAsIndividual(ImmutableMap<ButterflyChromosome, IAllele> template);
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
IButterfly templateAsIndividual(ImmutableMap<ButterflyChromosome, IAllele> templateActive, ImmutableMap<ButterflyChromosome, IAllele> templateInactive);
|
||||
|
||||
@Override
|
||||
IButterfly templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
IButterflyGenome templateAsGenome(ImmutableMap<ButterflyChromosome, IAllele> template);
|
||||
|
||||
@Override
|
||||
IButterflyGenome templateAsGenome(IAllele[] template);
|
||||
IButterflyGenome templateAsGenome(ImmutableMap<ButterflyChromosome, IAllele> templateActive, ImmutableMap<ButterflyChromosome, IAllele> templateInactive);
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
IButterflyGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
IButterflyGenome chromosomesAsGenome(ImmutableMap<ButterflyChromosome, IChromosome> chromosomes);
|
||||
|
||||
/* BUTTERFLY SPECIFIC */
|
||||
@Nonnull
|
||||
@Override
|
||||
ILepidopteristTracker getBreedingTracker(World world, GameProfile player);
|
||||
IButterflyTracker getBreedingTracker(@Nonnull World world, @Nonnull GameProfile player);
|
||||
|
||||
/**
|
||||
* Spawns the given butterfly in the world.
|
||||
@@ -64,7 +75,7 @@ public interface IButterflyRoot extends ISpeciesRoot {
|
||||
|
||||
/* TEMPLATES */
|
||||
@Override
|
||||
ArrayList<IButterfly> getIndividualTemplates();
|
||||
List<IButterfly> getIndividualTemplates();
|
||||
|
||||
/* MUTATIONS */
|
||||
@Override
|
||||
@@ -73,4 +84,14 @@ public interface IButterflyRoot extends ISpeciesRoot {
|
||||
@Override
|
||||
EnumFlutterType getType(ItemStack stack);
|
||||
|
||||
/** Modes */
|
||||
@Nonnull
|
||||
@Override
|
||||
IButterflyMode getMode(@Nonnull World world);
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
List<IButterflyMode> getModes();
|
||||
|
||||
void registerMode(@Nonnull IButterflyMode mode);
|
||||
}
|
||||
+1
-1
@@ -7,7 +7,7 @@ package forestry.api.lepidopterology;
|
||||
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
|
||||
public interface ILepidopteristTracker extends IBreedingTracker {
|
||||
public interface IButterflyTracker extends IBreedingTracker<ButterflyChromosome> {
|
||||
|
||||
void registerCatch(IButterfly butterfly);
|
||||
|
||||
@@ -8,7 +8,7 @@ package forestry.api.lepidopterology;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.passive.IAnimals;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
|
||||
public interface IEntityButterfly extends IAnimals {
|
||||
|
||||
@@ -23,7 +23,7 @@ public interface IEntityButterfly extends IAnimals {
|
||||
*/
|
||||
EntityCreature getEntity();
|
||||
|
||||
IIndividual getPollen();
|
||||
ITree getPollen();
|
||||
|
||||
void setPollen(IIndividual pollen);
|
||||
void setPollen(ITree pollen);
|
||||
}
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.multiblock;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -69,5 +71,5 @@ public interface IMultiblockLogic extends INbtWritable {
|
||||
* Use this in Tile.writeToNBT()
|
||||
*/
|
||||
@Override
|
||||
void writeToNBT(NBTTagCompound nbttagcompound);
|
||||
void writeToNBT(@Nonnull NBTTagCompound nbttagcompound);
|
||||
}
|
||||
@@ -12,7 +12,7 @@ package forestry.apiculture;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
|
||||
public class BeeHousingListener implements IBeeListener {
|
||||
private final IBeeHousing beeHousing;
|
||||
@@ -36,7 +36,7 @@ public class BeeHousingListener implements IBeeListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPollenRetrieved(IIndividual pollen) {
|
||||
public boolean onPollenRetrieved(ITree pollen) {
|
||||
for (IBeeListener beeListener : beeHousing.getBeeListeners()) {
|
||||
if (beeListener.onPollenRetrieved(pollen)) {
|
||||
return true;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -34,10 +35,10 @@ import forestry.api.apiculture.IBeeHousingInventory;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.apiculture.network.packets.PacketBeeLogicActive;
|
||||
import forestry.apiculture.network.packets.PacketBeeLogicActiveEntity;
|
||||
import forestry.core.config.Constants;
|
||||
@@ -101,7 +102,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
public void writeToNBT(@Nonnull NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setInteger("BreedingTime", beeProgress);
|
||||
nbttagcompound.setInteger("Throttle", queenWorkCycleThrottle);
|
||||
|
||||
@@ -492,7 +493,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
private static class PollenHandler {
|
||||
private static final int MAX_POLLINATION_ATTEMPTS = 20;
|
||||
|
||||
private IIndividual pollen;
|
||||
private ITree pollen;
|
||||
private int attemptedPollinations = 0;
|
||||
|
||||
public void doPollination(IBee queen, IBeeHousing beeHousing, IBeeListener beeListener) {
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -63,7 +65,7 @@ public class FakeBeekeepingLogic implements IBeekeepingLogic {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
public void writeToNBT(@Nonnull NBTTagCompound nbttagcompound) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -102,7 +103,7 @@ public class HasFlowersCache implements INbtWritable, INbtReadable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
public void writeToNBT(@Nonnull NBTTagCompound nbttagcompound) {
|
||||
NBTTagCompound hasFlowerCacheNBT = new NBTTagCompound();
|
||||
if (flowerCoords != null) {
|
||||
hasFlowerCacheNBT.setInteger("flowerX", flowerCoords.getX());
|
||||
|
||||
@@ -19,7 +19,7 @@ public class SaveEventHandlerApiculture implements ISaveEventHandler {
|
||||
|
||||
@Override
|
||||
public void onWorldLoad(World world) {
|
||||
BeeManager.beeRoot.resetBeekeepingMode();
|
||||
BeeManager.beeRoot.resetMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package forestry.apiculture.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
@@ -23,7 +24,7 @@ public class BeeModeHelper implements ICommandModeHelper {
|
||||
|
||||
@Override
|
||||
public String[] getModeNames() {
|
||||
ArrayList<IBeekeepingMode> beekeepingModes = BeeManager.beeRoot.getBeekeepingModes();
|
||||
Collection<IBeekeepingMode> beekeepingModes = BeeManager.beeRoot.getModes();
|
||||
int modeStringCount = beekeepingModes.size();
|
||||
List<String> modeStrings = new ArrayList<>(modeStringCount);
|
||||
for (IBeekeepingMode mode : beekeepingModes) {
|
||||
@@ -35,7 +36,7 @@ public class BeeModeHelper implements ICommandModeHelper {
|
||||
|
||||
@Override
|
||||
public String getModeNameMatching(String desired) {
|
||||
IBeekeepingMode mode = BeeManager.beeRoot.getBeekeepingMode(desired);
|
||||
IBeekeepingMode mode = BeeManager.beeRoot.getMode(desired);
|
||||
if (mode == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -44,17 +45,17 @@ public class BeeModeHelper implements ICommandModeHelper {
|
||||
|
||||
@Override
|
||||
public String getModeName(World world) {
|
||||
return BeeManager.beeRoot.getBeekeepingMode(world).getName();
|
||||
return BeeManager.beeRoot.getMode(world).getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMode(World world, String modeName) {
|
||||
BeeManager.beeRoot.setBeekeepingMode(world, modeName);
|
||||
BeeManager.beeRoot.setMode(world, modeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<String> getDescription(String modeName) {
|
||||
IBeekeepingMode mode = BeeManager.beeRoot.getBeekeepingMode(modeName);
|
||||
IBeekeepingMode mode = BeeManager.beeRoot.getMode(modeName);
|
||||
return mode.getDescription();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.commands;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -20,6 +22,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
import forestry.api.apiculture.BeeChromosome;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
@@ -129,7 +132,7 @@ public class CommandBeeGive extends SubCommand {
|
||||
throw new SpeciesNotFoundException(speciesName);
|
||||
}
|
||||
|
||||
IAllele[] template = BeeManager.beeRoot.getTemplate(species.getUID());
|
||||
ImmutableMap<BeeChromosome, IAllele> template = BeeManager.beeRoot.getTemplate(species.getUID());
|
||||
|
||||
if (template == null) {
|
||||
throw new TemplateNotFoundException(species);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.flowers;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -25,22 +26,24 @@ import forestry.api.genetics.IPollinatable;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class FlowerProvider implements IFlowerProvider {
|
||||
|
||||
@Nonnull
|
||||
private final String flowerType;
|
||||
@Nonnull
|
||||
private final String description;
|
||||
|
||||
public FlowerProvider(String flowerType, String description) {
|
||||
public FlowerProvider(@Nonnull String flowerType, @Nonnull String description) {
|
||||
this.flowerType = flowerType;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getFlowerType() {
|
||||
return flowerType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAcceptedPollinatable(World world, IPollinatable pollinatable) {
|
||||
public boolean isAcceptedPollinatable(@Nonnull World world, @Nonnull IPollinatable pollinatable) {
|
||||
|
||||
EnumSet<EnumPlantType> plantTypes = pollinatable.getPlantType();
|
||||
|
||||
@@ -54,11 +57,13 @@ public class FlowerProvider implements IFlowerProvider {
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return StringUtil.localize(this.description);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack[] affectProducts(World world, IIndividual individual, BlockPos pos, ItemStack[] products) {
|
||||
return products;
|
||||
|
||||
@@ -13,15 +13,15 @@ package forestry.apiculture.genetics;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.apiculture.BeeChromosome;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.genetics.BreedingTracker;
|
||||
|
||||
public class ApiaristTracker extends BreedingTracker implements IApiaristTracker {
|
||||
public class ApiaristTracker extends BreedingTracker<BeeChromosome> implements IApiaristTracker {
|
||||
|
||||
/** Required for creation from map storage */
|
||||
public ApiaristTracker(String s) {
|
||||
@@ -55,13 +55,13 @@ public class ApiaristTracker extends BreedingTracker implements IApiaristTracker
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPickup(IIndividual individual) {
|
||||
ISpeciesRoot speciesRoot = individual.getGenome().getPrimary().getRoot();
|
||||
public void registerPickup(IIndividual<BeeChromosome> individual) {
|
||||
ISpeciesRoot<BeeChromosome> speciesRoot = individual.getGenome().getPrimary().getRoot();
|
||||
if (!speciesRoot.getUID().equals(speciesRootUID())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!individual.isPureBred(EnumBeeChromosome.SPECIES)) {
|
||||
if (!individual.isPureBred(BeeChromosome.SPECIES)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class ApiaristTracker extends BreedingTracker implements IApiaristTracker
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerQueen(IIndividual bee) {
|
||||
public void registerQueen(IIndividual<BeeChromosome> bee) {
|
||||
queensTotal++;
|
||||
}
|
||||
|
||||
@@ -83,8 +83,7 @@ public class ApiaristTracker extends BreedingTracker implements IApiaristTracker
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPrincess(IIndividual bee) {
|
||||
|
||||
public void registerPrincess(IIndividual<BeeChromosome> bee) {
|
||||
princessesTotal++;
|
||||
registerBirth(bee);
|
||||
}
|
||||
@@ -95,7 +94,7 @@ public class ApiaristTracker extends BreedingTracker implements IApiaristTracker
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerDrone(IIndividual bee) {
|
||||
public void registerDrone(IIndividual<BeeChromosome> bee) {
|
||||
dronesTotal++;
|
||||
registerBirth(bee);
|
||||
}
|
||||
@@ -106,7 +105,7 @@ public class ApiaristTracker extends BreedingTracker implements IApiaristTracker
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IBreedingTracker getBreedingTracker(EntityPlayer player) {
|
||||
protected IBreedingTracker<BeeChromosome> getBreedingTracker(EntityPlayer player) {
|
||||
return BeeManager.beeRoot.getBreedingTracker(player.worldObj, player.getGameProfile());
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
@@ -28,20 +30,17 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.apiculture.BeeChromosome;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeeMutation;
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.core.BiomeHelper;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
@@ -54,14 +53,11 @@ import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.arboriculture.genetics.pollination.FakePollinatable;
|
||||
import forestry.arboriculture.genetics.pollination.ICheckPollinatable;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.genetics.Chromosome;
|
||||
import forestry.core.genetics.GenericRatings;
|
||||
import forestry.core.genetics.IndividualLiving;
|
||||
import forestry.core.utils.GeneticsUtil;
|
||||
@@ -69,7 +65,7 @@ import forestry.core.utils.Log;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
|
||||
public class Bee extends IndividualLiving implements IBee {
|
||||
public class Bee extends IndividualLiving<BeeChromosome> implements IBee {
|
||||
|
||||
private int generation;
|
||||
private boolean isNatural = true;
|
||||
@@ -119,7 +115,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
public void writeToNBT(@Nonnull NBTTagCompound nbttagcompound) {
|
||||
|
||||
super.writeToNBT(nbttagcompound);
|
||||
|
||||
@@ -173,7 +169,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
IAlleleBeeEffect secondary = (IAlleleBeeEffect) genome.getInactiveAllele(EnumBeeChromosome.EFFECT);
|
||||
IAlleleBeeEffect secondary = (IAlleleBeeEffect) genome.getInactiveAllele(BeeChromosome.EFFECT);
|
||||
if (!secondary.isCombinable()) {
|
||||
return storedData;
|
||||
}
|
||||
@@ -203,7 +199,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
IAlleleBeeEffect secondary = (IAlleleBeeEffect) genome.getInactiveAllele(EnumBeeChromosome.EFFECT);
|
||||
IAlleleBeeEffect secondary = (IAlleleBeeEffect) genome.getInactiveAllele(BeeChromosome.EFFECT);
|
||||
if (!secondary.isCombinable()) {
|
||||
return storedData;
|
||||
}
|
||||
@@ -374,7 +370,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
// You analyzed it? Juicy tooltip coming up!
|
||||
IAlleleBeeSpecies primary = genome.getPrimary();
|
||||
IAlleleBeeSpecies secondary = genome.getSecondary();
|
||||
if (!isPureBred(EnumBeeChromosome.SPECIES)) {
|
||||
if (!isPureBred(BeeChromosome.SPECIES)) {
|
||||
list.add(EnumChatFormatting.BLUE + StringUtil.localize("bees.hybrid").replaceAll("%PRIMARY", primary.getName()).replaceAll("%SECONDARY", secondary.getName()));
|
||||
}
|
||||
|
||||
@@ -394,9 +390,9 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
list.add(generationString);
|
||||
}
|
||||
|
||||
IAllele speedAllele = genome.getActiveAllele(EnumBeeChromosome.SPEED);
|
||||
IAlleleTolerance tempToleranceAllele = (IAlleleTolerance) getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
IAlleleTolerance humidToleranceAllele = (IAlleleTolerance) getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
IAllele speedAllele = genome.getActiveAllele(BeeChromosome.SPEED);
|
||||
IAlleleTolerance tempToleranceAllele = (IAlleleTolerance) getGenome().getActiveAllele(BeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
IAlleleTolerance humidToleranceAllele = (IAlleleTolerance) getGenome().getActiveAllele(BeeChromosome.HUMIDITY_TOLERANCE);
|
||||
|
||||
String unlocalizedCustomSpeed = "tooltip.worker." + speedAllele.getUnlocalizedName().replaceAll("(.*)\\.", "");
|
||||
String speed;
|
||||
@@ -406,7 +402,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
speed = speedAllele.getName() + ' ' + StringUtil.localize("gui.worker");
|
||||
}
|
||||
|
||||
String lifespan = genome.getActiveAllele(EnumBeeChromosome.LIFESPAN).getName() + ' ' + StringUtil.localize("gui.life");
|
||||
String lifespan = genome.getActiveAllele(BeeChromosome.LIFESPAN).getName() + ' ' + StringUtil.localize("gui.life");
|
||||
String tempTolerance = EnumChatFormatting.GREEN + "T: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getTemperature()) + " / " + tempToleranceAllele.getName();
|
||||
String humidTolerance = EnumChatFormatting.GREEN + "H: " + AlleleManager.climateHelper.toDisplay(genome.getPrimary().getHumidity()) + " / " + humidToleranceAllele.getName();
|
||||
String flowers = genome.getFlowerProvider().getDescription();
|
||||
@@ -428,7 +424,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
@Override
|
||||
public void age(World world, float housingLifespanModifier) {
|
||||
IBeekeepingMode mode = BeeManager.beeRoot.getBeekeepingMode(world);
|
||||
IBeekeepingMode mode = BeeManager.beeRoot.getMode(world);
|
||||
IBeeModifier beeModifier = mode.getBeeModifier();
|
||||
float finalModifier = housingLifespanModifier * beeModifier.getLifespanModifier(genome, mate, housingLifespanModifier);
|
||||
|
||||
@@ -478,7 +474,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
Log.warning("Failed to produce in an apiary because the beehousing was null.");
|
||||
return null;
|
||||
}
|
||||
IBeekeepingMode mode = BeeManager.beeRoot.getBeekeepingMode(housing.getWorld());
|
||||
IBeekeepingMode mode = BeeManager.beeRoot.getMode(housing.getWorld());
|
||||
if (mode == null) {
|
||||
Log.warning("Failed to produce in an apiary because the beekeeping mode was null.");
|
||||
return null;
|
||||
@@ -528,22 +524,13 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
/* REPRODUCTION */
|
||||
@Nullable
|
||||
@Override
|
||||
public IBee spawnPrincess(IBeeHousing housing) {
|
||||
|
||||
// We need a mated queen to produce offspring.
|
||||
if (mate == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Fatigued queens do not produce princesses.
|
||||
if (BeeManager.beeRoot.getBeekeepingMode(housing.getWorld()).isFatigued(this, housing)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return createOffspring(housing, getGeneration() + 1);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBee[] spawnDrones(IBeeHousing housing) {
|
||||
|
||||
@@ -557,8 +544,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
List<IBee> bees = new ArrayList<>();
|
||||
|
||||
BlockPos housingPos = housing.getCoordinates();
|
||||
int toCreate = BeeManager.beeRoot.getBeekeepingMode(world).getFinalFertility(this, world, housingPos);
|
||||
|
||||
int toCreate = BeeManager.beeRoot.getMode(world).getFinalFertility(this, world, housingPos);
|
||||
if (toCreate <= 0) {
|
||||
toCreate = 1;
|
||||
}
|
||||
@@ -578,93 +564,26 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private IBee createOffspring(IBeeHousing housing, int generation) {
|
||||
|
||||
World world = housing.getWorld();
|
||||
|
||||
IChromosome[] chromosomes = new IChromosome[genome.getChromosomes().length];
|
||||
IChromosome[] parent1 = genome.getChromosomes();
|
||||
IChromosome[] parent2 = mate.getChromosomes();
|
||||
|
||||
// Check for mutation. Replace one of the parents with the mutation
|
||||
// template if mutation occured.
|
||||
IChromosome[] mutated1 = mutateSpecies(housing, genome, mate);
|
||||
if (mutated1 != null) {
|
||||
parent1 = mutated1;
|
||||
}
|
||||
IChromosome[] mutated2 = mutateSpecies(housing, mate, genome);
|
||||
if (mutated2 != null) {
|
||||
parent2 = mutated2;
|
||||
// We need a mated queen to produce offspring.
|
||||
if (mate == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (int i = 0; i < parent1.length; i++) {
|
||||
if (parent1[i] != null && parent2[i] != null) {
|
||||
chromosomes[i] = Chromosome.inheritChromosome(world.rand, parent1[i], parent2[i]);
|
||||
}
|
||||
// Fatigued queens do not produce princesses.
|
||||
if (BeeManager.beeRoot.getMode(housing.getWorld()).isFatigued(this, housing)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
IBeekeepingMode mode = BeeManager.beeRoot.getBeekeepingMode(world);
|
||||
return new Bee(new BeeGenome(chromosomes), mode.isNaturalOffspring(this), generation);
|
||||
}
|
||||
|
||||
private static IChromosome[] mutateSpecies(IBeeHousing housing, IBeeGenome genomeOne, IBeeGenome genomeTwo) {
|
||||
|
||||
World world = housing.getWorld();
|
||||
|
||||
IChromosome[] parent1 = genomeOne.getChromosomes();
|
||||
IChromosome[] parent2 = genomeTwo.getChromosomes();
|
||||
|
||||
IBeeGenome genome0;
|
||||
IBeeGenome genome1;
|
||||
|
||||
IAlleleBeeSpecies allele0;
|
||||
IAlleleBeeSpecies allele1;
|
||||
|
||||
if (world.rand.nextBoolean()) {
|
||||
allele0 = (IAlleleBeeSpecies) parent1[EnumBeeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||
allele1 = (IAlleleBeeSpecies) parent2[EnumBeeChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||
|
||||
genome0 = genomeOne;
|
||||
genome1 = genomeTwo;
|
||||
} else {
|
||||
allele0 = (IAlleleBeeSpecies) parent2[EnumBeeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||
allele1 = (IAlleleBeeSpecies) parent1[EnumBeeChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||
|
||||
genome0 = genomeTwo;
|
||||
genome1 = genomeOne;
|
||||
}
|
||||
|
||||
GameProfile playerProfile = housing.getOwner();
|
||||
IApiaristTracker breedingTracker = BeeManager.beeRoot.getBreedingTracker(world, playerProfile);
|
||||
|
||||
List<IMutation> combinations = BeeManager.beeRoot.getCombinations(allele0, allele1, true);
|
||||
for (IMutation mutation : combinations) {
|
||||
IBeeMutation beeMutation = (IBeeMutation) mutation;
|
||||
|
||||
float chance = beeMutation.getChance(housing, allele0, allele1, genome0, genome1);
|
||||
if (chance <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// boost chance for researched mutations
|
||||
if (breedingTracker.isResearched(beeMutation)) {
|
||||
float mutationBoost = chance * (Config.researchMutationBoostMultiplier - 1.0f);
|
||||
mutationBoost = Math.min(Config.maxResearchMutationBoostPercent, mutationBoost);
|
||||
chance += mutationBoost;
|
||||
}
|
||||
|
||||
if (chance > world.rand.nextFloat() * 100) {
|
||||
breedingTracker.registerMutation(mutation);
|
||||
return BeeManager.beeRoot.templateAsChromosomes(mutation.getTemplate());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
ImmutableMap<BeeChromosome, IChromosome> chromosomes = createOffspringChromosomes(housing.getWorld(), housing.getOwner(), housing.getCoordinates(), genome, mate);
|
||||
IBeeGenome genome = BeeManager.beeRoot.chromosomesAsGenome(chromosomes);
|
||||
return new Bee(genome, isNatural, generation);
|
||||
}
|
||||
|
||||
/* FLOWERS */
|
||||
@Override
|
||||
public IIndividual retrievePollen(IBeeHousing housing) {
|
||||
public ITree retrievePollen(IBeeHousing housing) {
|
||||
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
@@ -682,7 +601,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
Vect offset = new Vect(-area.getX() / 2, -area.getY() / 4, -area.getZ() / 2);
|
||||
Vect housingPos = new Vect(housing.getCoordinates());
|
||||
|
||||
IIndividual pollen = null;
|
||||
ITree pollen = null;
|
||||
|
||||
for (int i = 0; i < 20; i++) {
|
||||
Vect randomPos = Vect.getRandomPositionInArea(random, area);
|
||||
@@ -707,7 +626,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pollinateRandom(IBeeHousing housing, IIndividual pollen) {
|
||||
public boolean pollinateRandom(IBeeHousing housing, ITree pollen) {
|
||||
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import forestry.api.apiculture.BeeChromosome;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import forestry.apiculture.genetics.alleles.AlleleEffect;
|
||||
@@ -12,104 +15,104 @@ import forestry.core.genetics.IBranchDefinition;
|
||||
import forestry.core.genetics.alleles.AlleleHelper;
|
||||
import forestry.core.genetics.alleles.EnumAllele;
|
||||
|
||||
public enum BeeBranchDefinition implements IBranchDefinition {
|
||||
public enum BeeBranchDefinition implements IBranchDefinition<BeeChromosome> {
|
||||
HONEY("Apis"),
|
||||
NOBLE("Probapis"),
|
||||
INDUSTRIOUS("Industrapis"),
|
||||
HEROIC("Herapis"),
|
||||
INFERNAL("Diapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.DOWN_2);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.NEVER_SLEEPS, true);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.NETHER);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.AVERAGE);
|
||||
protected void setBranchProperties(Map<BeeChromosome, IAllele> alleles) {
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.DOWN_2);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.NEVER_SLEEPS, true);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.NETHER);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.FLOWERING, EnumAllele.Flowering.AVERAGE);
|
||||
}
|
||||
},
|
||||
AUSTERE("Modapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.DOWN_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.NEVER_SLEEPS, true);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.CACTI);
|
||||
protected void setBranchProperties(Map<BeeChromosome, IAllele> alleles) {
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.DOWN_1);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.NEVER_SLEEPS, true);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.CACTI);
|
||||
}
|
||||
},
|
||||
TROPICAL("Caldapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.JUNGLE);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.EFFECT, AlleleEffect.effectMiasmic);
|
||||
protected void setBranchProperties(Map<BeeChromosome, IAllele> alleles) {
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.JUNGLE);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.EFFECT, AlleleEffect.effectMiasmic);
|
||||
}
|
||||
},
|
||||
END("Finapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.LOW);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONGER);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TERRITORY, EnumAllele.Territory.LARGE);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.END);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.NEVER_SLEEPS, true);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.EFFECT, AlleleEffect.effectMisanthrope);
|
||||
protected void setBranchProperties(Map<BeeChromosome, IAllele> alleles) {
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.FERTILITY, EnumAllele.Fertility.LOW);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONGER);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.TERRITORY, EnumAllele.Territory.LARGE);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.END);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.NEVER_SLEEPS, true);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.EFFECT, AlleleEffect.effectMisanthrope);
|
||||
}
|
||||
},
|
||||
FROZEN("Coagapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.SNOW);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.EFFECT, AlleleEffect.effectGlacial);
|
||||
protected void setBranchProperties(Map<BeeChromosome, IAllele> alleles) {
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.SNOW);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.EFFECT, AlleleEffect.effectGlacial);
|
||||
}
|
||||
},
|
||||
VENGEFUL("Punapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TERRITORY, EnumAllele.Territory.LARGEST);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.EFFECT, AlleleEffect.effectRadioactive);
|
||||
protected void setBranchProperties(Map<BeeChromosome, IAllele> alleles) {
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.TERRITORY, EnumAllele.Territory.LARGEST);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.EFFECT, AlleleEffect.effectRadioactive);
|
||||
}
|
||||
},
|
||||
FESTIVE("Festapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_2);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.NORMAL);
|
||||
protected void setBranchProperties(Map<BeeChromosome, IAllele> alleles) {
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_2);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.LIFESPAN, EnumAllele.Lifespan.NORMAL);
|
||||
}
|
||||
},
|
||||
AGRARIAN("Rustapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTER);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.FASTER);
|
||||
protected void setBranchProperties(Map<BeeChromosome, IAllele> alleles) {
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTER);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.FLOWERING, EnumAllele.Flowering.FASTER);
|
||||
}
|
||||
},
|
||||
BOGGY("Paludapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.MUSHROOMS);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.SLOWER);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
protected void setBranchProperties(Map<BeeChromosome, IAllele> alleles) {
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.MUSHROOMS);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.FLOWERING, EnumAllele.Flowering.SLOWER);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
}
|
||||
},
|
||||
MONASTIC("Monapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONG);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.LOW);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.FASTER);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.CAVE_DWELLING, true);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT);
|
||||
protected void setBranchProperties(Map<BeeChromosome, IAllele> alleles) {
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONG);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.FERTILITY, EnumAllele.Fertility.LOW);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.FLOWERING, EnumAllele.Flowering.FASTER);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.CAVE_DWELLING, true);
|
||||
AlleleHelper.instance.set(alleles, BeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -119,13 +122,13 @@ public enum BeeBranchDefinition implements IBranchDefinition {
|
||||
branch = BeeManager.beeFactory.createBranch(this.name().toLowerCase(Locale.ENGLISH), scientific);
|
||||
}
|
||||
|
||||
protected void setBranchProperties(IAllele[] template) {
|
||||
protected void setBranchProperties(Map<BeeChromosome, IAllele> template) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public final IAllele[] getTemplate() {
|
||||
IAllele[] template = getDefaultTemplate();
|
||||
public final Map<BeeChromosome, IAllele> getTemplate() {
|
||||
Map<BeeChromosome, IAllele> template = getDefaultTemplate();
|
||||
setBranchProperties(template);
|
||||
return template;
|
||||
}
|
||||
@@ -135,25 +138,27 @@ public enum BeeBranchDefinition implements IBranchDefinition {
|
||||
return branch;
|
||||
}
|
||||
|
||||
private static IAllele[] defaultTemplate;
|
||||
private static ImmutableMap<BeeChromosome, IAllele> defaultTemplate;
|
||||
|
||||
private static IAllele[] getDefaultTemplate() {
|
||||
private static Map<BeeChromosome, IAllele> getDefaultTemplate() {
|
||||
if (defaultTemplate == null) {
|
||||
defaultTemplate = new IAllele[EnumBeeChromosome.values().length];
|
||||
Map<BeeChromosome, IAllele> defaultTemplateBuilder = new EnumMap<>(BeeChromosome.class);
|
||||
AlleleHelper.instance.set(defaultTemplateBuilder, BeeChromosome.SPEED, EnumAllele.Speed.SLOWEST);
|
||||
AlleleHelper.instance.set(defaultTemplateBuilder, BeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTER);
|
||||
AlleleHelper.instance.set(defaultTemplateBuilder, BeeChromosome.FERTILITY, EnumAllele.Fertility.NORMAL);
|
||||
AlleleHelper.instance.set(defaultTemplateBuilder, BeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.NONE);
|
||||
AlleleHelper.instance.set(defaultTemplateBuilder, BeeChromosome.NEVER_SLEEPS, false);
|
||||
AlleleHelper.instance.set(defaultTemplateBuilder, BeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.NONE);
|
||||
AlleleHelper.instance.set(defaultTemplateBuilder, BeeChromosome.TOLERANT_FLYER, false);
|
||||
AlleleHelper.instance.set(defaultTemplateBuilder, BeeChromosome.CAVE_DWELLING, false);
|
||||
AlleleHelper.instance.set(defaultTemplateBuilder, BeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.VANILLA);
|
||||
AlleleHelper.instance.set(defaultTemplateBuilder, BeeChromosome.FLOWERING, EnumAllele.Flowering.SLOWEST);
|
||||
AlleleHelper.instance.set(defaultTemplateBuilder, BeeChromosome.TERRITORY, EnumAllele.Territory.AVERAGE);
|
||||
AlleleHelper.instance.set(defaultTemplateBuilder, BeeChromosome.EFFECT, AlleleEffect.effectNone);
|
||||
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWEST);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTER);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.NORMAL);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.NONE);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.NEVER_SLEEPS, false);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.NONE);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.TOLERANT_FLYER, false);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.CAVE_DWELLING, false);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.VANILLA);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.SLOWEST);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.TERRITORY, EnumAllele.Territory.AVERAGE);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.EFFECT, AlleleEffect.effectNone);
|
||||
defaultTemplate = ImmutableMap.copyOf(defaultTemplateBuilder);
|
||||
}
|
||||
return Arrays.copyOf(defaultTemplate, defaultTemplate.length);
|
||||
|
||||
return new EnumMap<>(defaultTemplate);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -10,19 +10,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IAlleleBeeSpeciesCustom;
|
||||
import forestry.api.apiculture.IAlleleBeeSpeciesBuilder;
|
||||
import forestry.api.apiculture.IBeeFactory;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import forestry.apiculture.genetics.alleles.AlleleBeeSpecies;
|
||||
|
||||
public class BeeFactory implements IBeeFactory {
|
||||
@Override
|
||||
public IAlleleBeeSpeciesCustom createSpecies(String uid, boolean dominant, String authority, String unlocalizedName, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor) {
|
||||
IAlleleBeeSpeciesCustom species = new AlleleBeeSpecies(uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial, primaryColor, secondaryColor);
|
||||
AlleleManager.alleleRegistry.registerAllele(species, EnumBeeChromosome.SPECIES);
|
||||
return species;
|
||||
public IAlleleBeeSpeciesBuilder createSpecies(String uid, boolean dominant, String authority, String unlocalizedName, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor) {
|
||||
return new AlleleBeeSpecies(uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial, primaryColor, secondaryColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,6 +13,7 @@ package forestry.apiculture.genetics;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -20,11 +21,12 @@ import java.util.concurrent.TimeUnit;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.apiculture.BeeChromosome;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.api.genetics.IAlleleFlowers;
|
||||
@@ -32,14 +34,13 @@ import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.genetics.Genome;
|
||||
import forestry.core.genetics.alleles.AlleleArea;
|
||||
import forestry.core.genetics.alleles.AlleleBoolean;
|
||||
import forestry.core.genetics.alleles.AlleleTolerance;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
|
||||
public class BeeGenome extends Genome implements IBeeGenome {
|
||||
public class BeeGenome extends Genome<BeeChromosome> implements IBeeGenome {
|
||||
/**
|
||||
* 0 - Species (determines product)
|
||||
* 1 - Speed
|
||||
@@ -76,11 +77,11 @@ public class BeeGenome extends Genome implements IBeeGenome {
|
||||
}
|
||||
|
||||
/* CONSTRUCTOR */
|
||||
private BeeGenome(NBTTagCompound nbttagcompound) {
|
||||
private BeeGenome(@Nonnull NBTTagCompound nbttagcompound) {
|
||||
super(nbttagcompound);
|
||||
}
|
||||
|
||||
public BeeGenome(IChromosome[] chromosomes) {
|
||||
public BeeGenome(@Nonnull ImmutableMap<BeeChromosome, IChromosome> chromosomes) {
|
||||
super(chromosomes);
|
||||
}
|
||||
|
||||
@@ -95,83 +96,90 @@ public class BeeGenome extends Genome implements IBeeGenome {
|
||||
return (IAlleleBeeSpecies) species;
|
||||
}
|
||||
|
||||
return (IAlleleBeeSpecies) getActiveAllele(itemStack, EnumBeeChromosome.SPECIES, BeeManager.beeRoot);
|
||||
return (IAlleleBeeSpecies) getActiveAllele(itemStack, BeeChromosome.SPECIES, BeeManager.beeRoot);
|
||||
}
|
||||
|
||||
// / INFORMATION RETRIEVAL
|
||||
@Nonnull
|
||||
@Override
|
||||
public IAlleleBeeSpecies getPrimary() {
|
||||
return (IAlleleBeeSpecies) getActiveAllele(EnumBeeChromosome.SPECIES);
|
||||
return (IAlleleBeeSpecies) getActiveAllele(BeeChromosome.SPECIES);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IAlleleBeeSpecies getSecondary() {
|
||||
return (IAlleleBeeSpecies) getInactiveAllele(EnumBeeChromosome.SPECIES);
|
||||
return (IAlleleBeeSpecies) getInactiveAllele(BeeChromosome.SPECIES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSpeed() {
|
||||
return ((IAlleleFloat) getActiveAllele(EnumBeeChromosome.SPEED)).getValue();
|
||||
return ((IAlleleFloat) getActiveAllele(BeeChromosome.SPEED)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLifespan() {
|
||||
return ((IAlleleInteger) getActiveAllele(EnumBeeChromosome.LIFESPAN)).getValue();
|
||||
return ((IAlleleInteger) getActiveAllele(BeeChromosome.LIFESPAN)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFertility() {
|
||||
return ((IAlleleInteger) getActiveAllele(EnumBeeChromosome.FERTILITY)).getValue();
|
||||
return ((IAlleleInteger) getActiveAllele(BeeChromosome.FERTILITY)).getValue();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public EnumTolerance getToleranceTemp() {
|
||||
return ((AlleleTolerance) getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE)).getValue();
|
||||
return ((AlleleTolerance) getActiveAllele(BeeChromosome.TEMPERATURE_TOLERANCE)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getNocturnal() {
|
||||
return ((AlleleBoolean) getActiveAllele(EnumBeeChromosome.NEVER_SLEEPS)).getValue();
|
||||
return ((AlleleBoolean) getActiveAllele(BeeChromosome.NEVER_SLEEPS)).getValue();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public EnumTolerance getToleranceHumid() {
|
||||
return ((AlleleTolerance) getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE)).getValue();
|
||||
return ((AlleleTolerance) getActiveAllele(BeeChromosome.HUMIDITY_TOLERANCE)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTolerantFlyer() {
|
||||
return ((AlleleBoolean) getActiveAllele(EnumBeeChromosome.TOLERANT_FLYER)).getValue();
|
||||
return ((AlleleBoolean) getActiveAllele(BeeChromosome.TOLERANT_FLYER)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getCaveDwelling() {
|
||||
return ((AlleleBoolean) getActiveAllele(EnumBeeChromosome.CAVE_DWELLING)).getValue();
|
||||
return ((AlleleBoolean) getActiveAllele(BeeChromosome.CAVE_DWELLING)).getValue();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IFlowerProvider getFlowerProvider() {
|
||||
return ((IAlleleFlowers) getActiveAllele(EnumBeeChromosome.FLOWER_PROVIDER)).getProvider();
|
||||
return ((IAlleleFlowers) getActiveAllele(BeeChromosome.FLOWER_PROVIDER)).getProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlowering() {
|
||||
return ((IAlleleInteger) getActiveAllele(EnumBeeChromosome.FLOWERING)).getValue();
|
||||
return ((IAlleleInteger) getActiveAllele(BeeChromosome.FLOWERING)).getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getTerritory() {
|
||||
Vect area = ((AlleleArea) getActiveAllele(EnumBeeChromosome.TERRITORY)).getArea();
|
||||
Vect area = ((AlleleArea) getActiveAllele(BeeChromosome.TERRITORY)).getArea();
|
||||
return area.toArray();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IAlleleBeeEffect getEffect() {
|
||||
return (IAlleleBeeEffect) getActiveAllele(EnumBeeChromosome.EFFECT);
|
||||
return (IAlleleBeeEffect) getActiveAllele(BeeChromosome.EFFECT);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
public IBeeRoot getSpeciesRoot() {
|
||||
return BeeManager.beeRoot;
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@@ -25,8 +29,8 @@ import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
|
||||
import forestry.api.apiculture.BeeChromosome;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
@@ -42,27 +46,31 @@ import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.apiculture.BeeHousingListener;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
import forestry.apiculture.BeekeepingLogic;
|
||||
import forestry.core.genetics.SpeciesRoot;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
public class BeeHelper extends SpeciesRoot<BeeChromosome> implements IBeeRoot {
|
||||
|
||||
private static int beeSpeciesCount = -1;
|
||||
public static final String UID = "rootBees";
|
||||
|
||||
public BeeHelper() {
|
||||
super(BeeChromosome.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return UID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IIndividual> getMemberClass() {
|
||||
public Class<IBee> getMemberClass() {
|
||||
return IBee.class;
|
||||
}
|
||||
|
||||
@@ -195,23 +203,32 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
|
||||
/* GENOME CONVERSIONS */
|
||||
@Override
|
||||
public IBeeGenome templateAsGenome(IAllele[] template) {
|
||||
IChromosome[] chromosomes = templateAsChromosomes(template);
|
||||
public IBeeGenome templateAsGenome(ImmutableMap<BeeChromosome, IAllele> template) {
|
||||
ImmutableMap<BeeChromosome, IChromosome> chromosomes = templateAsChromosomes(template);
|
||||
return new BeeGenome(chromosomes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive) {
|
||||
return new BeeGenome(templateAsChromosomes(templateActive, templateInactive));
|
||||
public IBeeGenome templateAsGenome(ImmutableMap<BeeChromosome, IAllele> templateActive, ImmutableMap<BeeChromosome, IAllele> templateInactive) {
|
||||
ImmutableMap<BeeChromosome, IChromosome> chromosomes = templateAsChromosomes(templateActive, templateInactive);
|
||||
return new BeeGenome(chromosomes);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBee templateAsIndividual(IAllele[] template) {
|
||||
public IBeeGenome chromosomesAsGenome(ImmutableMap<BeeChromosome, IChromosome> chromosomes) {
|
||||
return new BeeGenome(chromosomes);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBee templateAsIndividual(ImmutableMap<BeeChromosome, IAllele> template) {
|
||||
return new Bee(templateAsGenome(template));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBee templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive) {
|
||||
public IBee templateAsIndividual(ImmutableMap<BeeChromosome, IAllele> templateActive, ImmutableMap<BeeChromosome, IAllele> templateInactive) {
|
||||
return new Bee(templateAsGenome(templateActive, templateInactive));
|
||||
}
|
||||
|
||||
@@ -224,15 +241,16 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTemplate(String identifier, IAllele[] template) {
|
||||
public void registerTemplate(String identifier, ImmutableMap<BeeChromosome, IAllele> template) {
|
||||
super.registerTemplate(identifier, template);
|
||||
IBeeGenome beeGenome = BeeManager.beeRoot.templateAsGenome(template);
|
||||
IBee bee = new Bee(beeGenome);
|
||||
beeTemplates.add(bee);
|
||||
speciesTemplates.put(identifier, template);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IAllele[] getDefaultTemplate() {
|
||||
public ImmutableMap<BeeChromosome, IAllele> getDefaultTemplate() {
|
||||
return BeeDefinition.FOREST.getTemplate();
|
||||
}
|
||||
|
||||
@@ -251,14 +269,14 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMutation(IMutation mutation) {
|
||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getTemplate()[0].getUID())) {
|
||||
public void registerMutation(IMutation<BeeChromosome> mutation) {
|
||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getResultTemplate().get(getKaryotypeKey()).getUID())) {
|
||||
return;
|
||||
}
|
||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele0().getUID())) {
|
||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getSpecies0().getUID())) {
|
||||
return;
|
||||
}
|
||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele1().getUID())) {
|
||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getSpecies1().getUID())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -266,21 +284,24 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
}
|
||||
|
||||
/* BREEDING MODES */
|
||||
private final ArrayList<IBeekeepingMode> beekeepingModes = new ArrayList<>();
|
||||
@Nonnull
|
||||
private final List<IBeekeepingMode> beekeepingModes = new ArrayList<>();
|
||||
private static IBeekeepingMode activeBeekeepingMode;
|
||||
|
||||
@Override
|
||||
public void resetBeekeepingMode() {
|
||||
public void resetMode() {
|
||||
activeBeekeepingMode = null;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ArrayList<IBeekeepingMode> getBeekeepingModes() {
|
||||
public List<IBeekeepingMode> getModes() {
|
||||
return this.beekeepingModes;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeekeepingMode getBeekeepingMode(World world) {
|
||||
public IBeekeepingMode getMode(@Nonnull World world) {
|
||||
if (activeBeekeepingMode != null) {
|
||||
return activeBeekeepingMode;
|
||||
}
|
||||
@@ -292,37 +313,39 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
mode = PluginApiculture.beekeepingMode;
|
||||
}
|
||||
|
||||
setBeekeepingMode(world, mode);
|
||||
setMode(world, mode);
|
||||
FMLCommonHandler.instance().getFMLLogger().debug("Set beekeeping mode for a world to " + mode);
|
||||
|
||||
return activeBeekeepingMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBeekeepingMode(IBeekeepingMode mode) {
|
||||
public void registerMode(@Nonnull IBeekeepingMode mode) {
|
||||
beekeepingModes.add(mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeekeepingMode(World world, String name) {
|
||||
activeBeekeepingMode = getBeekeepingMode(name);
|
||||
public void setMode(@Nonnull World world, @Nonnull String name) {
|
||||
activeBeekeepingMode = getMode(name);
|
||||
getBreedingTracker(world, null).setModeName(name);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeekeepingMode getBeekeepingMode(String name) {
|
||||
public IBeekeepingMode getMode(@Nonnull String name) {
|
||||
for (IBeekeepingMode mode : beekeepingModes) {
|
||||
if (mode.getName().equals(name) || mode.getName().equals(name.toLowerCase(Locale.ENGLISH))) {
|
||||
return mode;
|
||||
}
|
||||
}
|
||||
|
||||
FMLCommonHandler.instance().getFMLLogger().debug("Failed to find a beekeeping mode called '%s', reverting to fallback.");
|
||||
Log.debug("Failed to find a beekeeping mode called '%s', reverting to fallback.");
|
||||
return beekeepingModes.get(0);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IApiaristTracker getBreedingTracker(World world, GameProfile player) {
|
||||
public IApiaristTracker getBreedingTracker(@Nonnull World world, @Nonnull GameProfile player) {
|
||||
String filename = "ApiaristTracker." + (player == null ? "common" : player.getId());
|
||||
ApiaristTracker tracker = (ApiaristTracker) world.loadItemData(ApiaristTracker.class, filename);
|
||||
|
||||
@@ -353,13 +376,15 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
return new BeeHousingListener(housing);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IChromosomeType[] getKaryotype() {
|
||||
return EnumBeeChromosome.values();
|
||||
public BeeChromosome[] getKaryotype() {
|
||||
return BeeChromosome.values();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IChromosomeType getKaryotypeKey() {
|
||||
return EnumBeeChromosome.SPECIES;
|
||||
public BeeChromosome getKaryotypeKey() {
|
||||
return BeeChromosome.SPECIES;
|
||||
}
|
||||
}
|
||||
@@ -10,42 +10,57 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeChromosome;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeeMutationCustom;
|
||||
import forestry.api.apiculture.IBeeMutation;
|
||||
import forestry.api.apiculture.IBeeMutationBuilder;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.core.genetics.mutations.Mutation;
|
||||
|
||||
public class BeeMutation extends Mutation implements IBeeMutationCustom {
|
||||
public class BeeMutation extends Mutation<BeeChromosome> implements IBeeMutation, IBeeMutationBuilder {
|
||||
|
||||
public BeeMutation(IAlleleBeeSpecies bee0, IAlleleBeeSpecies bee1, IAllele[] result, int chance) {
|
||||
public BeeMutation(IAlleleBeeSpecies bee0, IAlleleBeeSpecies bee1, ImmutableMap<BeeChromosome, IAllele> result, int chance) {
|
||||
super(bee0, bee1, result, chance);
|
||||
}
|
||||
|
||||
// TODO: break this into a separate builder class
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeMutation build() {
|
||||
BeeManager.beeRoot.registerMutation(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeRoot getRoot() {
|
||||
return BeeManager.beeRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(IBeeHousing housing, IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1, IBeeGenome genome0, IBeeGenome genome1) {
|
||||
public float getChance(IBeeHousing housing, IAlleleBeeSpecies genome, IAlleleBeeSpecies mate, IBeeGenome genome0, IBeeGenome genome1) {
|
||||
World world = housing.getWorld();
|
||||
BlockPos housingPos = housing.getCoordinates();
|
||||
|
||||
float processedChance = super.getChance(world, housingPos, allele0, allele1, genome0, genome1);
|
||||
float processedChance = super.getChance(world, housingPos, genome, mate, genome0, genome1);
|
||||
if (processedChance <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
IBeeModifier beeHousingModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
IBeeModifier beeModeModifier = BeeManager.beeRoot.getBeekeepingMode(world).getBeeModifier();
|
||||
IBeeModifier beeModeModifier = BeeManager.beeRoot.getMode(world).getBeeModifier();
|
||||
|
||||
processedChance *= beeHousingModifier.getMutationModifier(genome0, genome1, processedChance);
|
||||
processedChance *= beeModeModifier.getMutationModifier(genome0, genome1, processedChance);
|
||||
|
||||
@@ -10,18 +10,18 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import forestry.api.apiculture.BeeChromosome;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeMutationCustom;
|
||||
import forestry.api.apiculture.IBeeMutationBuilder;
|
||||
import forestry.api.apiculture.IBeeMutationFactory;
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
public class BeeMutationFactory implements IBeeMutationFactory {
|
||||
|
||||
@Override
|
||||
public IBeeMutationCustom createMutation(IAlleleBeeSpecies parentBee0, IAlleleBeeSpecies parentBee1, IAllele[] result, int chance) {
|
||||
IBeeMutationCustom mutation = new BeeMutation(parentBee0, parentBee1, result, chance);
|
||||
BeeManager.beeRoot.registerMutation(mutation);
|
||||
return mutation;
|
||||
public IBeeMutationBuilder createMutation(IAlleleBeeSpecies parentBee0, IAlleleBeeSpecies parentBee1, ImmutableMap<BeeChromosome, IAllele> result, int chance) {
|
||||
return new BeeMutation(parentBee0, parentBee1, result, chance);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,15 @@
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.BeeChromosome;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
@@ -12,19 +18,20 @@ import forestry.core.genetics.alleles.AlleleHelper;
|
||||
|
||||
public abstract class BeeVariation implements IBeeDefinition {
|
||||
|
||||
private final IAllele[] template;
|
||||
private final ImmutableMap<BeeChromosome, IAllele> template;
|
||||
private final IBeeGenome genome;
|
||||
|
||||
protected BeeVariation(IBeeDefinition bee) {
|
||||
template = bee.getTemplate();
|
||||
initializeTemplate(template);
|
||||
private BeeVariation(IBeeDefinition bee) {
|
||||
Map<BeeChromosome, IAllele> templateBuilder = new EnumMap<>(bee.getTemplate());
|
||||
initializeTemplate(templateBuilder);
|
||||
template = ImmutableMap.copyOf(templateBuilder);
|
||||
genome = BeeManager.beeRoot.templateAsGenome(template);
|
||||
}
|
||||
|
||||
protected abstract void initializeTemplate(IAllele[] template);
|
||||
protected abstract void initializeTemplate(@Nonnull Map<BeeChromosome, IAllele> template);
|
||||
|
||||
@Override
|
||||
public IAllele[] getTemplate() {
|
||||
public ImmutableMap<BeeChromosome, IAllele> getTemplate() {
|
||||
return template;
|
||||
}
|
||||
|
||||
@@ -50,8 +57,8 @@ public abstract class BeeVariation implements IBeeDefinition {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initializeTemplate(IAllele[] template) {
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.TOLERANT_FLYER, true);
|
||||
protected void initializeTemplate(@Nonnull Map<BeeChromosome, IAllele> template) {
|
||||
AlleleHelper.instance.set(template, BeeChromosome.TOLERANT_FLYER, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -12,12 +12,13 @@ package forestry.apiculture.genetics;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.BeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.core.genetics.IGeneticDefinition;
|
||||
|
||||
public interface IBeeDefinition extends IGeneticDefinition {
|
||||
public interface IBeeDefinition extends IGeneticDefinition<BeeChromosome> {
|
||||
@Override
|
||||
IBeeGenome getGenome();
|
||||
|
||||
|
||||
@@ -25,9 +25,11 @@ import com.mojang.authlib.GameProfile;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.BeeChromosome;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpeciesCustom;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IAlleleBeeSpeciesBuilder;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModelProvider;
|
||||
@@ -36,6 +38,7 @@ import forestry.api.apiculture.IBeeSpriteColourProvider;
|
||||
import forestry.api.apiculture.IJubilanceProvider;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.IModelProvider;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.apiculture.genetics.DefaultBeeModelProvider;
|
||||
@@ -44,7 +47,7 @@ import forestry.apiculture.genetics.JubilanceDefault;
|
||||
import forestry.core.genetics.alleles.AlleleSpecies;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpeciesCustom {
|
||||
public class AlleleBeeSpecies extends AlleleSpecies<BeeChromosome> implements IAlleleBeeSpecies, IAlleleBeeSpeciesBuilder {
|
||||
private final Map<ItemStack, Float> productChances = new HashMap<>();
|
||||
private final Map<ItemStack, Float> specialtyChances = new HashMap<>();
|
||||
|
||||
@@ -66,8 +69,15 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
|
||||
return BeeManager.beeRoot;
|
||||
}
|
||||
|
||||
// TODO: break this into a separate builder class
|
||||
@Override
|
||||
public IAlleleBeeSpeciesCustom addProduct(ItemStack product, Float chance) {
|
||||
public IAlleleBeeSpecies build() {
|
||||
AlleleManager.alleleRegistry.registerAllele(this, BeeChromosome.SPECIES);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleBeeSpeciesBuilder addProduct(ItemStack product, Float chance) {
|
||||
if (product == null || product.getItem() == null) {
|
||||
throw new IllegalArgumentException("Tried to add null product");
|
||||
}
|
||||
@@ -79,7 +89,7 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleBeeSpeciesCustom addSpecialty(ItemStack specialty, Float chance) {
|
||||
public IAlleleBeeSpeciesBuilder addSpecialty(ItemStack specialty, Float chance) {
|
||||
if (specialty == null || specialty.getItem() == null) {
|
||||
throw new IllegalArgumentException("Tried to add null specialty");
|
||||
}
|
||||
@@ -91,25 +101,25 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleBeeSpeciesCustom setJubilanceProvider(IJubilanceProvider provider) {
|
||||
public IAlleleBeeSpeciesBuilder setJubilanceProvider(IJubilanceProvider provider) {
|
||||
this.jubilanceProvider = provider;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleBeeSpeciesCustom setNocturnal() {
|
||||
public IAlleleBeeSpeciesBuilder setNocturnal() {
|
||||
nocturnal = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleBeeSpeciesCustom setCustomBeeModelProvider(IBeeModelProvider beeIconProvider) {
|
||||
public IAlleleBeeSpeciesBuilder setCustomBeeModelProvider(IBeeModelProvider beeIconProvider) {
|
||||
this.beeModelProvider = beeIconProvider;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleBeeSpeciesCustom setCustomBeeSpriteColourProvider(IBeeSpriteColourProvider beeIconColourProvider) {
|
||||
public IAlleleBeeSpeciesBuilder setCustomBeeSpriteColourProvider(IBeeSpriteColourProvider beeIconColourProvider) {
|
||||
this.beeSpriteColourProvider = beeIconColourProvider;
|
||||
return this;
|
||||
}
|
||||
@@ -136,7 +146,7 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getResearchBounty(World world, GameProfile researcher, IIndividual individual, int bountyLevel) {
|
||||
public ItemStack[] getResearchBounty(World world, GameProfile researcher, IIndividual<BeeChromosome> individual, int bountyLevel) {
|
||||
ArrayList<ItemStack> bounty = new ArrayList<>();
|
||||
Collections.addAll(bounty, super.getResearchBounty(world, researcher, individual, bountyLevel));
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
import forestry.api.apiculture.BeeChromosome;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
@@ -79,7 +79,7 @@ public abstract class AlleleEffect extends AlleleCategorized implements IAlleleB
|
||||
);
|
||||
|
||||
for (IAlleleBeeEffect beeEffect : beeEffects) {
|
||||
AlleleManager.alleleRegistry.registerAllele(beeEffect, EnumBeeChromosome.EFFECT);
|
||||
AlleleManager.alleleRegistry.registerAllele(beeEffect, BeeChromosome.EFFECT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,24 +10,28 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics.alleles;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.genetics.IAlleleFlowers;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.core.genetics.alleles.AlleleCategorized;
|
||||
|
||||
public class AlleleFlowers extends AlleleCategorized implements IAlleleFlowers {
|
||||
|
||||
@Nonnull
|
||||
private final IFlowerProvider provider;
|
||||
|
||||
public AlleleFlowers(String modId, String category, String name, IFlowerProvider provider, boolean isDominant) {
|
||||
public AlleleFlowers(@Nonnull String modId, @Nonnull String category, @Nonnull String name, @Nonnull IFlowerProvider provider, boolean isDominant) {
|
||||
super(modId, category, name, isDominant);
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IFlowerProvider getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getName() {
|
||||
return getProvider().getDescription();
|
||||
|
||||
@@ -15,8 +15,8 @@ import java.util.ArrayList;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.BeeChromosome;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBee;
|
||||
@@ -33,7 +33,7 @@ import forestry.core.inventory.ItemInventoryAlyzer;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class GuiBeealyzer extends GuiAlyzer {
|
||||
public class GuiBeealyzer extends GuiAlyzer<BeeChromosome> {
|
||||
|
||||
public GuiBeealyzer(EntityPlayer player, ItemInventoryBeealyzer inventory) {
|
||||
super(BeeManager.beeRoot, player, new ContainerAlyzer(inventory, player), inventory, "gui.beealyzer");
|
||||
@@ -110,30 +110,30 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
String customPrimaryBeeKey = "bees.custom.beealyzer." + type.getName() + "." + bee.getGenome().getPrimary().getUnlocalizedName().replace("bees.species.", "");
|
||||
String customSecondaryBeeKey = "bees.custom.beealyzer." + type.getName() + "." + bee.getGenome().getSecondary().getUnlocalizedName().replace("bees.species.", "");
|
||||
|
||||
drawSpeciesRow(StringUtil.localize("gui.species"), bee, EnumBeeChromosome.SPECIES, checkCustomName(customPrimaryBeeKey), checkCustomName(customSecondaryBeeKey));
|
||||
drawSpeciesRow(StringUtil.localize("gui.species"), bee, BeeChromosome.SPECIES, checkCustomName(customPrimaryBeeKey), checkCustomName(customSecondaryBeeKey));
|
||||
textLayout.newLine();
|
||||
}
|
||||
|
||||
drawChromosomeRow(StringUtil.localize("gui.lifespan"), bee, EnumBeeChromosome.LIFESPAN);
|
||||
drawChromosomeRow(StringUtil.localize("gui.lifespan"), bee, BeeChromosome.LIFESPAN);
|
||||
textLayout.newLine();
|
||||
drawChromosomeRow(StringUtil.localize("gui.speed"), bee, EnumBeeChromosome.SPEED);
|
||||
drawChromosomeRow(StringUtil.localize("gui.speed"), bee, BeeChromosome.SPEED);
|
||||
textLayout.newLine();
|
||||
drawChromosomeRow(StringUtil.localize("gui.pollination"), bee, EnumBeeChromosome.FLOWERING);
|
||||
drawChromosomeRow(StringUtil.localize("gui.pollination"), bee, BeeChromosome.FLOWERING);
|
||||
textLayout.newLine();
|
||||
drawChromosomeRow(StringUtil.localize("gui.flowers"), bee, EnumBeeChromosome.FLOWER_PROVIDER);
|
||||
drawChromosomeRow(StringUtil.localize("gui.flowers"), bee, BeeChromosome.FLOWER_PROVIDER);
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.drawLine(StringUtil.localize("gui.fertility"), COLUMN_0);
|
||||
IAlleleInteger primaryFertility = (IAlleleInteger) bee.getGenome().getActiveAllele(EnumBeeChromosome.FERTILITY);
|
||||
IAlleleInteger secondaryFertility = (IAlleleInteger) bee.getGenome().getInactiveAllele(EnumBeeChromosome.FERTILITY);
|
||||
IAlleleInteger primaryFertility = (IAlleleInteger) bee.getGenome().getActiveAllele(BeeChromosome.FERTILITY);
|
||||
IAlleleInteger secondaryFertility = (IAlleleInteger) bee.getGenome().getInactiveAllele(BeeChromosome.FERTILITY);
|
||||
drawFertilityInfo(primaryFertility.getValue(), COLUMN_1, getColorCoding(primaryFertility.isDominant()), 0);
|
||||
drawFertilityInfo(secondaryFertility.getValue(), COLUMN_2, getColorCoding(secondaryFertility.isDominant()), 0);
|
||||
textLayout.newLine();
|
||||
|
||||
drawChromosomeRow(StringUtil.localize("gui.area"), bee, EnumBeeChromosome.TERRITORY);
|
||||
drawChromosomeRow(StringUtil.localize("gui.area"), bee, BeeChromosome.TERRITORY);
|
||||
textLayout.newLine();
|
||||
|
||||
drawChromosomeRow(StringUtil.localize("gui.effect"), bee, EnumBeeChromosome.EFFECT);
|
||||
drawChromosomeRow(StringUtil.localize("gui.effect"), bee, BeeChromosome.EFFECT);
|
||||
textLayout.newLine();
|
||||
|
||||
textLayout.endPage();
|
||||
@@ -149,12 +149,12 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
textLayout.newLine();
|
||||
|
||||
drawRow(StringUtil.localize("gui.climate"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getTemperature()),
|
||||
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getTemperature()), bee, EnumBeeChromosome.SPECIES);
|
||||
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getTemperature()), bee, BeeChromosome.SPECIES);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTolerance tempToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
IAlleleTolerance tempToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
IAlleleTolerance tempToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(BeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
IAlleleTolerance tempToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(BeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
textLayout.drawLine(" " + StringUtil.localize("gui.tolerance"), COLUMN_0);
|
||||
drawToleranceInfo(tempToleranceActive, COLUMN_1);
|
||||
drawToleranceInfo(tempToleranceInactive, COLUMN_2);
|
||||
@@ -162,12 +162,12 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
textLayout.newLine(16);
|
||||
|
||||
drawRow(StringUtil.localize("gui.humidity"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getHumidity()),
|
||||
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getHumidity()), bee, EnumBeeChromosome.SPECIES);
|
||||
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getHumidity()), bee, BeeChromosome.SPECIES);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTolerance humidToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
IAlleleTolerance humidToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
IAlleleTolerance humidToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(BeeChromosome.HUMIDITY_TOLERANCE);
|
||||
IAlleleTolerance humidToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(BeeChromosome.HUMIDITY_TOLERANCE);
|
||||
textLayout.drawLine(" " + StringUtil.localize("gui.tolerance"), COLUMN_0);
|
||||
drawToleranceInfo(humidToleranceActive, COLUMN_1);
|
||||
drawToleranceInfo(humidToleranceInactive, COLUMN_2);
|
||||
@@ -184,7 +184,7 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
nocturnal0 = bee.getGenome().getPrimary().isNocturnal() ? yes : no;
|
||||
diurnal0 = !bee.getGenome().getPrimary().isNocturnal() ? yes : no;
|
||||
}
|
||||
if (((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.NEVER_SLEEPS)).getValue()) {
|
||||
if (((AlleleBoolean) bee.getGenome().getInactiveAllele(BeeChromosome.NEVER_SLEEPS)).getValue()) {
|
||||
nocturnal1 = diurnal1 = yes;
|
||||
} else {
|
||||
nocturnal1 = bee.getGenome().getSecondary().isNocturnal() ? yes : no;
|
||||
@@ -202,16 +202,16 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
String primary = StringUtil.readableBoolean(bee.getGenome().getTolerantFlyer(), yes, no);
|
||||
String secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TOLERANT_FLYER)).getValue(), yes, no);
|
||||
String secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(BeeChromosome.TOLERANT_FLYER)).getValue(), yes, no);
|
||||
|
||||
drawRow(StringUtil.localize("gui.flyer"), primary, secondary, bee, EnumBeeChromosome.TOLERANT_FLYER);
|
||||
drawRow(StringUtil.localize("gui.flyer"), primary, secondary, bee, BeeChromosome.TOLERANT_FLYER);
|
||||
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
primary = StringUtil.readableBoolean(bee.getGenome().getCaveDwelling(), yes, no);
|
||||
secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.CAVE_DWELLING)).getValue(), yes, no);
|
||||
secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(BeeChromosome.CAVE_DWELLING)).getValue(), yes, no);
|
||||
|
||||
drawRow(StringUtil.localize("gui.cave"), primary, secondary, bee, EnumBeeChromosome.CAVE_DWELLING);
|
||||
drawRow(StringUtil.localize("gui.cave"), primary, secondary, bee, BeeChromosome.CAVE_DWELLING);
|
||||
|
||||
textLayout.newLine();
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ public class InventoryApiary extends InventoryBeeHousing implements IApiaryInven
|
||||
|
||||
@Override
|
||||
public void wearOutFrames(IBeeHousing beeHousing, int amount) {
|
||||
IBeekeepingMode beekeepingMode = BeeManager.beeRoot.getBeekeepingMode(beeHousing.getWorld());
|
||||
IBeekeepingMode beekeepingMode = BeeManager.beeRoot.getMode(beeHousing.getWorld());
|
||||
int wear = Math.round(amount * beekeepingMode.getWearModifier());
|
||||
|
||||
for (int i = SLOT_FRAMES_1; i < SLOT_FRAMES_1 + SLOT_FRAMES_COUNT; i++) {
|
||||
|
||||
@@ -15,12 +15,13 @@ import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.BeeChromosome;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.gui.IHintSource;
|
||||
import forestry.core.inventory.ItemInventoryAlyzer;
|
||||
|
||||
public class ItemInventoryBeealyzer extends ItemInventoryAlyzer implements IHintSource {
|
||||
public class ItemInventoryBeealyzer extends ItemInventoryAlyzer<BeeChromosome> implements IHintSource {
|
||||
|
||||
public ItemInventoryBeealyzer(EntityPlayer player, ItemStack itemStack) {
|
||||
super(BeeManager.beeRoot, player, itemStack);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package forestry.apiculture.items;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
@@ -23,8 +24,8 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.BeeChromosome;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBee;
|
||||
@@ -153,7 +154,8 @@ public class ItemBeeGE extends ItemGE {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) {
|
||||
Map<String, IAllele> registeredAlleles = AlleleManager.alleleRegistry.getRegisteredAlleles();
|
||||
for (IAllele allele : registeredAlleles.values()) {
|
||||
if (allele instanceof IAlleleBeeSpecies) {
|
||||
((IAlleleBeeSpecies) allele).getModelProvider().registerModels(item, manager);
|
||||
}
|
||||
@@ -167,8 +169,7 @@ public class ItemBeeGE extends ItemGE {
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack) {
|
||||
IAlleleBeeSpecies species = (IAlleleBeeSpecies) getSpecies(stack);
|
||||
if (species == null) {
|
||||
species = (IAlleleBeeSpecies) BeeManager.beeRoot.getDefaultTemplate()[EnumBeeChromosome.SPECIES
|
||||
.ordinal()];
|
||||
species = (IAlleleBeeSpecies) BeeManager.beeRoot.getDefaultTemplate().get(BeeChromosome.SPECIES);
|
||||
}
|
||||
return species.getModel(type);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.genetics.BeeDefinition;
|
||||
import forestry.core.items.ItemForestry;
|
||||
import forestry.core.items.ItemOverlay;
|
||||
import forestry.core.items.ItemRegistry;
|
||||
@@ -53,7 +52,6 @@ public class ItemRegistryApiculture extends ItemRegistry {
|
||||
|
||||
public ItemRegistryApiculture() {
|
||||
// / BEES
|
||||
BeeDefinition.preInit();
|
||||
beeQueenGE = registerItem(new ItemBeeGE(EnumBeeType.QUEEN), "beeQueenGE");
|
||||
beeDroneGE = registerItem(new ItemBeeGE(EnumBeeType.DRONE), "beeDroneGE");
|
||||
beePrincessGE = registerItem(new ItemBeeGE(EnumBeeType.PRINCESS), "beePrincessGE");
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.multiblock;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@@ -288,7 +289,7 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound data) {
|
||||
public void writeToNBT(@Nonnull NBTTagCompound data) {
|
||||
super.writeToNBT(data);
|
||||
|
||||
data.setFloat("TempChange", tempChange);
|
||||
|
||||
@@ -16,9 +16,8 @@ import net.minecraft.item.ItemStack;
|
||||
import forestry.api.apiculture.DefaultBeeListener;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.ITreeRoot;
|
||||
import forestry.api.multiblock.IAlvearyComponent;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.apiculture.gui.ContainerAlvearySieve;
|
||||
@@ -62,7 +61,7 @@ public class TileAlvearySieve extends TileAlveary implements IAlvearyComponent.B
|
||||
return new ContainerAlvearySieve(player.inventory, this);
|
||||
}
|
||||
|
||||
static class AlvearySieveBeeListener extends DefaultBeeListener {
|
||||
private static class AlvearySieveBeeListener extends DefaultBeeListener {
|
||||
private final InventoryAlvearySieve inventory;
|
||||
|
||||
public AlvearySieveBeeListener(InventoryAlvearySieve inventory) {
|
||||
@@ -70,12 +69,12 @@ public class TileAlvearySieve extends TileAlveary implements IAlvearyComponent.B
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPollenRetrieved(IIndividual pollen) {
|
||||
public boolean onPollenRetrieved(ITree pollen) {
|
||||
if (!inventory.canStorePollen()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(pollen.getClass());
|
||||
ITreeRoot speciesRoot = pollen.getGenome().getSpeciesRoot();
|
||||
|
||||
ItemStack pollenStack = speciesRoot.getMemberStack(pollen, EnumGermlingType.POLLEN.ordinal());
|
||||
if (pollenStack != null) {
|
||||
|
||||
@@ -10,10 +10,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.tiles;
|
||||
|
||||
import forestry.api.apiculture.BeeChromosome;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.core.tiles.TileNaturalistChest;
|
||||
|
||||
public class TileApiaristChest extends TileNaturalistChest {
|
||||
public class TileApiaristChest extends TileNaturalistChest<BeeChromosome> {
|
||||
public TileApiaristChest() {
|
||||
super(BeeManager.beeRoot);
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.arboriculture.IAlleleFruit;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.TreeChromosome;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
@@ -85,7 +85,7 @@ public class FruitProviderPod extends FruitProviderNone {
|
||||
if (type == EnumPodType.COCOA) {
|
||||
return BlockUtil.tryPlantPot(world, pos, Blocks.cocoa);
|
||||
} else {
|
||||
return TreeManager.treeRoot.setFruitBlock(world, (IAlleleFruit) genome.getActiveAllele(EnumTreeChromosome.FRUITS),
|
||||
return TreeManager.treeRoot.setFruitBlock(world, (IAlleleFruit) genome.getActiveAllele(TreeChromosome.FRUITS),
|
||||
genome.getSappiness(), type.uids, pos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.ITreeModifier;
|
||||
import forestry.api.arboriculture.ITreekeepingMode;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
|
||||
@@ -51,7 +53,9 @@ public class FruitProviderRandom extends FruitProviderNone {
|
||||
public ItemStack[] getFruits(ITreeGenome genome, World world, BlockPos pos, int ripeningTime) {
|
||||
ArrayList<ItemStack> product = new ArrayList<>();
|
||||
|
||||
float modeYieldMod = TreeManager.treeRoot.getTreekeepingMode(world).getYieldModifier(genome, 1f);
|
||||
ITreekeepingMode mode = TreeManager.treeRoot.getMode(world);
|
||||
ITreeModifier modifier = mode.getTreeModifier();
|
||||
float modeYieldMod = modifier.getYieldModifier(genome, 1f);
|
||||
|
||||
for (Map.Entry<ItemStack, Float> entry : products.entrySet()) {
|
||||
if (world.rand.nextFloat() <= genome.getYield() * modeYieldMod * entry.getValue()) {
|
||||
|
||||
@@ -21,6 +21,8 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.ITreeModifier;
|
||||
import forestry.api.arboriculture.ITreekeepingMode;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
|
||||
@@ -71,7 +73,9 @@ public class FruitProviderRipening extends FruitProviderNone {
|
||||
return new ItemStack[0];
|
||||
}
|
||||
|
||||
float modeYieldMod = TreeManager.treeRoot.getTreekeepingMode(world).getYieldModifier(genome, 1f);
|
||||
ITreekeepingMode mode = TreeManager.treeRoot.getMode(world);
|
||||
ITreeModifier modifier = mode.getTreeModifier();
|
||||
float modeYieldMod = modifier.getYieldModifier(genome, 1f);
|
||||
|
||||
for (Map.Entry<ItemStack, Float> entry : products.entrySet()) {
|
||||
if (world.rand.nextFloat() <= genome.getYield() * entry.getValue() * modeYieldMod * 5.0f * stage) {
|
||||
|
||||
@@ -12,6 +12,7 @@ package forestry.arboriculture.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -176,7 +177,7 @@ public class BlockForestryLeaves extends BlockLeavesBase implements ITileEntityP
|
||||
}
|
||||
|
||||
// Add saplings
|
||||
ITree[] saplings = tile.getTree().getSaplings((World) world, playerProfile, pos, saplingModifier);
|
||||
Collection<ITree> saplings = tile.getTree().getSaplings((World) world, playerProfile, pos, saplingModifier);
|
||||
|
||||
for (ITree sapling : saplings) {
|
||||
if (sapling != null) {
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.commands;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
@@ -17,6 +19,7 @@ import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.TreeChromosome;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
@@ -73,7 +76,7 @@ public final class TreeGenHelper {
|
||||
throw new SpeciesNotFoundException(speciesName);
|
||||
}
|
||||
|
||||
IAllele[] template = TreeManager.treeRoot.getTemplate(species.getUID());
|
||||
ImmutableMap<TreeChromosome, IAllele> template = TreeManager.treeRoot.getTemplate(species.getUID());
|
||||
|
||||
if (template == null) {
|
||||
throw new TemplateNotFoundException(species);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package forestry.arboriculture.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
@@ -23,7 +24,7 @@ public class TreeModeHelper implements ICommandModeHelper {
|
||||
|
||||
@Override
|
||||
public String[] getModeNames() {
|
||||
ArrayList<ITreekeepingMode> treekeepingModes = TreeManager.treeRoot.getTreekeepingModes();
|
||||
Collection<ITreekeepingMode> treekeepingModes = TreeManager.treeRoot.getModes();
|
||||
int modeStringCount = treekeepingModes.size();
|
||||
List<String> modeStrings = new ArrayList<>(modeStringCount);
|
||||
for (ITreekeepingMode mode : treekeepingModes) {
|
||||
@@ -35,7 +36,7 @@ public class TreeModeHelper implements ICommandModeHelper {
|
||||
|
||||
@Override
|
||||
public String getModeNameMatching(String desired) {
|
||||
ITreekeepingMode mode = TreeManager.treeRoot.getTreekeepingMode(desired);
|
||||
ITreekeepingMode mode = TreeManager.treeRoot.getMode(desired);
|
||||
if (mode == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -44,17 +45,17 @@ public class TreeModeHelper implements ICommandModeHelper {
|
||||
|
||||
@Override
|
||||
public String getModeName(World world) {
|
||||
return TreeManager.treeRoot.getTreekeepingMode(world).getName();
|
||||
return TreeManager.treeRoot.getMode(world).getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMode(World world, String modeName) {
|
||||
TreeManager.treeRoot.setTreekeepingMode(world, modeName);
|
||||
TreeManager.treeRoot.setMode(world, modeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<String> getDescription(String modeName) {
|
||||
ITreekeepingMode mode = TreeManager.treeRoot.getTreekeepingMode(modeName);
|
||||
ITreekeepingMode mode = TreeManager.treeRoot.getMode(modeName);
|
||||
return mode.getDescription();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,12 +13,12 @@ package forestry.arboriculture.genetics;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import forestry.api.arboriculture.IArboristTracker;
|
||||
import forestry.api.arboriculture.TreeChromosome;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.genetics.BreedingTracker;
|
||||
|
||||
public class ArboristTracker extends BreedingTracker implements IArboristTracker {
|
||||
public class ArboristTracker extends BreedingTracker<TreeChromosome> implements IArboristTracker {
|
||||
|
||||
/** Required for creation from map storage */
|
||||
public ArboristTracker(String s) {
|
||||
@@ -26,13 +26,13 @@ public class ArboristTracker extends BreedingTracker implements IArboristTracker
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IBreedingTracker getBreedingTracker(EntityPlayer player) {
|
||||
protected IArboristTracker getBreedingTracker(EntityPlayer player) {
|
||||
return TreeManager.treeRoot.getBreedingTracker(player.worldObj, player.getGameProfile());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String speciesRootUID() {
|
||||
return TreeHelper.UID;
|
||||
return TreeRoot.UID;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loaded 100 of 217 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user