Merge pull request #281 from thatsIch/controlflow

Simplified some control flow statements
This commit is contained in:
Chris 2014-10-09 13:22:55 -07:00
commit 52e548eebc
33 changed files with 64 additions and 78 deletions

View file

@ -335,7 +335,7 @@ public abstract class AEBaseGui extends GuiContainer
return;
}
if ( disableShiftClick == false && isShiftKeyDown() )
if ( !disableShiftClick && isShiftKeyDown() )
{
disableShiftClick = true;

View file

@ -307,8 +307,8 @@ public class GuiCraftConfirm extends AEBaseGui
{
updateCPUButtonText();
start.enabled = ccc.noCPU || isSimulation() ? false : true;
selectCPU.enabled = isSimulation() ? false : true;
start.enabled = !(ccc.noCPU || isSimulation());
selectCPU.enabled = !isSimulation();
int x = 0;
int y = 0;

View file

@ -109,7 +109,7 @@ public class BusRenderHelper implements IPartRenderHelper
int renderingForPass = 0;
int currentPass = 0;
int itemsRendered = 0;
final boolean noAlphaPass = AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) == false;
final boolean noAlphaPass = !AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass );
public int getItemsRendered()
{

View file

@ -22,7 +22,7 @@ public class ItemEncodedPatternRenderer implements IItemRenderer
{
boolean isShiftHeld = Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) || Keyboard.isKeyDown( Keyboard.KEY_RSHIFT );
if ( recursive == false && type == IItemRenderer.ItemRenderType.INVENTORY && isShiftHeld )
if ( !recursive && type == IItemRenderer.ItemRenderType.INVENTORY && isShiftHeld )
{
ItemEncodedPattern iep = (ItemEncodedPattern) item.getItem();
if ( iep.getOutput( item ) != null )

View file

@ -290,7 +290,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
if ( ah instanceof PartPatternTerminal )
OriginalGui = GuiBridge.GUI_PATTERN_TERMINAL;
if ( result != null && simulation == false )
if ( result != null && !simulation )
{
ICraftingGrid cc = getGrid().getCache( ICraftingGrid.class );
ICraftingLink g = cc.submitJob( result, null, selectedCpu == -1 ? null : cpus.get( selectedCpu ).cpu, true, getActionSrc() );

View file

@ -107,7 +107,7 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
}
}
if ( matches && found == false )
if ( matches && !found )
return false;
}

View file

@ -291,9 +291,10 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
public boolean isSlotEnabled(int idx)
{
if ( idx == 1 )
return Platform.isServer() ? ct.isCraftingRecipe() == false : craftingMode == false;
if ( idx == 2 )
return Platform.isServer() ? ct.isCraftingRecipe() == true : craftingMode == true;
return Platform.isServer() ? !ct.isCraftingRecipe() : !craftingMode;
else if ( idx == 2 )
return Platform.isServer() ? ct.isCraftingRecipe() : craftingMode;
else
return false;
}

View file

@ -27,7 +27,7 @@ public class CraftingLink implements ICraftingLink
done = data.getBoolean( "done" );
standalone = data.getBoolean( "standalone" );
if ( !data.hasKey( "req" ) || data.getBoolean( "req" ) != true )
if ( !data.hasKey( "req" ) || !data.getBoolean( "req" ) )
throw new RuntimeException( "Invalid Crafting Link for Object" );
this.req = req;
@ -40,7 +40,7 @@ public class CraftingLink implements ICraftingLink
done = data.getBoolean( "done" );
standalone = data.getBoolean( "standalone" );
if ( !data.hasKey( "req" ) || data.getBoolean( "req" ) == true )
if ( !data.hasKey( "req" ) || data.getBoolean( "req" ) )
throw new RuntimeException( "Invalid Crafting Link for Object" );
this.cpu = cpu;

View file

@ -73,7 +73,7 @@ final public class EntitySingularity extends EntityItem
}
// check... other name.
if ( matches == false )
if ( !matches )
{
for (ItemStack is : OreDictionary.getOres( "dustEnderPearl" ))
{

View file

@ -140,7 +140,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
for (int x = 0; x < accountedFor.length; x++)
{
if ( accountedFor[x] == false )
if ( !accountedFor[x] )
addToCraftingList( patterns.getStackInSlot( x ) );
}

View file

@ -128,7 +128,7 @@ public class MultiCraftingTracker
hasStuff = true;
}
if ( hasStuff == false )
if ( !hasStuff )
links = null;
}
@ -156,7 +156,7 @@ public class MultiCraftingTracker
}
}
if ( hasStuff == false )
if ( !hasStuff )
jobs = null;
}

View file

@ -212,7 +212,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
@Override
synchronized public boolean isValidItemForSlot(int slotIndex, ItemStack i, World w)
{
if ( isCrafting == false )
if ( !isCrafting )
{
throw new RuntimeException( "Only crafting recipes supported." );
}
@ -268,7 +268,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
@Override
public ItemStack getOutput(InventoryCrafting craftingInv, World w)
{
if ( isCrafting == false )
if ( !isCrafting )
throw new RuntimeException( "Only crafting recipes supported." );
for (int x = 0; x < craftingInv.getSizeInventory(); x++)

View file

@ -120,11 +120,7 @@ public class CraftGuide extends CraftGuideAPIObject implements IIntegrationModul
Object[] items = generator.getCraftingRecipe( recipe, true );
if ( items == null )
{
continue;
}
else if ( items.length == 5 )
if ( items.length == 5 )
{
generator.addRecipe( templateSmall, items );
}

View file

@ -187,7 +187,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
{
Entity entity1 = (Entity) list.get( l );
if ( entity1.isDead == false && entity1 != p && !(entity1 instanceof EntityItem) )
if ( !entity1.isDead && entity1 != p && !(entity1 instanceof EntityItem) )
{
if ( entity1.isEntityAlive() )
{
@ -309,7 +309,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
{
Entity entity1 = (Entity) list.get( l );
if ( entity1.isDead == false && entity1 != p && !(entity1 instanceof EntityItem) )
if ( !entity1.isDead && entity1 != p && !(entity1 instanceof EntityItem) )
{
if ( entity1.isEntityAlive() )
{

View file

@ -219,7 +219,7 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
for (TileCraftingTile r : tiles)
{
IGridNode n = r.getActionableNode();
if ( n != null && posted == false )
if ( n != null && !posted )
{
IGrid g = n.getGrid();
if ( g != null )
@ -559,7 +559,7 @@ public class CraftingCPUCluster implements IAECluster, ICraftingCPU
usedOps[1] = usedOps[0];
usedOps[0] = started - remainingOperations;
if ( remainingOperations > 0 && somethingChanged == false )
if ( remainingOperations > 0 && !somethingChanged )
waiting = true;
}

View file

@ -175,7 +175,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
CachedItemStack old = memory.get( is.slot );
high = Math.max( high, is.slot );
ItemStack newIS = is.isExtractable == false && mode == StorageFilter.EXTRACTABLE_ONLY ? null : is.getItemStack();
ItemStack newIS = !is.isExtractable && mode == StorageFilter.EXTRACTABLE_ONLY ? null : is.getItemStack();
ItemStack oldIS = old == null ? null : old.itemStack;
if ( isDifferent( newIS, oldIS ) )

View file

@ -326,7 +326,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
public static boolean isLoading()
{
Boolean is = isLoading.get();
return is != null && is == true;
return is != null && is;
}
public void addToWorld()

View file

@ -423,19 +423,19 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
{
boolean Worked = false;
if ( Worked == false && side.offsetX == 0 && side.offsetZ == 0 )
if ( side.offsetX == 0 && side.offsetZ == 0 )
Worked = i.onItemUse( is, player, w, x + side.offsetX, y + side.offsetY, z + side.offsetZ, side.getOpposite().ordinal(),
side.offsetX, side.offsetY, side.offsetZ );
if ( Worked == false && side.offsetX == 0 && side.offsetZ == 0 )
if ( !Worked && side.offsetX == 0 && side.offsetZ == 0 )
Worked = i.onItemUse( is, player, w, x - side.offsetX, y - side.offsetY, z - side.offsetZ, side.ordinal(), side.offsetX,
side.offsetY, side.offsetZ );
if ( Worked == false && side.offsetY == 0 )
if ( !Worked && side.offsetY == 0 )
Worked = i.onItemUse( is, player, w, x, y - 1, z, ForgeDirection.UP.ordinal(), side.offsetX, side.offsetY, side.offsetZ );
if ( Worked == false )
Worked = i.onItemUse( is, player, w, x, y, z, side.getOpposite().ordinal(), side.offsetX, side.offsetY, side.offsetZ );
if ( !Worked )
i.onItemUse( is, player, w, x, y, z, side.getOpposite().ordinal(), side.offsetX, side.offsetY, side.offsetZ );
maxStorage = maxStorage - is.stackSize;
}

View file

@ -394,7 +394,6 @@ public class PartCable extends AEBasePart implements IPartCable
bch.addBox( dist, 6.0, 6.0, 6.0, 10.0, 10.0 );
break;
default:
continue;
}
}
}
@ -423,7 +422,6 @@ public class PartCable extends AEBasePart implements IPartCable
bch.addBox( 0.0, 6.0, 6.0, 6.0, 10.0, 10.0 );
break;
default:
continue;
}
}
}
@ -713,8 +711,6 @@ public class PartCable extends AEBasePart implements IPartCable
}
rh.renderBlock( x, y, z, renderer );
if ( true )
{
setSmartConnectionRotations( of, renderer );
IIcon firstIcon = new TaughtIcon( getChannelTex( channels, false ).getIcon(), -0.2f );
IIcon secondIcon = new TaughtIcon( getChannelTex( channels, true ).getIcon(), -0.2f );
@ -736,7 +732,6 @@ public class PartCable extends AEBasePart implements IPartCable
renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
}
rh.setTexture( getTexture( getCableColor() ) );
}
@ -965,7 +960,6 @@ public class PartCable extends AEBasePart implements IPartCable
renderer.setRenderBounds( 6 / 16.0, 6 / 16.0, 0, 10 / 16.0, 10 / 16.0, 16 / 16.0 );
break;
default:
continue;
}
}

View file

@ -97,7 +97,6 @@ public class PartCableCovered extends PartCable
bch.addBox( 0.0, 5.0, 5.0, 5.0, 11.0, 11.0 );
break;
default:
continue;
}
}
}
@ -229,7 +228,6 @@ public class PartCableCovered extends PartCable
renderer.setRenderBounds( 5 / 16.0, 5 / 16.0, 0, 11 / 16.0, 11 / 16.0, 16 / 16.0 );
break;
default:
continue;
}
}

View file

@ -151,7 +151,6 @@ public class PartCableSmart extends PartCable
bch.addBox( 0.0, 5.0, 5.0, 5.0, 11.0, 11.0 );
break;
default:
continue;
}
}
}

View file

@ -169,7 +169,6 @@ public class PartDenseCable extends PartCable
bch.addBox( 0.0, min, min, min, max, max );
break;
default:
continue;
}
}
else
@ -195,7 +194,6 @@ public class PartDenseCable extends PartCable
bch.addBox( 0.0, 5.0, 5.0, 5.0, 11.0, 11.0 );
break;
default:
continue;
}
}
}

View file

@ -79,7 +79,7 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
data.writeByte( spin );
data.writeBoolean( isLocked );
data.writeBoolean( configuredItem != null ? true : false );
data.writeBoolean( configuredItem != null );
if ( configuredItem != null )
configuredItem.writeToPacket( data );
}

View file

@ -78,7 +78,7 @@ public class CachedPlane
if ( reg.isBlacklisted( extendedblockstorage.getBlockByExtId( x, y & 15, z ) ) )
return false;
return skipThese == null ? true : !skipThese.contains( y );
return skipThese == null || !skipThese.contains( y );
}
public void setSkip(int yCoord)

View file

@ -92,7 +92,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
@Override
public boolean isUseableByPlayer(EntityPlayer p)
{
return this.worldObj.getTileEntity( this.xCoord, this.yCoord, this.zCoord ) != this ? false : p.getDistanceSq( this.xCoord + 0.5D,
return this.worldObj.getTileEntity( this.xCoord, this.yCoord, this.zCoord ) == this && p.getDistanceSq( this.xCoord + 0.5D,
this.yCoord + 0.5D, this.zCoord + 0.5D ) <= 32.0D;
}

View file

@ -118,7 +118,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
@Override
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack)
{
if ( inv == cell && locked == false )
if ( inv == cell && !locked )
{
locked = true;
@ -161,7 +161,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
locked = false;
}
else if ( inv == config && locked == false )
else if ( inv == config && !locked )
{
IInventory c = getCellConfigInventory();
if ( c != null )

View file

@ -317,7 +317,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable,
return true;
processingTime = 0;
return false || smash;
return smash;
}
@Override

View file

@ -22,7 +22,7 @@ public abstract class IC2 extends MinecraftJoules6 implements IEnergySink
@Override
final public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction)
{
return internalCanAcceptPower && getPowerSides().contains( direction );
return getPowerSides().contains( direction );
}
@Override

View file

@ -57,7 +57,7 @@ public abstract class MinecraftJoules5 extends AERootPoweredTile implements IPow
@Method(iname = "MJ5")
final public PowerReceiver getPowerReceiver(ForgeDirection side)
{
if ( internalCanAcceptPower && getPowerSides().contains( side ) && bcPowerWrapper != null )
if ( getPowerSides().contains( side ) && bcPowerWrapper != null )
return bcPowerWrapper.getPowerReceiver();
return null;
}

View file

@ -48,7 +48,7 @@ public abstract class RedstoneFlux extends RotaryCraft implements IEnergyHandler
@Override
final public boolean canConnectEnergy(ForgeDirection from)
{
return internalCanAcceptPower && getPowerSides().contains( from );
return getPowerSides().contains( from );
}
@Override

View file

@ -119,7 +119,7 @@ public abstract class RotaryCraft extends IC2 implements ShaftPowerReceiver
else if ( y == yCoord + 1 )
side = ForgeDirection.UP;
return internalCanAcceptPower && getPowerSides().contains( side );
return getPowerSides().contains( side );
}
@Override
@ -139,7 +139,7 @@ public abstract class RotaryCraft extends IC2 implements ShaftPowerReceiver
@Override
final public boolean canReadFrom(ForgeDirection side)
{
return internalCanAcceptPower && getPowerSides().contains( side );
return getPowerSides().contains( side );
}
@Override

View file

@ -141,7 +141,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements Callable
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack)
{
return (i == 0 ? isSpatialCell( itemstack ) : false);
return (i == 0 && isSpatialCell( itemstack ));
}
private boolean isSpatialCell(ItemStack cell)

View file

@ -1267,7 +1267,7 @@ public class Platform
{
Entity entity1 = (Entity) list.get( l );
if ( entity1.isDead == false && entity1 != p && !(entity1 instanceof EntityItem) )
if ( !entity1.isDead && entity1 != p && !(entity1 instanceof EntityItem) )
{
if ( entity1.isEntityAlive() )
{