API javadoc cleanup, use NonNullList for ItemStack lists

This commit is contained in:
mezz committed 2016-12-30 23:39:42 -08:00
1 parent 55919a135e
commit d8e735ef3b
48 files changed
+119 -207

No files matched your search

@@ -49,8 +49,6 @@ public interface IBee extends IIndividualLiving {
/**
* Set the natural flag on this bee.
*
* @param flag
*/
void setIsNatural(boolean flag);
@@ -18,7 +18,7 @@ import net.minecraft.world.World;
public interface IBeeRoot extends ISpeciesRoot {
/**
* @return true if passed item is a Forestry bee. Equal to getType(ItemStack stack) != EnumBeeType.NONE
* @return true if passed item is a Forestry bee. Equal to getType(ItemStack stack) != null
*/
@Override
boolean isMember(ItemStack stack);
@@ -49,7 +49,6 @@ public interface IBeeRoot extends ISpeciesRoot {
/* BREEDING TRACKER */
/**
* @param world
* @return {@link IApiaristTracker} associated with the passed world.
*/
@Override
@@ -58,7 +57,7 @@ public interface IBeeRoot extends ISpeciesRoot {
/* BEE SPECIFIC */
/**
* @return type of bee encoded on the itemstack. EnumBeeType.NONE if it isn't a bee.
* @return type of bee encoded on the itemstack. null if it isn't a bee.
*/
@Nullable
@Override
@@ -110,7 +109,7 @@ public interface IBeeRoot extends ISpeciesRoot {
void registerBeekeepingMode(IBeekeepingMode mode);
void setBeekeepingMode(World world, String name);
void setBeekeepingMode(World world, IBeekeepingMode mode);
/* MISC */
@@ -28,40 +28,31 @@ public interface IBeekeepingMode {
float getWearModifier();
/**
* @param queen
* @return fertility taking into account the birthing queen and surroundings.
*/
int getFinalFertility(IBee queen, World world, BlockPos pos);
/**
* @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);
@@ -5,9 +5,8 @@
******************************************************************************/
package forestry.api.apiculture;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
@@ -22,7 +21,7 @@ public interface IHiveDrop {
IBee getBeeType(IBlockAccess world, BlockPos pos);
Collection<ItemStack> getExtraItems(IBlockAccess world, BlockPos pos, int fortune);
NonNullList<ItemStack> getExtraItems(IBlockAccess world, BlockPos pos, int fortune);
/**
* Chance to drop a bee or extra items. Default drops have 0.80 (= 80 %).
@@ -6,6 +6,7 @@
package forestry.api.arboriculture;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Map;
import com.mojang.authlib.GameProfile;
@@ -36,7 +37,7 @@ public interface ITree extends IIndividual, ITreeGenData {
/**
* @since Forestry 4.0
*/
ITree[] getSaplings(World world, @Nullable GameProfile playerProfile, BlockPos pos, float modifier);
List<ITree> getSaplings(World world, @Nullable GameProfile playerProfile, BlockPos pos, float modifier);
// Products, Chance
Map<ItemStack, Float> getProducts();
@@ -8,32 +8,26 @@ 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);
@@ -43,7 +43,6 @@ public interface ITreeRoot extends ISpeciesRootPollinatable {
ITreeGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
/**
* @param world
* @return {@link IArboristTracker} associated with the passed world.
*/
@Override
@@ -87,11 +86,12 @@ public interface ITreeRoot extends ISpeciesRootPollinatable {
ITreekeepingMode getTreekeepingMode(World world);
@Nullable
ITreekeepingMode getTreekeepingMode(String name);
void registerTreekeepingMode(ITreekeepingMode mode);
void setTreekeepingMode(World world, String name);
void setTreekeepingMode(World world, ITreekeepingMode mode);
/* TEMPLATES */
@@ -5,7 +5,7 @@
******************************************************************************/
package forestry.api.arboriculture;
import java.util.ArrayList;
import java.util.List;
public interface ITreekeepingMode extends ITreeModifier {
@@ -17,6 +17,6 @@ public interface ITreekeepingMode extends ITreeModifier {
/**
* @return Localized list of strings outlining the behaviour of this treekeeping mode.
*/
ArrayList<String> getDescription();
List<String> getDescription();
}
@@ -5,7 +5,6 @@
******************************************************************************/
package forestry.api.core;
import javax.annotation.Nullable;
import java.util.List;
import net.minecraft.item.ItemStack;
@@ -22,7 +21,6 @@ public interface ICamouflageAccess {
/**
* @return A list of all item camouflage handler's that are registered for that camouflage type.
*/
@Nullable
List<ICamouflageItemHandler> getCamouflageItemHandler(String type);
void addItemToBlackList(String type, ItemStack camouflageBlock);
@@ -23,7 +23,7 @@ public class DefaultFarmListener implements IFarmListener {
}
@Override
public void afterCropHarvest(Collection<ItemStack> harvested, ICrop crop) {
public void afterCropHarvest(NonNullList<ItemStack> harvested, ICrop crop) {
}
@@ -27,7 +27,7 @@ public interface IFarmListener {
* @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);
void afterCropHarvest(NonNullList<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.
@@ -18,7 +18,6 @@ public interface IAlleleEffect extends IAllele {
/**
* Returns the passed data storage if it is valid for this effect or a new one if the passed storage object was invalid for this effect.
*
* @param storedData
* @return {@link IEffectData} for the next cycle.
*/
IEffectData validateStorage(IEffectData storedData);
@@ -55,11 +55,11 @@ public interface IAlleleRegistry {
/**
* Retrieve a matching {@link ISpeciesRoot} for the given {@link IIndividual}-class.
*
* @param clz Class extending {@link IIndividual}.
* @param individualClass Class extending {@link IIndividual}.
* @return {@link ISpeciesRoot} if found, null otherwise.
*/
@Nullable
ISpeciesRoot getSpeciesRoot(Class<? extends IIndividual> clz);
ISpeciesRoot getSpeciesRoot(Class<? extends IIndividual> individualClass);
/**
* Retrieve a matching {@link ISpeciesRoot} for the given {@link IIndividual}
@@ -71,7 +71,6 @@ public interface IAlleleRegistry {
/**
* Tests the itemstack for genetic information.
*
* @param stack
* @return true if the itemstack is an individual.
*/
boolean isIndividual(ItemStack stack);
@@ -183,15 +182,12 @@ public interface IAlleleRegistry {
/**
* Registers a new fruit family.
*
* @param family
*/
void registerFruitFamily(IFruitFamily family);
/**
* Retrieves a fruit family identified by uid.
*
* @param uid
* @return {IFruitFamily} if found, false otherwise.
*/
IFruitFamily getFruitFamily(String uid);
@@ -9,6 +9,7 @@ import com.mojang.authlib.GameProfile;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
/**
@@ -57,19 +58,14 @@ public interface IAlleleSpecies extends IAllele {
int getComplexity();
/**
* @param itemstack
* @return A float signifying the chance for the passed itemstack to yield a research success.
*/
float getResearchSuitability(ItemStack itemstack);
/**
* @param world
* @param gameProfile
* @param individual
* @param bountyLevel
* @return Array of itemstacks representing the bounty for this research success.
* @return itemstacks representing the bounty for this research success.
*/
ItemStack[] getResearchBounty(World world, GameProfile gameProfile, IIndividual individual, int bountyLevel);
NonNullList<ItemStack> getResearchBounty(World world, GameProfile gameProfile, IIndividual individual, int bountyLevel);
/* CLIMATE */
@@ -33,29 +33,21 @@ public interface IBreedingTracker {
/**
* Register the birth of an individual. Will mark it as discovered.
*
* @param individual
*/
void registerBirth(IIndividual individual);
/**
* Register the pickup of an individual.
*
* @param individual
*/
void registerPickup(IIndividual individual);
/**
* Marks a species as discovered. Should only be called from registerIndividual normally.
*
* @param species
*/
void registerSpecies(IAlleleSpecies species);
/**
* Register a successful mutation. Will mark it as discovered.
*
* @param mutation
*/
void registerMutation(IMutation mutation);
@@ -90,8 +90,6 @@ public interface IClassification {
/**
* Used by the allele registry to populate internal collection of branch members on the fly.
*
* @param species
*/
void addMemberSpecies(IAlleleSpecies species);
@@ -40,7 +40,6 @@ public interface IIndividual extends INbtWritable {
/**
* Check whether the genetic makeup of two IIndividuals is identical. Ignores additional data like generations, irregular mating, etc..
*
* @param other
* @return true if the given other IIndividual has the amount of chromosomes and their alleles are identical.
*/
boolean isGeneticEqual(IIndividual other);
@@ -34,9 +34,6 @@ public interface IIndividualLiving extends IIndividual {
/**
* Age the individual.
*
* @param world
* @param ageModifier
*/
void age(World world, float ageModifier);
@@ -49,13 +49,11 @@ public interface IMutation {
Collection<String> getSpecialConditions();
/**
* @param allele
* @return true if the passed allele is one of the alleles participating in this mutation.
*/
boolean isPartner(IAllele allele);
/**
* @param allele
* @return the other allele which was not passed as argument.
*/
IAllele getPartner(IAllele allele);
@@ -96,15 +96,11 @@ public interface ISpeciesRoot {
/**
* Registers a bee template using the UID of the first allele as identifier.
*
* @param template
*/
void registerTemplate(IAllele[] template);
/**
* Registers a bee template using the passed identifier.
*
* @param template
*/
void registerTemplate(String identifier, IAllele[] template);
@@ -144,8 +140,6 @@ public interface ISpeciesRoot {
/**
* Use to register mutations.
*
* @param mutation
*/
void registerMutation(IMutation mutation);
@@ -14,10 +14,9 @@ import net.minecraftforge.fml.common.eventhandler.Event;
public class GreenhouseEvents extends Event {
@Nullable
public final IGreenhouseController controller;
public GreenhouseEvents(@Nullable IGreenhouseController state) {
public GreenhouseEvents(IGreenhouseController state) {
this.controller = state;
}
@@ -14,7 +14,6 @@ public interface IAlleleButterflyEffect extends IAlleleEffect {
* Used by butterflies to trigger effects in the world.
*
* @param butterfly {@link IEntityButterfly}
* @param storedData
* @return {@link forestry.api.genetics.IEffectData} for the next cycle.
*/
IEffectData doEffect(IEntityButterfly butterfly, IEffectData storedData);
@@ -29,41 +29,27 @@ public interface IButterfly extends IIndividualLiving {
float getSize();
/**
* @param world
* @param x
* @param y
* @param z
* @return true if the butterfly can naturally spawn at the given location at this time. (Used to auto-spawn butterflies from tree leaves.)
*/
boolean canSpawn(World world, double x, double y, double z);
/**
* @param world
* @param x
* @param y
* @param z
* @return true if the butterfly can take flight at the given location at this time. (Used to auto-spawn butterflies from dropped items.)
*/
boolean canTakeFlight(World world, double x, double y, double z);
/**
* @param world
* @param x
* @param y
* @param z
* @return true if the environment (temperature, humidity) is valid for the butterfly at the given location.
*/
boolean isAcceptedEnvironment(World world, double x, double y, double z);
/**
* @param world
* @return create a caterpillar with the two genome's from the nursery.
*/
@Nullable
IButterfly spawnCaterpillar(World world, IButterflyNursery nursery);
/**
* @param entity
* @param playerKill Whether or not the butterfly was killed by a player.
* @param lootLevel Loot level according to the weapon used to kill the butterfly.
* @return Array of itemstacks to drop on death of the given entity.
@@ -71,7 +57,6 @@ public interface IButterfly extends IIndividualLiving {
NonNullList<ItemStack> getLootDrop(IEntityButterfly entity, boolean playerKill, int lootLevel);
/**
* @param nursery
* @param playerKill Whether or not the nursery was broken by a player.
* @param lootLevel Fortune level.
* @return Array of itemstacks to drop on breaking of the nursery.
@@ -79,8 +64,7 @@ public interface IButterfly extends IIndividualLiving {
NonNullList<ItemStack> getCaterpillarDrop(IButterflyNursery nursery, boolean playerKill, int lootLevel);
/**
* @param cocoon
* @return Array of itemstacks to drop on breaking of the cocoon.
* @return itemstacks to drop on breaking of the cocoon.
*/
NonNullList<ItemStack> getCocoonDrop(IButterflyCocoon cocoon);
@@ -17,8 +17,8 @@ public interface IButterflyNursery extends IHousing, IClimateProvider {
IIndividual getNanny();
void setCaterpillar(@Nullable IButterfly butterfly);
void setCaterpillar(@Nullable IButterfly caterpillar);
boolean canNurse(IButterfly butterfly);
boolean canNurse(IButterfly caterpillar);
}
@@ -48,7 +48,6 @@ public interface IButterflyRoot extends ISpeciesRoot {
/**
* Spawns the given butterfly in the world.
*
* @param butterfly
* @return butterfly entity on success, null otherwise.
*/
EntityLiving spawnButterflyInWorld(World world, IButterfly butterfly, double x, double y, double z);
@@ -5,11 +5,11 @@
******************************************************************************/
package forestry.api.recipes;
import java.util.Collection;
import java.util.Map;
import java.util.Random;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
public interface ICentrifugeRecipe extends IForestryRecipe {
@@ -26,7 +26,7 @@ public interface ICentrifugeRecipe extends IForestryRecipe {
/**
* Returns the randomized products from processing one input item.
**/
Collection<ItemStack> getProducts(Random random);
NonNullList<ItemStack> getProducts(Random random);
/**
* Returns a list of all possible products and their estimated probabilities (0.0 to 1.0],
@@ -27,7 +27,7 @@ public interface IDescriptiveRecipe {
/**
* @return array of all the ingredients in the crafting table.
* Ingredients may be null, ItemStack, ItemStack[], or a List of ItemStack
* Each inner list represents one slot's accepted ItemStacks
*/
NonNullList<NonNullList<ItemStack>> getIngredients();
@@ -18,6 +18,7 @@ public interface IFabricatorRecipe extends IForestryRecipe {
/**
* @return the list of ingredients in the crafting grid to create this recipe.
* Each inner list represents one slot's accepted ItemStacks
*/
NonNullList<NonNullList<ItemStack>> getIngredients();
@@ -12,7 +12,7 @@ import net.minecraftforge.fluids.FluidStack;
public interface ISqueezerRecipe extends IForestryRecipe {
/**
* @return Array of item stacks representing the required resources for one process. Stack size will be taken into account.
* @return item stacks representing the required resources for one process. Stack size will be taken into account.
*/
NonNullList<ItemStack> getResources();
@@ -14,7 +14,6 @@ import net.minecraft.item.ItemStack;
public interface IVariableFermentable {
/**
* @param itemstack
* @return Float representing the modification to be applied to the matching recipe's biomass output.
*/
float getFermentationModifier(ItemStack itemstack);