mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-10-25 20:22:26 +00:00
Move files
This commit is contained in:
1 parent
a958073079
commit
3429114d2a
274 files changed
+37547
-11
No files matched your search
-1
Submodule api/forestry deleted from 41e3cd955d.
Submodule api/redstoneflux deleted from b5771e4ef8.
@@ -56,9 +56,9 @@ import forestry.plugins.PluginManager;
|
||||
* @author SirSengir
|
||||
*/
|
||||
@Mod(
|
||||
modid = Constants.MOD,
|
||||
name = "Forestry",
|
||||
version = Version.VERSION,
|
||||
modid = Constants.ID,
|
||||
name = Constants.MOD,
|
||||
version = Constants.VERSION,
|
||||
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
|
||||
dependencies = "required-after:Forge@[10.13.4.1566,);"
|
||||
+ "after:Buildcraft|Core@[6.1.7,);"
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
/**
|
||||
*
|
||||
* Some miscellaneous lists and settings for bees.
|
||||
*
|
||||
* @author SirSengir
|
||||
*/
|
||||
public class BeeManager {
|
||||
|
||||
/**
|
||||
* 0 - Common Village Bees 1 - Uncommon Village Bees (20 % of spawns)
|
||||
*/
|
||||
public static ArrayList<IBeeGenome>[] villageBees;
|
||||
|
||||
/**
|
||||
* List of items that can induce swarming. Integer denotes x in 1000 chance.
|
||||
*/
|
||||
public static HashMap<ItemStack, Integer> inducers = new HashMap<ItemStack, Integer>();
|
||||
|
||||
/**
|
||||
* Convenient access to AlleleManager.alleleRegistry.getSpeciesRoot("rootBees")
|
||||
*/
|
||||
public static IBeeRoot beeRoot;
|
||||
|
||||
/**
|
||||
* Used to create new bees.
|
||||
*/
|
||||
public static IBeeFactory beeFactory;
|
||||
|
||||
/**
|
||||
* Used to create new bee mutations.
|
||||
*/
|
||||
public static IBeeMutationFactory beeMutationFactory;
|
||||
|
||||
/**
|
||||
* Used to get Forestry's jubilance implementations.
|
||||
*/
|
||||
public static IJubilanceFactory jubilanceFactory;
|
||||
|
||||
/**
|
||||
* Used to check whether a player is wearing Apiarist Armor.
|
||||
*/
|
||||
public static IArmorApiaristHelper armorApiaristHelper;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
/**
|
||||
* Easily extendable default IBeeListener.
|
||||
* By itself, this IBeeListener does nothing.
|
||||
* BeeListeners should inherit from this class unless they need to listen for everything.
|
||||
*/
|
||||
public class DefaultBeeListener implements IBeeListener {
|
||||
@Override
|
||||
public void wearOutEquipment(int amount) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQueenDeath() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPollenRetrieved(IIndividual pollen) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
/**
|
||||
* Easily extendable default IBeeModifier.
|
||||
* By itself, this IBeeModifier does nothing.
|
||||
* BeeModifiers should inherit from this class unless they modify everything.
|
||||
*/
|
||||
public class DefaultBeeModifier implements IBeeModifier {
|
||||
|
||||
public float getTerritoryModifier(IBeeGenome genome, float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public float getFloweringModifier(IBeeGenome genome, float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public float getGeneticDecay(IBeeGenome genome, float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public boolean isSealed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isSelfLighted() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isSunlightSimulated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isHellish() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Enum representing the order of chromosomes in a bee's genome and what they control.
|
||||
*
|
||||
* @author SirSengir
|
||||
*/
|
||||
public enum EnumBeeChromosome implements IChromosomeType {
|
||||
/**
|
||||
* Species of the bee. Alleles here must implement {@link IAlleleBeeSpecies}.
|
||||
*/
|
||||
SPECIES(IAlleleBeeSpecies.class),
|
||||
/**
|
||||
* (Production) Speed of the bee.
|
||||
*/
|
||||
SPEED(IAlleleFloat.class),
|
||||
/**
|
||||
* Lifespan of the bee.
|
||||
*/
|
||||
LIFESPAN(IAlleleInteger.class),
|
||||
/**
|
||||
* Fertility of the bee. Determines number of offspring.
|
||||
*/
|
||||
FERTILITY(IAlleleInteger.class),
|
||||
/**
|
||||
* Temperature difference to its native supported one the bee can tolerate.
|
||||
*/
|
||||
TEMPERATURE_TOLERANCE(IAlleleTolerance.class),
|
||||
/**
|
||||
* Slightly incorrectly named. If true, a naturally dirunal bee can work during the night. If true, a naturally nocturnal bee can work during the day.
|
||||
*/
|
||||
NOCTURNAL(IAlleleBoolean.class),
|
||||
/**
|
||||
* Not used / superseded by fixed values for the species. Probably going to be replaced with a boolean for FIRE_RESIST.
|
||||
*/
|
||||
@Deprecated
|
||||
HUMIDITY(IAllele.class),
|
||||
/**
|
||||
* Humidity difference to its native supported one the bee can tolerate.
|
||||
*/
|
||||
HUMIDITY_TOLERANCE(IAlleleTolerance.class),
|
||||
/**
|
||||
* If true the bee can work during rain.
|
||||
*/
|
||||
TOLERANT_FLYER(IAlleleBoolean.class),
|
||||
/**
|
||||
* If true, the bee can work without a clear view of the sky.
|
||||
*/
|
||||
CAVE_DWELLING(IAlleleBoolean.class),
|
||||
/**
|
||||
* Contains the supported flower provider.
|
||||
*/
|
||||
FLOWER_PROVIDER(IAlleleFlowers.class),
|
||||
/**
|
||||
* Determines pollination speed.
|
||||
*/
|
||||
FLOWERING(IAlleleInteger.class),
|
||||
/**
|
||||
* Determines the size of the bee's territory.
|
||||
*/
|
||||
TERRITORY(IAlleleArea.class),
|
||||
/**
|
||||
* Determines the bee's effect.
|
||||
*/
|
||||
EFFECT(IAlleleBeeEffect.class);
|
||||
|
||||
Class<? extends IAllele> clss;
|
||||
|
||||
EnumBeeChromosome(Class<? extends IAllele> clss) {
|
||||
this.clss = clss;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IAllele> getAlleleClass() {
|
||||
return clss;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return BeeManager.beeRoot;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
|
||||
public enum EnumBeeType implements ISpeciesType {
|
||||
DRONE, PRINCESS, QUEEN, LARVAE, NONE;
|
||||
|
||||
public static final EnumBeeType[] VALUES = values();
|
||||
|
||||
String name;
|
||||
|
||||
EnumBeeType() {
|
||||
this.name = this.toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.genetics.IFlowerRegistry;
|
||||
|
||||
public class FlowerManager {
|
||||
/**
|
||||
* <blockquote><pre>e.g. FlowerManager.flowerRegister.registerPlantableFlower(new ItemStack(Blocks.red_flower), 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);</pre></blockquote>
|
||||
*/
|
||||
public static IFlowerRegistry flowerRegistry;
|
||||
|
||||
public static final String FlowerTypeVanilla = "flowersVanilla";
|
||||
public static final String FlowerTypeNether = "flowersNether";
|
||||
public static final String FlowerTypeCacti = "flowersCacti";
|
||||
public static final String FlowerTypeMushrooms = "flowersMushrooms";
|
||||
public static final String FlowerTypeEnd = "flowersEnd";
|
||||
public static final String FlowerTypeJungle = "flowersJungle";
|
||||
public static final String FlowerTypeSnow = "flowersSnow";
|
||||
public static final String FlowerTypeWheat = "flowersWheat";
|
||||
public static final String FlowerTypeGourd = "flowersGourd";
|
||||
|
||||
/**
|
||||
* @deprecated since Forestry 3.4. Use IFlowerRegistry.registerPlantableFlower instead.
|
||||
* Completely unused since Forestry 4.0, kept for backward compatibility with older mods.
|
||||
*/
|
||||
@Deprecated
|
||||
public static ArrayList<ItemStack> plainFlowers = new ArrayList<ItemStack>();
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
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 housing {@link IBeeHousing} the bee currently resides in.
|
||||
* @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 housing {@link IBeeHousing} the bee currently resides in.
|
||||
* @return storedData, may have been manipulated.
|
||||
*/
|
||||
IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
|
||||
public interface IAlleleBeeSpecies extends IAlleleSpecies {
|
||||
|
||||
/**
|
||||
* @return the IBeeRoot
|
||||
*/
|
||||
IBeeRoot getRoot();
|
||||
|
||||
/**
|
||||
* @return true if this species is only active at night.
|
||||
*/
|
||||
boolean isNocturnal();
|
||||
|
||||
/**
|
||||
* @return Map of possible products with the chance for drop each bee cycle. (0 - 1]
|
||||
*/
|
||||
Map<ItemStack, Float> getProductChances();
|
||||
|
||||
/**
|
||||
* @return Map of possible specialities with the chance for drop each bee cycle. (0 - 1]
|
||||
*/
|
||||
Map<ItemStack, Float> getSpecialtyChances();
|
||||
|
||||
/**
|
||||
* Only jubilant bees produce specialities.
|
||||
* @return true if the bee is jubilant, false otherwise.
|
||||
*/
|
||||
boolean isJubilant(IBeeGenome genome, IBeeHousing housing);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
IIcon getIcon(EnumBeeType type, int renderPass);
|
||||
|
||||
/**
|
||||
* @deprecated since Forestry 3.6.
|
||||
* @return Path of the texture to use for entity rendering.
|
||||
*/
|
||||
@Deprecated
|
||||
String getEntityTexture();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.genetics.IAlleleSpeciesCustom;
|
||||
|
||||
public interface IAlleleBeeSpeciesCustom extends IAlleleBeeSpecies, IAlleleSpeciesCustom {
|
||||
|
||||
/**
|
||||
* Add a product for this bee species.
|
||||
* Chance is between 0 and 1.
|
||||
*/
|
||||
IAlleleBeeSpeciesCustom addProduct(ItemStack product, Float chance);
|
||||
|
||||
/**
|
||||
* Add a specialty product for this bee species.
|
||||
* Bees only produce their specialty when they are Jubilant (see IJubilanceProvider)
|
||||
* Chance is between 0 and 1.
|
||||
*/
|
||||
IAlleleBeeSpeciesCustom addSpecialty(ItemStack specialty, Float chance);
|
||||
|
||||
/**
|
||||
* Set the Jubilance Provider for this bee species.
|
||||
* Bees only produce their specialty when they are Jubilant (see IJubilanceProvider)
|
||||
*/
|
||||
IAlleleBeeSpeciesCustom setJubilanceProvider(IJubilanceProvider provider);
|
||||
|
||||
/**
|
||||
* Make this species only active at night.
|
||||
*/
|
||||
IAlleleBeeSpeciesCustom setNocturnal();
|
||||
|
||||
/** Use this if you have custom icons for bees. */
|
||||
IAlleleBeeSpeciesCustom setCustomBeeIconProvider(IBeeIconProvider beeIconProvider);
|
||||
|
||||
/** Use this if you have custom icon colours for bees (other than the default static primary + secondary colours). */
|
||||
IAlleleBeeSpeciesCustom setCustomBeeIconColourProvider(IBeeIconColourProvider beeIconColourProvider);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
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 forestry.api.genetics.ISpeciesRoot} for retrieval functions.
|
||||
*
|
||||
* @author SirSengir
|
||||
*/
|
||||
public interface IApiaristTracker extends IBreedingTracker {
|
||||
|
||||
/**
|
||||
* Register the birth of a queen. Will mark species as discovered.
|
||||
*
|
||||
* @param queen
|
||||
* 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 princess
|
||||
* 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 drone
|
||||
* Created drone.
|
||||
*/
|
||||
void registerDrone(IIndividual drone);
|
||||
|
||||
/**
|
||||
* @return Amount of drones bred with this tracker.
|
||||
*/
|
||||
int getDroneCount();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
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 entity Entity 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
|
||||
*/
|
||||
boolean protectEntity(EntityLivingBase entity, ItemStack armor, String cause, boolean doProtect);
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @deprecated since Forestry 4.2. Use protectEntity
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean protectPlayer(EntityPlayer player, ItemStack armor, String cause, boolean doProtect);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Helper class for checking whether an entity is wearing Apiarist Armor
|
||||
*
|
||||
* @author Vexatos
|
||||
*/
|
||||
public interface IArmorApiaristHelper {
|
||||
|
||||
/**
|
||||
* Called when the apiarist's armor acts as protection against an attack.
|
||||
* @param stack ItemStack to check
|
||||
* @param entity Entity being attacked
|
||||
* @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 item is valid Apiarist Armor and should protect the player from that attack
|
||||
* @since Forestry 4.2
|
||||
*/
|
||||
boolean isArmorApiarist(ItemStack stack, EntityLivingBase entity, String cause, boolean doProtect);
|
||||
|
||||
/**
|
||||
* Called when the apiarist's armor acts as protection against an attack.
|
||||
* @param entity Entity being attacked
|
||||
* @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 The number of valid Apiarist Armor pieces the player is wearing that are actually protecting
|
||||
* @since Forestry 4.2
|
||||
*/
|
||||
int wearsItems(EntityLivingBase entity, String cause, boolean doProtect);
|
||||
|
||||
/**
|
||||
* Called when the apiarist's armor acts as protection against an attack.
|
||||
* @param stack ItemStack to check
|
||||
* @param player Player being attacked
|
||||
* @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 item is valid Apiarist Armor and should protect the player from that attack
|
||||
* @deprecated since Forestry 4.2. use the EntityLivingBase version
|
||||
*/
|
||||
@Deprecated
|
||||
boolean isArmorApiarist(ItemStack stack, EntityPlayer player, String cause, boolean doProtect);
|
||||
|
||||
/**
|
||||
* Called when the apiarist's armor acts as protection against an attack.
|
||||
* @param player Player being attacked
|
||||
* @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 The number of valid Apiarist Armor pieces the player is wearing that are actually protecting
|
||||
* @deprecated since Forestry 4.2. use the EntityLivingBase version
|
||||
*/
|
||||
@Deprecated
|
||||
int wearsItems(EntityPlayer player, String cause, boolean doProtect);
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IIndividualLiving;
|
||||
|
||||
/**
|
||||
* Other implementations than Forestry's default one are not supported.
|
||||
*
|
||||
* @author SirSengir
|
||||
*/
|
||||
public interface IBee extends IIndividualLiving {
|
||||
|
||||
/**
|
||||
* @return Bee's genetic information.
|
||||
*/
|
||||
IBeeGenome getGenome();
|
||||
|
||||
/**
|
||||
* @return Genetic information of the bee's mate, null if unmated.
|
||||
*/
|
||||
IBeeGenome getMate();
|
||||
|
||||
/**
|
||||
* @return true if the individual is originally of natural origin.
|
||||
*/
|
||||
boolean isNatural();
|
||||
|
||||
/**
|
||||
* @return generation this individual is removed from the original individual.
|
||||
*/
|
||||
int getGeneration();
|
||||
|
||||
/**
|
||||
* Set the natural flag on this bee.
|
||||
* @param flag
|
||||
*/
|
||||
void setIsNatural(boolean flag);
|
||||
|
||||
IEffectData[] doEffect(IEffectData[] storedData, IBeeHousing housing);
|
||||
|
||||
IEffectData[] doFX(IEffectData[] storedData, IBeeHousing housing);
|
||||
|
||||
/**
|
||||
* @return true if the bee may spawn offspring
|
||||
*/
|
||||
boolean canSpawn();
|
||||
|
||||
/**
|
||||
* Determines whether the queen can work.
|
||||
* @param housing the {@link IBeeHousing} the bee currently resides in.
|
||||
* @return an empty set if the queen can work, a set of error states if the queen can not work
|
||||
*/
|
||||
Set<IErrorState> getCanWork(IBeeHousing housing);
|
||||
|
||||
List<BiomeGenBase> getSuitableBiomes();
|
||||
|
||||
ItemStack[] getProduceList();
|
||||
|
||||
ItemStack[] getSpecialtyList();
|
||||
|
||||
ItemStack[] produceStacks(IBeeHousing housing);
|
||||
|
||||
IBee spawnPrincess(IBeeHousing housing);
|
||||
|
||||
IBee[] spawnDrones(IBeeHousing housing);
|
||||
|
||||
void plantFlowerRandom(IBeeHousing housing);
|
||||
|
||||
IIndividual retrievePollen(IBeeHousing housing);
|
||||
|
||||
boolean pollinateRandom(IBeeHousing housing, IIndividual pollen);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import forestry.api.genetics.IClassification;
|
||||
|
||||
public interface IBeeFactory {
|
||||
|
||||
/**
|
||||
* Creates a new bee species.
|
||||
* Automatically registered with AlleleManager.alleleRegistry.registerAllele()
|
||||
* See IAlleleBeeSpeciesCustom and IAlleleSpeciesCustom for adding additional properties to the returned species.
|
||||
*
|
||||
* @param uid Unique Identifier for this species
|
||||
* @param dominant Whether this species is genetically dominant (false means it is recessive)
|
||||
* @param authority Authority for the binomial name, e.g. "Sengir" on species of base Forestry.
|
||||
* @param unlocalizedName Unlocalized name for this species
|
||||
* @param unlocalizedDescription Unlocalized description for this species
|
||||
* @param branch Classification of this species
|
||||
* @param binomial Binomial name of the species sans genus ("Apis"). "humboldti" will have the bee species flavour name be "Apis humboldti". Feel free to use fun names or null.
|
||||
* @param primaryColor The outline color of this species
|
||||
* @param secondaryColor The body color of this species
|
||||
* @return a new bee species allele.
|
||||
*/
|
||||
IAlleleBeeSpeciesCustom createSpecies(String uid, boolean dominant, String authority, String unlocalizedName, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor);
|
||||
|
||||
/**
|
||||
* Creates a new bee branch.
|
||||
* Must be registered with AlleleManager.alleleRegistry.getClassification("family.apidae").addMemberGroup();
|
||||
*
|
||||
* @param uid Unique Identifier for this branch
|
||||
* @param scientific approximates a "genus" in real life. Real life examples: "Micrapis", "Megapis"
|
||||
* @return a new bee branch
|
||||
*/
|
||||
IClassification createBranch(String uid, String scientific);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IGenome;
|
||||
|
||||
/**
|
||||
* Only the default implementation is supported.
|
||||
*
|
||||
* @author SirSengir
|
||||
*
|
||||
*/
|
||||
public interface IBeeGenome extends IGenome {
|
||||
|
||||
IAlleleBeeSpecies getPrimary();
|
||||
|
||||
IAlleleBeeSpecies getSecondary();
|
||||
|
||||
float getSpeed();
|
||||
|
||||
int getLifespan();
|
||||
|
||||
int getFertility();
|
||||
|
||||
EnumTolerance getToleranceTemp();
|
||||
|
||||
EnumTolerance getToleranceHumid();
|
||||
|
||||
boolean getNocturnal();
|
||||
|
||||
boolean getTolerantFlyer();
|
||||
|
||||
boolean getCaveDwelling();
|
||||
|
||||
IFlowerProvider getFlowerProvider();
|
||||
|
||||
int getFlowering();
|
||||
|
||||
int[] getTerritory();
|
||||
|
||||
IAlleleBeeEffect getEffect();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
import forestry.api.genetics.IHousing;
|
||||
|
||||
public interface IBeeHousing extends IHousing, IClimateProvider, IErrorLogicSource {
|
||||
|
||||
/**
|
||||
* Used by BeeManager.beeRoot.createBeeHousingModifier(IBeeHousing housing)
|
||||
* to combine bee modifiers from several sources that can change over time.
|
||||
* @return IBeeModifiers from the housing, frames, etc.
|
||||
*/
|
||||
Iterable<IBeeModifier> getBeeModifiers();
|
||||
|
||||
/**
|
||||
* Used by BeeManager.beeRoot.createBeeHousingListener(IBeeHousing housing)
|
||||
* to combine bee listeners from several sources that can change over time.
|
||||
* @return IBeeListeners from the housing, multiblock parts, etc.
|
||||
*/
|
||||
Iterable<IBeeListener> getBeeListeners();
|
||||
|
||||
IBeeHousingInventory getBeeInventory();
|
||||
IBeekeepingLogic getBeekeepingLogic();
|
||||
|
||||
int getBlockLightValue();
|
||||
boolean canBlockSeeTheSky();
|
||||
|
||||
World getWorld();
|
||||
GameProfile getOwner();
|
||||
|
||||
/**
|
||||
* @since Forestry 4.2
|
||||
* @return exact coordinates where bee FX should spawn from
|
||||
*/
|
||||
Vec3 getBeeFXCoordinates();
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IBeeHousingInventory {
|
||||
|
||||
ItemStack getQueen();
|
||||
ItemStack getDrone();
|
||||
|
||||
void setQueen(ItemStack itemstack);
|
||||
void setDrone(ItemStack itemstack);
|
||||
|
||||
/**
|
||||
* Adds products to the housing's inventory.
|
||||
*
|
||||
* @param product ItemStack with the product to add.
|
||||
* @param all if true, success requires that all products are added
|
||||
* @return boolean indicating success or failure.
|
||||
*/
|
||||
boolean addProduct(ItemStack product, boolean all);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
/**
|
||||
* Custom colour provider for bees with complicated colors.
|
||||
*/
|
||||
public interface IBeeIconColourProvider {
|
||||
int getIconColour(int renderPass);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public interface IBeeIconProvider {
|
||||
void registerIcons(IIconRegister register);
|
||||
IIcon getIcon(EnumBeeType type, int renderPass);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
public interface IBeeListener {
|
||||
|
||||
/**
|
||||
* Called when the bees wear out the housing's equipment.
|
||||
* @param amount Integer indicating the amount worn out.
|
||||
*/
|
||||
void wearOutEquipment(int amount);
|
||||
|
||||
/**
|
||||
* Called after the children have been spawned, and before the new princess is spawned.
|
||||
*/
|
||||
void onQueenDeath();
|
||||
|
||||
/**
|
||||
* Called when the bees have retrieved some pollen.
|
||||
* @return true if this bee listener handled the pollen.
|
||||
*/
|
||||
boolean onPollenRetrieved(IIndividual pollen);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
public interface IBeeModifier {
|
||||
/**
|
||||
* @param genome Genome of the bee this modifier is called for.
|
||||
* @param currentModifier Current modifier.
|
||||
* @return Float used to modify the base territory.
|
||||
*/
|
||||
float getTerritoryModifier(IBeeGenome genome, float currentModifier);
|
||||
|
||||
/**
|
||||
* @param genome Genome of the bee this modifier is called for.
|
||||
* @param mate Genome of the bee mate this modifier is called for.
|
||||
* @param currentModifier Current modifier.
|
||||
* @return Float used to modify the base mutation chance.
|
||||
*/
|
||||
float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier);
|
||||
|
||||
/**
|
||||
* @param genome Genome of the bee this modifier is called for.
|
||||
* @param currentModifier Current modifier.
|
||||
* @return Float used to modify the life span of queens.
|
||||
*/
|
||||
float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier);
|
||||
|
||||
/**
|
||||
* @param genome Genome of the bee this modifier is called for.
|
||||
* @param currentModifier Current modifier.
|
||||
* @return Float modifying the production speed of queens.
|
||||
*/
|
||||
float getProductionModifier(IBeeGenome genome, float currentModifier);
|
||||
|
||||
/**
|
||||
* @param genome Genome of the bee this modifier is called for.
|
||||
* @return Float modifying the flowering of queens.
|
||||
*/
|
||||
float getFloweringModifier(IBeeGenome genome, float currentModifier);
|
||||
|
||||
/**
|
||||
* @param genome Genome of the bee this modifier is called for.
|
||||
* @return Float modifying the chance for a swarmer queen to die off.
|
||||
*/
|
||||
float getGeneticDecay(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();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import forestry.api.genetics.IMutation;
|
||||
|
||||
public interface IBeeMutation extends IMutation {
|
||||
|
||||
IBeeRoot getRoot();
|
||||
|
||||
/**
|
||||
* @return float representing the chance for mutation to occur. note that this is 0 - 100 based, since it was an integer previously!
|
||||
*/
|
||||
float getChance(IBeeHousing housing, IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1, IBeeGenome genome0, IBeeGenome genome1);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import forestry.api.genetics.IMutationCustom;
|
||||
|
||||
public interface IBeeMutationCustom extends IBeeMutation, IMutationCustom {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
public interface IBeeMutationFactory {
|
||||
/**
|
||||
* Creates a new bee mutation.
|
||||
* Automatically registered with BeeManager.beeRoot.registerMutation()
|
||||
* See IBeeMutationCustom and IMutationCustom for adding additional properties to the returned mutation.
|
||||
*
|
||||
* @param parentBee0 A parent bee for this mutation
|
||||
* @param parentBee1 A parent bee for this mutation
|
||||
* @param result The resulting alleles for this mutation
|
||||
* @param chance The chance that breeding the two parent bees will result in this mutation
|
||||
* @return a new bee mutation.
|
||||
*/
|
||||
IBeeMutationCustom createMutation(IAlleleBeeSpecies parentBee0, IAlleleBeeSpecies parentBee1, IAllele[] result, int chance);
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public interface IBeeRoot extends ISpeciesRoot {
|
||||
|
||||
/**
|
||||
* @return true if passed item is a Forestry bee. Equal to getType(ItemStack stack) != EnumBeeType.NONE
|
||||
*/
|
||||
@Override
|
||||
boolean isMember(ItemStack stack);
|
||||
|
||||
/**
|
||||
* @return {@link IBee} pattern parsed from the passed stack's nbt data.
|
||||
*/
|
||||
@Override
|
||||
IBee getMember(ItemStack stack);
|
||||
|
||||
@Override
|
||||
IBee getMember(NBTTagCompound compound);
|
||||
|
||||
/* GENOME CONVERSION */
|
||||
@Override
|
||||
IBee templateAsIndividual(IAllele[] template);
|
||||
|
||||
@Override
|
||||
IBee templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
|
||||
@Override
|
||||
IBeeGenome templateAsGenome(IAllele[] template);
|
||||
|
||||
@Override
|
||||
IBeeGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
|
||||
/* BREEDING TRACKER */
|
||||
/**
|
||||
* @param world
|
||||
* @return {@link IApiaristTracker} associated with the passed world.
|
||||
*/
|
||||
IApiaristTracker getBreedingTracker(World world, GameProfile player);
|
||||
|
||||
/* BEE SPECIFIC */
|
||||
/**
|
||||
* @return type of bee encoded on the itemstack. EnumBeeType.NONE if it isn't a bee.
|
||||
*/
|
||||
@Override
|
||||
EnumBeeType getType(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);
|
||||
|
||||
/**
|
||||
* @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);
|
||||
|
||||
/* TEMPLATES */
|
||||
@Override
|
||||
ArrayList<IBee> getIndividualTemplates();
|
||||
|
||||
/* MUTATIONS */
|
||||
@Override
|
||||
Collection<IBeeMutation> getMutations(boolean shuffle);
|
||||
|
||||
/* GAME MODE */
|
||||
void resetBeekeepingMode();
|
||||
|
||||
ArrayList<IBeekeepingMode> getBeekeepingModes();
|
||||
|
||||
IBeekeepingMode getBeekeepingMode(World world);
|
||||
|
||||
IBeekeepingMode getBeekeepingMode(String name);
|
||||
|
||||
void registerBeekeepingMode(IBeekeepingMode mode);
|
||||
|
||||
void setBeekeepingMode(World world, String name);
|
||||
|
||||
/* MISC */
|
||||
/**
|
||||
* Creates beekeepingLogic for a housing.
|
||||
* Should be used when the housing is created, see IBeekeepingLogic
|
||||
*/
|
||||
IBeekeepingLogic createBeekeepingLogic(IBeeHousing housing);
|
||||
|
||||
/**
|
||||
* Combines multiple modifiers from an IBeeHousing into one.
|
||||
* Stays up to date with changes to the housing's modifiers.
|
||||
*/
|
||||
IBeeModifier createBeeHousingModifier(IBeeHousing housing);
|
||||
|
||||
/**
|
||||
* Combines multiple listeners from an IBeeHousing into one.
|
||||
* Stays up to date with changes to the housing's listeners.
|
||||
*/
|
||||
IBeeListener createBeeHousingListener(IBeeHousing housing);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
||||
import forestry.api.core.INBTTagable;
|
||||
|
||||
/**
|
||||
* Stores beekeeping logic for bee housings.
|
||||
* Get one with BeeManager.beeRoot.createBeekeepingLogic(IBeeHousing housing)
|
||||
* Save and load it to NBT using the INBTTagable methods.
|
||||
*/
|
||||
public interface IBeekeepingLogic extends INBTTagable {
|
||||
|
||||
/* SERVER */
|
||||
|
||||
/**
|
||||
* Checks that the bees can work, setting error conditions on the housing where needed
|
||||
* @return true if no errors are present and doWork should be called
|
||||
*/
|
||||
boolean canWork();
|
||||
|
||||
/**
|
||||
* Performs actual work, breeding, production, etc.
|
||||
*/
|
||||
void doWork();
|
||||
|
||||
|
||||
/* CLIENT */
|
||||
|
||||
/**
|
||||
* Call this when the housing comes into view of the client.
|
||||
* (i.e. when tile.getDescriptionPacket() is called)
|
||||
*/
|
||||
void syncToClient();
|
||||
void syncToClient(EntityPlayerMP player);
|
||||
|
||||
/**
|
||||
* Get the progress bar for breeding and production.
|
||||
* To avoid network spam, this is only available server-side,
|
||||
* and must be synced manually to the client when a GUI is open.
|
||||
*/
|
||||
int getBeeProgressPercent();
|
||||
|
||||
/**
|
||||
* Whether bee fx should be active.
|
||||
* Internally, this is automatically synced to the client.
|
||||
*/
|
||||
boolean canDoBeeFX();
|
||||
|
||||
/**
|
||||
* Display bee fx. Calls IBee.doFX(IEffectData[] storedData, IBeeHousing housing) on the queen.
|
||||
* Internally, the queen is automatically synced to the client for the fx.
|
||||
*/
|
||||
void doBeeFX();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IBeekeepingMode {
|
||||
|
||||
/**
|
||||
* @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, IBeeHousing housing);
|
||||
|
||||
/**
|
||||
* @param queen
|
||||
* @param housing
|
||||
* @return true if the queen is being overworked in the bee housing (with chance). will trigger a negative effect.
|
||||
*/
|
||||
boolean isOverworked(IBee queen, IBeeHousing housing);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param queen
|
||||
* @param offspring
|
||||
* @param housing
|
||||
* @return true if the genetic structure of the queen is breaking down during spawning of the offspring (with chance). will trigger a negative effect.
|
||||
*/
|
||||
boolean isDegenerating(IBee queen, IBee offspring, IBeeHousing housing);
|
||||
|
||||
/**
|
||||
* @param queen
|
||||
* @return true if an offspring of this queen is considered a natural
|
||||
*/
|
||||
boolean isNaturalOffspring(IBee queen);
|
||||
|
||||
/**
|
||||
* @param queen
|
||||
* @return true if this mode allows the passed queen or princess to be multiplied
|
||||
*/
|
||||
boolean mayMultiplyPrincess(IBee queen);
|
||||
|
||||
/**
|
||||
* @return the bee modifier for this mode
|
||||
*/
|
||||
IBeeModifier getBeeModifier();
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
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 with HiveManager.get___Hive.addDrop
|
||||
*
|
||||
* @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 Minecraft world this is called for.
|
||||
* @param x x-Coordinate of the broken hive.
|
||||
* @param y y-Coordinate of the broken hive.
|
||||
* @param z z-Coordinate of the broken hive.
|
||||
* @return Chance for drop as an integer of 0 - 100.
|
||||
*/
|
||||
int getChance(World world, int x, int y, int z);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IHiveFrame {
|
||||
|
||||
/**
|
||||
* 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. The wear modifier of the current beekeeping mode has already been taken into account.
|
||||
* @return ItemStack containing the actual frame with adjusted damage, or null if it has been broken.
|
||||
*/
|
||||
ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear);
|
||||
|
||||
IBeeModifier getBeeModifier();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public interface IJubilanceFactory {
|
||||
/** The default Jubilance Provider is satisfied when the humidity and temperature are ideal for the bee. */
|
||||
IJubilanceProvider getDefault();
|
||||
|
||||
/** The Requires Resource Jubilance Provider is satisfied when a specific block is under the hive. */
|
||||
IJubilanceProvider getRequiresResource(Block block, int meta);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
public interface IJubilanceProvider {
|
||||
|
||||
/**
|
||||
* Returns true when conditions are right to make this species Jubilant.
|
||||
* Jubilant bees can produce their Specialty products.
|
||||
*/
|
||||
boolean isJubilant(IAlleleBeeSpecies species, IBeeGenome genome, IBeeHousing housing);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture.hives;
|
||||
|
||||
public class HiveManager {
|
||||
|
||||
public static IHiveRegistry hiveRegistry;
|
||||
public static IHiveGenHelper genHelper;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture.hives;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
|
||||
public interface IHiveDescription {
|
||||
|
||||
/**
|
||||
* The hive generator for this hive.
|
||||
*/
|
||||
IHiveGen getHiveGen();
|
||||
|
||||
/**
|
||||
* The hive block to be placed in the world.
|
||||
*/
|
||||
Block getBlock();
|
||||
int getMeta();
|
||||
|
||||
/**
|
||||
* returns true if the hive can be generated in these conditions.
|
||||
* Used as a fast early-elimination check for hives that have no hope of spawning in the area.
|
||||
*/
|
||||
boolean isGoodBiome(BiomeGenBase biome);
|
||||
boolean isGoodHumidity(EnumHumidity humidity);
|
||||
boolean isGoodTemperature(EnumTemperature temperature);
|
||||
|
||||
/**
|
||||
* float representing the relative chance a hive will generate in a chunk.
|
||||
* Default is 1.0, higher numbers result in more hives, smaller will result in fewer.
|
||||
* Tree hives want around 3.0 to 4.0 since there are less locations to generate on.
|
||||
*/
|
||||
float getGenChance();
|
||||
|
||||
/**
|
||||
* Called after successful hive generation.
|
||||
* world, x, y, z give the location of the new hive.
|
||||
**/
|
||||
void postGen(World world, int x, int y, int z);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture.hives;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IHiveGen {
|
||||
|
||||
/**
|
||||
* return a Y value that the hive should try to generate at.
|
||||
* returns negative if the hive can't be placed anywhere.
|
||||
*/
|
||||
int getYForHive(World world, int x, int z);
|
||||
|
||||
/**
|
||||
* returns true if the hive can be generated at this location.
|
||||
* Used for advanced conditions, like checking that the ground below the hive is a certain type.
|
||||
*/
|
||||
boolean isValidLocation(World world, int x, int y, int z);
|
||||
|
||||
/**
|
||||
* returns true if the hive can safely replace the block at this location.
|
||||
*/
|
||||
boolean canReplace(World world, int x, int y, int z);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture.hives;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public interface IHiveGenHelper {
|
||||
|
||||
/**
|
||||
* Returns a hiveGen for a hive that spawns on the ground.
|
||||
* validGroundBlocks specifies which block materials it can spawn on.
|
||||
*/
|
||||
IHiveGen ground(Block... validGroundBlocks);
|
||||
|
||||
/**
|
||||
* Returns a hiveGen for a hive that spawns in trees.
|
||||
*/
|
||||
IHiveGen tree();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture.hives;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
|
||||
public interface IHiveRegistry {
|
||||
|
||||
/* Forestry Hive Names */
|
||||
public static final String forest = "Forestry:forest";
|
||||
public static final String meadows = "Forestry:meadows";
|
||||
public static final String desert = "Forestry:desert";
|
||||
public static final String jungle = "Forestry:jungle";
|
||||
public static final String end = "Forestry:end";
|
||||
public static final String snow = "Forestry:snow";
|
||||
public static final String swamp = "Forestry:swamp";
|
||||
|
||||
/**
|
||||
* Adds a new hive to be generated in the world.
|
||||
*/
|
||||
void registerHive(String hiveName, IHiveDescription hiveDescription);
|
||||
|
||||
/**
|
||||
* Add drops to a registered hive.
|
||||
*/
|
||||
void addDrops(String hiveName, IHiveDrop... drops);
|
||||
void addDrops(String hiveName, List<IHiveDrop> drop);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@API(apiVersion="4.1.0", owner="ForestryAPI|apiculture", provides="ForestryAPI|hives")
|
||||
package forestry.api.apiculture.hives;
|
||||
import cpw.mods.fml.common.API;
|
||||
@@ -0,0 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@API(apiVersion="5.0.0", owner="ForestryAPI|core", provides="ForestryAPI|apiculture")
|
||||
package forestry.api.apiculture;
|
||||
import cpw.mods.fml.common.API;
|
||||
@@ -0,0 +1,48 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
|
||||
public enum EnumFruitFamily implements IFruitFamily {
|
||||
PRUNES("prunes", "Prunus domestica"),
|
||||
POMES("pomes", "Pomum"),
|
||||
JUNGLE("jungle", "Tropicus"),
|
||||
NUX("nuts", "Nux");
|
||||
|
||||
private final String uid;
|
||||
private final String scientific;
|
||||
|
||||
EnumFruitFamily(String uid, String scientific) {
|
||||
this.uid = uid;
|
||||
this.scientific = scientific;
|
||||
AlleleManager.alleleRegistry.registerFruitFamily(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return "forestry." + uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getScientific() {
|
||||
return this.scientific;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return StatCollector.translateToLocal("for.family." + uid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return StatCollector.translateToLocal("for.family." + uid + ".description");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
|
||||
public enum EnumGermlingType implements ISpeciesType {
|
||||
SAPLING("sapling"), BLOSSOM("blossom"), POLLEN("pollen"), GERMLING("germling"), NONE("none");
|
||||
|
||||
public static final EnumGermlingType[] VALUES = values();
|
||||
|
||||
private final String name;
|
||||
|
||||
EnumGermlingType(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
public enum EnumGrowthConditions {
|
||||
HOSTILE, PALTRY, NORMAL, GOOD, EXCELLENT
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
public enum EnumLeafType {
|
||||
DECIDUOUS, CONIFERS, JUNGLE, WILLOW, MAPLE, PALM
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleArea;
|
||||
import forestry.api.genetics.IAlleleBoolean;
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IAllelePlantType;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public enum EnumTreeChromosome implements IChromosomeType {
|
||||
|
||||
/**
|
||||
* Determines the following: - WorldGen, including the used wood blocks - {@link IFruitFamily}s supported. Limits which {@link IFruitProvider}
|
||||
* will actually yield fruit with this species. - Native {@link EnumPlantType} for this tree. Combines with the PLANT chromosome.
|
||||
*/
|
||||
SPECIES(IAlleleTreeSpecies.class),
|
||||
/**
|
||||
* {@link IGrowthProvider}, determines conditions required by the tree to grow.
|
||||
*/
|
||||
GROWTH(IAlleleGrowth.class),
|
||||
/**
|
||||
* A float modifying the height of the tree. Taken into account at worldgen.
|
||||
*/
|
||||
HEIGHT(IAlleleFloat.class),
|
||||
/**
|
||||
* Chance for saplings.
|
||||
*/
|
||||
FERTILITY(IAlleleFloat.class),
|
||||
/**
|
||||
* {@link IFruitProvider}, determines if and what fruits are grown on the tree. Limited by the {@link IFruitFamily}s the species supports.
|
||||
*/
|
||||
FRUITS(IAlleleFruit.class),
|
||||
/**
|
||||
* Chance for fruit leaves and/or drops.
|
||||
*/
|
||||
YIELD(IAlleleFloat.class),
|
||||
/**
|
||||
* May add additional tolerances for {@link EnumPlantTypes}.
|
||||
*/
|
||||
PLANT(IAllelePlantType.class),
|
||||
/**
|
||||
* Determines the speed at which fruit will ripen on this tree.
|
||||
*/
|
||||
SAPPINESS(IAlleleFloat.class),
|
||||
/**
|
||||
* Territory for leaf effects. Unused.
|
||||
*/
|
||||
TERRITORY(IAlleleArea.class),
|
||||
/**
|
||||
* Leaf effect. Unused.
|
||||
*/
|
||||
EFFECT(IAlleleLeafEffect.class),
|
||||
/**
|
||||
* Amount of random ticks which need to elapse before a sapling will grow into a tree.
|
||||
*/
|
||||
MATURATION(IAlleleInteger.class),
|
||||
|
||||
GIRTH(IAlleleInteger.class),
|
||||
/**
|
||||
* Determines if the tree can burn.
|
||||
*/
|
||||
FIREPROOF(IAlleleBoolean.class),
|
||||
;
|
||||
|
||||
Class<? extends IAllele> clss;
|
||||
|
||||
EnumTreeChromosome(Class<? extends IAllele> clss) {
|
||||
this.clss = clss;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IAllele> getAlleleClass() {
|
||||
return clss;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISpeciesRoot getSpeciesRoot() {
|
||||
return TreeManager.treeRoot;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public enum EnumWoodType {
|
||||
LARCH, TEAK, ACACIA, LIME, CHESTNUT,
|
||||
WENGE, BAOBAB, SEQUOIA(4.0f), KAPOK, EBONY,
|
||||
MAHOGANY, BALSA(1.0f), WILLOW, WALNUT, GREENHEART(7.5f),
|
||||
CHERRY, MAHOE, POPLAR, PALM, PAPAYA,
|
||||
PINE(3.0f), PLUM, MAPLE, CITRUS, GIGANTEUM,
|
||||
IPE, PADAUK, COCOBOLO, ZEBRAWOOD;
|
||||
|
||||
public static final float DEFAULT_HARDNESS = 2.0f;
|
||||
public static final EnumWoodType[] VALUES = values();
|
||||
|
||||
private final float hardness;
|
||||
|
||||
EnumWoodType() {
|
||||
this.hardness = DEFAULT_HARDNESS;
|
||||
}
|
||||
|
||||
EnumWoodType(float hardness) {
|
||||
this.hardness = hardness;
|
||||
}
|
||||
|
||||
public float getHardness() {
|
||||
return hardness;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Forestry 4.2. Woods use itemDamage instead of NBT now
|
||||
*/
|
||||
@Deprecated
|
||||
public void saveToCompound(NBTTagCompound compound) {
|
||||
compound.setInteger("WoodType", ordinal());
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Forestry 4.2. Woods use itemDamage instead of NBT now
|
||||
*/
|
||||
@Deprecated
|
||||
public static EnumWoodType getFromCompound(NBTTagCompound compound) {
|
||||
if (compound != null) {
|
||||
int typeOrdinal = compound.getInteger("WoodType");
|
||||
if (typeOrdinal >= 0 && typeOrdinal < VALUES.length) {
|
||||
return VALUES[typeOrdinal];
|
||||
}
|
||||
}
|
||||
|
||||
return EnumWoodType.LARCH;
|
||||
}
|
||||
|
||||
public static EnumWoodType getRandom(Random random) {
|
||||
return VALUES[random.nextInt(VALUES.length)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
/**
|
||||
* Simple allele encapsulating an {@link IFruitProvider}.
|
||||
*/
|
||||
public interface IAlleleFruit extends IAllele {
|
||||
|
||||
IFruitProvider getProvider();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
/**
|
||||
* Simple allele encapsulating an {@link IGrowthProvider}.
|
||||
*/
|
||||
public interface IAlleleGrowth extends IAllele {
|
||||
|
||||
IGrowthProvider getProvider();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IAlleleEffect;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
|
||||
/**
|
||||
* Simple allele encapsulating a leaf effect. (Not implemented)
|
||||
*/
|
||||
public interface IAlleleLeafEffect extends IAlleleEffect {
|
||||
|
||||
IEffectData doEffect(ITreeGenome genome, IEffectData storedData, World world, int x, int y, int z);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
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 {
|
||||
|
||||
ITreeRoot getRoot();
|
||||
|
||||
/**
|
||||
* @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 Tree generator for this species.
|
||||
*/
|
||||
ITreeGenerator getGenerator();
|
||||
|
||||
/* TEXTURES AND OVERRIDES */
|
||||
int getLeafColour(boolean pollinated);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
IIcon getLeafIcon(boolean pollinated, boolean fancy);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
IIcon getGermlingIcon(EnumGermlingType type, int renderPass);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
int getGermlingColour(EnumGermlingType type, int renderPass);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.genetics.IAlleleSpeciesCustom;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
|
||||
public interface IAlleleTreeSpeciesCustom extends IAlleleSpeciesCustom, IAlleleTreeSpecies {
|
||||
|
||||
/** Add a fruit family for this tree. Trees can have multiple fruit families. */
|
||||
IAlleleTreeSpeciesCustom addFruitFamily(IFruitFamily family);
|
||||
|
||||
/** Set the minecraft plant type for this tree. Default is Plains. */
|
||||
IAlleleTreeSpeciesCustom setPlantType(EnumPlantType type);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
|
||||
public interface IArboristTracker extends IBreedingTracker {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
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 IIcon 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);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerIcons(IIconRegister register);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
/**
|
||||
* Provides icons for saplings, pollen, etc.
|
||||
* You must implement this yourself to use TreeManager.treeFactory.createSpecies()
|
||||
* There is no default implementation because every sapling has a unique icon.
|
||||
*/
|
||||
public interface IGermlingIconProvider {
|
||||
void registerIcons(IIconRegister register);
|
||||
IIcon getIcon(EnumGermlingType type, int renderPass);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
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 Genome of the tree this is called for.
|
||||
* @param world Minecraft world the tree will inhabit.
|
||||
* @param xPos x-Coordinate to attempt growth at.
|
||||
* @param yPos y-Coordinate to attempt growth at.
|
||||
* @param zPos z-Coordinate to attempt growth at.
|
||||
* @param expectedGirth Trunk size of the tree to generate.
|
||||
* @param expectedHeight Height of the tree to generate.
|
||||
* @return true if the tree can grow at the given coordinates, false otherwise.
|
||||
*/
|
||||
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();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
/**
|
||||
* Provides icons for leaves. Used by TreeManager.treeFactory.createSpecies()
|
||||
* Get a default Forestry implementation from TreeManager.treeFactory.getLeafIconProvider() or implement your own.
|
||||
*
|
||||
* If you implement your own, be sure to register the icons.
|
||||
* Icon registration is not done here because these icons are heavily reused.
|
||||
*/
|
||||
public interface ILeafIconProvider {
|
||||
IIcon getIcon(boolean pollinated, boolean fancy);
|
||||
int getColor(boolean pollinated);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface ILeafTickHandler {
|
||||
boolean onRandomLeafTick(ITree tree, World world, int x, int y, int z, boolean isDestroyed);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
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 ItemStack containing the grafter.
|
||||
* @param world Minecraft world the player and the target block inhabit.
|
||||
* @param x x-Coordinate of the broken leaf block.
|
||||
* @param y y-Coordinate of the broken leaf block.
|
||||
* @param z z-Coordinate of the broken leaf block.
|
||||
* @return Float representing the factor the usual drop chance is to be multiplied by.
|
||||
*/
|
||||
float getSaplingModifier(ItemStack stack, World world, EntityPlayer player, int x, int y, int z);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
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 com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.world.ITreeGenData;
|
||||
|
||||
public interface ITree extends IIndividual, ITreeGenData {
|
||||
|
||||
void mate(ITree other);
|
||||
|
||||
IEffectData[] doEffect(IEffectData[] storedData, World world, int x, int y, int z);
|
||||
|
||||
IEffectData[] doFX(IEffectData[] storedData, World world, int x, int y, int z);
|
||||
|
||||
ITreeGenome getGenome();
|
||||
|
||||
ITreeGenome getMate();
|
||||
|
||||
EnumSet<EnumPlantType> getPlantTypes();
|
||||
|
||||
/**
|
||||
* @since Forestry 4.0
|
||||
*/
|
||||
ITree[] getSaplings(World world, GameProfile playerProfile, int x, int y, int z, float modifier);
|
||||
|
||||
ItemStack[] getProduceList();
|
||||
|
||||
ItemStack[] getSpecialtyList();
|
||||
|
||||
ItemStack[] produceStacks(World world, int x, int y, int z, int ripeningTime);
|
||||
|
||||
/**
|
||||
* @return Boolean indicating whether a sapling can stay planted at the given position.
|
||||
*/
|
||||
boolean canStay(World world, int x, int y, int 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();
|
||||
|
||||
/**
|
||||
* @return Integer denoting how resilient leaf blocks are against adverse influences (i.e. caterpillars).
|
||||
*/
|
||||
int getResilience();
|
||||
|
||||
/**
|
||||
* @return Integer denoting the size of the tree trunk.
|
||||
*/
|
||||
int getGirth(World world, int x, int y, int 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();
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import forestry.api.genetics.IClassification;
|
||||
|
||||
public interface ITreeFactory {
|
||||
/**
|
||||
* Creates a new tree species.
|
||||
* Automatically registered with AlleleManager.alleleRegistry.registerAllele()
|
||||
* See IAlleleTreeSpeciesCustom and IAlleleSpeciesCustom for adding additional properties to the returned species.
|
||||
*
|
||||
* @param uid Unique Identifier for this species
|
||||
* @param unlocalizedName Unlocalized name for this species
|
||||
* @param authority Authority for the binomial name, e.g. "Sengir" on species of base Forestry.
|
||||
* @param unlocalizedDescription Unlocalized description for this species
|
||||
* @param dominant Whether this species is genetically dominant (false means it is recessive)
|
||||
* @param branch Classification of this species
|
||||
* @param binomial Binomial name of the species sans genus. "humboldti" will have the bee species flavour name be "Apis humboldti". Feel free to use fun names or null.
|
||||
* @param leafIconProvider The leaf icon provider for this species
|
||||
* @param germlingIconProvider The germling icon provider for this species
|
||||
* @param generator The tree generator
|
||||
* @return a new tree species allele.
|
||||
*/
|
||||
IAlleleTreeSpeciesCustom createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, ILeafIconProvider leafIconProvider, IGermlingIconProvider germlingIconProvider, ITreeGenerator generator);
|
||||
|
||||
/** Get one of the built-in Forestry leaf types. Default type is deciduous. */
|
||||
ILeafIconProvider getLeafIconProvider(EnumLeafType enumLeafType, Color color, Color colorPollinated);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import forestry.api.world.ITreeGenData;
|
||||
|
||||
/**
|
||||
* Implements the tree generation for a tree species.
|
||||
*/
|
||||
public interface ITreeGenerator {
|
||||
WorldGenerator getWorldGenerator(ITreeGenData tree);
|
||||
|
||||
void setLogBlock(ITreeGenome genome, World world, int x, int y, int z, ForgeDirection facing);
|
||||
|
||||
void setLeaves(ITreeGenome genome, World world, GameProfile owner, int x, int y, int z, boolean decorative);
|
||||
|
||||
/**
|
||||
* @deprecated since Forestry 4.2. use the genome version
|
||||
*/
|
||||
@Deprecated
|
||||
void setLogBlock(World world, int x, int y, int z, ForgeDirection facing);
|
||||
|
||||
/**
|
||||
* @deprecated since Forestry 4.2. use the genome version
|
||||
*/
|
||||
@Deprecated
|
||||
void setLeaves(World world, GameProfile owner, int x, int y, int z, boolean decorative);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
import forestry.api.genetics.IGenome;
|
||||
|
||||
public interface ITreeGenome extends IGenome {
|
||||
|
||||
IAlleleTreeSpecies getPrimary();
|
||||
|
||||
IAlleleTreeSpecies getSecondary();
|
||||
|
||||
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();
|
||||
|
||||
IAlleleLeafEffect getEffect();
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
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);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public interface ITreeMutation extends IMutation {
|
||||
|
||||
/**
|
||||
* @return {@link ISpeciesRoot} this mutation is associated with.
|
||||
*/
|
||||
ITreeRoot getRoot();
|
||||
|
||||
/**
|
||||
* @return float representing the percent chance for mutation to occur, from 0.0 to 100.0.
|
||||
* @since Forestry 4.0
|
||||
*/
|
||||
float getChance(World world, int x, int y, int z, IAlleleTreeSpecies allele0, IAlleleTreeSpecies allele1, ITreeGenome genome0, ITreeGenome genome1);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.genetics.IMutationCustom;
|
||||
|
||||
public interface ITreeMutationCustom extends ITreeMutation, IMutationCustom {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
public interface ITreeMutationFactory {
|
||||
/**
|
||||
* Creates a new tree mutation.
|
||||
* Automatically registered with TreeManager.treeRoot.registerMutation()
|
||||
* See ITreeMutationCustom and IMutationCustom for adding additional properties to the returned mutation.
|
||||
*
|
||||
* @param parentTree0 A parent tree for this mutation
|
||||
* @param parentTree1 A parent tree for this mutation
|
||||
* @param result The resulting alleles for this mutation
|
||||
* @param chance The chance that breeding the two parent trees will result in this mutation
|
||||
* @return a new tree mutation.
|
||||
*/
|
||||
ITreeMutationCustom createMutation(IAlleleTreeSpecies parentTree0, IAlleleTreeSpecies parentTree1, IAllele[] result, int chance);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public interface ITreeRoot extends ISpeciesRoot {
|
||||
|
||||
@Override
|
||||
boolean isMember(ItemStack itemstack);
|
||||
|
||||
@Override
|
||||
ITree getMember(ItemStack itemstack);
|
||||
|
||||
@Override
|
||||
ITree getMember(NBTTagCompound compound);
|
||||
|
||||
@Override
|
||||
ITree templateAsIndividual(IAllele[] template);
|
||||
|
||||
@Override
|
||||
ITree templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
|
||||
@Override
|
||||
ITreeGenome templateAsGenome(IAllele[] template);
|
||||
|
||||
@Override
|
||||
ITreeGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
|
||||
/**
|
||||
* @param world
|
||||
* @return {@link IArboristTracker} associated with the passed world.
|
||||
*/
|
||||
@Override
|
||||
IArboristTracker getBreedingTracker(World world, GameProfile player);
|
||||
|
||||
/* TREE SPECIFIC */
|
||||
/**
|
||||
* Register a leaf tick handler.
|
||||
* @param handler the {@link ILeafTickHandler} to register.
|
||||
*/
|
||||
void registerLeafTickHandler(ILeafTickHandler handler);
|
||||
|
||||
Collection<ILeafTickHandler> getLeafTickHandlers();
|
||||
|
||||
/**
|
||||
* @return type of tree encoded on the itemstack. EnumGermlingType.NONE if it isn't a tree.
|
||||
*/
|
||||
@Override
|
||||
EnumGermlingType getType(ItemStack stack);
|
||||
|
||||
ITree getTree(World world, int x, int y, int z);
|
||||
|
||||
ITree getTree(World world, ITreeGenome genome);
|
||||
|
||||
boolean plantSapling(World world, ITree tree, GameProfile owner, int x, int y, int z);
|
||||
|
||||
@Override
|
||||
IChromosome[] templateAsChromosomes(IAllele[] template);
|
||||
|
||||
@Override
|
||||
IChromosome[] templateAsChromosomes(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
|
||||
boolean setFruitBlock(World world, IAlleleFruit allele, float sappiness, short[] indices, int x, int y, int z);
|
||||
|
||||
/* GAME MODE */
|
||||
ArrayList<ITreekeepingMode> getTreekeepingModes();
|
||||
|
||||
ITreekeepingMode getTreekeepingMode(World world);
|
||||
|
||||
ITreekeepingMode getTreekeepingMode(String name);
|
||||
|
||||
void registerTreekeepingMode(ITreekeepingMode mode);
|
||||
|
||||
void setTreekeepingMode(World world, String name);
|
||||
|
||||
/* TEMPLATES */
|
||||
@Override
|
||||
ArrayList<ITree> getIndividualTemplates();
|
||||
|
||||
/* MUTATIONS */
|
||||
@Override
|
||||
Collection<ITreeMutation> getMutations(boolean shuffle);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
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();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IWoodItemAccess {
|
||||
ItemStack getLog(EnumWoodType woodType, boolean fireproof);
|
||||
ItemStack getPlanks(EnumWoodType woodType, boolean fireproof);
|
||||
ItemStack getSlab(EnumWoodType woodType, boolean fireproof);
|
||||
ItemStack getFence(EnumWoodType woodType, boolean fireproof);
|
||||
ItemStack getStairs(EnumWoodType woodType, boolean fireproof);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
public class TreeManager {
|
||||
|
||||
/**
|
||||
* Convenient access to AlleleManager.alleleRegistry.getSpeciesRoot("rootTrees")
|
||||
*/
|
||||
public static ITreeRoot treeRoot;
|
||||
|
||||
/**
|
||||
* Convenient access to wood items.
|
||||
*/
|
||||
public static IWoodItemAccess woodItemAccess;
|
||||
|
||||
/**
|
||||
* Used to create new trees.
|
||||
*/
|
||||
public static ITreeFactory treeFactory;
|
||||
|
||||
/**
|
||||
* Used to create new tree mutations.
|
||||
*/
|
||||
public static ITreeMutationFactory treeMutationFactory;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@API(apiVersion = "4.2.1", owner = "ForestryAPI|core", provides = "ForestryAPI|arboriculture")
|
||||
package forestry.api.arboriculture;
|
||||
import cpw.mods.fml.common.API;
|
||||
@@ -0,0 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.circuits;
|
||||
|
||||
public class ChipsetManager {
|
||||
|
||||
public static ISolderManager solderManager;
|
||||
public static ICircuitRegistry circuitRegistry;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.circuits;
|
||||
|
||||
public enum CircuitSocketType implements ICircuitSocketType {
|
||||
NONE("none"),
|
||||
FARM("forestry.farm"),
|
||||
ELECTRIC_ENGINE("forestry.electric.engine"),
|
||||
MACHINE("forestry.machine");
|
||||
|
||||
private final String uid;
|
||||
|
||||
CircuitSocketType(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(ICircuitSocketType socketType) {
|
||||
return uid.equals(socketType.getUid());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
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(Object tile);
|
||||
|
||||
void onInsertion(int slot, Object tile);
|
||||
|
||||
void onLoad(int slot, Object tile);
|
||||
|
||||
void onRemoval(int slot, Object tile);
|
||||
|
||||
void onTick(int slot, Object tile);
|
||||
|
||||
void addTooltip(List<String> list);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.circuits;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.core.INBTTagable;
|
||||
|
||||
public interface ICircuitBoard extends INBTTagable {
|
||||
|
||||
int getPrimaryColor();
|
||||
|
||||
int getSecondaryColor();
|
||||
|
||||
void addTooltip(List<String> list);
|
||||
|
||||
void onInsertion(Object tile);
|
||||
|
||||
void onLoad(Object tile);
|
||||
|
||||
void onRemoval(Object tile);
|
||||
|
||||
void onTick(Object tile);
|
||||
|
||||
ICircuit[] getCircuits();
|
||||
|
||||
/**
|
||||
* Specifies where a circuit can be used.
|
||||
* @since Forestry 4.0
|
||||
*/
|
||||
ICircuitSocketType getSocketType();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.circuits;
|
||||
|
||||
public interface ICircuitLayout {
|
||||
|
||||
/** unique ID for this circuit layout */
|
||||
String getUID();
|
||||
|
||||
/** localized name for this circuit layout */
|
||||
String getName();
|
||||
|
||||
/** localized string for how this circuit layout is used */
|
||||
String getUsage();
|
||||
|
||||
/**
|
||||
* Specifies where a circuit layout is used.
|
||||
* @since Forestry 4.0
|
||||
*/
|
||||
ICircuitSocketType getSocketType();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.circuits;
|
||||
|
||||
public interface ICircuitLibrary {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.circuits;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface ICircuitRegistry {
|
||||
|
||||
/* CIRCUITS */
|
||||
Map<String, ICircuit> getRegisteredCircuits();
|
||||
|
||||
void registerCircuit(ICircuit circuit);
|
||||
|
||||
ICircuit getCircuit(String uid);
|
||||
|
||||
ICircuitLibrary getCircuitLibrary(World world, String playername);
|
||||
|
||||
/* LAYOUTS */
|
||||
Map<String, ICircuitLayout> getRegisteredLayouts();
|
||||
|
||||
void registerLayout(ICircuitLayout layout);
|
||||
|
||||
ICircuitLayout getLayout(String uid);
|
||||
|
||||
ICircuitLayout getDefaultLayout();
|
||||
|
||||
ICircuitBoard getCircuitboard(ItemStack itemstack);
|
||||
|
||||
boolean isChipset(ItemStack itemstack);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.circuits;
|
||||
|
||||
/**
|
||||
* Specifies where a circuit layout can be used. (i.e. farm, machine, engine, etc)
|
||||
* See CircuitSocketType for Forestry's uses.
|
||||
*/
|
||||
public interface ICircuitSocketType {
|
||||
/** unique identifier for this socket type */
|
||||
String getUid();
|
||||
|
||||
/** comparison using uid */
|
||||
boolean equals(ICircuitSocketType socketType);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.circuits;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface ISolderManager {
|
||||
|
||||
void addRecipe(ICircuitLayout layout, ItemStack resource, ICircuit circuit);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@API(apiVersion = "3.1.0", owner = "ForestryAPI|core", provides = "ForestryAPI|circuits")
|
||||
package forestry.api.circuits;
|
||||
import cpw.mods.fml.common.API;
|
||||
@@ -0,0 +1,36 @@
|
||||
package forestry.api.core;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
public class BiomeHelper {
|
||||
|
||||
private static final Map<BiomeGenBase, Boolean> isBiomeHellishCache = new HashMap<BiomeGenBase, Boolean>();
|
||||
|
||||
/**
|
||||
* Determines if it can rain or snow in the given biome.
|
||||
*/
|
||||
public static boolean canRainOrSnow(BiomeGenBase biomeGenBase) {
|
||||
return biomeGenBase.getEnableSnow() || biomeGenBase.canSpawnLightningBolt();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if a given BiomeGenBase is of HELLISH temperature, since it is treated separately from actual temperature values.
|
||||
* Uses the BiomeDictionary.
|
||||
* @param biomeGen BiomeGenBase of the biome in question
|
||||
* @return true, if the BiomeGenBase is a Nether-type biome; false otherwise.
|
||||
*/
|
||||
public static boolean isBiomeHellish(BiomeGenBase biomeGen) {
|
||||
if (isBiomeHellishCache.containsKey(biomeGen)) {
|
||||
return isBiomeHellishCache.get(biomeGen);
|
||||
}
|
||||
|
||||
boolean isBiomeHellish = BiomeDictionary.isBiomeOfType(biomeGen, BiomeDictionary.Type.NETHER);
|
||||
isBiomeHellishCache.put(biomeGen, isBiomeHellish);
|
||||
return isBiomeHellish;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
/**
|
||||
* Many things Forestry use temperature and humidity of a biome to determine whether they can or how they can work or spawn at a given location.
|
||||
*
|
||||
* This enum concerns humidity.
|
||||
*/
|
||||
public enum EnumHumidity {
|
||||
ARID("Arid"), NORMAL("Normal"), DAMP("Damp");
|
||||
|
||||
public final String name;
|
||||
|
||||
private EnumHumidity(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the EnumHumidity given a floating point representation of Minecraft Rainfall.
|
||||
* To check if rainfall is possible in a biome, use BiomeHelper.canRainOrSnow().
|
||||
* @param rawHumidity raw rainfall value
|
||||
* @return EnumHumidity corresponding to rainfall value
|
||||
*/
|
||||
public static EnumHumidity getFromValue(float rawHumidity) {
|
||||
if (rawHumidity > 0.85f) { // matches BiomeGenBase.isHighHumidity()
|
||||
return DAMP;
|
||||
}
|
||||
else if (rawHumidity >= 0.3f) {
|
||||
return NORMAL;
|
||||
}
|
||||
else {
|
||||
return ARID;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Many things Forestry use temperature and humidity of a biome to determine whether they can or how they can work or spawn at a given location.
|
||||
*
|
||||
* This enum concerns temperature.
|
||||
*/
|
||||
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");
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon() {
|
||||
return ForestryAPI.textureManager.getDefault(iconIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the EnumTemperature given a floating point representation of
|
||||
* Minecraft temperature. Hellish biomes are handled based on their biome
|
||||
* type - check BiomeHelper.isBiomeHellish.
|
||||
* @param rawTemp raw temperature value
|
||||
* @return EnumTemperature corresponding to value of rawTemp
|
||||
*/
|
||||
public static EnumTemperature getFromValue(float rawTemp) {
|
||||
if (rawTemp > 1.00f) {
|
||||
return HOT;
|
||||
}
|
||||
else if (rawTemp > 0.85f) {
|
||||
return WARM;
|
||||
}
|
||||
else if (rawTemp > 0.35f) {
|
||||
return NORMAL;
|
||||
}
|
||||
else if (rawTemp > 0.0f) {
|
||||
return COLD;
|
||||
}
|
||||
else {
|
||||
return ICY;
|
||||
}
|
||||
}
|
||||
|
||||
public static EnumTemperature getFromBiome(BiomeGenBase biomeGenBase) {
|
||||
if (BiomeHelper.isBiomeHellish(biomeGenBase)) {
|
||||
return HELLISH;
|
||||
}
|
||||
return getFromValue(biomeGenBase.temperature);
|
||||
}
|
||||
|
||||
public static EnumTemperature getFromBiome(BiomeGenBase biomeGenBase, int x, int y, int z) {
|
||||
if (BiomeHelper.isBiomeHellish(biomeGenBase)) {
|
||||
return HELLISH;
|
||||
}
|
||||
float temperature = biomeGenBase.getFloatTemperature(x, y, z);
|
||||
return getFromValue(temperature);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Forestry's API is divided into several subcategories to make it easier to understand.
|
||||
*
|
||||
* If you need to distribute API files, try to only include the parts you are actually
|
||||
* using to minimize conflicts due to API changes.
|
||||
*
|
||||
* .core - Miscallenous base classes and interfaces as well as some basics for tools, armor, game modes and stuff needed by biome mods.
|
||||
* .fuels - Managers and classes to facilitate adding fuels to various engines and machines.
|
||||
* .recipes - Managers and helpers to facilitate adding new recipes to various machines.
|
||||
* .storage - Managers, events and interfaces for defining new backpacks and handling backpack behaviour.
|
||||
* .mail - Anything related to handling letters and adding new mail carrier systems.
|
||||
* .genetics - Shared code for all genetic subclasses.
|
||||
* \ .apiculture - Bees.
|
||||
* \ .arboriculture - Trees.
|
||||
* \ .lepidopterology - Butterflies.
|
||||
*
|
||||
* Note that if Forestry is not present, all these references will be null.
|
||||
*/
|
||||
public class ForestryAPI {
|
||||
|
||||
/**
|
||||
* The main mod instance for Forestry.
|
||||
*/
|
||||
public static Object instance;
|
||||
|
||||
/**
|
||||
* A {@link ITextureManager} needed for some things in the API.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static ITextureManager textureManager;
|
||||
|
||||
public static IClimateManager climateManager;
|
||||
|
||||
/**
|
||||
* The currently active {@link IGameMode}.
|
||||
*/
|
||||
public static IGameMode activeMode;
|
||||
|
||||
/**
|
||||
* Provides information on certain Forestry constants (Villager IDs, Chest gen keys, etc)
|
||||
*/
|
||||
public static IForestryConstants forestryConstants;
|
||||
|
||||
/**
|
||||
* The currently enabled Forestry plugins.
|
||||
* Can be used to check if certain features are available, for example:
|
||||
* ForestryAPI.enabledPlugins.contains("APICULTURE")
|
||||
*/
|
||||
public static Set<String> enabledPlugins;
|
||||
|
||||
/**
|
||||
* Instance of the errorStateRegistry for registering errors.
|
||||
* Also creates new instances of IErrorLogic.
|
||||
*/
|
||||
public static IErrorStateRegistry errorStateRegistry;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public abstract class ForestryEvent extends Event {
|
||||
|
||||
private static abstract class BreedingEvent extends ForestryEvent {
|
||||
public final ISpeciesRoot root;
|
||||
public final IBreedingTracker tracker;
|
||||
public final GameProfile username;
|
||||
|
||||
private BreedingEvent(ISpeciesRoot root, GameProfile username, IBreedingTracker tracker) {
|
||||
super();
|
||||
this.root = root;
|
||||
this.username = username;
|
||||
this.tracker = tracker;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SpeciesDiscovered extends BreedingEvent {
|
||||
public final IAlleleSpecies species;
|
||||
public SpeciesDiscovered(ISpeciesRoot root, GameProfile username, IAlleleSpecies species, IBreedingTracker tracker) {
|
||||
super(root, username, tracker);
|
||||
this.species = species;
|
||||
}
|
||||
}
|
||||
|
||||
public static class MutationDiscovered extends BreedingEvent {
|
||||
public final IMutation allele;
|
||||
public MutationDiscovered(ISpeciesRoot root, GameProfile username, IMutation allele, IBreedingTracker tracker) {
|
||||
super(root, username, tracker);
|
||||
this.allele = allele;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SyncedBreedingTracker extends ForestryEvent {
|
||||
public final IBreedingTracker tracker;
|
||||
public final EntityPlayer player;
|
||||
public SyncedBreedingTracker(IBreedingTracker tracker, EntityPlayer player) {
|
||||
super();
|
||||
this.tracker = tracker;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IArmorNaturalist {
|
||||
|
||||
/**
|
||||
* Called when the naturalist's armor acts as spectacles for seeing pollinated tree leaves/flowers.
|
||||
*
|
||||
* @param player
|
||||
* Player doing the viewing
|
||||
* @param armor
|
||||
* Armor item
|
||||
* @param doSee
|
||||
* Whether or not to actually do the side effects of viewing
|
||||
* @return true if the armor actually allows the player to see pollination.
|
||||
*/
|
||||
public boolean canSeePollination(EntityPlayer player, ItemStack armor, boolean doSee);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
public interface IClimateControlled {
|
||||
/**
|
||||
* Change the temperature, but not lower than boundaryDown or higher than boundaryUp.
|
||||
*/
|
||||
void addTemperatureChange(float change, float boundaryDown, float boundaryUp);
|
||||
|
||||
/**
|
||||
* Change the humidity, but not lower than boundaryDown or higher than boundaryUp.
|
||||
*/
|
||||
void addHumidityChange(float change, float boundaryDown, float boundaryUp);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IClimateManager {
|
||||
|
||||
float getTemperature(World world, int x, int y, int z);
|
||||
|
||||
float getHumidity(World world, int x, int y, int z);
|
||||
|
||||
IClimateProvider getDefaultClimate(World world, int x, int y, int z);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public interface IClimateProvider {
|
||||
BiomeGenBase getBiome();
|
||||
|
||||
EnumTemperature getTemperature();
|
||||
|
||||
EnumHumidity getHumidity();
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Keeps track of all the IErrorStates for an object.
|
||||
* Create a new IErrorLogic instance for your object with ForestryAPI.errorStateRegistry.createErrorLogic().
|
||||
*/
|
||||
public interface IErrorLogic extends IErrorSource {
|
||||
|
||||
/**
|
||||
* Sets the errorState when condition is true, and unsets it when condition is false.
|
||||
* @return condition
|
||||
*/
|
||||
boolean setCondition(boolean condition, IErrorState errorState);
|
||||
|
||||
/**
|
||||
* @return true if the error state is active.
|
||||
*/
|
||||
boolean contains(IErrorState state);
|
||||
|
||||
/**
|
||||
* @return true if there are any active error states.
|
||||
*/
|
||||
boolean hasErrors();
|
||||
|
||||
/**
|
||||
* Sets all active error states to false
|
||||
*/
|
||||
void clearErrors();
|
||||
|
||||
/**
|
||||
* Network serialization for syncing errors to the client from the server.
|
||||
*/
|
||||
void writeData(DataOutputStream data) throws IOException;
|
||||
void readData(DataInputStream data) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
/**
|
||||
* An IErrorLogicSource uses an instance of IErrorLogic to deal with its errors.
|
||||
*/
|
||||
public interface IErrorLogicSource {
|
||||
IErrorLogic getErrorLogic();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
public interface IErrorSource {
|
||||
/**
|
||||
* @return the active error states. An empty Set indicates no errors.
|
||||
*/
|
||||
ImmutableSet<IErrorState> getErrorStates();
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author CovertJaguar <http://www.railcraft.info/>
|
||||
*/
|
||||
public interface IErrorState {
|
||||
|
||||
short getID();
|
||||
|
||||
String getUniqueName();
|
||||
|
||||
String getDescription();
|
||||
|
||||
String getHelp();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerIcons(IIconRegister register);
|
||||
|
||||
@SideOnly(value = Side.CLIENT)
|
||||
IIcon getIcon();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public interface IErrorStateRegistry {
|
||||
void registerErrorState(IErrorState state);
|
||||
void addAlias(IErrorState state, String name);
|
||||
|
||||
IErrorState getErrorState(short id);
|
||||
IErrorState getErrorState(String name);
|
||||
Set<IErrorState> getErrorStates();
|
||||
|
||||
IErrorLogic createErrorLogic();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
public interface IForestryConstants {
|
||||
|
||||
/**
|
||||
* @return The villager ID for the Apiarist Villager.
|
||||
*/
|
||||
public int getApicultureVillagerID();
|
||||
|
||||
/**
|
||||
* @return The villager ID for the Arborist Villager.
|
||||
*/
|
||||
public int getArboricultureVillagerID();
|
||||
|
||||
/**
|
||||
* @return The ChestGenHooks key for adding items to the Forestry Villager chest.
|
||||
*/
|
||||
public String getVillagerChestGenKey();
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IGameMode {
|
||||
|
||||
/**
|
||||
* @return Human-readable identifier for the game mode. (i.e. 'EASY', 'NORMAL', 'HARD')
|
||||
*/
|
||||
String getIdentifier();
|
||||
|
||||
/**
|
||||
* @param ident Identifier for the setting. (See the gamemode config.)
|
||||
* @return Value of the requested setting, false if unknown setting.
|
||||
*/
|
||||
boolean getBooleanSetting(String ident);
|
||||
|
||||
/**
|
||||
* @param ident Identifier for the setting. (See the gamemode config.)
|
||||
* @return Value of the requested setting, 0 if unknown setting.
|
||||
*/
|
||||
int getIntegerSetting(String ident);
|
||||
|
||||
/**
|
||||
* @param ident Identifier for the setting. (See the gamemode config.)
|
||||
* @return Value of the requested setting, 0 if unknown setting.
|
||||
*/
|
||||
float getFloatSetting(String ident);
|
||||
|
||||
/**
|
||||
* @param ident Identifier for the setting. (See the gamemode config.)
|
||||
* @return Value of the requested setting, an itemstack containing an apple if unknown setting.
|
||||
*/
|
||||
ItemStack getStackSetting(String ident);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Provides icons, needed in some interfaces, most notably for bees and trees.
|
||||
*/
|
||||
public interface IIconProvider {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
IIcon getIcon(short texUID);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerIcons(IIconRegister register);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public interface INBTTagable {
|
||||
void readFromNBT(NBTTagCompound nbttagcompound);
|
||||
|
||||
void writeToNBT(NBTTagCompound nbttagcompound);
|
||||
}
|
||||
Loaded 100 of 274 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user