Begin code cleanup for generics, types, warnings, nulls, and spelling

This commit is contained in:
mezz committed 2016-02-25 19:11:29 -08:00
1 parent c9b2f7bd3e
commit 406392e7f7
98 files changed
+472 -314

No files matched your search

@@ -25,7 +25,7 @@ public class BeeManager {
/**
* List of items that can induce swarming. Integer denotes x in 1000 chance.
*/
public static HashMap<ItemStack, Integer> inducers = new HashMap<ItemStack, Integer>();
public static HashMap<ItemStack, Integer> inducers = new HashMap<>();
/**
* Convenient access to AlleleManager.alleleRegistry.getSpeciesRoot("rootBees")
@@ -44,7 +44,7 @@ public enum EnumBeeChromosome implements IChromosomeType {
*/
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.
* Slightly incorrectly named. If true, a naturally diurnal bee can work during the night. If true, a naturally nocturnal bee can work during the day.
*/
NOCTURNAL(IAlleleBoolean.class),
/**
@@ -81,15 +81,15 @@ public enum EnumBeeChromosome implements IChromosomeType {
*/
EFFECT(IAlleleBeeEffect.class);
Class<? extends IAllele> clss;
private final Class<? extends IAllele> alleleClass;
EnumBeeChromosome(Class<? extends IAllele> clss) {
this.clss = clss;
EnumBeeChromosome(Class<? extends IAllele> alleleClass) {
this.alleleClass = alleleClass;
}
@Override
public Class<? extends IAllele> getAlleleClass() {
return clss;
return alleleClass;
}
@Override
@@ -5,6 +5,8 @@
******************************************************************************/
package forestry.api.apiculture;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Set;
@@ -26,12 +28,14 @@ public interface IBee extends IIndividualLiving {
/**
* @return Bee's genetic information.
*/
@Nonnull
@Override
IBeeGenome getGenome();
/**
* @return Genetic information of the bee's mate, null if unmated.
*/
@Nullable
@Override
IBeeGenome getMate();
@@ -7,13 +7,14 @@ package forestry.api.apiculture.hives;
import java.util.List;
import forestry.api.apiculture.IHiveDrop;
import net.minecraft.util.IStringSerializable;
import forestry.api.apiculture.IHiveDrop;
public interface IHiveRegistry {
/* Forestry Hive Names */
public static enum HiveType implements IStringSerializable{
enum HiveType implements IStringSerializable {
FOREST("Forestry:forest"),
MEADOWS("Forestry:meadows"),
DESERT("Forestry:desert"),
@@ -22,11 +23,11 @@ public interface IHiveRegistry {
SNOW("Forestry:snow"),
SWAMP("Forestry:swamp");
private HiveType(String name) {
HiveType(String name) {
this.name = name;
}
public String name;
private final String name;
public String getHiveName()
{
@@ -19,7 +19,7 @@ public interface ICircuitRegistry {
ICircuit getCircuit(String uid);
ICircuitLibrary getCircuitLibrary(World world, String playername);
ICircuitLibrary getCircuitLibrary(World world, String playerName);
/* LAYOUTS */
Map<String, ICircuitLayout> getRegisteredLayouts();
@@ -30,7 +30,7 @@ public interface ICircuitRegistry {
ICircuitLayout getDefaultLayout();
ICircuitBoard getCircuitboard(ItemStack itemstack);
ICircuitBoard getCircuitBoard(ItemStack itemstack);
boolean isChipset(ItemStack itemstack);
@@ -9,7 +9,7 @@ import net.minecraftforge.common.BiomeDictionary;
public class BiomeHelper {
private static final Map<BiomeGenBase, Boolean> isBiomeHellishCache = new HashMap<BiomeGenBase, Boolean>();
private static final Map<BiomeGenBase, Boolean> isBiomeHellishCache = new HashMap<>();
/**
* Determines if it can rain or snow in the given biome.
@@ -15,7 +15,7 @@ public enum EnumHumidity {
public final String name;
private EnumHumidity(String name) {
EnumHumidity(String name) {
this.name = name;
}
@@ -8,6 +8,7 @@ package forestry.api.core;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.BlockPos;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -23,7 +24,7 @@ public enum EnumTemperature {
public final String name;
public final String iconIndex;
private EnumTemperature(String name, String iconIndex) {
EnumTemperature(String name, String iconIndex) {
this.name = name;
this.iconIndex = iconIndex;
}
@@ -21,5 +21,5 @@ public interface IArmorNaturalist {
* 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);
boolean canSeePollination(EntityPlayer player, ItemStack armor, boolean doSee);
}
@@ -10,15 +10,15 @@ public interface IForestryConstants {
/**
* @return The villager ID for the Apiarist Villager.
*/
public int getApicultureVillagerID();
int getApicultureVillagerID();
/**
* @return The villager ID for the Arborist Villager.
*/
public int getArboricultureVillagerID();
int getArboricultureVillagerID();
/**
* @return The ChestGenHooks key for adding items to the Forestry Villager chest.
*/
public String getVillagerChestGenKey();
String getVillagerChestGenKey();
}
@@ -14,6 +14,6 @@ public class Farmables {
*
* Identifiers: farmArboreal farmWheat farmGourd farmInfernal farmPoales farmSucculentes farmVegetables farmShroom
*/
public static HashMap<String, Collection<IFarmable>> farmables = new HashMap<String, Collection<IFarmable>>();
public static HashMap<String, Collection<IFarmable>> farmables = new HashMap<>();
}
@@ -20,11 +20,11 @@ public class AlleleManager {
/**
* 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>();
public static HashMap<ItemStack, IIndividual> ersatzSpecimen = new HashMap<>();
/**
* 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>();
public static HashMap<ItemStack, IIndividual> ersatzSaplings = new HashMap<>();
/**
* Queryable instance of an {@link IClimateHelper} for easier implementation.
*/
@@ -20,7 +20,7 @@ public interface IAlleleHandler {
* @param allele
* Allele which was registered.
*/
public void onRegisterAllele(IAllele allele);
void onRegisterAllele(IAllele allele);
/**
* Called when a classification is registered with {@link IAlleleRegistry}.
@@ -28,7 +28,7 @@ public interface IAlleleHandler {
* @param classification
* Classification which was registered.
*/
public void onRegisterClassification(IClassification classification);
void onRegisterClassification(IClassification classification);
/**
* Called when a fruit family is registered with {@link IAlleleRegistry}.
@@ -36,6 +36,5 @@ public interface IAlleleHandler {
* @param family
* Fruit family which was registered.
*/
public void onRegisterFruitFamily(IFruitFamily family);
void onRegisterFruitFamily(IFruitFamily family);
}
@@ -11,6 +11,6 @@ import net.minecraftforge.common.EnumPlantType;
public interface IAllelePlantType extends IAllele {
public EnumSet<EnumPlantType> getPlantTypes();
EnumSet<EnumPlantType> getPlantTypes();
}
@@ -12,19 +12,19 @@ package forestry.api.genetics;
*/
public interface IClassification {
public enum EnumClassLevel {
enum EnumClassLevel {
DOMAIN(0x777fff, true), KINGDOM(0x77c3ff), PHYLUM(0x77ffb6, true), DIVISION(0x77ffb6, true), CLASS(0x7bff77), ORDER(0xbeff77), FAMILY(0xfffd77),
SUBFAMILY(0xfffd77), TRIBE(0xfffd77), GENUS(0xffba77);
private int colour;
private boolean isDroppable;
private final int colour;
private final boolean isDroppable;
private EnumClassLevel(int colour) {
EnumClassLevel(int colour) {
this(colour, false);
}
private EnumClassLevel(int colour, boolean isDroppable) {
EnumClassLevel(int colour, boolean isDroppable) {
this.colour = colour;
this.isDroppable = isDroppable;
}
@@ -5,6 +5,7 @@
******************************************************************************/
package forestry.api.genetics;
import javax.annotation.Nonnull;
import java.util.List;
import forestry.api.core.INBTTagable;
@@ -34,6 +35,7 @@ public interface IIndividual extends INBTTagable {
boolean isSecret();
@Nonnull
IGenome getGenome();
/**
@@ -10,7 +10,7 @@ public enum EnumPostage {
private final int value;
private EnumPostage(int value) {
EnumPostage(int value) {
this.value = value;
}
@@ -33,7 +33,7 @@ public interface ICarpenterManager extends ICraftingProvider<ICarpenterRecipe> {
* @param materials
* Materials needed in the crafting matrix. This gets passed directly to {@link ShapedRecipes}. Notation is the same.
*/
public void addRecipe(ItemStack box, ItemStack product, Object... materials);
void addRecipe(ItemStack box, ItemStack product, Object... materials);
/**
* Add a shaped recipe to the carpenter.
@@ -47,7 +47,7 @@ public interface ICarpenterManager extends ICraftingProvider<ICarpenterRecipe> {
* @param materials
* Materials needed in the crafting matrix. This gets passed directly to {@link ShapedRecipes}. Notation is the same.
*/
public void addRecipe(int packagingTime, ItemStack box, ItemStack product, Object... materials);
void addRecipe(int packagingTime, ItemStack box, ItemStack product, Object... materials);
/**
* Add a shaped recipe to the carpenter.
@@ -63,5 +63,5 @@ public interface ICarpenterManager extends ICraftingProvider<ICarpenterRecipe> {
* @param materials
* Materials needed in the crafting matrix. This gets passed directly to {@link ShapedRecipes}. Notation is the same.
*/
public void addRecipe(int packagingTime, FluidStack liquid, ItemStack box, ItemStack product, Object... materials);
void addRecipe(int packagingTime, FluidStack liquid, ItemStack box, ItemStack product, Object... materials);
}
@@ -35,7 +35,7 @@ public interface IFermenterManager extends ICraftingProvider<IFermenterRecipe> {
* @param liquid LiquidStack representing resource liquid and amount.
* @throws NullPointerException if resource, output or liquid is null
*/
public void addRecipe(ItemStack resource, int fermentationValue, float modifier, FluidStack output, FluidStack liquid);
void addRecipe(ItemStack resource, int fermentationValue, float modifier, FluidStack output, FluidStack liquid);
/**
* Add a recipe to the fermenter. Defaults to water as input liquid.
@@ -49,5 +49,5 @@ public interface IFermenterManager extends ICraftingProvider<IFermenterRecipe> {
* determined by fermentationValue*modifier.
* @throws NullPointerException if resource, output or liquid is null
*/
public void addRecipe(ItemStack resource, int fermentationValue, float modifier, FluidStack output);
void addRecipe(ItemStack resource, int fermentationValue, float modifier, FluidStack output);
}
@@ -29,5 +29,5 @@ public interface IMoistenerManager extends ICraftingProvider<IMoistenerRecipe> {
* @param timePerItem
* Moistener runs at 1 - 4 time ticks per ingame tick depending on light level. For mycelium this value is currently 5000.
*/
public void addRecipe(ItemStack resource, ItemStack product, int timePerItem);
void addRecipe(ItemStack resource, ItemStack product, int timePerItem);
}
@@ -32,7 +32,7 @@ public interface ISqueezerManager extends ICraftingProvider<ISqueezerRecipe> {
* @param remnants Item stack representing the possible remnants from this recipe.
* @param chance Chance remnants will be produced by a single recipe cycle, from 0 to 100.
*/
public void addRecipe(int timePerItem, ItemStack[] resources, FluidStack liquid, ItemStack remnants, int chance);
void addRecipe(int timePerItem, ItemStack[] resources, FluidStack liquid, ItemStack remnants, int chance);
/**
* Add a recipe to the squeezer.
@@ -41,7 +41,7 @@ public interface ISqueezerManager extends ICraftingProvider<ISqueezerRecipe> {
* @param resources Array of item stacks representing the required resources for one process. Stack size will be taken into account.
* @param liquid {@link FluidStack} representing the output of this recipe.
*/
public void addRecipe(int timePerItem, ItemStack[] resources, FluidStack liquid);
void addRecipe(int timePerItem, ItemStack[] resources, FluidStack liquid);
/**
* Add a recipe for a fluid container to the squeezer.
@@ -30,5 +30,5 @@ public interface IStillManager extends ICraftingProvider<IStillRecipe> {
* @param output
* FluidStack representing the output liquid
*/
public void addRecipe(int cyclesPerUnit, FluidStack input, FluidStack output);
void addRecipe(int cyclesPerUnit, FluidStack input, FluidStack output);
}
@@ -23,5 +23,5 @@ public class BackpackManager {
/**
* Only use this if you know what you are doing. Prefer backpackInterface.
*/
public static HashMap<String, IBackpackDefinition> definitions = new HashMap<String, IBackpackDefinition>();
public static HashMap<String, IBackpackDefinition> definitions = new HashMap<>();
}