Merge pull request #1 from CovertJaguar/master

Link the API and Lang repos, clean up build script
This commit is contained in:
CovertJaguar committed 2014-05-02 14:35:41 -07:00
commit cf087fe5f2
183 files changed
+515 -6861

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
.classpath
.gradle/
.nb-gradle/
.settings/
build/
eclipse/
.project
gradle.properties
+6
View File
@@ -0,0 +1,6 @@
[submodule "api/forestry"]
path = api/forestry
url = https://github.com/ForestryMC/ForestryAPI.git
[submodule "lang"]
path = lang
url = https://github.com/ForestryMC/Forestry-Localization.git
+25 -2
View File
@@ -13,12 +13,35 @@ Forestry is a modification for the game Minecraft and known primarily for its fa
[IRC #forestry on esper.net](http://webchat.esper.net/?nick=ForestryWiki...&channels=forestry&prompt=1)
### Building
The API and localization files reside in their own repository. It is pulled in automatically.
You need to put the Ic2 and CraftGuide APIs in "../IC2/src/" and "../CraftGuide/src" respectively. Hopefully that can be automated in the future.
You will need to define a "./gradle.properties" file.
Sample properties file:
```
mcversion=1.7.2
forgeversion=10.12.1.1061
version_major=2
version_minor=4
version_patch=0
version_revision=0
version_build=0
mcUsername=SirSengir
mcPassword=password
```
To setup, open a command line and run "gradlew setupDecompWorkspace" and "gradlew eclipse".
To package, open a command line and type "gradlew release".
### Notes
Beware of ugly code.
The API resides in its own repository. You will need it to compile this code.
Bugfixes are generally welcome. If you want to contribute something which changes game mechanics, please talk to someone with commit privileges first. Nothing is more frustrating than putting a lot of work and effort into a new game mechanic and then having the PR rejected because it doesn’t fit gameplay-wise.
If you submit a PR you must accept the Contributor License Agreement. There is no way around that, since otherwise changing the license later - even to something more permissive! - , becomes close to impossible.
Submodule
+1
Submodule api/forestry added at 092b463bd5.
+214 -35
View File
@@ -11,24 +11,26 @@ buildscript {
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.1-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}
apply plugin: 'forge'
ext.buildnumber = createBuildNumber()
version = "2.4.0.0-" + buildnumber
version = version_major + '.' + version_minor + '.' + version_patch + '.' + version_revision + '-' + version_build
group= "net.sengir.forestry" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "forestry"
archivesBaseName = "forestry_" + mcversion
ext.dirDest = './build/dist'
ext.dirLang = "./lang"
ext.langDir = "../Forestry-Localization"
ext.srcbcDir = "../BuildCraft/common"
ext.srcIc2Dir = "../IC2/src"
ext.srcCraftguideDir = "../CraftGuide/src"
ext.apiForestry = "./api/forestry"
minecraft {
version = "1.7.2-10.12.0.1032"
version = mcversion + "-" + forgeversion
assetDir = "eclipse/assets"
replace '@VERSION@', project.version
@@ -44,31 +46,35 @@ minecraft {
}
sourceSets {
api {
main {
java {
srcDir project.srcCraftguideDir
include '**/CraftGuide/api/**'
}
}
main {
java {
srcDirs file('forestry_common').listFiles()
include 'forestry/**'
srcDir project.srcbcDir
include 'buildcraft/api/**'
srcDir project.srcIc2Dir
include 'api/**'
include '**/api/**'
srcDir project.apiForestry
}
resources {
srcDir 'forestry_resources'
srcDir project.langDir
srcDir project.dirLang
}
}
}
configurations{
buildcraft
compile.extendsFrom buildcraft
}
dependencies {
buildcraft 'com.mod-buildcraft:buildcraft:5.0.4.2942:dev'
}
processResources {
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
@@ -85,19 +91,199 @@ processResources {
}
}
task apiZip(type: Jar) {
from sourceSets.main.allSource
include 'forestry/api/**'
classifier = 'api'
extension = 'zip'
runClient {
args "--username=${project.mcUsername}"
args "--password=${project.mcPassword}"
}
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'dev'
debugClient {
args "--username=${project.mcUsername}"
args "--password=${project.mcPassword}"
}
build.dependsOn apiZip, deobfJar
task echoVersion << {
printNextVersion()
}
def saveVersion() {
ant.propertyfile(
file: "gradle.properties") {
entry( key:"version_major", type:"int", value: version_major)
entry( key:"version_minor", type:"int", value: version_minor)
entry( key:"version_patch", type:"int", value: version_patch)
entry( key:"version_revision", type:"int", value: version_revision)
entry( key:"version_build", type:"int", value: version_build)
}
project.version = version_major + '.' + version_minor + '.' + version_patch + '.' + version_revision + '-' + version_build
printNextVersion()
}
def printNextVersion(){
println '*************************************************************'
println 'The next build will be version: ' + project.version
println '*************************************************************'
}
task bumpMajor << {
project.version_major = Integer.parseInt(project.version_major) + 1
project.version_minor = "0"
project.version_patch = "0"
project.version_revision = "0"
saveVersion()
}
task bumpMinor << {
project.version_minor = Integer.parseInt(project.version_minor) + 1
project.version_patch = "0"
project.version_revision = "0"
saveVersion()
}
task bumpPatch << {
project.version_patch = Integer.parseInt(project.version_patch) + 1
project.version_revision = "0"
saveVersion()
}
task bumpRevision << {
project.version_revision = Integer.parseInt(project.version_revision) + 1
saveVersion()
}
task bumpBuild << {
project.version_build = Integer.parseInt(project.version_build) + 1
saveVersion()
}
task setBuild << {
def console = System.console()
if (console) {
project.version_build = console.readLine('> What should the build be? ')
} else {
logger.error "Cannot get console."
}
saveVersion()
}
jar {
destinationDir = file("build/tmp")
archiveName = "main.jar"
}
task mainJarSigned ( type: Jar, dependsOn: 'reobf' ) {
from (zipTree(jar.getArchivePath())) {
exclude '**/api/**'
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
destinationDir = file("build/tmp")
archiveName = "signed.jar"
doLast {
if (project.hasProperty('signingKeystore')) {
ant.signjar(jar: getArchivePath(),
alias: signingAlias,
keystore: signingKeystore,
storepass: signingStorepass)
} else {
println 'Signing disabled, gradle.properties is missing.'
}
}
}
task mainJar ( type: Zip, dependsOn: mainJarSigned ) {
from (zipTree(mainJarSigned.getArchivePath())) {
include '**'
}
from (zipTree(jar.getArchivePath())) {
include '**'
}
from {
configurations.buildcraft.collect {
it.isDirectory() ? it : zipTree(it).matching {
include '**/api/**'
}
}
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
destinationDir = file(dirDest)
includeEmptyDirs = false
extension = 'jar'
}
task devJarSigned ( type: Jar, dependsOn: 'classes' ) {
from(sourceSets.main.output) {
exclude '**/api/**'
}
destinationDir = file("build/tmp")
archiveName = "signed-dev.jar"
doLast {
if (project.hasProperty('signingKeystore')) {
ant.signjar(jar: getArchivePath(),
alias: signingAlias,
keystore: signingKeystore,
storepass: signingStorepass)
} else {
println 'Signing disabled, gradle.properties is missing.'
}
}
}
task devJar ( type: Zip, dependsOn: devJarSigned ) {
from (zipTree(devJarSigned.getArchivePath())) {
include '**'
}
from(sourceSets.main.allSource) {
include '**/api/**'
}
from(sourceSets.main.output) {
include '**'
}
from {
configurations.buildcraft.collect {
it.isDirectory() ? it : zipTree(it).matching {
include '**/api/**'
}
}
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
destinationDir = file(dirDest)
extension = 'jar'
classifier = 'dev'
}
task apiZip ( type: Zip ) {
from project.apiForestry
destinationDir = file(dirDest)
classifier = 'api'
extension = 'zip'
}
task releaseInit << {
println '*************************************************************'
println 'This build will be version: ' + project.version
println '*************************************************************'
}
task release << {
project.version_build = Integer.parseInt(project.version_build) + 1
saveVersion()
}
release.dependsOn releaseInit, mainJar, devJar, apiZip
mainJar.shouldRunAfter releaseInit
devJar.shouldRunAfter releaseInit
apiZip.shouldRunAfter releaseInit
def rndString() {
String AB = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
@@ -113,11 +299,4 @@ def rndString() {
rndStart = rndStart >= ret.length() - 4 ? 3 : rndStart;
return ret.substring(0, rndStart).toLowerCase(Locale.ENGLISH) + ret.substring(rndStart)
}
def createBuildNumber() {
ant.buildnumber()
return ant.antProject.properties['build.number']
}
}
-3
View File
@@ -1,3 +0,0 @@
#Build Number for ANT. Do not edit!
#Mon Mar 31 06:46:14 CEST 2014
build.number=712
@@ -1,48 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.apiculture;
import java.util.ArrayList;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
import forestry.api.genetics.IMutation;
/**
*
* Some miscellaneous lists and settings for bees.
*
* @author SirSengir
*/
public class BeeManager {
/**
* Get your own reference to this via AlleleManager.alleleRegistry.getSpeciesRoot("rootBees") and save it somewhere.
*/
@Deprecated
public static IBeeRoot beeInterface;
/**
* Species templates for bees that can drop from hives.
*
* 0 - Forest 1 - Meadows 2 - Desert 3 - Jungle 4 - End 5 - Snow 6 - Swamp
*
* see {@link IMutation} for template format
*/
public static ArrayList<IHiveDrop>[] hiveDrops;
/**
* 0 - Common Village Bees 1 - Uncommon Village Bees (20 % of spawns)
*/
public static ArrayList<IBeeGenome>[] villageBees;
/**
* List of items that can induce swarming. Integer denotes x in 1000 chance.
*/
public static HashMap<ItemStack, Integer> inducers = new HashMap<ItemStack, Integer>();
}
@@ -1,105 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.apiculture;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleArea;
import forestry.api.genetics.IAlleleBoolean;
import forestry.api.genetics.IAlleleFloat;
import forestry.api.genetics.IAlleleFlowers;
import forestry.api.genetics.IAlleleInteger;
import forestry.api.genetics.IAlleleTolerance;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.ISpeciesRoot;
/**
* 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();
}
@Override
public ISpeciesRoot getSpeciesRoot() {
return AlleleManager.alleleRegistry.getSpeciesRoot("rootBees");
}
}
@@ -1,26 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.apiculture;
import java.util.Locale;
public enum EnumBeeType {
DRONE, PRINCESS, QUEEN, LARVAE, NONE;
public static final EnumBeeType[] VALUES = values();
String name;
private EnumBeeType() {
this.name = "bees." + this.toString().toLowerCase(Locale.ENGLISH);
}
public String getName() {
return name;
}
}
@@ -1,21 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.apiculture;
import java.util.ArrayList;
import net.minecraft.item.ItemStack;
import forestry.api.genetics.IFlowerProvider;
public class FlowerManager {
/**
* ItemStacks representing simple flower blocks. Meta-sensitive, processed by the basic {@link IFlowerProvider}.
*/
public static ArrayList<ItemStack> plainFlowers = new ArrayList<ItemStack>();
}
@@ -1,38 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
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);
}
@@ -1,55 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
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 - 100)
*/
Map<ItemStack, Integer> getProducts();
/**
* @return Map of possible specialities with the chance for drop each bee cycle. (0 - 100)
*/
Map<ItemStack, Integer> getSpecialty();
/**
* 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);
/**
* @return Path of the texture to use for entity rendering.
*/
String getEntityTexture();
}
@@ -1,34 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.apiculture;
import forestry.api.core.ITileStructure;
/**
* Needs to be implemented by TileEntities that want to be part of an alveary.
*/
public interface IAlvearyComponent extends ITileStructure {
void registerBeeModifier(IBeeModifier modifier);
void removeBeeModifier(IBeeModifier modifier);
void registerBeeListener(IBeeListener event);
void removeBeeListener(IBeeListener event);
void addTemperatureChange(float change, float boundaryDown, float boundaryUp);
void addHumidityChange(float change, float boundaryDown, float boundaryUp);
/**
* @return true if this TE has a function other than a plain alveary block. Returning true prevents the TE from becoming master.
*/
boolean hasFunction();
}
@@ -1,59 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
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();
}
@@ -1,31 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.apiculture;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
/**
* When implemented by armor piece items, allows them to act as apiarist's armor.
*/
public interface IArmorApiarist {
/**
* Called when the apiarist's armor acts as protection against an attack.
*
* @param player
* Player being attacked
* @param armor
* Armor item
* @param cause
* Optional cause of attack, such as a bee effect identifier
* @param doProtect
* Whether or not to actually do the side effects of protection
* @return Whether or not the armor should protect the player from that attack
*/
public boolean protectPlayer(EntityPlayer player, ItemStack armor, String cause, boolean doProtect);
}
@@ -1,93 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.apiculture;
import java.util.ArrayList;
import net.minecraft.item.ItemStack;
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);
/**
* @return true if the bee is mated with another whose isNatural() doesn't match.
*/
boolean isIrregularMating();
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 Ordinal of the error code encountered. 0 - EnumErrorCode.OK
*/
int isWorking(IBeeHousing housing);
boolean hasFlower(IBeeHousing housing);
ArrayList<Integer> getSuitableBiomeIds();
ItemStack[] getProduceList();
ItemStack[] getSpecialtyList();
ItemStack[] produceStacks(IBeeHousing housing);
IBee spawnPrincess(IBeeHousing housing);
IBee[] spawnDrones(IBeeHousing housing);
void plantFlowerRandom(IBeeHousing housing);
IIndividual retrievePollen(IBeeHousing housing);
boolean pollinateRandom(IBeeHousing housing, IIndividual pollen);
}
@@ -1,50 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
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();
}
@@ -1,29 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.apiculture;
import net.minecraft.item.ItemStack;
import forestry.api.genetics.IHousing;
public interface IBeeHousing extends IBeeModifier, IBeeListener, IHousing {
ItemStack getQueen();
ItemStack getDrone();
void setQueen(ItemStack itemstack);
void setDrone(ItemStack itemstack);
/**
* @return true if princesses and drones can (currently) mate in this housing to generate queens.
*/
boolean canBreed();
}
@@ -1,48 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.apiculture;
import net.minecraft.item.ItemStack;
import forestry.api.genetics.IIndividual;
public interface IBeeListener {
/**
* Called on queen update.
*
* @param queen
*/
void onQueenChange(ItemStack queen);
/**
* Called when the bees wear out the housing's equipment.
*
* @param amount
* Integer indicating the amount worn out.
*/
void wearOutEquipment(int amount);
/**
* Called just before the children are generated, and the queen removed.
*
* @param queen
*/
void onQueenDeath(IBee queen);
/**
* Called after the children have been spawned, but before the queen appears
*
* @param queen
*/
void onPostQueenDeath(IBee queen);
boolean onPollenRetrieved(IBee queen, IIndividual pollen, boolean isHandled);
boolean onEggLaid(IBee queen);
}
@@ -1,73 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
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
* @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();
}
@@ -1,27 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.apiculture;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutation;
public interface IBeeMutation extends IMutation {
IBeeRoot getRoot();
/**
* @param housing
* @param allele0
* @param allele1
* @param genome0
* @param genome1
* @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, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
}
@@ -1,119 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
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 forestry.api.core.IStructureLogic;
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
*/
boolean isMember(ItemStack stack);
/**
* @return {@link IBee} pattern parsed from the passed stack's nbt data.
*/
IBee getMember(ItemStack stack);
IBee getMember(NBTTagCompound compound);
/* GENOME CONVERSION */
IBee templateAsIndividual(IAllele[] template);
IBee templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive);
IBeeGenome templateAsGenome(IAllele[] template);
IBeeGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
/* BREEDING TRACKER */
/**
* @param world
* @return {@link IApiaristTracker} associated with the passed world.
*/
IApiaristTracker getBreedingTracker(World world, String player);
/* BEE SPECIFIC */
/**
* @return type of bee encoded on the itemstack. EnumBeeType.NONE if it isn't a bee.
*/
EnumBeeType getType(ItemStack stack);
/**
* @return true if passed item is a 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 */
ArrayList<IBee> getIndividualTemplates();
/* MUTATIONS */
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 */
/**
* @param housing
* Object implementing IBeeHousing.
* @return IBeekeepingLogic
*/
IBeekeepingLogic createBeekeepingLogic(IBeeHousing housing);
/**
* TileEntities wanting to function as alveary components need to implement structure logic for validation.
*
* @return IStructureLogic for alvearies.
*/
IStructureLogic createAlvearyStructureLogic(IAlvearyComponent structure);
}
@@ -1,29 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.apiculture;
import forestry.api.core.INBTTagable;
import forestry.api.genetics.IEffectData;
public interface IBeekeepingLogic extends INBTTagable {
/* STATE INFORMATION */
int getBreedingTime();
int getTotalBreedingTime();
IBee getQueen();
IBeeHousing getHousing();
IEffectData[] getEffectData();
/* UPDATING */
void update();
}
@@ -1,72 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.apiculture;
import java.util.ArrayList;
import net.minecraft.world.World;
public interface IBeekeepingMode extends IBeeModifier {
/**
* @return Localized name of this beekeeping mode.
*/
String getName();
/**
* @return Localized list of strings outlining the behaviour of this beekeeping mode.
*/
ArrayList<String> getDescription();
/**
* @return Float used to modify the wear on comb frames.
*/
float getWearModifier();
/**
* @param queen
* @return fertility taking into account the birthing queen and surroundings.
*/
int getFinalFertility(IBee queen, World world, int x, int y, int z);
/**
* @param queen
* @return true if the queen is genetically "fatigued" and should not be reproduced anymore.
*/
boolean isFatigued(IBee queen, 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);
}
@@ -1,40 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.apiculture;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* Bees can be seeded either as hive drops or as mutation results.
*
* Add IHiveDrops to BeeManager.hiveDrops
*
* @author SirSengir
*/
public interface IHiveDrop {
ItemStack getPrincess(World world, int x, int y, int z, int fortune);
Collection<ItemStack> getDrones(World world, int x, int y, int z, int fortune);
Collection<ItemStack> getAdditional(World world, int x, int y, int z, int fortune);
/**
* Chance to drop. Default drops have 80 (= 80 %).
*
* @param world 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);
}
@@ -1,29 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.apiculture;
import net.minecraft.item.ItemStack;
public interface IHiveFrame extends IBeeModifier {
/**
* Wears out a frame.
*
* @param housing
* IBeeHousing the frame is contained in.
* @param frame
* ItemStack containing the actual frame.
* @param queen
* Current queen in the caller.
* @param wear
* Integer denoting the amount worn out. The wear modifier of the current beekeeping mode has already been taken into account.
* @return ItemStack containing the actual frame with adjusted damage.
*/
ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear);
}
@@ -1,10 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
@API(apiVersion="1.0", owner="ForestryAPI|core", provides="ForestryAPI|apiculture")
package forestry.api.apiculture;
import cpw.mods.fml.common.API;
@@ -1,25 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.arboriculture;
public enum EnumGermlingType {
SAPLING("Sapling"), BLOSSOM("Blossom"), POLLEN("Pollen"), GERMLING("Germling"), NONE("None");
public static final EnumGermlingType[] VALUES = values();
String name;
private EnumGermlingType(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
@@ -1,12 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.arboriculture;
public enum EnumGrowthConditions {
HOSTILE, PALTRY, NORMAL, GOOD, EXCELLENT
}
@@ -1,94 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.arboriculture;
import net.minecraftforge.common.EnumPlantType;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleArea;
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),
;
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();
}
@Override
public ISpeciesRoot getSpeciesRoot() {
return AlleleManager.alleleRegistry.getSpeciesRoot("rootTrees");
}
}
@@ -1,19 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.arboriculture;
import forestry.api.genetics.IAllele;
/**
* Simple allele encapsulating an {@link IFruitProvider}.
*/
public interface IAlleleFruit extends IAllele {
IFruitProvider getProvider();
}
@@ -1,19 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.arboriculture;
import forestry.api.genetics.IAllele;
/**
* Simple allele encapsulating an {@link IGrowthProvider}.
*/
public interface IAlleleGrowth extends IAllele {
IGrowthProvider getProvider();
}
@@ -1,22 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
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);
}
@@ -1,77 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.arboriculture;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.EnumPlantType;
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 Trunk girth. 1 = 1x1, 2 = 2x2, etc.
*/
@Deprecated
int getGirth();
/**
* @param tree
* @param world
* @param x
* @param y
* @param z
* @return Tree generator for the tree at the given location.
*/
WorldGenerator getGenerator(ITree tree, World world, int x, int y, int z);
/**
* @return All available generator classes for this species.
*/
Class<? extends WorldGenerator>[] getGeneratorClasses();
/* TEXTURES AND OVERRIDES */
int getLeafColour(ITree tree);
short getLeafIconIndex(ITree tree, boolean fancy);
@SideOnly(Side.CLIENT)
IIcon getGermlingIcon(EnumGermlingType type, int renderPass);
@SideOnly(Side.CLIENT)
int getGermlingColour(EnumGermlingType type, int renderPass);
/**
*
* @return Array of ItemStacks representing logs that these tree produces, the first one being the primary one
*/
ItemStack[] getLogStacks();
}
@@ -1,14 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.arboriculture;
import forestry.api.genetics.IBreedingTracker;
public interface IArboristTracker extends IBreedingTracker {
}
@@ -1,76 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
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);
}
@@ -1,40 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
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();
}
@@ -1,14 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.arboriculture;
import net.minecraft.world.World;
public interface ILeafTickHandler {
boolean onRandomLeafTick(ITree tree, World world, int biomeId, int x, int y, int z, boolean isDestroyed);
}
@@ -1,26 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
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);
}
@@ -1,101 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.arboriculture;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.common.EnumPlantType;
import forestry.api.genetics.IEffectData;
import forestry.api.genetics.IIndividual;
public interface ITree extends IIndividual {
void mate(ITree other);
IEffectData[] doEffect(IEffectData[] storedData, World world, int biomeid, int x, int y, int z);
IEffectData[] doFX(IEffectData[] storedData, World world, int biomeid, int x, int y, int z);
ITreeGenome getGenome();
ITreeGenome getMate();
EnumSet<EnumPlantType> getPlantTypes();
ITree[] getSaplings(World world, int x, int y, int z, float modifier);
ItemStack[] getProduceList();
ItemStack[] getSpecialtyList();
ItemStack[] produceStacks(World world, int x, int y, int z, int ripeningTime);
/**
*
* @param world
* @param x
* @param y
* @param z
* @return Boolean indicating whether a sapling can stay planted at the given position.
*/
boolean canStay(World world, int x, int y, int z);
/**
*
* @param world
* @param x
* @param y
* @param z
* @return Boolean indicating whether a sapling at the given position can grow into a tree.
*/
boolean canGrow(World world, int x, int y, int z, int expectedGirth, int expectedHeight);
/**
* @return Integer denoting the maturity (block ticks) required for a sapling to attempt to grow into a tree.
*/
int getRequiredMaturity();
/**
* @return Integer denoting how resilient leaf blocks are against adverse influences (i.e. caterpillars).
*/
int getResilience();
/**
* @param world
* @param x
* @param y
* @param z
* @return Integer denoting the size of the tree trunk.
*/
int getGirth(World world, int x, int y, int z);
/**
*
* @param world
* @param x
* @param y
* @param z
* @return Growth conditions at the given position.
*/
EnumGrowthConditions getGrowthCondition(World world, int x, int y, int z);
WorldGenerator getTreeGenerator(World world, int x, int y, int z, boolean wasBonemealed);
ITree copy();
boolean isPureBred(EnumTreeChromosome chromosome);
boolean canBearFruit();
}
@@ -1,48 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
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();
}
@@ -1,47 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
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);
}
@@ -1,36 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.arboriculture;
import net.minecraft.world.World;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
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();
/**
* @param world
* @param x
* @param y
* @param z
* @param allele0
* @param allele1
* @param genome0
* @param genome1
* @return float representing the chance for mutation to occur. note that this is 0 - 100 based, since it was an integer previously!
*/
float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
}
@@ -1,85 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
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 forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosome;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.ISpeciesRoot;
public interface ITreeRoot extends ISpeciesRoot {
boolean isMember(ItemStack itemstack);
ITree getMember(ItemStack itemstack);
ITree getMember(NBTTagCompound compound);
ITreeGenome templateAsGenome(IAllele[] template);
ITreeGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
/**
* @param world
* @return {@link IArboristTracker} associated with the passed world.
*/
IArboristTracker getBreedingTracker(World world, String 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. EnumBeeType.NONE if it isn't a tree.
*/
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, String owner, int x, int y, int z);
boolean setLeaves(World world, IIndividual tree, String owner, int x, int y, int z);
IChromosome[] templateAsChromosomes(IAllele[] template);
IChromosome[] templateAsChromosomes(IAllele[] templateActive, IAllele[] templateInactive);
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 */
ArrayList<ITree> getIndividualTemplates();
/* MUTATIONS */
Collection<ITreeMutation> getMutations(boolean shuffle);
}
@@ -1,24 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
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();
}
@@ -1,18 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.arboriculture;
public class TreeManager {
public static int treeSpeciesCount = 0;
/**
* Get your own reference to this via AlleleManager.alleleRegistry.getSpeciesRoot("rootTrees") and save it somewhere.
*/
@Deprecated
public static ITreeRoot treeInterface;
}
@@ -1,10 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
@API(apiVersion="1.0", owner="ForestryAPI|core", provides="ForestryAPI|arboriculture")
package forestry.api.arboriculture;
import cpw.mods.fml.common.API;
@@ -1,15 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.circuits;
public class ChipsetManager {
public static ISolderManager solderManager;
public static ICircuitRegistry circuitRegistry;
}
@@ -1,34 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.circuits;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
public interface ICircuit {
String getUID();
boolean requiresDiscovery();
int getLimit();
String getName();
boolean isCircuitable(TileEntity tile);
void onInsertion(int slot, TileEntity tile);
void onLoad(int slot, TileEntity tile);
void onRemoval(int slot, TileEntity tile);
void onTick(int slot, TileEntity tile);
void addTooltip(List<String> list);
}
@@ -1,34 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.circuits;
import java.util.List;
import net.minecraft.tileentity.TileEntity;
import forestry.api.core.INBTTagable;
public interface ICircuitBoard extends INBTTagable {
int getPrimaryColor();
int getSecondaryColor();
void addTooltip(List<String> list);
void onInsertion(TileEntity tile);
void onLoad(TileEntity tile);
void onRemoval(TileEntity tile);
void onTick(TileEntity tile);
ICircuit[] getCircuits();
}
@@ -1,18 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.circuits;
public interface ICircuitLayout {
String getUID();
String getName();
String getUsage();
}
@@ -1,12 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.circuits;
public interface ICircuitLibrary {
}
@@ -1,44 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.circuits;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public interface ICircuitRegistry {
/* CIRCUITS */
HashMap<String, ICircuit> getRegisteredCircuits();
void registerCircuit(ICircuit circuit);
ICircuit getCircuit(String uid);
ICircuitLibrary getCircuitLibrary(World world, String playername);
void registerLegacyMapping(int id, String uid);
ICircuit getFromLegacyMap(int id);
/* LAYOUTS */
HashMap<String, ICircuitLayout> getRegisteredLayouts();
void registerLayout(ICircuitLayout layout);
ICircuitLayout getLayout(String uid);
ICircuitLayout getDefaultLayout();
ICircuitBoard getCircuitboard(ItemStack itemstack);
boolean isChipset(ItemStack itemstack);
}
@@ -1,16 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.circuits;
import net.minecraft.item.ItemStack;
public interface ISolderManager {
void addRecipe(ICircuitLayout layout, ItemStack resource, ICircuit circuit);
}
@@ -1,10 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
@API(apiVersion="1.0", owner="ForestryAPI|core", provides="ForestryAPI|circuits")
package forestry.api.circuits;
import cpw.mods.fml.common.API;
@@ -1,42 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.core;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.FMLLog;
public class BlockInterface {
/**
* Rather limited function to retrieve block ids.
*
* @param ident
* @return ItemStack representing the block.
*/
@Deprecated
public static ItemStack getBlock(String ident) {
ItemStack item = null;
try {
String pack = ItemInterface.class.getPackage().getName();
pack = pack.substring(0, pack.lastIndexOf('.'));
String itemClass = pack.substring(0, pack.lastIndexOf('.')) + ".core.config.ForestryBlock";
Object obj = Class.forName(itemClass).getField(ident).get(null);
if (obj instanceof Block)
item = new ItemStack((Block) obj);
else if (obj instanceof ItemStack)
item = (ItemStack) obj;
} catch (Exception ex) {
FMLLog.warning("Could not retrieve Forestry block identified by: " + ident);
}
return item;
}
}
@@ -1,79 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.core;
import java.util.ArrayList;
/**
* 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");
/**
* Populated by Forestry with vanilla biomes. Add additional arid biomes here. (ex. desert)
* @deprecated Biomes will be checked live rather than relying on cached values, so you don't have to register them.
*/
@Deprecated
public static ArrayList<Integer> aridBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional damp biomes here. (ex. jungle)
* @deprecated Biomes will be checked live rather than relying on cached values, so you don't have to register them.
*/
@Deprecated
public static ArrayList<Integer> dampBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional normal biomes here.
* @deprecated Biomes will be checked live rather than relying on cached values, so you don't have to register them.
*/
@Deprecated
public static ArrayList<Integer> normalBiomeIds = new ArrayList<Integer>();
public final String name;
private EnumHumidity(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
@Deprecated
public static ArrayList<Integer> getBiomeIds(EnumHumidity humidity) {
switch (humidity) {
case ARID:
return aridBiomeIds;
case DAMP:
return dampBiomeIds;
case NORMAL:
default:
return normalBiomeIds;
}
}
/**
* Determines the EnumHumidity given a floating point representation of Minecraft Rainfall
* @param rawHumidity raw rainfall value
* @return EnumHumidity corresponding to rainfall value
*/
public static EnumHumidity getFromValue(float rawHumidity) {
EnumHumidity value = EnumHumidity.ARID;
if (rawHumidity >= 0.9f) {
value = EnumHumidity.DAMP;
}
else if (rawHumidity >= 0.3f) {
value = EnumHumidity.NORMAL;
}
return value;
}
}
@@ -1,152 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.core;
import java.util.ArrayList;
import net.minecraft.util.IIcon;
import net.minecraft.world.biome.BiomeGenBase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.BiomeDictionary;
/**
* 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");
/**
* Populated by Forestry with vanilla biomes. Add additional icy/snow biomes here. (ex. snow plains)
* @deprecated Biomes will be checked live rather than relying on cached values, so you don't have to register them.
*/
@Deprecated
public static ArrayList<Integer> icyBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional cold biomes here. (ex. taiga)
* @deprecated Biomes will be checked live rather than relying on cached values, so you don't have to register them.
*/
@Deprecated
public static ArrayList<Integer> coldBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional normal biomes here. (ex. forest, plains)
* @deprecated Biomes will be checked live rather than relying on cached values, so you don't have to register them.
*/
@Deprecated
public static ArrayList<Integer> normalBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional warm biomes here. (ex. jungle)
* @deprecated Biomes will be checked live rather than relying on cached values, so you don't have to register them.
*/
@Deprecated
public static ArrayList<Integer> warmBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional hot biomes here. (ex. desert)
* @deprecated Biomes will be checked live rather than relying on cached values, so you don't have to register them.
*/
@Deprecated
public static ArrayList<Integer> hotBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional hellish biomes here. (ex. nether)
* @deprecated Biomes will be checked live rather than relying on cached values, so you don't have to register them.
*/
@Deprecated
public static ArrayList<Integer> hellishBiomeIds = new ArrayList<Integer>();
public final String name;
public final String iconIndex;
private EnumTemperature(String name, String iconIndex) {
this.name = name;
this.iconIndex = iconIndex;
}
public String getName() {
return this.name;
}
@SideOnly(Side.CLIENT)
public IIcon getIcon() {
return ForestryAPI.textureManager.getDefault(iconIndex);
}
/**
* @deprecated Switching most internals to use getFromValue to not rely on cached values.
*/
@Deprecated
public static ArrayList<Integer> getBiomeIds(EnumTemperature temperature) {
switch (temperature) {
case ICY:
return icyBiomeIds;
case COLD:
return coldBiomeIds;
case WARM:
return warmBiomeIds;
case HOT:
return hotBiomeIds;
case HELLISH:
return hellishBiomeIds;
case NORMAL:
default:
return normalBiomeIds;
}
}
/**
* Determines if a given BiomeGenBase is of HELLISH temperature, since it is treated seperatly 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) {
return BiomeDictionary.isBiomeOfType(biomeGen, BiomeDictionary.Type.NETHER);
}
/**
* Determines if a given biomeID is of HELLISH temperature, since it is treated seperatly from actual temperature values.
* Uses the BiomeDictionary.
* @param biomeID ID of the BiomeGenBase in question
* @return true, if the biomeID is a Nether-type biome; false otherwise.
*/
public static boolean isBiomeHellish(int biomeID) {
return BiomeDictionary.isBiomeRegistered(biomeID) && BiomeDictionary.isBiomeOfType(BiomeGenBase.getBiome(biomeID), BiomeDictionary.Type.NETHER);
}
/**
* Determines the EnumTemperature given a floating point representation of
* Minecraft temperature. Hellish biomes are handled based on their biome
* type - check isBiomeHellish.
* @param rawTemp raw temperature value
* @return EnumTemperature corresponding to value of rawTemp
*/
public static EnumTemperature getFromValue(float rawTemp) {
EnumTemperature value = EnumTemperature.ICY;
if (rawTemp >= 2.0f) {
value = EnumTemperature.HOT;
}
else if (rawTemp >= 1.2f) {
value = EnumTemperature.WARM;
}
else if (rawTemp >= 0.2f) {
value = EnumTemperature.NORMAL;
}
else if (rawTemp >= 0.05f) {
value = EnumTemperature.COLD;
}
return value;
}
}
@@ -1,54 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.core;
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;
/**
* 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;
}
@@ -1,60 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.core;
import net.minecraft.entity.player.EntityPlayer;
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 String username;
private BreedingEvent(ISpeciesRoot root, String 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, String 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, String 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;
}
}
}
@@ -1,27 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
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);
}
@@ -1,26 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
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();
}
@@ -1,43 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
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);
}
@@ -1,27 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
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);
}
@@ -1,16 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.core;
import net.minecraft.nbt.NBTTagCompound;
public interface INBTTagable {
void readFromNBT(NBTTagCompound nbttagcompound);
void writeToNBT(NBTTagCompound nbttagcompound);
}
@@ -1,39 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.core;
/**
* Optional way to hook into Forestry.
*
* Plugin classes can reside in any package, their class name however has to start with 'Plugin', i.e. 'PluginMyStuff'.
*
* @author SirSengir
*/
public interface IPlugin {
/**
* @return true if the plugin is to be loaded.
*/
public boolean isAvailable();
/**
* Called during Forestry's @PreInit.
*/
public void preInit();
/**
* Called at the start of Forestry's @PostInit.
*/
public void doInit();
/**
* Called at the end of Forestry's @PostInit.
*/
public void postInit();
}
@@ -1,22 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.core;
public interface IStructureLogic extends INBTTagable {
/**
* @return String unique to the type of structure controlled by this structure logic.
*/
String getTypeUID();
/**
* Called by {@link ITileStructure}'s validateStructure().
*/
void validateStructure();
}
@@ -1,23 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.core;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public interface ITextureManager {
void registerIconProvider(IIconProvider provider);
IIcon getIcon(short texUID);
IIcon getDefault(String ident);
}
@@ -1,65 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.core;
import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntity;
/**
* The basis for multiblock components.
*/
public interface ITileStructure {
/**
* @return String unique to the type of structure controlled by this structure logic. Should map to {@link IStructureLogic}
*/
String getTypeUID();
/**
* Should map to {@link IStructureLogic}
*/
void validateStructure();
/**
* Called when the structure resets.
*/
void onStructureReset();
/**
* @return TileEntity that is the master in this structure, null if no structure exists.
*/
ITileStructure getCentralTE();
/**
* Called to set the master TileEntity. Implementing TileEntity should keep track of the master's coordinates, not refer to the TE object itself.
*
* @param tile
*/
void setCentralTE(TileEntity tile);
/**
* @return IInventory representing the TE's inventory.
*/
IInventory getInventory();
/**
* Only called on Forestry's own blocks.
*/
void makeMaster();
/**
* @return true if this TE is the master in a structure, false otherwise.
*/
boolean isMaster();
/**
* @return true if the TE is master or has a master.
*/
boolean isIntegratedIntoStructure();
}
@@ -1,15 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.core;
/**
* Marks a tool as a scoop.
*/
public interface IToolScoop {
}
@@ -1,51 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.core;
import java.lang.reflect.Method;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.FMLLog;
/**
* This is going away someday, use FML's GameRegistry instead.
* @deprecated
*/
@Deprecated
public class ItemInterface {
/**
* Get items here!
*
* Blocks currently not supported.
*
* @param ident
* @return ItemStack representing the item, null if not found.
*/
public static ItemStack getItem(String ident) {
ItemStack item = null;
try {
String pack = ItemInterface.class.getPackage().getName();
pack = pack.substring(0, pack.lastIndexOf('.'));
String itemClass = pack.substring(0, pack.lastIndexOf('.')) + ".core.config.ForestryItem";
Object[] enums = Class.forName(itemClass).getEnumConstants();
for (Object e : enums) {
if (e.toString().equals(ident)) {
Method m = e.getClass().getMethod("getItemStack");
return (ItemStack) m.invoke(e);
}
}
} catch (Exception ex) {
FMLLog.warning("Could not retrieve Forestry item identified by: " + ident);
}
return item;
}
}
@@ -1,56 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.core;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Optional annotation to provide additional information on IPlugins. This information will be available via the "/forestry plugin info $pluginID" command ingame.
*
* @author SirSengir
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface PluginInfo {
/**
* @return Unique identifier for the plugin, no spaces!
*/
String pluginID();
/**
* @return Nice and readable plugin name.
*/
String name();
/**
* @return Plugin author's name.
*/
String author() default "";
/**
* @return URL of plugin homepage.
*/
String url() default "";
/**
* @return Version of the plugin, if any.
*/
String version() default "";
/**
* @return Short description what the plugin does.
*/
String description() default "";
/**
* @return Not used (yet?).
*/
String help() default "";
}
@@ -1,21 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.core;
import net.minecraft.creativetab.CreativeTabs;
/**
* References to the specialised tabs added by Forestry to creative inventory.
*/
public class Tabs {
public static CreativeTabs tabApiculture;
public static CreativeTabs tabArboriculture;
public static CreativeTabs tabLepidopterology;
}
@@ -1,10 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
@API(apiVersion="1.0", owner="Forestry", provides="ForestryAPI|core")
package forestry.api.core;
import cpw.mods.fml.common.API;
@@ -1,22 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.farming;
import java.util.Collection;
import java.util.HashMap;
public class Farmables {
/**
* Can be used to add IFarmables to some of the vanilla farm logics.
*
* Identifiers: farmArboreal farmWheat farmGourd farmInfernal farmPoales farmSucculentes farmVegetables farmShroom
*/
public static HashMap<String, Collection<IFarmable>> farmables = new HashMap<String, Collection<IFarmable>>();
public static IFarmInterface farmInterface;
}
@@ -1,23 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.farming;
import java.util.Collection;
import net.minecraft.item.ItemStack;
public interface ICrop {
/**
* Harvests this crop. Performs the necessary manipulations to set the crop into a "harvested" state.
*
* @return Products harvested.
*/
Collection<ItemStack> harvest();
}
@@ -1,19 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.farming;
import forestry.api.core.ITileStructure;
public interface IFarmComponent extends ITileStructure {
boolean hasFunction();
void registerListener(IFarmListener listener);
void removeListener(IFarmListener listener);
}
@@ -1,76 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.farming;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
public interface IFarmHousing {
int[] getCoords();
int[] getArea();
int[] getOffset();
World getWorld();
/**
* Will run the work cycle on a master TE. Will do nothing on any other farm component.
*
* @return true if any work was done, false otherwise.
*/
boolean doWork();
boolean hasLiquid(FluidStack liquid);
void removeLiquid(FluidStack liquid);
boolean hasResources(ItemStack[] resources);
void removeResources(ItemStack[] resources);
/**
* Callback for {@link IFarmLogic}s to plant a sapling, seed, germling, stem. Will remove the appropriate germling from the farm's inventory. It's up to the
* logic to only call this on a valid location.
*
* @param farmable
* @param world
* @param x
* @param y
* @param z
* @return true if planting was successful, false otherwise.
*/
boolean plantGermling(IFarmable farmable, World world, int x, int y, int z);
/* INTERACTION WITH HATCHES */
boolean acceptsAsGermling(ItemStack itemstack);
boolean acceptsAsResource(ItemStack itemstack);
boolean acceptsAsFertilizer(ItemStack itemstack);
/* LOGIC */
/**
* Set a farm logic for the given direction. UP/DOWN/UNKNOWN are invalid!
*
* @param direction
* @param logic
*/
void setFarmLogic(ForgeDirection direction, IFarmLogic logic);
/**
* Reset the farm logic for the given direction to default. UP/DOWN/UNKNOWN are invalid!
*
* @param direction
*/
void resetFarmLogic(ForgeDirection direction);
}
@@ -1,22 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.farming;
import forestry.api.core.IStructureLogic;
public interface IFarmInterface {
/**
* Creates {@link IStructureLogic} for use in farm components.
*
* @param structure
* {@link IFarmComponent} to create the logic for.
* @return {@link IStructureLogic} for use in farm components
*/
IStructureLogic createFarmStructureLogic(IFarmComponent structure);
}
@@ -1,79 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.farming;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
public interface IFarmListener {
/**
* Called before a crop is harvested.
*
* @param crop
* ICrop about to be harvested.
* @return true to cancel further processing of this crop.
*/
boolean beforeCropHarvest(ICrop crop);
/**
* Called after a crop has been harvested, but before harvested items are stowed in the farms inventory.
*
* @param harvested
* Collection of harvested stacks. May be manipulated. Ensure removal of stacks with 0 or less items!
* @param crop
* Harvested {@link ICrop}
*/
void afterCropHarvest(Collection<ItemStack> harvested, ICrop crop);
/**
* Called after the stack of collected items has been returned by the farm logic, but before it is added to the farm's pending queue.
*
* @param collected
* Collection of collected stacks. May be manipulated. Ensure removal of stacks with 0 or less items!
* @param logic
*/
void hasCollected(Collection<ItemStack> collected, IFarmLogic logic);
/**
* Called after farmland has successfully been cultivated by a farm logic.
*
* @param logic
* @param x
* @param y
* @param z
* @param direction
* @param extent
*/
void hasCultivated(IFarmLogic logic, int x, int y, int z, ForgeDirection direction, int extent);
/**
* Called after the stack of harvested crops has been returned by the farm logic, but before it is added to the farm's pending queue.
*
* @param harvested
* @param logic
* @param x
* @param y
* @param z
* @param direction
* @param extent
*/
void hasScheduledHarvest(Collection<ICrop> harvested, IFarmLogic logic, int x, int y, int z, ForgeDirection direction, int extent);
/**
* Can be used to cancel farm task on a per side/{@link IFarmLogic} basis.
*
* @param logic
* @param direction
* @return true to skip any work action on the given logic and direction for this work cycle.
*/
boolean cancelTask(IFarmLogic logic, ForgeDirection direction);
}
@@ -1,43 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.farming;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.util.ForgeDirection;
public interface IFarmLogic {
int getFertilizerConsumption();
int getWaterConsumption(float hydrationModifier);
boolean isAcceptedResource(ItemStack itemstack);
boolean isAcceptedGermling(ItemStack itemstack);
Collection<ItemStack> collect();
boolean cultivate(int x, int y, int z, ForgeDirection direction, int extent);
Collection<ICrop> harvest(int x, int y, int z, ForgeDirection direction, int extent);
@SideOnly(Side.CLIENT)
IIcon getIcon();
ResourceLocation getSpriteSheet();
String getName();
}
@@ -1,61 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.farming;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* IGermling describes a crop or other harvestable object and can be used to inspect item stacks and blocks for matches.
*/
public interface IFarmable {
/**
* @param world
* @param x
* @param y
* @param z
* @return true if the block at the given location is a "sapling" for this type, i.e. a non-harvestable immature version of the crop.
*/
boolean isSaplingAt(World world, int x, int y, int z);
/**
* @param world
* @param x
* @param y
* @param z
* @return {@link ICrop} if the block at the given location is a harvestable and mature crop, null otherwise.
*/
ICrop getCropAt(World world, int x, int y, int z);
/**
* @param itemstack
* @return true if the item is a valid germling (plantable sapling, seed, etc.) for this type.
*/
boolean isGermling(ItemStack itemstack);
/**
* @param itemstack
* @return true if the item is something that can drop from this type without actually being harvested as a crop. (Apples or sapling from decaying leaves.)
*/
boolean isWindfall(ItemStack itemstack);
/**
* Plants a sapling by manipulating the world. The {@link IFarmLogic} should have verified the given location as valid. Called by the {@link IFarmHousing}
* which handles resources.
*
* @param germling
* @param world
* @param x
* @param y
* @param z
* @return true on success, false otherwise.
*/
boolean plantSaplingAt(ItemStack germling, World world, int x, int y, int z);
}
@@ -1,10 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
@API(apiVersion="1.0", owner="ForestryAPI|core", provides="ForestryAPI|farming")
package forestry.api.farming;
import cpw.mods.fml.common.API;
@@ -1,15 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.food;
public class BeverageManager {
public static IBeverageEffect[] effectList = new IBeverageEffect[128];
public static IInfuserManager infuserManager;
public static IIngredientManager ingredientManager;
}
@@ -1,19 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.food;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
public interface IBeverageEffect {
int getId();
void doEffect(World world, EntityPlayer player);
String getDescription();
}
@@ -1,24 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.food;
import net.minecraft.item.ItemStack;
public interface IInfuserManager {
void addMixture(int meta, ItemStack ingredient, IBeverageEffect effect);
void addMixture(int meta, ItemStack[] ingredients, IBeverageEffect effect);
ItemStack getSeasoned(ItemStack base, ItemStack[] ingredients);
boolean hasMixtures(ItemStack[] ingredients);
ItemStack[] getRequired(ItemStack[] ingredients);
}
@@ -1,18 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.food;
import net.minecraft.item.ItemStack;
public interface IIngredientManager {
String getDescription(ItemStack itemstack);
void addIngredient(ItemStack ingredient, String description);
}
@@ -1,10 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
@API(apiVersion="1.0", owner="ForestryAPI|core", provides="ForestryAPI|food")
package forestry.api.food;
import cpw.mods.fml.common.API;
@@ -1,36 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.fuels;
import net.minecraftforge.fluids.Fluid;
public class EngineBronzeFuel {
/**
* Item that is valid fuel for a biogas engine.
*/
public final Fluid liquid;
/**
* Power produced by this fuel per work cycle of the engine.
*/
public final int powerPerCycle;
/**
* How many work cycles a single "stack" of this type lasts.
*/
public final int burnDuration;
/**
* By how much the normal heat dissipation rate of 1 is multiplied when using this fuel type.
*/
public final int dissipationMultiplier;
public EngineBronzeFuel(Fluid liquid, int powerPerCycle, int burnDuration, int dissipationMultiplier) {
this.liquid = liquid;
this.powerPerCycle = powerPerCycle;
this.burnDuration = burnDuration;
this.dissipationMultiplier = dissipationMultiplier;
}
}
@@ -1,33 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class EngineCopperFuel {
/**
* Item that is valid fuel for a peat-fired engine.
*/
public final ItemStack fuel;
/**
* Power produced by this fuel per work cycle.
*/
public final int powerPerCycle;
/**
* Amount of work cycles this item lasts before being consumed.
*/
public final int burnDuration;
public EngineCopperFuel(ItemStack fuel, int powerPerCycle, int burnDuration) {
this.fuel = fuel;
this.powerPerCycle = powerPerCycle;
this.burnDuration = burnDuration;
}
}
@@ -1,31 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class FermenterFuel {
/**
* Item that is a valid fuel for the fermenter (i.e. fertilizer).
*/
public final ItemStack item;
/**
* How much is fermeted per work cycle, i.e. how much biomass is produced per cycle.
*/
public final int fermentPerCycle;
/**
* Amount of work cycles a single item of this fuel lasts before expiring.
*/
public final int burnDuration;
public FermenterFuel(ItemStack item, int fermentPerCycle, int burnDuration) {
this.item = item;
this.fermentPerCycle = fermentPerCycle;
this.burnDuration = burnDuration;
}
}
@@ -1,36 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.fuels;
import java.util.HashMap;
public class FuelManager {
/**
* Add new fuels for the fermenter here (i.e. fertilizer). Will accept Items, ItemStacks and Strings (Ore Dictionary)
*/
public static HashMap<Object, FermenterFuel> fermenterFuel;
/**
* Add new resources for the moistener here (i.e. wheat)
*/
public static HashMap<Object, MoistenerFuel> moistenerResource;
/**
* Add new substrates for the rainmaker here
*/
public static HashMap<Object, RainSubstrate> rainSubstrate;
/**
* Add new fuels for EngineBronze (= biogas engine) here
*/
public static HashMap<Object, EngineBronzeFuel> bronzeEngineFuel;
/**
* Add new fuels for EngineCopper (= peat-fired engine) here
*/
public static HashMap<Object, EngineCopperFuel> copperEngineFuel;
// Generator fuel list in GeneratorFuel.class
}
@@ -1,37 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.fuels;
import java.util.HashMap;
import net.minecraftforge.fluids.FluidStack;
public class GeneratorFuel {
public static HashMap<Integer, GeneratorFuel> fuels = new HashMap<Integer, GeneratorFuel>();
/**
* LiquidStack representing the fuel type and amount consumed per triggered cycle.
*/
public final FluidStack fuelConsumed;
/**
* EU emitted per tick while this fuel is being consumed in the generator (i.e. biofuel = 32, biomass = 8).
*/
public final int eu;
/**
* Rate at which the fuel is consumed. 1 - Every tick 2 - Every second tick 3 - Every third tick etc.
*/
public final int rate;
public GeneratorFuel(FluidStack fuelConsumed, int eu, int rate) {
this.fuelConsumed = fuelConsumed;
this.eu = eu;
this.rate = rate;
}
}
@@ -1,36 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class MoistenerFuel {
/**
* The item to use
*/
public final ItemStack item;
/**
* The item that leaves the moistener's working slot (i.e. mouldy wheat, decayed wheat, mulch)
*/
public final ItemStack product;
/**
* How much this item contributes to the final product of the moistener (i.e. mycelium)
*/
public final int moistenerValue;
/**
* What stage this product represents. Resources with lower stage value will be consumed first.
*/
public final int stage;
public MoistenerFuel(ItemStack item, ItemStack product, int stage, int moistenerValue) {
this.item = item;
this.product = product;
this.stage = stage;
this.moistenerValue = moistenerValue;
}
}
@@ -1,42 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class RainSubstrate {
/**
* Rain substrate capable of activating the rainmaker.
*/
public ItemStack item;
/**
* Duration of the rain shower triggered by this substrate in Minecraft ticks.
*/
public int duration;
/**
* Speed of activation sequence triggered.
*/
public float speed;
public boolean reverse;
public RainSubstrate(ItemStack item, int duration, float speed) {
this(item, duration, speed, false);
}
public RainSubstrate(ItemStack item, float speed) {
this(item, 0, speed, true);
}
public RainSubstrate(ItemStack item, int duration, float speed, boolean reverse) {
this.item = item;
this.duration = duration;
this.speed = speed;
this.reverse = reverse;
}
}
@@ -1,10 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
@API(apiVersion="1.0", owner="ForestryAPI|core", provides="ForestryAPI|fuels")
package forestry.api.fuels;
import cpw.mods.fml.common.API;
@@ -1,31 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.genetics;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
/**
* Holds a static reference to the {@link IAlleleRegistry}.
*/
public class AlleleManager {
/**
* Main access point for all things related to genetics. See {@link IAlleleRegistry} for details.
*/
public static IAlleleRegistry alleleRegistry;
/**
* Translates plain leaf blocks into genetic data. Used by bees and butterflies to convert and pollinate foreign leaf blocks.
*/
public static HashMap<ItemStack, IIndividual> ersatzSpecimen = new HashMap<ItemStack, IIndividual>();
/**
* Translates plain saplings into genetic data. Used by the treealyzer and the farm to convert foreign saplings.
*/
public static HashMap<ItemStack, IIndividual> ersatzSaplings = new HashMap<ItemStack, IIndividual>();
}
@@ -1,18 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.genetics;
public enum EnumTolerance {
NONE,
BOTH_1, BOTH_2, BOTH_3, BOTH_4, BOTH_5,
UP_1, UP_2, UP_3, UP_4, UP_5,
DOWN_1, DOWN_2, DOWN_3, DOWN_4, DOWN_5
}
@@ -1,36 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.genetics;
/**
* An {@link IIndividual}'s {@link IGenome} is composed of {@link IChromosome}s consisting each of a primary and secondary {@link IAllele}.
*
* {@link IAllele}s hold all information regarding an {@link IIndividual}'s traits, from species to size, temperature tolerances, etc.
*
* Should be extended for different types of alleles. ISpeciesAllele, IBiomeAllele, etc.
*
* @author SirSengir
*/
public interface IAllele {
/**
* @return A unique string identifier for this allele.
*/
String getUID();
/**
* @return true if the allele is dominant, false otherwise.
*/
boolean isDominant();
/**
* @return Localized short, human-readable identifier used in tooltips and beealyzer.
*/
String getName();
}
@@ -1,17 +0,0 @@
/*******************************************************************************
* Copyright 2011-2014 by SirSengir
*
* This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
*
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/.
******************************************************************************/
package forestry.api.genetics;
/**
* Simple interface to allow adding additional alleles containing float values.
*/
public interface IAlleleArea extends IAllele {
int[] getValue();
}
Loaded 100 of 183 files, more files were not shown because too many files have changed in this diff. Show more