Fixed server crash with mudballs, fixed forestry beehive spawning as well as giving biomes appropriate temperatures

This commit is contained in:
Adubbz 2013-04-10 13:35:11 +10:00
parent 94bab1f63f
commit 1e3eab38b0
128 changed files with 4259 additions and 4 deletions

View file

@ -0,0 +1,39 @@
package forestry.api.apiculture;
import java.util.ArrayList;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
import forestry.api.genetics.IMutation;
public class BeeManager {
/**
* See {@link IBeeInterface} for details
*/
public static IBeeInterface beeInterface;
/**
* Species templates for bees that can drop from hives.
*
* 0 - Forest 1 - Meadows 2 - Desert 3 - Jungle 4 - End 5 - Snow 6 - Swamp
*
* see {@link IMutation} for template format
*/
public static ArrayList<IHiveDrop>[] hiveDrops;
/**
* 0 - Common Village Bees 1 - Uncommon Village Bees (20 % of spawns)
*/
public static ArrayList<IBeeGenome>[] villageBees;
/**
* Access to Forestry's breeding manager for breeding information.
*/
public static IBreedingManager breedingManager;
/**
* List of items that can induce swarming. Integer denotes x in 1000 chance.
*/
public static HashMap<ItemStack, Integer> inducers = new HashMap<ItemStack, Integer>();
}

View file

@ -0,0 +1,6 @@
package forestry.api.apiculture;
public enum EnumBeeChromosome {
SPECIES, SPEED, LIFESPAN, FERTILITY, TEMPERATURE_TOLERANCE, NOCTURNAL, @Deprecated
HUMIDITY, HUMIDITY_TOLERANCE, TOLERANT_FLYER, CAVE_DWELLING, FLOWER_PROVIDER, FLOWERING, TERRITORY, EFFECT
}

View file

@ -0,0 +1,17 @@
package forestry.api.apiculture;
import java.util.Locale;
public enum EnumBeeType {
NONE, PRINCESS, QUEEN, DRONE;
String name;
private EnumBeeType() {
this.name = "bees." + this.toString().toLowerCase(Locale.ENGLISH);
}
public String getName() {
return name;
}
}

View file

@ -0,0 +1,12 @@
package forestry.api.apiculture;
import java.util.ArrayList;
import net.minecraft.item.ItemStack;
public class FlowerManager {
/**
* ItemStacks representing simple flower blocks. Meta-sensitive, processed by the basic {@link IFlowerProvider}.
*/
public static ArrayList<ItemStack> plainFlowers = new ArrayList<ItemStack>();
}

View file

@ -0,0 +1,47 @@
package forestry.api.apiculture;
import forestry.api.genetics.IAlleleEffect;
import forestry.api.genetics.IEffectData;
public interface IAlleleBeeEffect extends IAlleleEffect {
/**
* Called by apiaries to cause an effect in the world.
*
* @param genome
* Genome of the bee queen causing this effect
* @param storedData
* Object containing the stored effect data for the apiary/hive the bee is in.
* @param world
* @param biomeid
* @param x
* @param y
* @param z
* @return storedData, may have been manipulated.
*/
IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing);
/**
* Is called to produce bee effects.
*
* @param genome
* @param storedData
* Object containing the stored effect data for the apiary/hive the bee is in.
* @param world
* @param biomeid
* @param x
* @param y
* @param z
* @return storedData, may have been manipulated.
*/
IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing);
/**
* @return A texture file containing an icon representing the effect
*/
String getIconTextureFile();
/**
* @return Icon index of the effect's icon, return -1 if there isn't one
*/
int getIconIndex();
}

View file

@ -0,0 +1,26 @@
package forestry.api.apiculture;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.genetics.IAlleleSpecies;
public interface IAlleleBeeSpecies extends IAlleleSpecies {
// / Products, Chance
HashMap<ItemStack, Integer> getProducts();
// / Specialty, Chance
HashMap<ItemStack, Integer> getSpecialty();
// / Only jubilant bees give their specialty product
boolean isJubilant(IBeeGenome genome, IBeeHousing housing);
int getIconColour(int renderPass);
@SideOnly(Side.CLIENT)
Icon getIcon(EnumBeeType type, int renderPass);
}

View file

@ -0,0 +1,12 @@
package forestry.api.apiculture;
import forestry.api.genetics.IAllele;
public interface IAlleleFlowers extends IAllele {
/**
* @return FlowerProvider
*/
IFlowerProvider getProvider();
}

View file

@ -0,0 +1,27 @@
package forestry.api.apiculture;
import forestry.api.core.ITileStructure;
/**
* Needs to be implemented by TileEntities that want to be part of an alveary.
*/
public interface IAlvearyComponent extends ITileStructure {
void registerBeeModifier(IBeeModifier modifier);
void removeBeeModifier(IBeeModifier modifier);
void registerBeeListener(IBeeListener event);
void removeBeeListener(IBeeListener event);
void addTemperatureChange(float change, float boundaryDown, float boundaryUp);
void addHumidityChange(float change, float boundaryDown, float boundaryUp);
/**
* @return true if this TE has a function other than a plain alveary block. Returning true prevents the TE from becoming master.
*/
boolean hasFunction();
}

View file

@ -0,0 +1,52 @@
package forestry.api.apiculture;
import forestry.api.genetics.IBreedingTracker;
import forestry.api.genetics.IIndividual;
/**
* Can be used to garner information on bee breeding. See {@link IBreedingManager}
*
* @author SirSengir
*/
public interface IApiaristTracker extends IBreedingTracker {
/**
* Register the birth of a queen. Will mark species as discovered.
*
* @param bee
* Created queen.
*/
void registerQueen(IIndividual queen);
/**
* @return Amount of queens bred with this tracker.
*/
int getQueenCount();
/**
* Register the birth of a princess. Will mark species as discovered.
*
* @param bee
* Created princess.
*/
void registerPrincess(IIndividual princess);
/**
* @return Amount of princesses bred with this tracker.
*/
int getPrincessCount();
/**
* Register the birth of a drone. Will mark species as discovered.
*
* @param bee
* Created drone.
*/
void registerDrone(IIndividual drone);
/**
* @return Amount of drones bred with this tracker.
*/
int getDroneCount();
}

View file

@ -0,0 +1,24 @@
package forestry.api.apiculture;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* When implemented by armor piece items, allows them to act as apiarist's armor.
*/
public interface IArmorApiarist {
/**
* Called when the apiarist's armor acts as protection against an attack.
*
* @param player
* Player being attacked
* @param armor
* Armor item
* @param cause
* Optional cause of attack, such as a bee effect identifier
* @param doProtect
* Whether or not to actually do the side effects of protection
* @return Whether or not the armor should protect the player from that attack
*/
public boolean protectPlayer(EntityPlayer player, ItemStack armor, String cause, boolean doProtect);
}

View file

@ -0,0 +1,93 @@
package forestry.api.apiculture;
import java.util.ArrayList;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import forestry.api.genetics.IEffectData;
import forestry.api.genetics.IIndividual;
/**
* Other implementations than Forestry's default one are not supported.
*
* @author SirSengir
*/
public interface IBee extends IIndividual {
/**
* @return true if the individual is originally of natural origin.
*/
boolean isNatural();
/**
* @return generation this individual is removed from the original individual.
*/
int getGeneration();
IBee setNatural(boolean flag);
boolean isIrregularMating();
void age(World world, float ageModifier);
void mate(IBee drone);
void setIsNatural(boolean flag);
IEffectData[] doEffect(IEffectData[] storedData, IBeeHousing housing);
IEffectData[] doFX(IEffectData[] storedData, IBeeHousing housing);
boolean isAlive();
boolean isPureBred(EnumBeeChromosome chromosome);
/**
* @return true if the bee may spawn offspring
*/
boolean canSpawn();
/**
* Determines whether the queen can work.
*
* @param world
* @param isAlveary
* @param biomeid
* @param temperature
* @param humidity
* @param x
* @param y
* @param z
* @return Ordinal of the error code encountered. 0 - EnumErrorCode.OK
*/
int isWorking(IBeeHousing housing);
boolean hasFlower(IBeeHousing housing);
ArrayList<Integer> getSuitableBiomeIds();
ItemStack[] getProduceList();
ItemStack[] getSpecialtyList();
ItemStack[] produceStacks(IBeeHousing housing);
IBee spawnPrincess(IBeeHousing housing);
IBee[] spawnDrones(IBeeHousing housing);
void plantFlowerRandom(IBeeHousing housing);
int getHealth();
int getMaxHealth();
IBeeGenome getGenome();
IBeeGenome getMate();
IIndividual retrievePollen(IBeeHousing housing);
boolean pollinateRandom(IBeeHousing housing, IIndividual pollen);
}

View file

@ -0,0 +1,42 @@
package forestry.api.apiculture;
import forestry.api.genetics.EnumTolerance;
import forestry.api.genetics.IGenome;
/**
* Only the default implementation is supported.
*
* @author SirSengir
*
*/
public interface IBeeGenome extends IGenome {
IAlleleBeeSpecies getPrimaryAsBee();
IAlleleBeeSpecies getSecondaryAsBee();
float getSpeed();
int getLifespan();
int getFertility();
boolean getNocturnal();
boolean getTolerantFlyer();
boolean getCaveDwelling();
IFlowerProvider getFlowerProvider();
int getFlowering();
int[] getTerritory();
IAlleleBeeEffect getEffect();
EnumTolerance getToleranceTemp();
EnumTolerance getToleranceHumid();
}

View file

@ -0,0 +1,56 @@
package forestry.api.apiculture;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
public interface IBeeHousing extends IBeeModifier, IBeeListener {
int getXCoord();
int getYCoord();
int getZCoord();
ItemStack getQueen();
ItemStack getDrone();
void setQueen(ItemStack itemstack);
void setDrone(ItemStack itemstack);
int getBiomeId();
EnumTemperature getTemperature();
EnumHumidity getHumidity();
World getWorld();
/**
* @return String containing the login of this housing's owner.
*/
String getOwnerName();
void setErrorState(int state);
int getErrorOrdinal();
/**
* @return true if princesses and drones can (currently) mate in this housing to generate queens.
*/
boolean canBreed();
/**
* Called by IBeekeepingLogic to add products to the housing's inventory.
*
* @param product
* ItemStack with the product to add.
* @param all
* @return Boolean indicating success or failure.
*/
boolean addProduct(ItemStack product, boolean all);
}

View file

@ -0,0 +1,69 @@
package forestry.api.apiculture;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosome;
public interface IBeeInterface {
/**
* @return type of bee encoded on the itemstack. EnumBeeType.NONE if it isn't a bee.
*/
EnumBeeType getType(ItemStack stack);
/**
* @return true if passed item is a Forestry bee. Equal to getType(ItemStack stack) != EnumBeeType.NONE
*/
boolean isBee(ItemStack stack);
/**
* @return true if passed item is a drone. Equal to getType(ItemStack stack) == EnumBeeType.DRONE
*/
boolean isDrone(ItemStack stack);
/**
* @return true if passed item is mated (i.e. a queen)
*/
boolean isMated(ItemStack stack);
/**
* @return {@link IBee} pattern parsed from the passed stack's nbt data.
*/
IBee getBee(ItemStack stack);
/**
* @param genome
* Valid {@link IBeeGenome}
* @return {@link IBee} from the passed genome
*/
IBee getBee(World world, IBeeGenome genome);
/**
* Creates an IBee suitable for a queen containing the necessary second genome for the mate.
*
* @param genome
* Valid {@link IBeeGenome}
* @param mate
* Valid {@link IBee} representing the mate.
* @return Mated {@link IBee} from the passed genomes.
*/
IBee getBee(World world, IBeeGenome genome, IBee mate);
/**
* @param bee
* Bee object to use in creating the itemstack. If a queen is to be created, make sure the mate genome is set.
* @param type
* {@link EnumBeeType} according to whether a princess, drone or queen is wanted.
* @return ItemStack representing a Forestry bee.
*/
ItemStack getBeeStack(IBee bee, EnumBeeType type);
IChromosome[] templateAsChromosomes(IAllele[] template);
IChromosome[] templateAsChromosomes(IAllele[] templateActive, IAllele[] templateInactive);
IBeeGenome templateAsGenome(IAllele[] template);
IBeeGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
}

View file

@ -0,0 +1,36 @@
package forestry.api.apiculture;
import net.minecraft.item.ItemStack;
public interface IBeeListener {
/**
* Called on queen update.
*
* @param queen
*/
void onQueenChange(ItemStack queen);
/**
* Called when the bees wear out the housing's equipment.
*
* @param amount
* Integer indicating the amount worn out.
*/
void wearOutEquipment(int amount);
/**
* Called just before the children are generated, and the queen removed.
*
* @param queen
*/
void onQueenDeath(IBee queen);
/**
* Called after the children have been spawned, but before the queen appears
*
* @param queen
*/
void onPostQueenDeath(IBee queen);
}

View file

@ -0,0 +1,60 @@
package forestry.api.apiculture;
public interface IBeeModifier {
/**
*
* @param genome
* @return Float used to modify the base territory.
*/
float getTerritoryModifier(IBeeGenome genome, float currentModifier);
/**
* @param genome
* @param mate
* @return Float used to modify the base mutation chance.
*/
float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier);
/**
* @param genome
* @param mate
* @return Float used to modify the life span of queens.
*/
float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier);
/**
* @param genome
* @param mate
* @return Fload modifying the production speed of queens.
*/
float getProductionModifier(IBeeGenome genome, float currentModifier);
/**
* @param genome
* @param mate
* @return Fload modifying the flowering of queens.
*/
float getFloweringModifier(IBeeGenome genome, float currentModifier);
/**
* @return Boolean indicating if housing can ignore rain
*/
boolean isSealed();
/**
* @return Boolean indicating if housing can ignore darkness/night
*/
boolean isSelfLighted();
/**
* @return Boolean indicating if housing can ignore not seeing the sky
*/
boolean isSunlightSimulated();
/**
* @return Boolean indicating whether this housing simulates the nether
*/
boolean isHellish();
}

View file

@ -0,0 +1,9 @@
package forestry.api.apiculture;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutation;
public interface IBeeMutation extends IMutation {
int getChance(IBeeHousing housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
}

View file

@ -0,0 +1,20 @@
package forestry.api.apiculture;
import forestry.api.core.INBTTagable;
import forestry.api.genetics.IEffectData;
public interface IBeekeepingLogic extends INBTTagable {
// / STATE INFORMATION
int getBreedingTime();
int getTotalBreedingTime();
IBee getQueen();
IEffectData[] getEffectData();
// / UPDATING
void update();
}

View file

@ -0,0 +1,48 @@
package forestry.api.apiculture;
import java.util.ArrayList;
import net.minecraft.world.World;
public interface IBeekeepingMode extends IBeeModifier {
/**
* @return Localized name of this beekeeping mode.
*/
String getName();
/**
* @return Localized list of strings outlining the behaviour of this beekeeping mode.
*/
ArrayList<String> getDescription();
/**
* @return Float used to modify the wear on comb frames.
*/
float getWearModifier();
/**
* @param queen
* @return fertility taking into account the birthing queen and surroundings.
*/
int getFinalFertility(IBee queen, World world, int x, int y, int z);
/**
* @param queen
* @return true if the queen is genetically "fatigued" and should not be reproduced anymore.
*/
boolean isFatigued(IBee queen);
/**
* @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
*/
boolean mayMultiplyPrincess(IBee queen);
}

View file

@ -0,0 +1,103 @@
package forestry.api.apiculture;
import java.util.ArrayList;
import java.util.Collection;
import net.minecraft.world.World;
import forestry.api.core.IStructureLogic;
import forestry.api.genetics.IAllele;
public interface IBreedingManager {
ArrayList<IBeekeepingMode> getBeekeepingModes();
IBeekeepingMode getBeekeepingMode(World world);
IBeekeepingMode getBeekeepingMode(String name);
void registerBeekeepingMode(IBeekeepingMode mode);
void setBeekeepingMode(World world, String name);
/**
* @return Integer denoting the number of (counted) bee species in the world.
*/
int getBeeSpeciesCount();
/**
* Moved to IAlleleRegistry
*/
@Deprecated
void blacklistBeeSpecies(String uid);
/**
* Moved to IAlleleRegistry
*/
@Deprecated
ArrayList<String> getBeeSpeciesBlacklist();
/**
* Moved to IAlleleRegistry
*/
@Deprecated
boolean isBlacklisted(String uid);
/**
* @param housing
* Object implementing IBeeHousing.
* @return IBeekeepingLogic
*/
IBeekeepingLogic createBeekeepingLogic(IBeeHousing housing);
/**
* TileEntities wanting to function as alveary components need to implement structure logic for validation.
*
* @return IStructureLogic for alvearies.
*/
IStructureLogic createAlvearyStructureLogic(IAlvearyComponent structure);
/**
* Registers a bee template using the UID of the first allele as identifier.
*
* @param template
*/
void registerBeeTemplate(IAllele[] template);
/**
* Registers a bee template using the passed identifier.
*
* @param template
*/
void registerBeeTemplate(String identifier, IAllele[] template);
/**
* Retrieves a registered template using the passed identifier.
*
* @param identifier
* @return
*/
IAllele[] getBeeTemplate(String identifier);
/**
* @return Default bee template for use in emergencies.
*/
IAllele[] getDefaultBeeTemplate();
/**
* @param world
* @return {@link IApiaristTracker} associated with the passed world.
*/
IApiaristTracker getApiaristTracker(World world, String player);
/**
* Use to register bee mutations.
*
* @param mutation
*/
void registerBeeMutation(IBeeMutation mutation);
/**
* @return All registered mutations.
*/
Collection<IBeeMutation> getMutations(boolean shuffle);
}

View file

@ -0,0 +1,44 @@
package forestry.api.apiculture;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import forestry.api.genetics.IPollinatable;
public interface IFlowerProvider {
/**
* @param world
* @param species
* Integer representing a species' ordinal matching {@EnumBeeBreed}
* @param x
* @param y
* @param z
* @return True if the block at the passed coordinates is a valid flower for the species.
*/
boolean isAcceptedFlower(World world, IBeeGenome genome, int x, int y, int z);
boolean isAcceptedPollinatable(World world, IPollinatable pollinatable);
/**
* @param world
* @param species
* Integer representing a species' ordinal matching {@EnumBeeBreed}
* @param x
* @param y
* @param z
* @return True if a flower was planted.
*/
boolean growFlower(World world, IBeeGenome genome, int x, int y, int z);
/**
* @return Short, human-readable identifier used in the beealyzer.
*/
String getDescription();
ItemStack[] affectProducts(World world, IBeeGenome genome, int x, int y, int z, ItemStack[] products);
/**
* @return Array of itemstacks representing valid flowers for the flower provider. The first in the array is for use as an icon Return null or an empty
* array if the flower does not have an itemstack
*/
ItemStack[] getItemStacks();
}

View file

@ -0,0 +1,33 @@
package forestry.api.apiculture;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* Bees can be seeded either as hive drops or as mutation results.
*
* Add IHiveDrops to BeeManager.hiveDrops
*
* @author SirSengir
*/
public interface IHiveDrop {
ItemStack getPrincess(World world, int x, int y, int z, int fortune);
Collection<ItemStack> getDrones(World world, int x, int y, int z, int fortune);
Collection<ItemStack> getAdditional(World world, int x, int y, int z, int fortune);
/**
* Chance to drop. Default drops have 80 (= 80 %).
*
* @param world
* @param x
* @param y
* @param z
* @return
*/
int getChance(World world, int x, int y, int z);
}

View file

@ -0,0 +1,22 @@
package forestry.api.apiculture;
import net.minecraft.item.ItemStack;
public interface IHiveFrame extends IBeeModifier {
/**
* Wears out a frame.
*
* @param housing
* IBeeHousing the frame is contained in.
* @param frame
* ItemStack containing the actual frame.
* @param queen
* Current queen in the caller.
* @param wear
* Integer denoting the amount worn out. {@link IBeekeepingMode.getWearModifier()} has already been taken into account.
* @return ItemStack containing the actual frame with adjusted damage.
*/
ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear);
}

View file

@ -0,0 +1,16 @@
package forestry.api.arboriculture;
public enum EnumGermlingType {
SAPLING("Sapling"), BLOSSOM("Blossom"), POLLEN("Pollen"), GERMLING("Germling");
String name;
private EnumGermlingType(String name) {
this.name = name;
}
public String getName() {
return name;
}
}

View file

@ -0,0 +1,5 @@
package forestry.api.arboriculture;
public enum EnumGrowthConditions {
HOSTILE, PALTRY, NORMAL, GOOD, EXCELLENT
}

View file

@ -0,0 +1,56 @@
package forestry.api.arboriculture;
import net.minecraftforge.common.EnumPlantType;
import forestry.api.genetics.IFruitFamily;
public enum EnumTreeChromosome {
/**
* Determines the following: - WorldGen, including the used wood blocks - {@link IFruitFamily}s supported. Limits which {@IFruitProvider}
* will actually yield fruit with this species. - Native {@link EnumPlantType} for this tree. Combines with the PLANT chromosome.
*/
SPECIES,
/**
* {@link IGrowthProvider}, determines conditions required by the tree to grow.
*/
GROWTH,
/**
* A float modifying the height of the tree. Taken into account at worldgen.
*/
HEIGHT,
/**
* Chance for saplings.
*/
FERTILITY,
/**
* {@link IFruitProvider}, determines if and what fruits are grown on the tree. Limited by the {@link IFruitFamily}s the species supports.
*/
FRUITS,
/**
* Chance for fruit leaves and/or drops.
*/
YIELD,
/**
* May add additional tolerances for {@link EnumPlantTypes}.
*/
PLANT,
/**
* Determines the speed at which fruit will ripen on this tree.
*/
SAPPINESS,
/**
* Territory for leaf effects. Unused.
*/
TERRITORY,
/**
* Leaf effect. Unused.
*/
EFFECT,
/**
* Amount of random ticks that need to elapse before a sapling will grow into a tree.
*/
MATURATION,
GIRTH
}

View file

@ -0,0 +1,12 @@
package forestry.api.arboriculture;
import forestry.api.genetics.IAllele;
/**
* Simple allele encapsulating an {@link IFruitProvider}.
*/
public interface IAlleleFruit extends IAllele {
IFruitProvider getProvider();
}

View file

@ -0,0 +1,12 @@
package forestry.api.arboriculture;
import forestry.api.genetics.IAllele;
/**
* Simple allele encapsulating an {@link IGrowthProvider}.
*/
public interface IAlleleGrowth extends IAllele {
IGrowthProvider getProvider();
}

View file

@ -0,0 +1,10 @@
package forestry.api.arboriculture;
import forestry.api.genetics.IAlleleEffect;
/**
* Simple allele encapsulating a leaf effect. (Not implemented)
*/
public interface IAlleleLeafEffect extends IAlleleEffect {
}

View file

@ -0,0 +1,57 @@
package forestry.api.arboriculture;
import java.util.Collection;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.common.EnumPlantType;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IFruitFamily;
public interface IAlleleTreeSpecies extends IAlleleSpecies {
/**
* @return Native plant type of this species.
*/
EnumPlantType getPlantType();
/**
* @return List of all {@link IFruitFamily}s which can grow on leaves generated by this species.
*/
Collection<IFruitFamily> getSuitableFruit();
/**
* @return Trunk girth. 1 = 1x1, 2 = 2x2, etc.
*/
@Deprecated
int getGirth();
/**
* @param tree
* @param world
* @param x
* @param y
* @param z
* @return Tree generator for the tree at the given location.
*/
WorldGenerator getGenerator(ITree tree, World world, int x, int y, int z);
/**
* @return All available generator classes for this species.
*/
Class<? extends WorldGenerator>[] getGeneratorClasses();
/* TEXTURES AND OVERRIDES */
int getLeafColour(ITree tree);
short getLeafIconIndex(ITree tree, boolean fancy);
int getGermlingIconColour(int renderPass);
@SideOnly(Side.CLIENT)
Icon getGermlingIcon(EnumGermlingType type, int renderPass);
}

View file

@ -0,0 +1,7 @@
package forestry.api.arboriculture;
import forestry.api.genetics.IBreedingTracker;
public interface IArboristTracker extends IBreedingTracker {
}

View file

@ -0,0 +1,63 @@
package forestry.api.arboriculture;
import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import forestry.api.genetics.IFruitFamily;
public interface IFruitProvider {
IFruitFamily getFamily();
int getColour(ITreeGenome genome, IBlockAccess world, int x, int y, int z, int ripeningTime);
boolean markAsFruitLeaf(ITreeGenome genome, World world, int x, int y, int z);
int getRipeningPeriod();
// / Products, Chance
ItemStack[] getProducts();
// / Specialty, Chance
ItemStack[] getSpecialty();
ItemStack[] getFruits(ITreeGenome genome, World world, int x, int y, int z, int ripeningTime);
/**
* @return Short, human-readable identifier used in the treealyzer.
*/
String getDescription();
/* TEXTURE OVERLAY */
/**
* @param genome
* @param world
* @param x
* @param y
* @param z
* @param ripeningTime
* Elapsed ripening time for the fruit.
* @param fancy
* @return Icon index of the texture to overlay on the leaf block.
*/
short getIconIndex(ITreeGenome genome, IBlockAccess world, int x, int y, int z, int ripeningTime, boolean fancy);
/**
* @return true if this fruit provider requires fruit blocks to spawn, false otherwise.
*/
boolean requiresFruitBlocks();
/**
* Tries to spawn a fruit block at the potential position when the tree generates.
*
* @param genome
* @param world
* @param x
* @param y
* @param z
* @return true if a fruit block was spawned, false otherwise.
*/
boolean trySpawnFruitBlock(ITreeGenome genome, World world, int x, int y, int z);
void registerIcons();
}

View file

@ -0,0 +1,33 @@
package forestry.api.arboriculture;
import net.minecraft.world.World;
public interface IGrowthProvider {
/**
* Check to see whether a sapling at the given location with the given genome can grow into a tree.
*
* @param genome
* @param world
* @param xPos
* @param yPos
* @param zPos
* @param expectedGirth
* @param expectedHeight
* @return
*/
boolean canGrow(ITreeGenome genome, World world, int xPos, int yPos, int zPos, int expectedGirth, int expectedHeight);
EnumGrowthConditions getGrowthConditions(ITreeGenome genome, World world, int xPos, int yPos, int zPos);
/**
* @return Short, human-readable identifier used in the treealyzer.
*/
String getDescription();
/**
* @return Detailed description of growth behaviour used in the treealyzer.
*/
String[] getInfo();
}

View file

@ -0,0 +1,18 @@
package forestry.api.arboriculture;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public interface IToolGrafter {
/**
* Called by leaves to determine the increase in sapling droprate.
*
* @param stack
* @param world
* @param x
* @param y
* @param z
* @return
*/
float getSaplingModifier(ItemStack stack, World world, int x, int y, int z);
}

View file

@ -0,0 +1,78 @@
package forestry.api.arboriculture;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.common.EnumPlantType;
import forestry.api.genetics.IEffectData;
import forestry.api.genetics.IIndividual;
public interface ITree extends IIndividual {
void mate(ITree other);
IEffectData[] doEffect(IEffectData[] storedData, World world, int biomeid, int x, int y, int z);
IEffectData[] doFX(IEffectData[] storedData, World world, int biomeid, int x, int y, int z);
ITreeGenome getGenome();
ITreeGenome getMate();
EnumSet<EnumPlantType> getPlantTypes();
ITree[] getSaplings(World world, int x, int y, int z, float modifier);
ItemStack[] getProduceList();
ItemStack[] getSpecialtyList();
ItemStack[] produceStacks(World world, int x, int y, int z, int ripeningTime);
/**
*
* @param world
* @param x
* @param y
* @param z
* @return Boolean indicating whether a sapling can stay planted at the given position.
*/
boolean canStay(World world, int x, int y, int z);
/**
*
* @param world
* @param x
* @param y
* @param z
* @return Boolean indicating whether a sapling at the given position can grow into a tree.
*/
boolean canGrow(World world, int x, int y, int z, int expectedGirth, int expectedHeight);
/**
* @return Integer denoting the maturity (block ticks) required for a sapling to attempt to grow into a tree.
*/
int getRequiredMaturity();
int getGirth(World world, int x, int y, int z);
/**
*
* @param world
* @param x
* @param y
* @param z
* @return Growth conditions at the given position.
*/
EnumGrowthConditions getGrowthCondition(World world, int x, int y, int z);
WorldGenerator getTreeGenerator(World world, int x, int y, int z, boolean wasBonemealed);
ITree copy();
boolean isPureBred(EnumTreeChromosome chromosome);
boolean canBearFruit();
}

View file

@ -0,0 +1,37 @@
package forestry.api.arboriculture;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.world.World;
import forestry.api.genetics.IAllele;
public interface ITreeBreedingManager {
void registerTreeTemplate(IAllele[] template);
void registerTreeTemplate(String identifier, IAllele[] template);
IAllele[] getTreeTemplate(String identifier);
IAllele[] getDefaultTreeTemplate();
/**
* @param world
* @return {@link IArboristTracker} associated with the passed world.
*/
IArboristTracker getArboristTracker(World world, String player);
ArrayList<ITreekeepingMode> getTreekeepingModes();
ITreekeepingMode getTreekeepingMode(World world);
ITreekeepingMode getTreekeepingMode(String name);
void registerTreekeepingMode(ITreekeepingMode mode);
void setTreekeepingMode(World world, String name);
IAllele[] getRandomTreeTemplate(Random rand);
}

View file

@ -0,0 +1,38 @@
package forestry.api.arboriculture;
import java.util.EnumSet;
import net.minecraftforge.common.EnumPlantType;
import forestry.api.genetics.IGenome;
public interface ITreeGenome extends IGenome {
IAlleleTreeSpecies getPrimaryAsTree();
IAlleleTreeSpecies getSecondaryAsTree();
IFruitProvider getFruitProvider();
IGrowthProvider getGrowthProvider();
float getHeight();
float getFertility();
/**
* @return Determines either a) how many fruit leaves there are or b) the chance for any fruit leave to drop a sapling. Exact usage determined by the
* IFruitProvider
*/
float getYield();
float getSappiness();
EnumSet<EnumPlantType> getPlantTypes();
/**
* @return Amount of random block ticks required for a sapling to mature into a fully grown tree.
*/
int getMaturationTime();
int getGirth();
}

View file

@ -0,0 +1,38 @@
package forestry.api.arboriculture;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosome;
import forestry.api.genetics.IIndividual;
public interface ITreeInterface {
boolean isGermling(ItemStack itemstack);
boolean isPollen(ItemStack itemstack);
boolean isPollinated(ItemStack itemstack);
ITree getTree(World world, int x, int y, int z);
ITree getTree(ItemStack itemstack);
ITree getTree(World world, ITreeGenome genome);
ItemStack getGermlingStack(ITree tree, EnumGermlingType type);
boolean plantSapling(World world, ITree tree, String owner, int x, int y, int z);
boolean setLeaves(World world, IIndividual tree, String owner, int x, int y, int z);
IChromosome[] templateAsChromosomes(IAllele[] template);
IChromosome[] templateAsChromosomes(IAllele[] templateActive, IAllele[] templateInactive);
ITreeGenome templateAsGenome(IAllele[] template);
ITreeGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
boolean setFruitBlock(World world, IAlleleFruit allele, float sappiness, short[] indices, int x, int y, int z);
}

View file

@ -0,0 +1,40 @@
package forestry.api.arboriculture;
public interface ITreeModifier {
/**
*
* @param genome
* @return Float used to modify the height.
*/
float getHeightModifier(ITreeGenome genome, float currentModifier);
/**
*
* @param genome
* @return Float used to modify the yield.
*/
float getYieldModifier(ITreeGenome genome, float currentModifier);
/**
*
* @param genome
* @return Float used to modify the sappiness.
*/
float getSappinessModifier(ITreeGenome genome, float currentModifier);
/**
*
* @param genome
* @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);
}

View file

@ -0,0 +1,10 @@
package forestry.api.arboriculture;
import net.minecraft.world.World;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutation;
public interface ITreeMutation extends IMutation {
int getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
}

View file

@ -0,0 +1,17 @@
package forestry.api.arboriculture;
import java.util.ArrayList;
public interface ITreekeepingMode extends ITreeModifier {
/**
* @return Localized name of this treekeeping mode.
*/
String getName();
/**
* @return Localized list of strings outlining the behaviour of this treekeeping mode.
*/
ArrayList<String> getDescription();
}

View file

@ -0,0 +1,15 @@
package forestry.api.arboriculture;
import java.util.ArrayList;
public class TreeManager {
public static int treeSpeciesCount = 0;
public static ITreeInterface treeInterface;
public static ITreeBreedingManager breedingManager;
/**
* List of possible mutations on fruit alleles.
*/
public static ArrayList<ITreeMutation> treeMutations = new ArrayList<ITreeMutation>();
}

View file

@ -0,0 +1,8 @@
package forestry.api.circuits;
public class ChipsetManager {
public static ISolderManager solderManager;
public static ICircuitRegistry circuitRegistry;
}

View file

@ -0,0 +1,27 @@
package forestry.api.circuits;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
public interface ICircuit {
String getUID();
boolean requiresDiscovery();
int getLimit();
String getName();
boolean isCircuitable(TileEntity tile);
void onInsertion(int slot, TileEntity tile);
void onLoad(int slot, TileEntity tile);
void onRemoval(int slot, TileEntity tile);
void onTick(int slot, TileEntity tile);
void addTooltip(List<String> list);
}

View file

@ -0,0 +1,24 @@
package forestry.api.circuits;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
import forestry.api.core.INBTTagable;
public interface ICircuitBoard extends INBTTagable {
int getPrimaryColor();
int getSecondaryColor();
void addTooltip(List<String> list);
void onInsertion(TileEntity tile);
void onLoad(TileEntity tile);
void onRemoval(TileEntity tile);
void onTick(TileEntity tile);
}

View file

@ -0,0 +1,11 @@
package forestry.api.circuits;
public interface ICircuitLayout {
String getUID();
String getName();
String getUsage();
}

View file

@ -0,0 +1,5 @@
package forestry.api.circuits;
public interface ICircuitLibrary {
}

View file

@ -0,0 +1,31 @@
package forestry.api.circuits;
import java.util.HashMap;
import net.minecraft.world.World;
public interface ICircuitRegistry {
/* CIRCUITS */
HashMap<String, ICircuit> getRegisteredCircuits();
void registerCircuit(ICircuit circuit);
ICircuit getCircuit(String uid);
ICircuitLibrary getCircuitLibrary(World world, String playername);
void registerLegacyMapping(int id, String uid);
ICircuit getFromLegacyMap(int id);
/* LAYOUTS */
HashMap<String, ICircuitLayout> getRegisteredLayouts();
void registerLayout(ICircuitLayout layout);
ICircuitLayout getLayout(String uid);
ICircuitLayout getDefaultLayout();
}

View file

@ -0,0 +1,9 @@
package forestry.api.circuits;
import net.minecraft.item.ItemStack;
public interface ISolderManager {
void addRecipe(ICircuitLayout layout, ItemStack resource, ICircuit circuit);
}

View file

@ -0,0 +1,33 @@
package forestry.api.core;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.FMLLog;
public class BlockInterface {
/**
* Get yer blocks here!
*
* @param ident
* @return
*/
public static ItemStack getBlock(String ident) {
ItemStack item = null;
try {
String pack = ItemInterface.class.getPackage().getName();
pack = pack.substring(0, pack.lastIndexOf('.'));
String itemClass = pack.substring(0, pack.lastIndexOf('.')) + ".core.config.ForestryBlock";
Object obj = Class.forName(itemClass).getField(ident).get(null);
if (obj instanceof Block)
item = new ItemStack((Block) obj);
else if (obj instanceof ItemStack)
item = (ItemStack) obj;
} catch (Exception ex) {
FMLLog.warning("Could not retrieve Forestry block identified by: " + ident);
}
return item;
}
}

View file

@ -0,0 +1,48 @@
package forestry.api.core;
import java.util.ArrayList;
public enum EnumHumidity {
ARID("Arid", 2), NORMAL("Normal", 1), DAMP("Damp", 4);
/**
* Populated by Forestry with vanilla biomes. Add additional arid biomes here. (ex. desert)
*/
public static ArrayList<Integer> aridBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional damp biomes here. (ex. jungle)
*/
public static ArrayList<Integer> dampBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional normal biomes here.
*/
public static ArrayList<Integer> normalBiomeIds = new ArrayList<Integer>();
public final String name;
public final int iconIndex;
private EnumHumidity(String name, int iconIndex) {
this.name = name;
this.iconIndex = iconIndex;
}
public String getName() {
return this.name;
}
public int getIconIndex() {
return this.iconIndex;
}
public static ArrayList<Integer> getBiomeIds(EnumHumidity humidity) {
switch (humidity) {
case ARID:
return aridBiomeIds;
case DAMP:
return dampBiomeIds;
case NORMAL:
default:
return normalBiomeIds;
}
}
}

View file

@ -0,0 +1,70 @@
package forestry.api.core;
import java.util.ArrayList;
import net.minecraft.util.Icon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public enum EnumTemperature {
NONE("None", "habitats/ocean"), ICY("Icy", "habitats/snow"), COLD("Cold", "habitats/taiga"),
NORMAL("Normal", "habitats/plains"), WARM("Warm", "habitats/jungle"), HOT("Hot", "habitats/desert"), HELLISH("Hellish", "habitats/nether");
/**
* Populated by Forestry with vanilla biomes. Add additional icy/snow biomes here. (ex. snow plains)
*/
public static ArrayList<Integer> icyBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional cold biomes here. (ex. taiga)
*/
public static ArrayList<Integer> coldBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional normal biomes here. (ex. forest, plains)
*/
public static ArrayList<Integer> normalBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional warm biomes here. (ex. jungle)
*/
public static ArrayList<Integer> warmBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional hot biomes here. (ex. desert)
*/
public static ArrayList<Integer> hotBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional hellish biomes here. (ex. nether)
*/
public static ArrayList<Integer> hellishBiomeIds = new ArrayList<Integer>();
public final String name;
public final String iconIndex;
private EnumTemperature(String name, String iconIndex) {
this.name = name;
this.iconIndex = iconIndex;
}
public String getName() {
return this.name;
}
public static ArrayList<Integer> getBiomeIds(EnumTemperature temperature) {
switch (temperature) {
case ICY:
return icyBiomeIds;
case COLD:
return coldBiomeIds;
case WARM:
return warmBiomeIds;
case HOT:
return hotBiomeIds;
case HELLISH:
return hellishBiomeIds;
case NORMAL:
default:
return normalBiomeIds;
}
}
}

View file

@ -0,0 +1,12 @@
package forestry.api.core;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ForestryAPI {
public static Object instance;
@SideOnly(Side.CLIENT)
public static ITextureManager textureManager;
}

View file

@ -0,0 +1,12 @@
package forestry.api.core;
import java.util.ArrayList;
public class GlobalManager {
public static ArrayList<Integer> dirtBlockIds = new ArrayList<Integer>();
public static ArrayList<Integer> sandBlockIds = new ArrayList<Integer>();
public static ArrayList<Integer> leafBlockIds = new ArrayList<Integer>();
public static ArrayList<Integer> snowBlockIds = new ArrayList<Integer>();
}

View file

@ -0,0 +1,18 @@
package forestry.api.core;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.util.Icon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public interface IIconProvider {
@SideOnly(Side.CLIENT)
Icon getIcon(short texUID);
@SideOnly(Side.CLIENT)
void registerItemIcons(IconRegister itemMap);
@SideOnly(Side.CLIENT)
void registerTerrainIcons(IconRegister terrainMap);
}

View file

@ -0,0 +1,9 @@
package forestry.api.core;
import net.minecraft.nbt.NBTTagCompound;
public interface INBTTagable {
void readFromNBT(NBTTagCompound nbttagcompound);
void writeToNBT(NBTTagCompound nbttagcompound);
}

View file

@ -0,0 +1,17 @@
package forestry.api.core;
/**
* Plugins get loaded at the beginning of Forestry's ModsLoaded() if isAvailable() returns true.
*
* @author SirSengir
*/
public interface IPlugin {
public boolean isAvailable();
public void preInit();
public void doInit();
public void postInit();
}

View file

@ -0,0 +1,15 @@
package forestry.api.core;
public interface IStructureLogic extends INBTTagable {
/**
* @return String unique to the type of structure controlled by this structure logic.
*/
String getTypeUID();
/**
* Called by {@link ITileStructure}'s validateStructure().
*/
void validateStructure();
}

View file

@ -0,0 +1,14 @@
package forestry.api.core;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.util.Icon;
@SideOnly(Side.CLIENT)
public interface ITextureManager {
void registerIconProvider(IIconProvider provider);
Icon getIcon(short texUID);
}

View file

@ -0,0 +1,55 @@
package forestry.api.core;
import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntity;
public interface ITileStructure {
/**
* @return String unique to the type of structure controlled by this structure logic. Should map to {@link IStructureLogic}
*/
String getTypeUID();
/**
* Should map to {@link IStructureLogic}
*/
void validateStructure();
/**
* Called when the structure resets.
*/
void onStructureReset();
/**
* @return TileEntity that is the master in this structure, null if no structure exists.
*/
ITileStructure getCentralTE();
/**
* Called to set the master TileEntity. Implementing TileEntity should keep track of the master's coordinates, not refer to the TE object itself.
*
* @param tile
*/
void setCentralTE(TileEntity tile);
/**
* @return IInventory representing the TE's inventory.
*/
IInventory getInventory();
/**
* Only called on Forestry's own blocks.
*/
void makeMaster();
/**
* @return true if this TE is the master in a structure, false otherwise.
*/
boolean isMaster();
/**
* @return true if the TE is master or has a master.
*/
boolean isIntegratedIntoStructure();
}

View file

@ -0,0 +1,117 @@
package forestry.api.core;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.FMLLog;
public class ItemInterface {
/**
* Get yer items here!
*
* Blocks currently not supported.
*
* @param ident
* @return
*/
public static ItemStack getItem(String ident) {
ItemStack item = null;
try {
String pack = ItemInterface.class.getPackage().getName();
pack = pack.substring(0, pack.lastIndexOf('.'));
String itemClass = pack.substring(0, pack.lastIndexOf('.')) + ".core.config.ForestryItem";
Object obj = Class.forName(itemClass).getField(ident).get(null);
if (obj instanceof Item)
item = new ItemStack((Item) obj);
else if (obj instanceof ItemStack)
item = (ItemStack) obj;
} catch (Exception ex) {
FMLLog.warning("Could not retrieve Forestry item identified by: " + ident);
}
return item;
}
/*
* public static Item fertilizerBio; public static Item fertilizerCompound; public static Item apatite;
*
* // Ingots public static ItemStack ingotCopper; public static ItemStack ingotTin; public static ItemStack ingotBronze;
*
* public static Item wrench; public static Item bucketBiomass; public static Item vialEmpty; public static Item vialCatalyst; public static Item
* liquidBiomass; public static Item liquidBiofuel; public static Item bucketBiofuel; public static Item liquidMilk;
*
* // Crafting public static Item sturdyMachine; public static Item hardenedMachine; public static Item craftingMaterial;
*
* // Rainmaker public static Item iodineCapsule;
*
* // Gears public static Item gearBronze; public static Item gearCopper; public static Item gearTin;
*
* // Carpenter public static Item oakStick; public static Item woodPulp; public static Item carton; public static Item crate;
*
* // Tools public static Item bronzePickaxe; public static Item brokenBronzePickaxe; public static Item kitPickaxe; public static Item bronzeShovel; public
* static Item brokenBronzeShovel; public static Item kitShovel;
*
* // Do not touch - contagious! public static Item tent;
*
* // Moistener public static Item mouldyWheat; public static Item decayingWheat; public static Item mulch;
*
* // Peat public static Item peat; public static Item bituminousPeat; public static Item ash;
*
* // Bees public static Item beeQueen; public static Item beeDrone; public static Item beePrincess; public static Item beeQueenGE; public static Item
* beeDroneGE; public static Item beePrincessGE;
*
* public static Item beealyzer;
*
* public static Item honeyDrop; public static Item scoop; public static Item beeswax; public static Item pollen; public static Item propolis; public static
* Item honeydew; public static Item royalJelly; public static Item honeyedSlice; public static Item shortMead; public static Item ambrosia; public static
* Item honeyPot; public static Item phosphor; public static Item refractoryWax;
*
* // Apiarist's Armor public static Item apiaristHat; public static Item apiaristChest; public static Item apiaristLegs; public static Item apiaristBoots;
*
* // Combs public static Item beeComb;
*
* public static Item honeyComb; public static Item cocoaComb; public static Item simmeringComb; public static Item stringyComb; public static Item
* frozenComb; public static Item drippingComb;
*
* // Backpacks public static Item apiaristBackpack; public static Item minerBackpack; public static Item diggerBackpack; public static Item
* foresterBackpack; public static Item hunterBackpack; public static Item masonBackpack; // unused/null public static Item dyerBackpack; // unused/null
* public static Item railroaderBackpack; // unused/null public static Item tinkererBackpack; // unused/null public static Item adventurerBackpack; // T2
* public static Item minerBackpackT2; public static Item diggerBackpackT2; public static Item foresterBackpackT2; public static Item hunterBackpackT2;
* public static Item masonBackpackT2; // unused/null public static Item dyerBackpackT2; // unused/null public static Item railroaderBackpackT2; //
* unused/null public static Item tinkererBackpackT2; // unused/null public static Item adventurerBackpackT2;
*
* // Liquids public static Item liquidSeedOil; public static Item liquidJuice; public static Item liquidHoney;
*
* // Capsules public static Item waxCapsule; public static Item waxCapsuleWater; public static Item waxCapsuleBiomass; public static Item
* waxCapsuleBiofuel; public static Item waxCapsuleOil; public static Item waxCapsuleFuel; public static Item waxCapsuleSeedOil; public static Item
* waxCapsuleHoney; public static Item waxCapsuleJuice;
*
* // Refractory Capsules public static Item refractoryEmpty; public static Item refractoryWater; public static Item refractoryBiomass; public static Item
* refractoryBiofuel; public static Item refractoryOil; public static Item refractoryFuel; public static Item refractoryLava; public static Item
* refractorySeedOil; public static Item refractoryHoney; public static Item refractoryJuice;
*
* // Cans public static Item canWater; public static Item canEmpty; public static Item canBiomass; public static Item canBiofuel; public static Item
* canOil; public static Item canFuel; public static Item canLava; public static Item canSeedOil; public static Item canHoney; public static Item canJuice;
*
* // Crating public static ItemGenericCrate cratedWood; public static ItemGenericCrate cratedCobblestone; public static ItemGenericCrate cratedDirt; public
* static ItemGenericCrate cratedStone; public static ItemGenericCrate cratedBrick; public static ItemGenericCrate cratedCacti; public static
* ItemGenericCrate cratedSand; public static ItemGenericCrate cratedObsidian; public static ItemGenericCrate cratedNetherrack; public static
* ItemGenericCrate cratedSoulsand; public static ItemGenericCrate cratedSandstone; public static ItemGenericCrate cratedBogearth; public static
* ItemGenericCrate cratedHumus; public static ItemGenericCrate cratedNetherbrick; public static ItemGenericCrate cratedPeat; public static ItemGenericCrate
* cratedApatite; public static ItemGenericCrate cratedFertilizer; public static ItemGenericCrate cratedTin; public static ItemGenericCrate cratedCopper;
* public static ItemGenericCrate cratedBronze; public static ItemGenericCrate cratedWheat; public static ItemGenericCrate cratedMycelium; public static
* ItemGenericCrate cratedMulch; public static ItemGenericCrate cratedSilver; public static ItemGenericCrate cratedBrass; public static ItemGenericCrate
* cratedNikolite; public static ItemGenericCrate cratedCookies; public static ItemGenericCrate cratedHoneycombs; public static ItemGenericCrate
* cratedBeeswax; public static ItemGenericCrate cratedPollen; public static ItemGenericCrate cratedPropolis; public static ItemGenericCrate cratedHoneydew;
* public static ItemGenericCrate cratedRoyalJelly; public static ItemGenericCrate cratedCocoaComb; public static ItemGenericCrate cratedRedstone; public
* static ItemGenericCrate cratedLapis; public static ItemGenericCrate cratedReeds; public static ItemGenericCrate cratedClay; public static
* ItemGenericCrate cratedGlowstone; public static ItemGenericCrate cratedApples; public static ItemGenericCrate cratedNetherwart; public static
* ItemGenericCrate cratedResin; public static ItemGenericCrate cratedRubber; public static ItemGenericCrate cratedScrap; public static ItemGenericCrate
* cratedUUM; public static ItemGenericCrate cratedSimmeringCombs; public static ItemGenericCrate cratedStringyCombs; public static ItemGenericCrate
* cratedFrozenCombs; public static ItemGenericCrate cratedDrippingCombs; public static ItemGenericCrate cratedRefractoryWax; public static ItemGenericCrate
* cratedPhosphor; public static ItemGenericCrate cratedAsh; public static ItemGenericCrate cratedCharcoal; public static ItemGenericCrate cratedGravel;
* public static ItemGenericCrate cratedCoal; public static ItemGenericCrate cratedSeeds; public static ItemGenericCrate cratedSaplings;
*/
}

View file

@ -0,0 +1,49 @@
package forestry.api.core;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Annotation to provide additional information on IPlugins. This information will be available via the "/forestry plugin info $pluginID" command ingame.
*
* @author SirSengir
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface PluginInfo {
/**
* @return Unique identifier for the plugin, no spaces!
*/
String pluginID();
/**
* @return Nice and readable plugin name.
*/
String name();
/**
* @return Plugin author's name.
*/
String author() default "";
/**
* @return URL of plugin homepage.
*/
String url() default "";
/**
* @return Version of the plugin, if any.
*/
String version() default "";
/**
* @return Short description what the plugin does.
*/
String description() default "";
/**
* @return Not used (yet?).
*/
String help() default "";
}

View file

@ -0,0 +1,10 @@
package forestry.api.core;
import net.minecraft.creativetab.CreativeTabs;
public class Tabs {
public static CreativeTabs tabApiculture;
public static CreativeTabs tabArboriculture;
}

View file

@ -0,0 +1,15 @@
package forestry.api.farming;
import java.util.Collection;
import java.util.HashMap;
public class Farmables {
/**
* Can be used to add IFarmables to some of the vanilla farm logics.
*
* Identifiers: farmArboreal farmWheat farmGourd farmInfernal farmPoales farmSucculentes farmVegetables farmShroom
*/
public static HashMap<String, Collection<IFarmable>> farmables = new HashMap<String, Collection<IFarmable>>();
public static IFarmInterface farmInterface;
}

View file

@ -0,0 +1,16 @@
package forestry.api.farming;
import java.util.Collection;
import net.minecraft.item.ItemStack;
public interface ICrop {
/**
* Harvests this crop. Performs the necessary manipulations to set the crop into a "harvested" state.
*
* @return Products harvested.
*/
Collection<ItemStack> harvest();
}

View file

@ -0,0 +1,12 @@
package forestry.api.farming;
import forestry.api.core.ITileStructure;
public interface IFarmComponent extends ITileStructure {
boolean hasFunction();
void registerListener(IFarmListener listener);
void removeListener(IFarmListener listener);
}

View file

@ -0,0 +1,68 @@
package forestry.api.farming;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.LiquidStack;
public interface IFarmHousing {
int[] getCoords();
int[] getArea();
int[] getOffset();
World getWorld();
/**
* Will run the work cycle on a master TE. Will do nothing on any other farm component.
*
* @return true if any work was done, false otherwise.
*/
boolean doWork();
boolean hasLiquid(LiquidStack liquid);
void removeLiquid(LiquidStack liquid);
boolean hasResources(ItemStack[] resources);
void removeResources(ItemStack[] resources);
/**
* Callback for {@link IFarmLogic}s to plant a sapling, seed, germling, stem. Will remove the appropriate germling from the farm's inventory. It's up to the
* logic to only call this on a valid location.
*
* @param farmable
* @param world
* @param x
* @param y
* @param z
* @return true if planting was successful, false otherwise.
*/
boolean plantGermling(IFarmable farmable, World world, int x, int y, int z);
/* INTERACTION WITH HATCHES */
boolean acceptsAsGermling(ItemStack itemstack);
boolean acceptsAsResource(ItemStack itemstack);
boolean acceptsAsFertilizer(ItemStack itemstack);
/* LOGIC */
/**
* Set a farm logic for the given direction. UP/DOWN/UNKNOWN are invalid!
*
* @param direction
* @param logic
*/
void setFarmLogic(ForgeDirection direction, IFarmLogic logic);
/**
* Reset the farm logic for the given direction to default. UP/DOWN/UNKNOWN are invalid!
*
* @param direction
*/
void resetFarmLogic(ForgeDirection direction);
}

View file

@ -0,0 +1,15 @@
package forestry.api.farming;
import forestry.api.core.IStructureLogic;
public interface IFarmInterface {
/**
* Creates {@link IStructureLogic} for use in farm components.
*
* @param structure
* {@link IFarmComponent} to create the logic for.
* @return {@link IStructureLogic} for use in farm components
*/
IStructureLogic createFarmStructureLogic(IFarmComponent structure);
}

View file

@ -0,0 +1,71 @@
package forestry.api.farming;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
public interface IFarmListener {
/**
* Called before a crop is harvested.
*
* @param crop
* ICrop about to be harvested.
* @return true to cancel further processing of this crop.
*/
boolean beforeCropHarvest(ICrop crop);
/**
* Called after a crop has been harvested, but before harvested items are stowed in the farms inventory.
*
* @param harvested
* Collection of harvested stacks. May be manipulated. Ensure removal of stacks with 0 or less items!
* @param crop
* Harvested {@link ICrop}
*/
void afterCropHarvest(Collection<ItemStack> harvested, ICrop crop);
/**
* Called after the stack of collected items has been returned by the farm logic, but before it is added to the farm's pending queue.
*
* @param collected
* Collection of collected stacks. May be manipulated. Ensure removal of stacks with 0 or less items!
* @param logic
*/
void hasCollected(Collection<ItemStack> collected, IFarmLogic logic);
/**
* Called after farmland has successfully been cultivated by a farm logic.
*
* @param logic
* @param x
* @param y
* @param z
* @param direction
* @param extent
*/
void hasCultivated(IFarmLogic logic, int x, int y, int z, ForgeDirection direction, int extent);
/**
* Called after the stack of harvested crops has been returned by the farm logic, but before it is added to the farm's pending queue.
*
* @param harvested
* @param logic
* @param x
* @param y
* @param z
* @param direction
* @param extent
*/
void hasScheduledHarvest(Collection<ICrop> harvested, IFarmLogic logic, int x, int y, int z, ForgeDirection direction, int extent);
/**
* Can be used to cancel farm task on a per side/{@link IFarmLogic} basis.
*
* @param logic
* @param direction
* @return true to skip any work action on the given logic and direction for this work cycle.
*/
boolean cancelTask(IFarmLogic logic, ForgeDirection direction);
}

View file

@ -0,0 +1,31 @@
package forestry.api.farming;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraftforge.common.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public interface IFarmLogic {
int getFertilizerConsumption();
int getWaterConsumption(float hydrationModifier);
boolean isAcceptedResource(ItemStack itemstack);
boolean isAcceptedGermling(ItemStack itemstack);
Collection<ItemStack> collect();
boolean cultivate(int x, int y, int z, ForgeDirection direction, int extent);
Collection<ICrop> harvest(int x, int y, int z, ForgeDirection direction, int extent);
@SideOnly(Side.CLIENT)
Icon getIcon();
String getName();
}

View file

@ -0,0 +1,54 @@
package forestry.api.farming;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* IGermling describes a crop or other harvestable object and can be used to inspect item stacks and blocks for matches.
*/
public interface IFarmable {
/**
* @param world
* @param x
* @param y
* @param z
* @return true if the block at the given location is a "sapling" for this type, i.e. a non-harvestable immature version of the crop.
*/
boolean isSaplingAt(World world, int x, int y, int z);
/**
* @param world
* @param x
* @param y
* @param z
* @return {@link ICrop} if the block at the given location is a harvestable and mature crop, null otherwise.
*/
ICrop getCropAt(World world, int x, int y, int z);
/**
* @param itemstack
* @return true if the item is a valid germling (plantable sapling, seed, etc.) for this type.
*/
boolean isGermling(ItemStack itemstack);
/**
* @param itemstack
* @return true if the item is something that can drop from this type without actually being harvested as a crop. (Apples or sapling from decaying leaves.)
*/
boolean isWindfall(ItemStack itemstack);
/**
* Plants a sapling by manipulating the world. The {@link IFarmLogic} should have verified the given location as valid. Called by the {@link IFarmHousing}
* which handles resources.
*
* @param germling
* @param world
* @param x
* @param y
* @param z
* @return true on success, false otherwise.
*/
boolean plantSaplingAt(ItemStack germling, World world, int x, int y, int z);
}

View file

@ -0,0 +1,8 @@
package forestry.api.food;
public class BeverageManager {
public static IBeverageEffect[] effectList = new IBeverageEffect[128];
public static IInfuserManager infuserManager;
public static IIngredientManager ingredientManager;
}

View file

@ -0,0 +1,12 @@
package forestry.api.food;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public interface IBeverageEffect {
int getId();
void doEffect(World world, EntityPlayer player);
String getDescription();
}

View file

@ -0,0 +1,17 @@
package forestry.api.food;
import net.minecraft.item.ItemStack;
public interface IInfuserManager {
void addMixture(int meta, ItemStack ingredient, IBeverageEffect effect);
void addMixture(int meta, ItemStack[] ingredients, IBeverageEffect effect);
ItemStack getSeasoned(ItemStack base, ItemStack[] ingredients);
boolean hasMixtures(ItemStack[] ingredients);
ItemStack[] getRequired(ItemStack[] ingredients);
}

View file

@ -0,0 +1,11 @@
package forestry.api.food;
import net.minecraft.item.ItemStack;
public interface IIngredientManager {
String getDescription(ItemStack itemstack);
void addIngredient(ItemStack ingredient, String description);
}

View file

@ -0,0 +1,29 @@
package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class EngineBronzeFuel {
/**
* Item that is valid fuel for a biogas engine.
*/
public final ItemStack liquid;
/**
* Power produced by this fuel per work cycle of the engine.
*/
public final int powerPerCycle;
/**
* How many work cycles a single "stack" of this type lasts.
*/
public final int burnDuration;
/**
* By how much the normal heat dissipation rate of 1 is multiplied when using this fuel type.
*/
public final int dissipationMultiplier;
public EngineBronzeFuel(ItemStack liquid, int powerPerCycle, int burnDuration, int dissipationMultiplier) {
this.liquid = liquid;
this.powerPerCycle = powerPerCycle;
this.burnDuration = burnDuration;
this.dissipationMultiplier = dissipationMultiplier;
}
}

View file

@ -0,0 +1,26 @@
package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class EngineCopperFuel {
/**
* Item that is valid fuel for a peat-fired engine.
*/
public final ItemStack fuel;
/**
* Power produced by this fuel per work cycle.
*/
public final int powerPerCycle;
/**
* Amount of work cycles this item lasts before being consumed.
*/
public final int burnDuration;
public EngineCopperFuel(ItemStack fuel, int powerPerCycle, int burnDuration) {
this.fuel = fuel;
this.powerPerCycle = powerPerCycle;
this.burnDuration = burnDuration;
}
}

View file

@ -0,0 +1,24 @@
package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class FermenterFuel {
/**
* Item that is a valid fuel for the fermenter (i.e. fertilizer).
*/
public final ItemStack item;
/**
* How much is fermeted per work cycle, i.e. how much biomass is produced per cycle.
*/
public final int fermentPerCycle;
/**
* Amount of work cycles a single item of this fuel lasts before expiring.
*/
public final int burnDuration;
public FermenterFuel(ItemStack item, int fermentPerCycle, int burnDuration) {
this.item = item;
this.fermentPerCycle = fermentPerCycle;
this.burnDuration = burnDuration;
}
}

View file

@ -0,0 +1,30 @@
package forestry.api.fuels;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
public class FuelManager {
/**
* Add new fuels for the fermenter here (i.e. fertilizer)
*/
public static HashMap<ItemStack, FermenterFuel> fermenterFuel = new ItemStackMap<FermenterFuel>();
/**
* Add new resources for the moistener here (i.e. wheat)
*/
public static HashMap<ItemStack, MoistenerFuel> moistenerResource = new ItemStackMap<MoistenerFuel>();
/**
* Add new substrates for the rainmaker here
*/
public static HashMap<ItemStack, RainSubstrate> rainSubstrate = new ItemStackMap<RainSubstrate>();
/**
* Add new fuels for EngineBronze (= biogas engine) here
*/
public static HashMap<ItemStack, EngineBronzeFuel> bronzeEngineFuel = new ItemStackMap<EngineBronzeFuel>();
/**
* Add new fuels for EngineCopper (= peat-fired engine) here
*/
public static HashMap<ItemStack, EngineCopperFuel> copperEngineFuel = new ItemStackMap<EngineCopperFuel>();
// Generator fuel list in GeneratorFuel.class
}

View file

@ -0,0 +1,30 @@
package forestry.api.fuels;
import java.util.HashMap;
import net.minecraftforge.liquids.LiquidStack;
public class GeneratorFuel {
public static HashMap<Integer, GeneratorFuel> fuels = new HashMap<Integer, GeneratorFuel>();
/**
* LiquidStack representing the fuel type and amount consumed per triggered cycle.
*/
public final LiquidStack fuelConsumed;
/**
* EU emitted per tick while this fuel is being consumed in the generator (i.e. biofuel = 32, biomass = 8).
*/
public final int eu;
/**
* Rate at which the fuel is consumed. 1 - Every tick 2 - Every second tick 3 - Every third tick etc.
*/
public final int rate;
public GeneratorFuel(LiquidStack fuelConsumed, int eu, int rate) {
this.fuelConsumed = fuelConsumed;
this.eu = eu;
this.rate = rate;
}
}

View file

@ -0,0 +1,57 @@
package forestry.api.fuels;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.liquids.LiquidStack;
public class ItemStackMap<T> extends HashMap<ItemStack, T> {
private static final long serialVersionUID = 5383477742290646466L;
@Override
public boolean containsKey(Object key) {
for (Map.Entry<ItemStack, T> entry : this.entrySet())
if (areItemStacksEqual(entry.getKey(), key))
return true;
return super.containsKey(key);
}
@Override
public T remove(Object key) {
Iterator<Map.Entry<ItemStack, T>> iterator = this.entrySet().iterator();
;
while (iterator.hasNext()) {
Map.Entry<ItemStack, T> entry = iterator.next();
if (areItemStacksEqual(entry.getKey(), key))
iterator.remove();
}
return super.remove(key);
}
@Override
public T get(Object key) {
for (Map.Entry<ItemStack, T> entry : this.entrySet())
if (areItemStacksEqual(entry.getKey(), key))
return entry.getValue();
return super.get(key);
}
private boolean areItemStacksEqual(ItemStack a, Object b) {
if (a == null || b == null)
return false;
if (b instanceof ItemStack)
return ItemStack.areItemStackTagsEqual(a, (ItemStack) b) && a.isItemEqual((ItemStack) b);
else if (b instanceof LiquidStack)
return ItemStack.areItemStackTagsEqual(a, ((LiquidStack) b).asItemStack()) && a.isItemEqual(((LiquidStack) b).asItemStack());
else if (b instanceof Integer)
return ((Integer) b).equals(a.itemID);
else if (b instanceof Item)
return ((Item) b).itemID == a.itemID;
return false;
}
}

View file

@ -0,0 +1,29 @@
package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class MoistenerFuel {
/**
* The item to use
*/
public final ItemStack item;
/**
* The item that leaves the moistener's working slot (i.e. mouldy wheat, decayed wheat, mulch)
*/
public final ItemStack product;
/**
* How much this item contributes to the final product of the moistener (i.e. mycelium)
*/
public final int moistenerValue;
/**
* What stage this product represents. Resources with lower stage value will be consumed first.
*/
public final int stage;
public MoistenerFuel(ItemStack item, ItemStack product, int stage, int moistenerValue) {
this.item = item;
this.product = product;
this.stage = stage;
this.moistenerValue = moistenerValue;
}
}

View file

@ -0,0 +1,35 @@
package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class RainSubstrate {
/**
* Rain substrate capable of activating the rainmaker.
*/
public ItemStack item;
/**
* Duration of the rain shower triggered by this substrate in Minecraft ticks.
*/
public int duration;
/**
* Speed of activation sequence triggered.
*/
public float speed;
public boolean reverse;
public RainSubstrate(ItemStack item, int duration, float speed) {
this(item, duration, speed, false);
}
public RainSubstrate(ItemStack item, float speed) {
this(item, 0, speed, true);
}
public RainSubstrate(ItemStack item, int duration, float speed, boolean reverse) {
this.item = item;
this.duration = duration;
this.speed = speed;
this.reverse = reverse;
}
}

View file

@ -0,0 +1,42 @@
package forestry.api.genetics;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.FMLLog;
public class AlleleManager {
public static IAlleleRegistry alleleRegistry;
/**
* Translates plain leaf blocks into genetic data. Used by bees to convert and pollinate foreign leaf blocks.
*/
public static HashMap<ItemStack, IIndividual> ersatzSpecimen = new HashMap<ItemStack, IIndividual>();
/**
* Translates plain saplings into genetic data. Used by the treealyzer and the farm to convert foreign saplings.
*/
public static HashMap<ItemStack, IIndividual> ersatzSaplings = new HashMap<ItemStack, IIndividual>();
/**
* @deprecated Use IAlleleRegistry.getAllele instead!
*/
@Deprecated
public static IAllele getAllele(String ident) {
IAllele allele = null;
try {
String alleleClass = "forestry.core.genetics.Allele";
Object obj = Class.forName(alleleClass).getField(ident).get(null);
if (obj instanceof IAllele)
allele = (IAllele) obj;
} catch (Exception ex) {
FMLLog.warning("Could not retrieve bee allele identified by: " + ident);
}
return allele;
}
}

View file

@ -0,0 +1,11 @@
package forestry.api.genetics;
public enum EnumTolerance {
NONE,
BOTH_1, BOTH_2, BOTH_3, BOTH_4, BOTH_5,
UP_1, UP_2, UP_3, UP_4, UP_5,
DOWN_1, DOWN_2, DOWN_3, DOWN_4, DOWN_5
}

View file

@ -0,0 +1,17 @@
package forestry.api.genetics;
/**
* Should be extended for different types of alleles. ISpeciesAllele, IBiomeAllele, etc.
*/
public interface IAllele {
/**
* @return A unique string identifier for this allele.
*/
String getUID();
/**
* @return true if the allele is dominant, false otherwise.
*/
boolean isDominant();
}

View file

@ -0,0 +1,23 @@
package forestry.api.genetics;
public interface IAlleleEffect extends IAllele {
/**
* @return true if this effect can combine with the effect on other allele (i.e. run before or after). combination can only occur if both effects are
* combinable.
*/
boolean isCombinable();
/**
* Returns the passed data storage if it is valid for this effect or a new one if the passed storage object was invalid for this effect.
*
* @param storedData
* @return
*/
IEffectData validateStorage(IEffectData storedData);
/**
* @return Short, human-readable identifier used in the beealyzer.
*/
String getIdentifier();
}

View file

@ -0,0 +1,10 @@
package forestry.api.genetics;
/**
* Simple interface to allow adding additional alleles containing float values.
*/
public interface IAlleleFloat extends IAllele {
float getValue();
}

View file

@ -0,0 +1,36 @@
package forestry.api.genetics;
/**
* @author Alex Binnie
*
* Handler for events that occur in IAlleleRegistry, such as registering alleles, branches etc. Useful for handling plugin specific behavior (i.e.
* creating a list of all bee species etc.)
*
*/
public interface IAlleleHandler {
/**
* Called when an allele is registered with {@link IAlleleRegistry}.
*
* @param allele
* Allele which was registered.
*/
public void onRegisterAllele(IAllele allele);
/**
* Called when a classification is registered with {@link IAlleleRegistry}.
*
* @param classification
* Classification which was registered.
*/
public void onRegisterClassification(IClassification classification);
/**
* Called when a fruit family is registered with {@link IAlleleRegistry}.
*
* @param family
* Fruit family which was registered.
*/
public void onRegisterFruitFamily(IFruitFamily family);
}

View file

@ -0,0 +1,10 @@
package forestry.api.genetics;
/**
* Simple interface to allow adding additional alleles containing integer values.
*/
public interface IAlleleInteger extends IAllele {
int getValue();
}

View file

@ -0,0 +1,154 @@
package forestry.api.genetics;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import forestry.api.genetics.IClassification.EnumClassLevel;
public interface IAlleleRegistry {
/* INDIVIDUAL */
/**
* Tests the itemstack for genetic information.
*
* @param stack
* @return true if the itemstack is an individual.
*/
boolean isIndividual(ItemStack stack);
/**
* Retrieve genetic information from an itemstack.
*
* @param stack
* Stack to retrieve genetic information for.
* @return IIndividual containing genetic information, null if none could be extracted.
*/
IIndividual getIndividual(ItemStack stack);
/* ALLELES */
/**
* @return HashMap of all currently registered alleles.
*/
LinkedHashMap<String, IAllele> getRegisteredAlleles();
/**
* Registers an allele.
*
* @param allele
* IAllele to register.
*/
void registerAllele(IAllele allele);
/**
* Gets an allele
*
* @param uid
* String based unique identifier of the allele to retrieve.
* @return IAllele if found, null otherwise.
*/
IAllele getAllele(String uid);
/* THIS SHOULD BE PHASED OUT */
@Deprecated
void reloadMetaMap(World world);
@Deprecated
IAllele getFromMetaMap(int meta);
@Deprecated
int getFromUIDMap(String uid);
/* CLASSIFICATIONS */
/**
* @return HashMap of all currently registered classifications.
*/
LinkedHashMap<String, IClassification> getRegisteredClassifications();
/**
* Registers a classification.
*
* @param classification
* IClassification to register.
*/
void registerClassification(IClassification classification);
/**
* Creates and returns a classification.
*
* @param level
* EnumClassLevel of the classification to create.
* @param uid
* String based unique identifier. Implementation will throw an exception if the key is already taken.
* @param scientific
* Binomial for the given classification.
* @return
*/
IClassification createAndRegisterClassification(EnumClassLevel level, String uid, String scientific);
/**
* Gets a classification.
*
* @param uid
* String based unique identifier of the classification to retrieve.
* @return Classification if found, null otherwise.
*/
IClassification getClassification(String uid);
/* FRUIT FAMILIES */
/**
* Get all registered fruit families.
*
* @return
*/
LinkedHashMap<String, IFruitFamily> getRegisteredFruitFamilies();
/**
* Registers a new fruit family.
*
* @param family
*/
void registerFruitFamily(IFruitFamily family);
/**
* Retrieves a fruit family identified by uid.
*
* @param uid
* @return
*/
IFruitFamily getFruitFamily(String uid);
/* ALLELE HANDLERS */
/**
* Registers a new IAlleleHandler
*
* @param handler
* IAlleleHandler to register.
*/
void registerAlleleHandler(IAlleleHandler handler);
/* BLACKLIST */
/**
* Blacklist an allele identified by its UID from mutation.
*
* @param uid
* UID of the allele to blacklist.
*/
void blacklistAllele(String uid);
/**
* @return Current blacklisted alleles.
*/
ArrayList<String> getAlleleBlacklist();
/**
* @param uid
* UID of the species to vet.
* @return true if the allele is blacklisted.
*/
boolean isBlacklisted(String uid);
}

View file

@ -0,0 +1,68 @@
package forestry.api.genetics;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.core.IIconProvider;
public interface IAlleleSpecies extends IAllele {
/**
* @return Localized short, human-readable identifier used in tooltips and beealyzer.
*/
String getName();
/**
* @return Localized short description of this species. (May be null.)
*/
String getDescription();
/**
* @return Preferred temperature
*/
EnumTemperature getTemperature();
/**
* @return Preferred humidity
*/
EnumHumidity getHumidity();
/**
* @return true if the species icon should have a glowing effect.
*/
boolean hasEffect();
/**
* @return true if the species should not be displayed in NEI or creative inventory.
*/
boolean isSecret();
/**
* @return true to have the species count against the species total.
*/
boolean isCounted();
/**
* Binomial name of the species sans genus ("Apis"). Returning "humboldti" will have the bee species flavour name be "Apis humboldti". Feel free to use fun
* names or return null.
*
* @return flavour text (may be null)
*/
String getBinomial();
/**
* Authority for the binomial name, e.g. "Sengir" on species of base Forestry.
*
* @return flavour text (may be null)
*/
String getAuthority();
/**
* @return Branch this species is associated with.
*/
IClassification getBranch();
@SideOnly(Side.CLIENT)
IIconProvider getIconProvider();
}

View file

@ -0,0 +1,75 @@
package forestry.api.genetics;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import forestry.api.apiculture.IBeekeepingMode;
public interface IBreedingTracker {
void decodeFromNBT(NBTTagCompound nbttagcompound);
void encodeToNBT(NBTTagCompound nbttagcompound);
/**
* @return Name of the current {@link IBeekeepingMode}.
*/
String getModeName();
/**
* @return Set the current {@link IBeekeepingMode}.
*/
void setModeName(String name);
/**
* @return Amount of species discovered.
*/
int getSpeciesBred();
/**
* Register the birth of an individual. Will mark it as discovered.
*
* @param individual
*/
void registerIndividual(IIndividual individual);
/**
* Marks a species as discovered. Should only be called from registerIndividual normally.
*
* @param species
*/
void registerSpecies(IAlleleSpecies species);
/**
* Register a successful mutation. Will mark it as discovered.
*
* @param mutation
*/
void registerMutation(IMutation mutation);
/**
* Queries the tracker for discovered species.
*
* @param mutation
* Mutation to query for.
* @return true if the mutation has been discovered.
*/
boolean isDiscovered(IMutation mutation);
/**
* Queries the tracker for discovered species.
*
* @param species
* Species to check.
* @return true if the species has been bred.
*/
boolean isDiscovered(IAlleleSpecies species);
/**
* Synchronizes the tracker to the client side. Should be called before opening any gui needing that information.
*
* @param world
* @param player
*/
void synchToPlayer(EntityPlayer player);
}

View file

@ -0,0 +1,20 @@
package forestry.api.genetics;
import forestry.api.core.INBTTagable;
/**
* Implementations other than Forestry's default one are not supported!
*
* @author SirSengir
*/
public interface IChromosome extends INBTTagable {
IAllele getPrimaryAllele();
IAllele getSecondaryAllele();
IAllele getInactiveAllele();
IAllele getActiveAllele();
}

View file

@ -0,0 +1,97 @@
package forestry.api.genetics;
/**
* Used by the *alyzers to display hierarchies.
*/
public interface IClassification {
public enum EnumClassLevel {
DOMAIN(0x777fff, true), KINGDOM(0x77c3ff), PHYLUM(0x77ffb6, true), DIVISION(0x77ffb6, true), CLASS(0x7bff77), ORDER(0xbeff77), FAMILY(0xfffd77), TRIBE(
0xfffd77), GENUS(0xffba77);
private int colour;
private boolean isDroppable;
private EnumClassLevel(int colour) {
this(colour, false);
}
private EnumClassLevel(int colour, boolean isDroppable) {
this.colour = colour;
this.isDroppable = isDroppable;
}
/**
* @return Colour to use for displaying this classification.
*/
public int getColour() {
return colour;
}
/**
* @return Indicates whether display of this classification level can be ommitted in case of space constraints.
*/
public boolean isDroppable() {
return isDroppable;
}
}
EnumClassLevel getLevel();
/**
* @return Unique String identifier.
*/
String getUID();
/**
* @return Localized branch name for user display.
*/
String getName();
/**
* A branch approximates a "genus" in real life. Real life examples: "Micrapis", "Megapis"
*
* @return flavour text (may be null)
*/
String getScientific();
/**
* @return Localized description of this branch. (May be null.)
*/
String getDescription();
/**
* @return Member groups of this one.
*/
IClassification[] getMemberGroups();
/**
* Adds subgroups to this group.
*/
void addMemberGroup(IClassification group);
/**
* @return Member species of this group.
*/
IAlleleSpecies[] getMemberSpecies();
/**
* Used by the allele registry to populate internal collection of branch members on the fly.
*
* @param species
*/
void addMemberSpecies(IAlleleSpecies species);
/**
* @return Parent classification, null if this is root.
*/
IClassification getParent();
/**
* Only used internally by the AlleleRegistry if this classification has been added to another one.
*
* @param parent
*/
void setParent(IClassification parent);
}

View file

@ -0,0 +1,17 @@
package forestry.api.genetics;
import forestry.api.core.INBTTagable;
public interface IEffectData extends INBTTagable {
void setInteger(int index, int val);
void setFloat(int index, float val);
void setBoolean(int index, boolean val);
int getInteger(int index);
float getFloat(int index);
boolean getBoolean(int index);
}

View file

@ -0,0 +1,40 @@
package forestry.api.genetics;
import java.util.Collection;
import net.minecraft.item.ItemStack;
public interface IFruitBearer {
/**
* @return true if the actual tile can bear fruits.
*/
boolean hasFruit();
/**
* @return Family of the potential fruits on this tile.
*/
IFruitFamily getFruitFamily();
/**
* Picks the fruits of this tile, resetting it to unripe fruits.
*
* @param tool
* Tool used in picking the fruits. May be null.
* @return Picked fruits.
*/
Collection<ItemStack> pickFruit(ItemStack tool);
/**
* @return float indicating the ripeness of the fruit with >= 1.0f indicating full ripeness.
*/
float getRipeness();
/**
* Increases the ripeness of the fruit.
*
* @param add
* Float to add to the ripeness. Will truncate to valid values.
*/
void addRipeness(float add);
}

View file

@ -0,0 +1,27 @@
package forestry.api.genetics;
public interface IFruitFamily {
/**
* @return Unique String identifier.
*/
String getUID();
/**
* @return Localized family name for user display.
*/
String getName();
/**
* A scientific-y name for this fruit family
*
* @return flavour text (may be null)
*/
String getScientific();
/**
* @return Localized description of this fruit family. (May be null.)
*/
String getDescription();
}

View file

@ -0,0 +1,21 @@
package forestry.api.genetics;
import forestry.api.core.INBTTagable;
/**
* Implementations other than Forestry's default one are not supported!
*/
public interface IGenome extends INBTTagable {
IAlleleSpecies getPrimary();
IAlleleSpecies getSecondary();
IChromosome[] getChromosomes();
IAllele getActiveAllele(int chromosome);
IAllele getInactiveAllele(int chromosome);
boolean isGeneticEqual(IGenome other);
}

View file

@ -0,0 +1,41 @@
package forestry.api.genetics;
import java.util.List;
import forestry.api.core.INBTTagable;
/**
* Implementations other than Forestry's default one are not supported!
*/
public interface IIndividual extends INBTTagable {
String getIdent();
String getDisplayName();
void addTooltip(List<String> list);
/**
* Call to mark the IIndividual as analyzed.
* @return true if the IIndividual has not been analyzed previously.
*/
boolean analyze();
boolean isAnalyzed();
boolean hasEffect();
boolean isSecret();
IGenome 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);
IIndividual copy();
}

Some files were not shown because too many files have changed in this diff Show more