Make SpeciesCustom classes into SpeciesBuilder

This commit is contained in:
mezz committed 2016-03-03 21:46:21 -08:00
1 parent efcab41e04
commit 5a901ffa36
20 files changed
+250 -191

No files matched your search

@@ -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 {
@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);
}
@@ -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.
@@ -7,15 +7,18 @@ 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 {
@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);
}
@@ -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);
@@ -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 {
IAlleleSpeciesCustom setTemperature(EnumTemperature temperature);
IAlleleSpecies build();
IAlleleSpeciesCustom setHumidity(EnumHumidity humidity);
IAlleleSpeciesBuilder setTemperature(EnumTemperature temperature);
IAlleleSpeciesCustom setHasEffect();
IAlleleSpeciesBuilder setHumidity(EnumHumidity humidity);
IAlleleSpeciesBuilder setHasEffect();
/** Secret species are not shown in creative mode. */
IAlleleSpeciesCustom setIsSecret();
IAlleleSpeciesBuilder setIsSecret();
/** Uncounted species do not count toward total species discovered. */
IAlleleSpeciesCustom setIsNotCounted();
IAlleleSpeciesBuilder setIsNotCounted();
}
@@ -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 {
IAlleleButterflySpeciesCustom setFlightDistance(float flightDistance);
@Override
IAlleleButterflySpecies build();
IAlleleButterflySpeciesCustom setNocturnal();
IAlleleButterflySpeciesBuilder setRarity(float rarity);
IAlleleButterflySpeciesBuilder setFlightDistance(float flightDistance);
IAlleleButterflySpeciesBuilder setNocturnal();
}
@@ -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);
}