Skip to content

Commit

Permalink
API javadoc cleanup, use NonNullList for ItemStack lists
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Dec 31, 2016
1 parent 55919a1 commit d8e735e
Show file tree
Hide file tree
Showing 48 changed files with 119 additions and 207 deletions.
2 changes: 0 additions & 2 deletions src/main/java/forestry/api/apiculture/IBee.java
Expand Up @@ -49,8 +49,6 @@ public interface IBee extends IIndividualLiving {

/**
* Set the natural flag on this bee.
*
* @param flag
*/
void setIsNatural(boolean flag);

Expand Down
7 changes: 3 additions & 4 deletions src/main/java/forestry/api/apiculture/IBeeRoot.java
Expand Up @@ -18,7 +18,7 @@
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);
Expand Down Expand Up @@ -49,7 +49,6 @@ public interface IBeeRoot extends ISpeciesRoot {
/* BREEDING TRACKER */

/**
* @param world
* @return {@link IApiaristTracker} associated with the passed world.
*/
@Override
Expand All @@ -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
Expand Down Expand Up @@ -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 */

Expand Down
9 changes: 0 additions & 9 deletions src/main/java/forestry/api/apiculture/IBeekeepingMode.java
Expand Up @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/forestry/api/apiculture/IHiveDrop.java
Expand Up @@ -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;

Expand All @@ -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 %).
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/forestry/api/arboriculture/ITree.java
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/forestry/api/arboriculture/ITreeModifier.java
Expand Up @@ -8,32 +8,26 @@
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);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/forestry/api/arboriculture/ITreeRoot.java
Expand Up @@ -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
Expand Down Expand Up @@ -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 */

Expand Down
Expand Up @@ -5,7 +5,7 @@
******************************************************************************/
package forestry.api.arboriculture;

import java.util.ArrayList;
import java.util.List;

public interface ITreekeepingMode extends ITreeModifier {

Expand All @@ -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();

}
2 changes: 0 additions & 2 deletions src/main/java/forestry/api/core/ICamouflageAccess.java
Expand Up @@ -5,7 +5,6 @@
******************************************************************************/
package forestry.api.core;

import javax.annotation.Nullable;
import java.util.List;

import net.minecraft.item.ItemStack;
Expand All @@ -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);
Expand Down
Expand Up @@ -23,7 +23,7 @@ public boolean beforeCropHarvest(ICrop crop) {
}

@Override
public void afterCropHarvest(Collection<ItemStack> harvested, ICrop crop) {
public void afterCropHarvest(NonNullList<ItemStack> harvested, ICrop crop) {

}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/forestry/api/farming/IFarmListener.java
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion src/main/java/forestry/api/genetics/IAlleleEffect.java
Expand Up @@ -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);
Expand Down
8 changes: 2 additions & 6 deletions src/main/java/forestry/api/genetics/IAlleleRegistry.java
Expand Up @@ -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}
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 3 additions & 7 deletions src/main/java/forestry/api/genetics/IAlleleSpecies.java
Expand Up @@ -9,6 +9,7 @@
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;

/**
Expand Down Expand Up @@ -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 */

Expand Down
8 changes: 0 additions & 8 deletions src/main/java/forestry/api/genetics/IBreedingTracker.java
Expand Up @@ -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);

Expand Down
2 changes: 0 additions & 2 deletions src/main/java/forestry/api/genetics/IClassification.java
Expand Up @@ -90,8 +90,6 @@ public boolean isDroppable() {

/**
* Used by the allele registry to populate internal collection of branch members on the fly.
*
* @param species
*/
void addMemberSpecies(IAlleleSpecies species);

Expand Down
1 change: 0 additions & 1 deletion src/main/java/forestry/api/genetics/IIndividual.java
Expand Up @@ -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);
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/forestry/api/genetics/IIndividualLiving.java
Expand Up @@ -34,9 +34,6 @@ public interface IIndividualLiving extends IIndividual {

/**
* Age the individual.
*
* @param world
* @param ageModifier
*/
void age(World world, float ageModifier);

Expand Down
2 changes: 0 additions & 2 deletions src/main/java/forestry/api/genetics/IMutation.java
Expand Up @@ -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);
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/forestry/api/genetics/ISpeciesRoot.java
Expand Up @@ -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);

Expand Down Expand Up @@ -144,8 +140,6 @@ public interface ISpeciesRoot {

/**
* Use to register mutations.
*
* @param mutation
*/
void registerMutation(IMutation mutation);

Expand Down

0 comments on commit d8e735e

Please sign in to comment.