Deleted redundant null checks

This commit is contained in:
Andrew 2014-09-28 10:41:51 -07:00
parent f9b9729fb5
commit 0042176f29
18 changed files with 32 additions and 46 deletions

0
gradlew vendored Normal file → Executable file
View file

View file

@ -88,7 +88,7 @@ public abstract class AEBaseMEGui extends AEBaseGui
drawTooltip( x, y, 0, join( currentToolTip, "\n" ) ); drawTooltip( x, y, 0, join( currentToolTip, "\n" ) );
} }
else if ( stack != null && stack.stackSize > BigNumber ) else if ( stack.stackSize > BigNumber )
{ {
List var4 = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips ); List var4 = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips );
var4.add( "Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( stack.stackSize ) ); var4.add( "Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( stack.stackSize ) );

View file

@ -404,7 +404,7 @@ public abstract class AEBaseContainer extends Container
return null; return null;
else if ( dest == null ) else if ( dest == null )
{ {
cs.putStack( tis != null ? tis.copy() : null ); cs.putStack( tis.copy() );
cs.onSlotChanged(); cs.onSlotChanged();
updateSlot( cs ); updateSlot( cs );
return null; return null;
@ -422,13 +422,13 @@ public abstract class AEBaseContainer extends Container
if ( d instanceof SlotDisabled || d instanceof SlotME ) if ( d instanceof SlotDisabled || d instanceof SlotME )
continue; continue;
if ( d.isItemValid( tis ) && tis != null ) if ( d.isItemValid( tis ) )
{ {
if ( d.getHasStack() ) if ( d.getHasStack() )
{ {
ItemStack t = d.getStack(); ItemStack t = d.getStack();
if ( tis != null && Platform.isSameItemPrecise( tis, t ) ) // t.isItemEqual(tis)) if ( Platform.isSameItemPrecise( tis, t ) ) // t.isItemEqual(tis))
{ {
int maxSize = t.getMaxStackSize(); int maxSize = t.getMaxStackSize();
if ( maxSize > d.getSlotStackLimit() ) if ( maxSize > d.getSlotStackLimit() )
@ -468,13 +468,13 @@ public abstract class AEBaseContainer extends Container
if ( d instanceof SlotDisabled || d instanceof SlotME ) if ( d instanceof SlotDisabled || d instanceof SlotME )
continue; continue;
if ( d.isItemValid( tis ) && tis != null ) if ( d.isItemValid( tis ) )
{ {
if ( d.getHasStack() ) if ( d.getHasStack() )
{ {
ItemStack t = d.getStack(); ItemStack t = d.getStack();
if ( tis != null && Platform.isSameItemPrecise( t, tis ) ) if ( Platform.isSameItemPrecise( t, tis ) )
{ {
int maxSize = t.getMaxStackSize(); int maxSize = t.getMaxStackSize();
if ( d.getSlotStackLimit() < maxSize ) if ( d.getSlotStackLimit() < maxSize )

View file

@ -346,16 +346,13 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
ItemStack is = r.getCraftingResult( ic ); ItemStack is = r.getCraftingResult( ic );
if ( r != null && inv != null ) for (int x = 0; x < ic.getSizeInventory(); x++)
{ {
for (int x = 0; x < ic.getSizeInventory(); x++) if ( ic.getStackInSlot( x ) != null )
{ {
if ( ic.getStackInSlot( x ) != null ) ItemStack pulled = Platform.extractItemsByRecipe( powerSrc, mySrc, storage, p.worldObj, r, is, ic, ic.getStackInSlot( x ), x, all,
{ Actionable.MODULATE, ItemViewCell.createFilter( getViewCells() ) );
ItemStack pulled = Platform.extractItemsByRecipe( powerSrc, mySrc, storage, p.worldObj, r, is, ic, ic.getStackInSlot( x ), x, all, real.setInventorySlotContents( x, pulled );
Actionable.MODULATE, ItemViewCell.createFilter( getViewCells() ) );
real.setInventorySlotContents( x, pulled );
}
} }
} }

View file

@ -112,7 +112,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
is = r.getCraftingResult( ic ); is = r.getCraftingResult( ic );
if ( r != null && inv != null ) if ( inv != null )
{ {
for (int x = 0; x < pattern.getSizeInventory(); x++) for (int x = 0; x < pattern.getSizeInventory(); x++)
{ {

View file

@ -196,7 +196,7 @@ public class SlotRestrictedInput extends AppEngSlot
case STORAGE_CELLS: case STORAGE_CELLS:
return AEApi.instance().registries().cell().isCellHandled( i ); return AEApi.instance().registries().cell().isCellHandled( i );
case WORKBENCH_CELL: case WORKBENCH_CELL:
return i != null && i.getItem() instanceof ICellWorkbenchItem && ((ICellWorkbenchItem) i.getItem()).isEditable( i ); return i.getItem() instanceof ICellWorkbenchItem && ((ICellWorkbenchItem) i.getItem()).isEditable( i );
case STORAGE_COMPONENT: case STORAGE_COMPONENT:
boolean isComp = i.getItem() instanceof IStorageComponent && ((IStorageComponent) i.getItem()).isStorageComponent( i ); boolean isComp = i.getItem() instanceof IStorageComponent && ((IStorageComponent) i.getItem()).isStorageComponent( i );
return isComp; return isComp;

View file

@ -364,7 +364,7 @@ public class DualityInterface implements IGridTickable, ISegmentedInventory, ISt
return; return;
} }
} }
else if ( Stored != null ) // dispose! else // Stored != null; dispose!
{ {
IAEItemStack work = AEApi.instance().storage().createItemStack( Stored ); IAEItemStack work = AEApi.instance().storage().createItemStack( Stored );
requireWork[slot] = work.setStackSize( -work.getStackSize() ); requireWork[slot] = work.setStackSize( -work.getStackSize() );

View file

@ -74,8 +74,6 @@ public class MultiCraftingTracker
{ {
if ( craftingJob.isDone() ) if ( craftingJob.isDone() )
job = craftingJob.get(); job = craftingJob.get();
else if ( craftingJob.isCancelled() )
job = null;
if ( job != null ) if ( job != null )
{ {

View file

@ -86,11 +86,8 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
for (IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes()) for (IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes())
{ {
CachedGrindStoneRecipe cachedRecipe = new CachedGrindStoneRecipe( recipe ); CachedGrindStoneRecipe cachedRecipe = new CachedGrindStoneRecipe( recipe );
if ( cachedRecipe != null ) cachedRecipe.computeVisuals();
{ this.arecipes.add( cachedRecipe );
cachedRecipe.computeVisuals();
this.arecipes.add( cachedRecipe );
}
} }
} }
else else
@ -118,7 +115,7 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
{ {
CachedGrindStoneRecipe cachedRecipe = new CachedGrindStoneRecipe( recipe ); CachedGrindStoneRecipe cachedRecipe = new CachedGrindStoneRecipe( recipe );
if ( (cachedRecipe != null) && (cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() )) ) if ( (cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() )) )
{ {
cachedRecipe.computeVisuals(); cachedRecipe.computeVisuals();
if ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) ) if ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )

View file

@ -58,11 +58,8 @@ public class NEIInscriberRecipeHandler extends TemplateRecipeHandler
for (InscriberRecipe recipe : Inscribe.recipes) for (InscriberRecipe recipe : Inscribe.recipes)
{ {
CachedInscriberRecipe cachedRecipe = new CachedInscriberRecipe( recipe ); CachedInscriberRecipe cachedRecipe = new CachedInscriberRecipe( recipe );
if ( cachedRecipe != null ) cachedRecipe.computeVisuals();
{ this.arecipes.add( cachedRecipe );
cachedRecipe.computeVisuals();
this.arecipes.add( cachedRecipe );
}
} }
} }
else else
@ -90,7 +87,7 @@ public class NEIInscriberRecipeHandler extends TemplateRecipeHandler
{ {
CachedInscriberRecipe cachedRecipe = new CachedInscriberRecipe( recipe ); CachedInscriberRecipe cachedRecipe = new CachedInscriberRecipe( recipe );
if ( (cachedRecipe != null) && (cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() )) ) if ( (cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() )) )
{ {
cachedRecipe.computeVisuals(); cachedRecipe.computeVisuals();
if ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) ) if ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )

View file

@ -802,7 +802,7 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
if ( requestingMachine == null ) if ( requestingMachine == null )
return myLastLink; return myLastLink;
ICraftingLink whatLink = new CraftingLink( generateLinkData( craftID, requestingMachine == null, true ), requestingMachine ); ICraftingLink whatLink = new CraftingLink( generateLinkData( craftID, false, true ), requestingMachine );
submitLink( myLastLink ); submitLink( myLastLink );
submitLink( whatLink ); submitLink( whatLink );

View file

@ -176,7 +176,7 @@ public class MEMonitorIInventory implements IMEInventory<IAEItemStack>, IMEMonit
CachedItemStack old = memory.get( is.slot ); CachedItemStack old = memory.get( is.slot );
high = Math.max( high, is.slot ); high = Math.max( high, is.slot );
ItemStack newIS = is == null || is.isExtractable == false && mode == StorageFilter.EXTRACTABLE_ONLY ? null : is.getItemStack(); ItemStack newIS = is.isExtractable == false && mode == StorageFilter.EXTRACTABLE_ONLY ? null : is.getItemStack();
ItemStack oldIS = old == null ? null : old.itemStack; ItemStack oldIS = old == null ? null : old.itemStack;
if ( isDifferent( newIS, oldIS ) ) if ( isDifferent( newIS, oldIS ) )
@ -190,7 +190,7 @@ public class MEMonitorIInventory implements IMEInventory<IAEItemStack>, IMEMonit
changes.add( old.aeStack ); changes.add( old.aeStack );
} }
if ( cis != null && cis.aeStack != null ) if ( cis.aeStack != null )
{ {
changes.add( cis.aeStack ); changes.add( cis.aeStack );
list.add( cis.aeStack ); list.add( cis.aeStack );
@ -198,7 +198,7 @@ public class MEMonitorIInventory implements IMEInventory<IAEItemStack>, IMEMonit
changed = true; changed = true;
} }
else if ( is != null ) else
{ {
int newSize = (newIS == null ? 0 : newIS.stackSize); int newSize = (newIS == null ? 0 : newIS.stackSize);
int diff = newSize - (oldIS == null ? 0 : oldIS.stackSize); int diff = newSize - (oldIS == null ? 0 : oldIS.stackSize);

View file

@ -247,7 +247,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
if ( sbp != null ) if ( sbp != null )
{ {
IGridNode sn = sbp.getGridNode(); IGridNode sn = sbp.getGridNode();
if ( sn != null && cn != null ) if ( sn != null )
{ {
try try
{ {
@ -574,8 +574,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
data.writeShort( Item.getIdFromItem( is.getItem() ) ); data.writeShort( Item.getIdFromItem( is.getItem() ) );
data.writeShort( is.getItemDamage() ); data.writeShort( is.getItemDamage() );
if ( p != null ) p.writeToStream( data );
p.writeToStream( data );
} }
} }
@ -921,7 +920,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
} }
} }
if ( facades != null && !facades.isEmpty() ) if ( !facades.isEmpty() )
{ {
TileEntity te = tcb.getTile(); TileEntity te = tcb.getTile();
Platform.spawnDrops( te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, facades ); Platform.spawnDrops( te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, facades );

View file

@ -162,7 +162,7 @@ public class PartPlacement
if ( host.isEmpty() ) if ( host.isEmpty() )
host.cleanup(); host.cleanup();
if ( is != null && !is.isEmpty() ) if ( !is.isEmpty() )
{ {
Platform.spawnDrops( world, x, y, z, is ); Platform.spawnDrops( world, x, y, z, is );
} }

View file

@ -254,7 +254,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
if ( !ignore ) if ( !ignore )
{ {
if ( !w.isAirBlock( x, y, z ) && w.blockExists( x, y, z ) && blk != null && w.canMineBlock( Platform.getPlayer( w ), x, y, z ) ) if ( !w.isAirBlock( x, y, z ) && w.blockExists( x, y, z ) && w.canMineBlock( Platform.getPlayer( w ), x, y, z ) )
{ {
float hardness = blk.getBlockHardness( w, x, y, z ); float hardness = blk.getBlockHardness( w, x, y, z );
if ( hardness >= 0.0 ) if ( hardness >= 0.0 )

View file

@ -59,8 +59,6 @@ public class LayerISidedInventory extends LayerBase implements ISidedInventory
if ( inventories.isEmpty() || slotCount == 0 ) if ( inventories.isEmpty() || slotCount == 0 )
{ {
inventories = null; inventories = null;
sideData = null;
slots = null;
} }
else else
{ {

View file

@ -93,7 +93,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
{ {
if ( is.getStackSize() != dspPlay.getStackSize() ) if ( is.getStackSize() != dspPlay.getStackSize() )
{ {
dspPlay = is == null ? null : is.copy(); dspPlay = is.copy();
markForUpdate(); markForUpdate();
} }
} }

View file

@ -635,7 +635,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
try try
{ {
IMEInventoryHandler handler = getHandler( StorageChannel.ITEMS ); IMEInventoryHandler handler = getHandler( StorageChannel.ITEMS );
if ( ch != null && handler instanceof ChestMonitorHandler ) if ( handler instanceof ChestMonitorHandler )
return ch.getStatusForCell( cell, ((ChestMonitorHandler) handler).getInternalHandler() ); return ch.getStatusForCell( cell, ((ChestMonitorHandler) handler).getInternalHandler() );
} }
catch (ChestNoHandler e) catch (ChestNoHandler e)
@ -645,7 +645,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
try try
{ {
IMEInventoryHandler handler = getHandler( StorageChannel.FLUIDS ); IMEInventoryHandler handler = getHandler( StorageChannel.FLUIDS );
if ( ch != null && handler instanceof ChestMonitorHandler ) if ( handler instanceof ChestMonitorHandler )
return ch.getStatusForCell( cell, ((ChestMonitorHandler) handler).getInternalHandler() ); return ch.getStatusForCell( cell, ((ChestMonitorHandler) handler).getInternalHandler() );
} }
catch (ChestNoHandler e) catch (ChestNoHandler e)