Fix some null warnings

This commit is contained in:
mezz committed 2016-10-20 23:51:14 -07:00
1 parent c6783e573c
commit 3178aa890d
22 files changed
+114 -95

No files matched your search

@@ -44,7 +44,7 @@ public abstract class AnalystPageProduce extends ControlAnalystPage {
final List<ItemStack> products = new ArrayList<>();
for (final ICentrifugeRecipe recipe : RecipeManagers.centrifugeManager.recipes()) {
boolean isRecipe = false;
if (recipe.getInput() instanceof ItemStack && stack.isItemEqual((ItemStack) recipe.getInput())) {
if (recipe.getInput() != null && stack.isItemEqual(recipe.getInput())) {
isRecipe = true;
}
if (isRecipe) {
@@ -68,8 +68,8 @@ public abstract class AnalystPageProduce extends ControlAnalystPage {
}
}
if (isRecipe) {
if (recipe.getRemnants() instanceof ItemStack) {
products.add((ItemStack) recipe.getRemnants());
if (recipe.getRemnants() != null) {
products.add(recipe.getRemnants());
}
}
}
@@ -139,7 +139,7 @@ public abstract class AnalystPageProduce extends ControlAnalystPage {
}
}
if (isRecipe) {
if (recipe.getFluidOutput() instanceof FluidStack) {
if (recipe.getFluidOutput() != null) {
products.add(recipe.getFluidOutput());
}
}
@@ -27,6 +27,7 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import javax.annotation.Nullable;
import java.util.*;
public class Acclimatiser {
@@ -35,17 +36,17 @@ public class Acclimatiser {
public static final int[] slotAcclimatiser;
public static final int[] slotDone;
private static List<ToleranceSystem> toleranceSystems;
static Map<ItemStack, Float> temperatureItems;
static Map<ItemStack, Float> humidityItems;
private static Map<ItemStack, Float> temperatureItems;
private static Map<ItemStack, Float> humidityItems;
@Nullable
private static ToleranceSystem getToleranceSystem(final ItemStack stack, final ItemStack acclim) {
final ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
if (root == null) {
return null;
}
for (final ToleranceSystem system : Acclimatiser.toleranceSystems) {
if (root.getUID() == system.uid && system.type.hasEffect(acclim)) {
return system;
if (root != null) {
for (final ToleranceSystem system : Acclimatiser.toleranceSystems) {
if (Objects.equals(root.getUID(), system.uid) && system.type.hasEffect(acclim)) {
return system;
}
}
}
return null;
@@ -135,6 +136,9 @@ public class Acclimatiser {
public static ItemStack acclimatise(final ItemStack stack, final ItemStack acc) {
final ToleranceSystem system = getToleranceSystem(stack, acc);
if (system == null) {
return stack;
}
return system.alter(stack, acc);
}
@@ -201,7 +201,7 @@ public class Analyser {
public ComponentAnalyserFX(final IMachine machine) {
super(machine);
this.dummyEntityItem = new EntityItem((World) null);
this.dummyEntityItem = new EntityItem(machine.getWorld());
}
@SideOnly(Side.CLIENT)
@@ -53,8 +53,9 @@ public abstract class ComponentIndexerInventory<T> extends ComponentInventory im
@Override
public ItemStack decrStackSize(final int index, final int amount) {
if (index >= 0) {
final ItemStack returnStack = this.getStackInSlot(index).copy();
ItemStack stackInSlot = this.getStackInSlot(index);
if (stackInSlot != null) {
final ItemStack returnStack = stackInSlot.copy();
this.setInventorySlotContents(index, null);
return returnStack;
}