From 0042176f295a4b97366e45f3c2aed389efd8e34b Mon Sep 17 00:00:00 2001 From: Andrew Date: Sun, 28 Sep 2014 10:41:51 -0700 Subject: [PATCH] Deleted redundant null checks --- gradlew | 0 src/main/java/appeng/client/gui/AEBaseMEGui.java | 2 +- src/main/java/appeng/container/AEBaseContainer.java | 10 +++++----- .../implementations/ContainerPatternTerm.java | 13 +++++-------- .../appeng/container/slot/SlotCraftingTerm.java | 2 +- .../appeng/container/slot/SlotRestrictedInput.java | 2 +- src/main/java/appeng/helpers/DualityInterface.java | 2 +- .../java/appeng/helpers/MultiCraftingTracker.java | 2 -- .../modules/NEIHelpers/NEIGrinderRecipeHandler.java | 9 +++------ .../NEIHelpers/NEIInscriberRecipeHandler.java | 9 +++------ .../cluster/implementations/CraftingCPUCluster.java | 2 +- .../java/appeng/me/storage/MEMonitorIInventory.java | 6 +++--- src/main/java/appeng/parts/CableBusContainer.java | 7 +++---- src/main/java/appeng/parts/PartPlacement.java | 2 +- .../parts/automation/PartAnnihilationPlane.java | 2 +- .../appeng/parts/layers/LayerISidedInventory.java | 2 -- .../tile/crafting/TileCraftingMonitorTile.java | 2 +- src/main/java/appeng/tile/storage/TileChest.java | 4 ++-- 18 files changed, 32 insertions(+), 46 deletions(-) mode change 100644 => 100755 gradlew diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/src/main/java/appeng/client/gui/AEBaseMEGui.java b/src/main/java/appeng/client/gui/AEBaseMEGui.java index 4dadf8ef309..6cc143ef4ab 100644 --- a/src/main/java/appeng/client/gui/AEBaseMEGui.java +++ b/src/main/java/appeng/client/gui/AEBaseMEGui.java @@ -88,7 +88,7 @@ protected void renderToolTip(ItemStack stack, int x, int y) 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 ); var4.add( "Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( stack.stackSize ) ); diff --git a/src/main/java/appeng/container/AEBaseContainer.java b/src/main/java/appeng/container/AEBaseContainer.java index f6e9821506b..d1cd64e6f63 100644 --- a/src/main/java/appeng/container/AEBaseContainer.java +++ b/src/main/java/appeng/container/AEBaseContainer.java @@ -404,7 +404,7 @@ public ItemStack transferStackInSlot(EntityPlayer p, int idx) return null; else if ( dest == null ) { - cs.putStack( tis != null ? tis.copy() : null ); + cs.putStack( tis.copy() ); cs.onSlotChanged(); updateSlot( cs ); return null; @@ -422,13 +422,13 @@ else if ( dest == null ) if ( d instanceof SlotDisabled || d instanceof SlotME ) continue; - if ( d.isItemValid( tis ) && tis != null ) + if ( d.isItemValid( tis ) ) { if ( d.getHasStack() ) { 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(); if ( maxSize > d.getSlotStackLimit() ) @@ -468,13 +468,13 @@ else if ( dest == null ) if ( d instanceof SlotDisabled || d instanceof SlotME ) continue; - if ( d.isItemValid( tis ) && tis != null ) + if ( d.isItemValid( tis ) ) { if ( d.getHasStack() ) { ItemStack t = d.getStack(); - if ( tis != null && Platform.isSameItemPrecise( t, tis ) ) + if ( Platform.isSameItemPrecise( t, tis ) ) { int maxSize = t.getMaxStackSize(); if ( d.getSlotStackLimit() < maxSize ) diff --git a/src/main/java/appeng/container/implementations/ContainerPatternTerm.java b/src/main/java/appeng/container/implementations/ContainerPatternTerm.java index 2c8842f5c39..8e95e82c349 100644 --- a/src/main/java/appeng/container/implementations/ContainerPatternTerm.java +++ b/src/main/java/appeng/container/implementations/ContainerPatternTerm.java @@ -346,16 +346,13 @@ public void craftOrGetItem(PacketPatternSlot packetPatternSlot) 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() ) ); - real.setInventorySlotContents( x, pulled ); - } + ItemStack pulled = Platform.extractItemsByRecipe( powerSrc, mySrc, storage, p.worldObj, r, is, ic, ic.getStackInSlot( x ), x, all, + Actionable.MODULATE, ItemViewCell.createFilter( getViewCells() ) ); + real.setInventorySlotContents( x, pulled ); } } diff --git a/src/main/java/appeng/container/slot/SlotCraftingTerm.java b/src/main/java/appeng/container/slot/SlotCraftingTerm.java index 15efa3e9b07..f2ee08f67c1 100644 --- a/src/main/java/appeng/container/slot/SlotCraftingTerm.java +++ b/src/main/java/appeng/container/slot/SlotCraftingTerm.java @@ -112,7 +112,7 @@ public ItemStack craftItem(EntityPlayer p, ItemStack request, IMEMonitor= 0.0 ) diff --git a/src/main/java/appeng/parts/layers/LayerISidedInventory.java b/src/main/java/appeng/parts/layers/LayerISidedInventory.java index 940a66ec68f..eb784b69644 100644 --- a/src/main/java/appeng/parts/layers/LayerISidedInventory.java +++ b/src/main/java/appeng/parts/layers/LayerISidedInventory.java @@ -59,8 +59,6 @@ public void notifyNeighbors() if ( inventories.isEmpty() || slotCount == 0 ) { inventories = null; - sideData = null; - slots = null; } else { diff --git a/src/main/java/appeng/tile/crafting/TileCraftingMonitorTile.java b/src/main/java/appeng/tile/crafting/TileCraftingMonitorTile.java index c428d9d3401..f73b3161b60 100644 --- a/src/main/java/appeng/tile/crafting/TileCraftingMonitorTile.java +++ b/src/main/java/appeng/tile/crafting/TileCraftingMonitorTile.java @@ -93,7 +93,7 @@ else if ( is != null && dspPlay != null ) { if ( is.getStackSize() != dspPlay.getStackSize() ) { - dspPlay = is == null ? null : is.copy(); + dspPlay = is.copy(); markForUpdate(); } } diff --git a/src/main/java/appeng/tile/storage/TileChest.java b/src/main/java/appeng/tile/storage/TileChest.java index 371af080e28..8a703ed00a5 100644 --- a/src/main/java/appeng/tile/storage/TileChest.java +++ b/src/main/java/appeng/tile/storage/TileChest.java @@ -635,7 +635,7 @@ public int getCellStatus(int slot) try { IMEInventoryHandler handler = getHandler( StorageChannel.ITEMS ); - if ( ch != null && handler instanceof ChestMonitorHandler ) + if ( handler instanceof ChestMonitorHandler ) return ch.getStatusForCell( cell, ((ChestMonitorHandler) handler).getInternalHandler() ); } catch (ChestNoHandler e) @@ -645,7 +645,7 @@ public int getCellStatus(int slot) try { IMEInventoryHandler handler = getHandler( StorageChannel.FLUIDS ); - if ( ch != null && handler instanceof ChestMonitorHandler ) + if ( handler instanceof ChestMonitorHandler ) return ch.getStatusForCell( cell, ((ChestMonitorHandler) handler).getInternalHandler() ); } catch (ChestNoHandler e)