Test with stuff + Forestry potential support

This commit is contained in:
WayofTime 2014-01-25 20:36:28 -05:00
parent 5b05cf651b
commit bd26e441cb
174 changed files with 5602 additions and 0 deletions

View file

@ -0,0 +1,93 @@
package forestry.api.lepidopterology;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleArea;
import forestry.api.genetics.IAlleleBoolean;
import forestry.api.genetics.IAlleleFloat;
import forestry.api.genetics.IAlleleFlowers;
import forestry.api.genetics.IAlleleInteger;
import forestry.api.genetics.IAlleleTolerance;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.ISpeciesRoot;
public enum EnumButterflyChromosome implements IChromosomeType {
/**
* Species of the bee. Alleles here must implement {@link IAlleleButterflySpecies}.
*/
SPECIES(IAlleleButterflySpecies.class),
/**
* Physical size.
*/
SIZE(IAlleleFloat.class),
/**
* Flight speed.
*/
SPEED(IAlleleFloat.class),
/**
* How long the butterfly can last without access to matching pollinatables.
*/
LIFESPAN(IAlleleInteger.class),
/**
* Species with a higher metabolism have a higher appetite and may cause more damage to their environment.
*/
METABOLISM(IAlleleInteger.class),
/**
* Determines likelyhood of caterpillars and length of caterpillar/pupation phase. Also: Number of max caterpillars after mating?
*/
FERTILITY(IAlleleInteger.class),
/**
* Not sure yet.
*/
TEMPERATURE_TOLERANCE(IAlleleTolerance.class),
/**
* Not sure yet.
*/
HUMIDITY_TOLERANCE(IAlleleTolerance.class),
/**
* Only nocturnal butterflys/moths will fly at night. Allows daylight activity for naturally nocturnal species.
*/
NOCTURNAL(IAlleleBoolean.class),
/**
* Only tolerant flyers will fly in the rain.
*/
TOLERANT_FLYER(IAlleleBoolean.class),
/**
* Fire resistance.
*/
FIRE_RESIST(IAlleleBoolean.class),
/**
* Required flowers/leaves.
*/
FLOWER_PROVIDER(IAlleleFlowers.class),
/**
* Extra effect to surroundings. (?)
*/
EFFECT(IAlleleButterflyEffect.class),
/**
* Not used yet
*/
TERRITORY(IAlleleArea.class),
;
Class<? extends IAllele> clss;
EnumButterflyChromosome(Class<? extends IAllele> clss) {
this.clss = clss;
}
@Override
public Class<? extends IAllele> getAlleleClass() {
return clss;
}
@Override
public String getName() {
return this.toString().toLowerCase();
}
@Override
public ISpeciesRoot getSpeciesRoot() {
return AlleleManager.alleleRegistry.getSpeciesRoot("rootButterflies");
}
}

View file

@ -0,0 +1,10 @@
package forestry.api.lepidopterology;
public enum EnumFlutterType {
BUTTERFLY,
SERUM,
CATERPILLAR,
NONE;
public static final EnumFlutterType[] VALUES = values();
}

View file

@ -0,0 +1,16 @@
package forestry.api.lepidopterology;
import forestry.api.genetics.IAlleleEffect;
import forestry.api.genetics.IEffectData;
public interface IAlleleButterflyEffect extends IAlleleEffect {
/**
* Used by butterflies to trigger effects in the world.
* @param butterfly {@link IEntityButterfly}
* @param storedData
* @return {@link forestry.api.genetics.IEffectData} for the next cycle.
*/
IEffectData doEffect(IEntityButterfly butterfly, IEffectData storedData);
}

View file

@ -0,0 +1,53 @@
package forestry.api.lepidopterology;
import java.util.EnumSet;
import java.util.Map;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.BiomeDictionary;
import forestry.api.genetics.IAlleleSpecies;
public interface IAlleleButterflySpecies extends IAlleleSpecies {
/**
* @return the IBeeRoot
*/
IButterflyRoot getRoot();
/**
* @return Path of the texture to use for entity rendering.
*/
String getEntityTexture();
/**
* Allows butterflies to restrict random spawns beyond the restrictions set by getTemperature() and getHumidity().
*
* @return EnumSet of biome tags this butterfly species can be spawned in.
*/
EnumSet<BiomeDictionary.Type> getSpawnBiomes();
/**
* @return true if a prospective spawn biome must not match a biome tag outside of getSpawnBiomes.
*/
boolean strictSpawnMatch();
/**
* @return Float between 0 and 1 representing the rarity of the species, will affect spawn rate.
*/
float getRarity();
/**
* @return Float representing the distance below which this butterfly will take flight if it detects a player which is not sneaking.
*/
float getFlightDistance();
/**
* @return true if this species is only active at night.
*/
boolean isNocturnal();
Map<ItemStack, Float> getButterflyLoot();
Map<ItemStack, Float> getCaterpillarLoot();
}

View file

@ -0,0 +1,71 @@
package forestry.api.lepidopterology;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import forestry.api.genetics.IIndividualLiving;
public interface IButterfly extends IIndividualLiving {
IButterflyGenome getGenome();
/**
* @return Genetic information of the mate, null if unmated.
*/
IButterflyGenome getMate();
/**
* @return Physical size of the butterfly.
*/
float getSize();
/**
* @param world
* @param x
* @param y
* @param z
* @return true if the butterfly can naturally spawn at the given location at this time. (Used to auto-spawn butterflies from tree leaves.)
*/
boolean canSpawn(World world, double x, double y, double z);
/**
* @param world
* @param x
* @param y
* @param z
* @return true if the butterfly can take flight at the given location at this time. (Used to auto-spawn butterflies from dropped items.)
*/
boolean canTakeFlight(World world, double x, double y, double z);
/**
* @param world
* @param x
* @param y
* @param z
* @return true if the environment (temperature, humidity) is valid for the butterfly at the given location.
*/
boolean isAcceptedEnvironment(World world, double x, double y, double z);
IButterfly spawnCaterpillar(IButterflyNursery nursery);
/**
* @param entity
* @param playerKill Whether or not the butterfly was killed by a player.
* @param lootLevel Loot level according to the weapon used to kill the butterfly.
* @return Array of itemstacks to drop on death of the given entity.
*/
ItemStack[] getLootDrop(IEntityButterfly entity, boolean playerKill, int lootLevel);
/**
* @param nursery
* @param playerKill Whether or not the nursery was broken by a player.
* @param lootLevel Fortune level.
* @return Array of itemstacks to drop on breaking of the nursery.
*/
ItemStack[] getCaterpillarDrop(IButterflyNursery nursery, boolean playerKill, int lootLevel);
/**
* Create an exact copy of this butterfly.
*/
IButterfly copy();
}

View file

@ -0,0 +1,37 @@
package forestry.api.lepidopterology;
import forestry.api.genetics.EnumTolerance;
import forestry.api.genetics.IFlowerProvider;
import forestry.api.genetics.IGenome;
public interface IButterflyGenome extends IGenome {
IAlleleButterflySpecies getPrimary();
IAlleleButterflySpecies getSecondary();
float getSize();
int getLifespan();
int getMetabolism();
int getFertility();
float getSpeed();
EnumTolerance getToleranceTemp();
EnumTolerance getToleranceHumid();
boolean getNocturnal();
boolean getTolerantFlyer();
boolean getFireResist();
IFlowerProvider getFlowerProvider();
IAlleleButterflyEffect getEffect();
}

View file

@ -0,0 +1,9 @@
package forestry.api.lepidopterology;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutation;
public interface IButterflyMutation extends IMutation {
float getChance(IButterflyNursery housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
}

View file

@ -0,0 +1,16 @@
package forestry.api.lepidopterology;
import forestry.api.genetics.IHousing;
import forestry.api.genetics.IIndividual;
public interface IButterflyNursery extends IHousing {
IButterfly getCaterpillar();
IIndividual getNanny();
void setCaterpillar(IButterfly butterfly);
boolean canNurse(IButterfly butterfly);
}

View file

@ -0,0 +1,54 @@
package forestry.api.lepidopterology;
import java.util.ArrayList;
import java.util.Collection;
import net.minecraft.entity.EntityLiving;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.ISpeciesRoot;
public interface IButterflyRoot extends ISpeciesRoot {
boolean isMember(ItemStack stack);
IButterfly getMember(ItemStack stack);
IButterfly getMember(NBTTagCompound compound);
ItemStack getMemberStack(IIndividual butterfly, int type);
/* GENOME CONVERSION */
IButterfly templateAsIndividual(IAllele[] template);
IButterfly templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive);
IButterflyGenome templateAsGenome(IAllele[] template);
IButterflyGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
/* BUTTERFLY SPECIFIC */
ILepidopteristTracker getBreedingTracker(World world, String player);
/**
* Spawns the given butterfly in the world.
* @param butterfly
* @return butterfly entity on success, null otherwise.
*/
EntityLiving spawnButterflyInWorld(World world, IButterfly butterfly, double x, double y, double z);
/**
* @return true if passed item is mated.
*/
boolean isMated(ItemStack stack);
/* TEMPLATES */
ArrayList<IButterfly> getIndividualTemplates();
/* MUTATIONS */
Collection<IButterflyMutation> getMutations(boolean shuffle);
}

View file

@ -0,0 +1,23 @@
package forestry.api.lepidopterology;
import forestry.api.genetics.IIndividual;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.passive.IAnimals;
public interface IEntityButterfly extends IAnimals {
void changeExhaustion(int change);
int getExhaustion();
IButterfly getButterfly();
/**
* @return The entity as an EntityCreature to save casting.
*/
EntityCreature getEntity();
IIndividual getPollen();
void setPollen(IIndividual pollen);
}

View file

@ -0,0 +1,9 @@
package forestry.api.lepidopterology;
import forestry.api.genetics.IBreedingTracker;
public interface ILepidopteristTracker extends IBreedingTracker {
void registerCatch(IButterfly butterfly);
}

View file

@ -0,0 +1,3 @@
@API(apiVersion="1.0", owner="ForestryAPI|core", provides="ForestryAPI|lepidopterology")
package forestry.api.lepidopterology;
import cpw.mods.fml.common.API;