Unnecessary null check before instanceof

This commit is contained in:
thatsIch
2015-03-26 11:22:31 +01:00
parent d8f452b665
commit d81eb1fe2d
4 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -331,7 +331,7 @@ public class AEBasePart implements IPart, IGridProxyable, IActionHost, IUpgradea
} }
IInventory inv = this.getInventoryByName( "config" ); IInventory inv = this.getInventoryByName( "config" );
if ( inv != null && inv instanceof AppEngInternalAEInventory ) if ( inv instanceof AppEngInternalAEInventory )
{ {
AppEngInternalAEInventory target = (AppEngInternalAEInventory) inv; AppEngInternalAEInventory target = (AppEngInternalAEInventory) inv;
AppEngInternalAEInventory tmp = new AppEngInternalAEInventory( null, target.getSizeInventory() ); AppEngInternalAEInventory tmp = new AppEngInternalAEInventory( null, target.getSizeInventory() );
@@ -362,7 +362,7 @@ public class AEBasePart implements IPart, IGridProxyable, IActionHost, IUpgradea
} }
IInventory inv = this.getInventoryByName( "config" ); IInventory inv = this.getInventoryByName( "config" );
if ( inv != null && inv instanceof AppEngInternalAEInventory ) if ( inv instanceof AppEngInternalAEInventory )
{ {
((AppEngInternalAEInventory) inv).writeToNBT( output, "config" ); ((AppEngInternalAEInventory) inv).writeToNBT( output, "config" );
} }
@@ -796,7 +796,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
public AECableType getCableConnectionType(ForgeDirection dir) public AECableType getCableConnectionType(ForgeDirection dir)
{ {
IPart part = this.getPart( dir ); IPart part = this.getPart( dir );
if ( part != null && part instanceof IGridHost ) if ( part instanceof IGridHost )
{ {
AECableType t = ((IGridHost) part).getCableConnectionType( dir ); AECableType t = ((IGridHost) part).getCableConnectionType( dir );
if ( t != null && t != AECableType.NONE ) if ( t != null && t != AECableType.NONE )
@@ -1009,7 +1009,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
for (ForgeDirection d : ForgeDirection.values()) for (ForgeDirection d : ForgeDirection.values())
{ {
IPart p = this.getPart( d ); IPart p = this.getPart( d );
if ( p != null && p instanceof IGridHost ) if ( p instanceof IGridHost )
((IGridHost) p).securityBreak(); ((IGridHost) p).securityBreak();
} }
} }
@@ -880,7 +880,7 @@ public class PartCable extends AEBasePart implements IPartCable
for ( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS ) for ( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
{ {
IPart p = this.getHost().getPart( dir ); IPart p = this.getHost().getPart( dir );
if ( p != null && p instanceof IGridHost ) if ( p instanceof IGridHost )
{ {
IGridHost igh = ( IGridHost ) p; IGridHost igh = ( IGridHost ) p;
AECableType type = igh.getCableConnectionType( dir.getOpposite() ); AECableType type = igh.getCableConnectionType( dir.getOpposite() );
+2 -2
View File
@@ -433,7 +433,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
if ( this instanceof ISegmentedInventory ) if ( this instanceof ISegmentedInventory )
{ {
IInventory inv = ((ISegmentedInventory) this).getInventoryByName( "config" ); IInventory inv = ((ISegmentedInventory) this).getInventoryByName( "config" );
if ( inv != null && inv instanceof AppEngInternalAEInventory ) if ( inv instanceof AppEngInternalAEInventory )
{ {
AppEngInternalAEInventory target = (AppEngInternalAEInventory) inv; AppEngInternalAEInventory target = (AppEngInternalAEInventory) inv;
AppEngInternalAEInventory tmp = new AppEngInternalAEInventory( null, target.getSizeInventory() ); AppEngInternalAEInventory tmp = new AppEngInternalAEInventory( null, target.getSizeInventory() );
@@ -477,7 +477,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
if ( this instanceof ISegmentedInventory ) if ( this instanceof ISegmentedInventory )
{ {
IInventory inv = ((ISegmentedInventory) this).getInventoryByName( "config" ); IInventory inv = ((ISegmentedInventory) this).getInventoryByName( "config" );
if ( inv != null && inv instanceof AppEngInternalAEInventory ) if ( inv instanceof AppEngInternalAEInventory )
{ {
((AppEngInternalAEInventory) inv).writeToNBT( output, "config" ); ((AppEngInternalAEInventory) inv).writeToNBT( output, "config" );
} }