First batch of null -> isEmpty() checks.

I most likely still missed a ton of checks...
This commit is contained in:
Gunther De Wachter
2017-06-26 05:15:25 +02:00
parent 370fc49357
commit da5879b667
117 changed files with 594 additions and 570 deletions
@@ -90,7 +90,7 @@ public final class DisassembleRecipe implements IRecipe
for( int slotIndex = 0; slotIndex < inventory.getSizeInventory(); slotIndex++ )
{
final ItemStack stackInSlot = inventory.getStackInSlot( slotIndex );
if( stackInSlot != null )
if( !stackInSlot.isEmpty() )
{
// needs a single input in the recipe
itemCount++;
@@ -57,7 +57,7 @@ public final class FacadeRecipe implements IRecipe
@Nullable
private ItemStack getOutput( final IInventory inv, final boolean createFacade )
{
if( inv.getStackInSlot( 0 ) == null && inv.getStackInSlot( 2 ) == null && inv.getStackInSlot( 6 ) == null && inv.getStackInSlot( 8 ) == null )
if( inv.getStackInSlot( 0 ).isEmpty() && inv.getStackInSlot( 2 ).isEmpty() && inv.getStackInSlot( 6 ).isEmpty() && inv.getStackInSlot( 8 ).isEmpty() )
{
if( this.anchor.isSameAs( inv.getStackInSlot( 1 ) ) && this.anchor.isSameAs( inv.getStackInSlot( 3 ) ) && this.anchor.isSameAs( inv.getStackInSlot( 5 ) ) && this.anchor.isSameAs( inv.getStackInSlot( 7 ) ) )
{
@@ -42,7 +42,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
private static final int MAX_CRAFT_GRID_WIDTH = 3;
private static final int MAX_CRAFT_GRID_HEIGHT = 3;
private ItemStack output = null;
private ItemStack output = ItemStack.EMPTY;
private Object[] input = null;
private int width = 0;
private int height = 0;
@@ -256,7 +256,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
return false;
}
}
else if( target == null && slot != null )
else if( target == null && !slot.isEmpty() )
{
return false;
}
@@ -268,7 +268,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
private boolean checkItemEquals( final ItemStack target, final ItemStack input )
{
if( input == null && target != null || input != null && target == null )
if( input.isEmpty() && !target.isEmpty() || !input.isEmpty() && target.isEmpty() )
{
return false;
}
@@ -38,7 +38,7 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
{
private final ArrayList<Object> input = new ArrayList<Object>();
private ItemStack output = null;
private ItemStack output = ItemStack.EMPTY;
private boolean disable = false;
public ShapelessRecipe( final ItemStack result, final Object... recipe )
@@ -83,7 +83,7 @@ public class ShapelessRecipe implements IRecipe, IRecipeBakeable
{
final ItemStack slot = var1.getStackInSlot( x );
if( slot != null )
if( !slot.isEmpty() )
{
boolean inRecipe = false;
@@ -59,8 +59,8 @@ public final class Inscribe extends InscriberProcess
final ItemStack[] realInput = this.getImprintable().getItemStackSet();
final List<ItemStack> inputs = new ArrayList<ItemStack>( realInput.length );
Collections.addAll( inputs, realInput );
final ItemStack top = ( this.getTopOptional() == null ) ? null : this.getTopOptional().getItemStack();
final ItemStack bot = ( this.getBotOptional() == null ) ? null : this.getBotOptional().getItemStack();
final ItemStack top = ( this.getTopOptional() == null ) ? ItemStack.EMPTY : this.getTopOptional().getItemStack();
final ItemStack bot = ( this.getBotOptional() == null ) ? ItemStack.EMPTY : this.getBotOptional().getItemStack();
final ItemStack output = this.getOutput().getItemStack();
final InscriberProcessType type = InscriberProcessType.INSCRIBE;
@@ -59,8 +59,8 @@ public final class Press extends InscriberProcess
final ItemStack[] realInput = this.getImprintable().getItemStackSet();
final List<ItemStack> inputs = new ArrayList<ItemStack>( realInput.length );
Collections.addAll( inputs, realInput );
final ItemStack top = ( this.getTopOptional() == null ) ? null : this.getTopOptional().getItemStack();
final ItemStack bot = ( this.getBotOptional() == null ) ? null : this.getBotOptional().getItemStack();
final ItemStack top = ( this.getTopOptional() == null ) ? ItemStack.EMPTY : this.getTopOptional().getItemStack();
final ItemStack bot = ( this.getBotOptional() == null ) ? ItemStack.EMPTY : this.getBotOptional().getItemStack();
final ItemStack output = this.getOutput().getItemStack();
final InscriberProcessType type = InscriberProcessType.PRESS;