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; return;
} }
if ( disableShiftClick == false && isShiftKeyDown() ) if ( !disableShiftClick && isShiftKeyDown() )
{ {
disableShiftClick = true; disableShiftClick = true;

View file

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

View file

@ -109,7 +109,7 @@ public class BusRenderHelper implements IPartRenderHelper
int renderingForPass = 0; int renderingForPass = 0;
int currentPass = 0; int currentPass = 0;
int itemsRendered = 0; int itemsRendered = 0;
final boolean noAlphaPass = AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) == false; final boolean noAlphaPass = !AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass );
public int getItemsRendered() 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 ); 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(); ItemEncodedPattern iep = (ItemEncodedPattern) item.getItem();
if ( iep.getOutput( item ) != null ) if ( iep.getOutput( item ) != null )

View file

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

View file

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

View file

@ -27,7 +27,7 @@ public class CraftingLink implements ICraftingLink
done = data.getBoolean( "done" ); done = data.getBoolean( "done" );
standalone = data.getBoolean( "standalone" ); 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" ); throw new RuntimeException( "Invalid Crafting Link for Object" );
this.req = req; this.req = req;
@ -40,7 +40,7 @@ public class CraftingLink implements ICraftingLink
done = data.getBoolean( "done" ); done = data.getBoolean( "done" );
standalone = data.getBoolean( "standalone" ); 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" ); throw new RuntimeException( "Invalid Crafting Link for Object" );
this.cpu = cpu; this.cpu = cpu;

View file

@ -73,7 +73,7 @@ final public class EntitySingularity extends EntityItem
} }
// check... other name. // check... other name.
if ( matches == false ) if ( !matches )
{ {
for (ItemStack is : OreDictionary.getOres( "dustEnderPearl" )) 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++) for (int x = 0; x < accountedFor.length; x++)
{ {
if ( accountedFor[x] == false ) if ( !accountedFor[x] )
addToCraftingList( patterns.getStackInSlot( x ) ); addToCraftingList( patterns.getStackInSlot( x ) );
} }

View file

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

View file

@ -212,7 +212,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
@Override @Override
synchronized public boolean isValidItemForSlot(int slotIndex, ItemStack i, World w) synchronized public boolean isValidItemForSlot(int slotIndex, ItemStack i, World w)
{ {
if ( isCrafting == false ) if ( !isCrafting )
{ {
throw new RuntimeException( "Only crafting recipes supported." ); throw new RuntimeException( "Only crafting recipes supported." );
} }
@ -268,7 +268,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
@Override @Override
public ItemStack getOutput(InventoryCrafting craftingInv, World w) public ItemStack getOutput(InventoryCrafting craftingInv, World w)
{ {
if ( isCrafting == false ) if ( !isCrafting )
throw new RuntimeException( "Only crafting recipes supported." ); throw new RuntimeException( "Only crafting recipes supported." );
for (int x = 0; x < craftingInv.getSizeInventory(); x++) 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 ); Object[] items = generator.getCraftingRecipe( recipe, true );
if ( items == null ) if ( items.length == 5 )
{
continue;
}
else if ( items.length == 5 )
{ {
generator.addRecipe( templateSmall, items ); generator.addRecipe( templateSmall, items );
} }

View file

@ -187,7 +187,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
{ {
Entity entity1 = (Entity) list.get( l ); 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() ) if ( entity1.isEntityAlive() )
{ {
@ -309,7 +309,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
{ {
Entity entity1 = (Entity) list.get( l ); 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() ) if ( entity1.isEntityAlive() )
{ {

View file

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

View file

@ -175,7 +175,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
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.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; ItemStack oldIS = old == null ? null : old.itemStack;
if ( isDifferent( newIS, oldIS ) ) if ( isDifferent( newIS, oldIS ) )

View file

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

View file

@ -423,19 +423,19 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
{ {
boolean Worked = false; 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(), Worked = i.onItemUse( is, player, w, x + side.offsetX, y + side.offsetY, z + side.offsetZ, side.getOpposite().ordinal(),
side.offsetX, side.offsetY, side.offsetZ ); 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, Worked = i.onItemUse( is, player, w, x - side.offsetX, y - side.offsetY, z - side.offsetZ, side.ordinal(), side.offsetX,
side.offsetY, side.offsetZ ); 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 ); Worked = i.onItemUse( is, player, w, x, y - 1, z, ForgeDirection.UP.ordinal(), side.offsetX, side.offsetY, side.offsetZ );
if ( Worked == false ) if ( !Worked )
Worked = i.onItemUse( is, player, w, x, y, z, side.getOpposite().ordinal(), side.offsetX, side.offsetY, side.offsetZ ); i.onItemUse( is, player, w, x, y, z, side.getOpposite().ordinal(), side.offsetX, side.offsetY, side.offsetZ );
maxStorage = maxStorage - is.stackSize; 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 ); bch.addBox( dist, 6.0, 6.0, 6.0, 10.0, 10.0 );
break; break;
default: 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 ); bch.addBox( 0.0, 6.0, 6.0, 6.0, 10.0, 10.0 );
break; break;
default: default:
continue;
} }
} }
} }
@ -713,8 +711,6 @@ public class PartCable extends AEBasePart implements IPartCable
} }
rh.renderBlock( x, y, z, renderer ); rh.renderBlock( x, y, z, renderer );
if ( true )
{
setSmartConnectionRotations( of, renderer ); setSmartConnectionRotations( of, renderer );
IIcon firstIcon = new TaughtIcon( getChannelTex( channels, false ).getIcon(), -0.2f ); IIcon firstIcon = new TaughtIcon( getChannelTex( channels, false ).getIcon(), -0.2f );
IIcon secondIcon = new TaughtIcon( getChannelTex( channels, true ).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 ); renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, rh, renderer );
renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0; renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth = renderer.uvRotateTop = renderer.uvRotateWest = 0;
}
rh.setTexture( getTexture( getCableColor() ) ); 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 ); renderer.setRenderBounds( 6 / 16.0, 6 / 16.0, 0, 10 / 16.0, 10 / 16.0, 16 / 16.0 );
break; break;
default: 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 ); bch.addBox( 0.0, 5.0, 5.0, 5.0, 11.0, 11.0 );
break; break;
default: 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 ); renderer.setRenderBounds( 5 / 16.0, 5 / 16.0, 0, 11 / 16.0, 11 / 16.0, 16 / 16.0 );
break; break;
default: 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 ); bch.addBox( 0.0, 5.0, 5.0, 5.0, 11.0, 11.0 );
break; break;
default: default:
continue;
} }
} }
} }

View file

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

View file

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

View file

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

View file

@ -92,7 +92,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
@Override @Override
public boolean isUseableByPlayer(EntityPlayer p) 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; 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 @Override
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack)
{ {
if ( inv == cell && locked == false ) if ( inv == cell && !locked )
{ {
locked = true; locked = true;
@ -161,7 +161,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
locked = false; locked = false;
} }
else if ( inv == config && locked == false ) else if ( inv == config && !locked )
{ {
IInventory c = getCellConfigInventory(); IInventory c = getCellConfigInventory();
if ( c != null ) if ( c != null )

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1267,7 +1267,7 @@ public class Platform
{ {
Entity entity1 = (Entity) list.get( l ); 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() ) if ( entity1.isEntityAlive() )
{ {