Fix a load of null issues, and get it to sort of work.
This commit is contained in:
parent
65e651f402
commit
528fecc2b5
35 changed files with 101 additions and 87 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -3,7 +3,10 @@ package techreborn.utils;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.items.DynamicCell;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class RecipeUtils {
|
||||
@Nonnull
|
||||
public static ItemStack getEmptyCell(int stackSize) {
|
||||
return DynamicCell.getEmptyCell(stackSize);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class UpgradeHandler {
|
|||
crafter.resetSpeedMulti();
|
||||
for (int slot : this.slots) {
|
||||
ItemStack stack = inventory.getStackInSlot(slot);
|
||||
if (stack != null && stack.getItem() instanceof IMachineUpgrade) {
|
||||
if (stack != ItemStack.EMPTY && stack.getItem() instanceof IMachineUpgrade) {
|
||||
((IMachineUpgrade) stack.getItem()).processUpgrade(crafter, stack);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue