Fix a load of null issues, and get it to sort of work.

This commit is contained in:
modmuss50 2016-11-19 16:36:13 +00:00
parent 65e651f402
commit 528fecc2b5
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82
35 changed files with 101 additions and 87 deletions

View file

@ -6,6 +6,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import javax.annotation.Nonnull;
import java.util.List;
public class OreDictUtils {
@ -54,6 +55,7 @@ public class OreDictUtils {
return false;
}
@Nonnull
public static ItemStack getDictOreOrNull(String name, int amount) {
List<ItemStack> ores = OreDictionary.getOres(name);
if (ores.isEmpty())
@ -77,8 +79,8 @@ public class OreDictUtils {
return isOre(new ItemStack(item), oreName);
}
public static boolean isOre(ItemStack stack, String oreName) {
if (stack != null && !stack.isEmpty() && oreName != null) {
public static boolean isOre(@Nonnull ItemStack stack, String oreName) {
if (stack != ItemStack.EMPTY && !stack.isEmpty() && oreName != null) {
int id = OreDictionary.getOreID(oreName);
int[] ids = OreDictionary.getOreIDs(stack);