diff --git a/src/main/java/forestry/api/apiculture/EnumBeeType.java b/src/main/java/forestry/api/apiculture/EnumBeeType.java index a3f564e81..87ea5af71 100644 --- a/src/main/java/forestry/api/apiculture/EnumBeeType.java +++ b/src/main/java/forestry/api/apiculture/EnumBeeType.java @@ -10,7 +10,7 @@ import java.util.Locale; import forestry.api.genetics.ISpeciesType; public enum EnumBeeType implements ISpeciesType { - DRONE, PRINCESS, QUEEN, LARVAE, NONE; + DRONE, PRINCESS, QUEEN, LARVAE; public static final EnumBeeType[] VALUES = values(); diff --git a/src/main/java/forestry/api/apiculture/IBeeRoot.java b/src/main/java/forestry/api/apiculture/IBeeRoot.java index c01590936..2c0c4a237 100644 --- a/src/main/java/forestry/api/apiculture/IBeeRoot.java +++ b/src/main/java/forestry/api/apiculture/IBeeRoot.java @@ -5,6 +5,7 @@ ******************************************************************************/ package forestry.api.apiculture; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; @@ -61,6 +62,7 @@ public interface IBeeRoot extends ISpeciesRoot { /** * @return type of bee encoded on the itemstack. EnumBeeType.NONE if it isn't a bee. */ + @Nullable @Override EnumBeeType getType(ItemStack stack); diff --git a/src/main/java/forestry/api/arboriculture/EnumGermlingType.java b/src/main/java/forestry/api/arboriculture/EnumGermlingType.java index c1e403068..7485657e5 100644 --- a/src/main/java/forestry/api/arboriculture/EnumGermlingType.java +++ b/src/main/java/forestry/api/arboriculture/EnumGermlingType.java @@ -8,7 +8,7 @@ package forestry.api.arboriculture; import forestry.api.genetics.ISpeciesType; public enum EnumGermlingType implements ISpeciesType { - SAPLING("sapling"), BLOSSOM("blossom"), POLLEN("pollen"), GERMLING("germling"), NONE("none"); + SAPLING("sapling"), POLLEN("pollen"); public static final EnumGermlingType[] VALUES = values(); diff --git a/src/main/java/forestry/api/arboriculture/ITreeRoot.java b/src/main/java/forestry/api/arboriculture/ITreeRoot.java index 91b92275c..023d92b3b 100644 --- a/src/main/java/forestry/api/arboriculture/ITreeRoot.java +++ b/src/main/java/forestry/api/arboriculture/ITreeRoot.java @@ -5,6 +5,7 @@ ******************************************************************************/ package forestry.api.arboriculture; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; @@ -62,6 +63,7 @@ public interface ITreeRoot extends ISpeciesRoot { /** * @return type of tree encoded on the itemstack. EnumGermlingType.NONE if it isn't a tree. */ + @Nullable @Override EnumGermlingType getType(ItemStack stack); diff --git a/src/main/java/forestry/api/genetics/ISpeciesRoot.java b/src/main/java/forestry/api/genetics/ISpeciesRoot.java index f2e40b12c..fe9da26c1 100644 --- a/src/main/java/forestry/api/genetics/ISpeciesRoot.java +++ b/src/main/java/forestry/api/genetics/ISpeciesRoot.java @@ -5,6 +5,7 @@ ******************************************************************************/ package forestry.api.genetics; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -63,6 +64,7 @@ public interface ISpeciesRoot { IIndividual getMember(NBTTagCompound compound); + @Nullable ISpeciesType getType(ItemStack itemStack); ItemStack getMemberStack(IIndividual individual, int type); diff --git a/src/main/java/forestry/api/lepidopterology/EnumFlutterType.java b/src/main/java/forestry/api/lepidopterology/EnumFlutterType.java index 7d42e9d4c..00db80e26 100644 --- a/src/main/java/forestry/api/lepidopterology/EnumFlutterType.java +++ b/src/main/java/forestry/api/lepidopterology/EnumFlutterType.java @@ -8,10 +8,7 @@ package forestry.api.lepidopterology; import forestry.api.genetics.ISpeciesType; public enum EnumFlutterType implements ISpeciesType { - BUTTERFLY, - SERUM, - CATERPILLAR, - NONE; + BUTTERFLY, SERUM, CATERPILLAR; public static final EnumFlutterType[] VALUES = values(); } diff --git a/src/main/java/forestry/api/lepidopterology/IButterflyRoot.java b/src/main/java/forestry/api/lepidopterology/IButterflyRoot.java index f867645f0..1bed1d2ea 100644 --- a/src/main/java/forestry/api/lepidopterology/IButterflyRoot.java +++ b/src/main/java/forestry/api/lepidopterology/IButterflyRoot.java @@ -5,6 +5,7 @@ ******************************************************************************/ package forestry.api.lepidopterology; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; @@ -70,6 +71,7 @@ public interface IButterflyRoot extends ISpeciesRoot { @Override Collection getMutations(boolean shuffle); + @Nullable @Override EnumFlutterType getType(ItemStack stack); diff --git a/src/main/java/forestry/apiculture/commands/CommandBeeGive.java b/src/main/java/forestry/apiculture/commands/CommandBeeGive.java index c8516e8be..294a0feb7 100644 --- a/src/main/java/forestry/apiculture/commands/CommandBeeGive.java +++ b/src/main/java/forestry/apiculture/commands/CommandBeeGive.java @@ -10,6 +10,7 @@ ******************************************************************************/ package forestry.apiculture.commands; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -43,9 +44,6 @@ public class CommandBeeGive extends SubCommand { List beeTypeStrings = new ArrayList<>(); for (EnumBeeType type : EnumBeeType.values()) { - if (type == EnumBeeType.NONE) { - continue; - } beeTypeStrings.add(type.getName()); } @@ -73,7 +71,7 @@ public class CommandBeeGive extends SubCommand { IBeeGenome beeGenome = getBeeGenome(arguments[0]); EnumBeeType beeType = getBeeType(arguments[1]); - if (beeType == EnumBeeType.NONE) { + if (beeType == null) { printHelp(sender); return; } @@ -164,13 +162,14 @@ public class CommandBeeGive extends SubCommand { return species.toArray(new String[species.size()]); } + @Nullable private static EnumBeeType getBeeType(String beeTypeName) { for (EnumBeeType beeType : EnumBeeType.values()) { if (beeType.getName().equalsIgnoreCase(beeTypeName)) { return beeType; } } - return EnumBeeType.NONE; + return null; } @Override diff --git a/src/main/java/forestry/apiculture/genetics/BeeRoot.java b/src/main/java/forestry/apiculture/genetics/BeeRoot.java index 12f8611b2..a2f377ea6 100644 --- a/src/main/java/forestry/apiculture/genetics/BeeRoot.java +++ b/src/main/java/forestry/apiculture/genetics/BeeRoot.java @@ -10,6 +10,7 @@ ******************************************************************************/ package forestry.apiculture.genetics; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -84,7 +85,7 @@ public class BeeRoot extends SpeciesRoot implements IBeeRoot { @Override public boolean isMember(ItemStack stack) { - return getType(stack) != EnumBeeType.NONE; + return getType(stack) != null; } @Override @@ -133,10 +134,11 @@ public class BeeRoot extends SpeciesRoot implements IBeeRoot { return beeStack; } + @Nullable @Override public EnumBeeType getType(ItemStack stack) { if (stack == null) { - return EnumBeeType.NONE; + return null; } Item item = stack.getItem(); @@ -151,7 +153,7 @@ public class BeeRoot extends SpeciesRoot implements IBeeRoot { return EnumBeeType.LARVAE; } - return EnumBeeType.NONE; + return null; } @Override diff --git a/src/main/java/forestry/arboriculture/genetics/TreeRoot.java b/src/main/java/forestry/arboriculture/genetics/TreeRoot.java index 62cafb792..434060e9f 100644 --- a/src/main/java/forestry/arboriculture/genetics/TreeRoot.java +++ b/src/main/java/forestry/arboriculture/genetics/TreeRoot.java @@ -19,6 +19,7 @@ import java.util.Locale; import java.util.Map.Entry; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -98,7 +99,7 @@ public class TreeRoot extends SpeciesRoot implements ITreeRoot { @Override public boolean isMember(ItemStack itemstack) { - return getType(itemstack) != EnumGermlingType.NONE; + return getType(itemstack) != null; } @Override @@ -115,7 +116,7 @@ public class TreeRoot extends SpeciesRoot implements ITreeRoot { @Override public EnumGermlingType getType(ItemStack stack) { if (stack == null) { - return EnumGermlingType.NONE; + return null; } Item item = stack.getItem(); @@ -126,7 +127,7 @@ public class TreeRoot extends SpeciesRoot implements ITreeRoot { return EnumGermlingType.POLLEN; } - return EnumGermlingType.NONE; + return null; } @Override @@ -192,7 +193,8 @@ public class TreeRoot extends SpeciesRoot implements ITreeRoot { @Override public boolean plantSapling(World world, ITree tree, GameProfile owner, BlockPos pos) { - boolean placed = world.setBlockState(pos, PluginArboriculture.blocks.saplingGE.getStateFromMeta(0), Constants.FLAG_BLOCK_SYNCH_AND_UPDATE); + IBlockState state = PluginArboriculture.blocks.saplingGE.getStateFromMeta(0); + boolean placed = world.setBlockState(pos, state, Constants.FLAG_BLOCK_SYNCH_AND_UPDATE); if (!placed) { return false; } diff --git a/src/main/java/forestry/arboriculture/items/ItemGermlingGE.java b/src/main/java/forestry/arboriculture/items/ItemGermlingGE.java index 5db568fba..d4f6356a3 100755 --- a/src/main/java/forestry/arboriculture/items/ItemGermlingGE.java +++ b/src/main/java/forestry/arboriculture/items/ItemGermlingGE.java @@ -101,14 +101,12 @@ public class ItemGermlingGE extends ItemGE implements IVariableFermentable { return StringUtil.localize("trees.grammar." + type.getName()).replaceAll("%SPECIES", species.getName()).replaceAll("%TYPE", StringUtil.localize("trees.grammar." + type.getName() + ".type")); } - @SuppressWarnings("rawtypes") @Override - public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) { + public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) { addCreativeItems(itemList, true); } - @SuppressWarnings({"rawtypes", "unchecked"}) - public void addCreativeItems(List itemList, boolean hideSecrets) { + public void addCreativeItems(List itemList, boolean hideSecrets) { for (IIndividual individual : TreeManager.treeRoot.getIndividualTemplates()) { // Don't show secrets unless ordered to. if (hideSecrets && individual.isSecret() && !Config.isDebug) { diff --git a/src/main/java/forestry/lepidopterology/genetics/ButterflyRoot.java b/src/main/java/forestry/lepidopterology/genetics/ButterflyRoot.java index ef0e22be9..31c3b27f4 100644 --- a/src/main/java/forestry/lepidopterology/genetics/ButterflyRoot.java +++ b/src/main/java/forestry/lepidopterology/genetics/ButterflyRoot.java @@ -10,6 +10,7 @@ ******************************************************************************/ package forestry.lepidopterology.genetics; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -74,13 +75,14 @@ public class ButterflyRoot extends SpeciesRoot implements IButterflyRoot { @Override public boolean isMember(ItemStack stack) { - return getType(stack) != EnumFlutterType.NONE; + return getType(stack) != null; } + @Nullable @Override public EnumFlutterType getType(ItemStack stack) { if (stack == null) { - return EnumFlutterType.NONE; + return null; } Item item = stack.getItem(); @@ -91,7 +93,7 @@ public class ButterflyRoot extends SpeciesRoot implements IButterflyRoot { } else if (PluginLepidopterology.items.caterpillarGE == item) { return EnumFlutterType.CATERPILLAR; } else { - return EnumFlutterType.NONE; + return null; } }