Always use {} for statements

This commit is contained in:
yueh 2015-12-24 02:11:17 +01:00
parent 4a486673f6
commit 2e51ea5f78
12 changed files with 76 additions and 0 deletions

View File

@ -169,7 +169,9 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
{
final Class<? extends BaseBlockRender> re = this.getRenderer();
if( re == null )
{
return null; // use 1.8 models.
}
final BaseBlockRender renderer = re.newInstance();
this.renderInfo = new BlockRenderInfo( renderer );
@ -250,7 +252,9 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
final IOrientable ori = this.getOrientable( w, pos );
if( ori == null )
{
return this.getIcon( side, state );
}
return this.getIcon( this.mapRotation( ori, side ), state );
}
@ -363,9 +367,13 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
}
if( b == null )
{
b = new AxisAlignedBB( 16d, 16d, 16d, 0d, 0d, 0d );
}
else
{
b = AxisAlignedBB.fromBounds( b.minX + pos.getX(), b.minY + pos.getY(), b.minZ + pos.getZ(), b.maxX + pos.getX(), b.maxY + pos.getY(), b.maxZ + pos.getZ() );
}
return b;
}
@ -597,7 +605,9 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
}
if( west == null )
{
return dir;
}
if( dir == forward )
{

View File

@ -226,7 +226,9 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
EnumFacing side )
{
if( side == null )
{
side = EnumFacing.UP;
}
return this.cb( w, pos ).canConnectRedstone( EnumSet.of( side ) );
}

View File

@ -48,7 +48,9 @@ public class ModelGenerator
{
this.general = new ArrayList<BakedQuad>();
for( final EnumFacing f : EnumFacing.VALUES )
{
this.faces[f.ordinal()] = new ArrayList<BakedQuad>();
}
}
@Override
@ -147,7 +149,9 @@ public class ModelGenerator
final Block block )
{
if( block == null )
{
return;
}
this.setRenderMinX( block.getBlockBoundsMinX() );
this.setRenderMinY( block.getBlockBoundsMinY() );
@ -245,18 +249,24 @@ public class ModelGenerator
final Item it = is.getItem();
if( it instanceof ItemMultiPart )
{
return ( (ItemMultiPart) it ).getIcon( is );
}
final Block blk = Block.getBlockFromItem( it );
if( blk != null )
{
return this.getIcon( blk.getStateFromMeta( is.getMetadata() ) )[0];
}
if( it instanceof AEBaseItem )
{
final IAESprite ico = ( (AEBaseItem) it ).getIcon( is );
if( ico != null )
{
return ico;
}
}
return new MissingIcon( is );
@ -272,7 +282,9 @@ public class ModelGenerator
{
final AEBaseBlock base = (AEBaseBlock) blk;
for( final EnumFacing face : EnumFacing.VALUES )
{
out[face.ordinal()] = base.getIcon( face, state );
}
}
else
{
@ -312,7 +324,9 @@ public class ModelGenerator
final AEBaseBlock base = (AEBaseBlock) blk;
for( final EnumFacing face : EnumFacing.VALUES )
{
out[face.ordinal()] = base.getIcon( world, pos, face );
}
return out;
}
@ -566,7 +580,9 @@ public class ModelGenerator
IAESprite texture )
{
if( this.getOverrideBlockTexture() != null )
{
texture = this.getOverrideBlockTexture();
}
this.faces.add( new SMFace( face, isEdge, this.color, to, from, defUVs2, new IconUnwrapper( texture ) ) );
}
@ -577,17 +593,29 @@ public class ModelGenerator
final float z )
{
if( x > 0.5 )
{
this.currentFace = EnumFacing.EAST;
}
if( x < -0.5 )
{
this.currentFace = EnumFacing.WEST;
}
if( y > 0.5 )
{
this.currentFace = EnumFacing.UP;
}
if( y < -0.5 )
{
this.currentFace = EnumFacing.DOWN;
}
if( z > 0.5 )
{
this.currentFace = EnumFacing.SOUTH;
}
if( z < -0.5 )
{
this.currentFace = EnumFacing.NORTH;
}
}
public void setOverrideBlockTexture(
@ -601,7 +629,9 @@ public class ModelGenerator
ModelRotation mr = ModelRotation.X0_Y0;
if( Flip )
{
mr = ModelRotation.X0_Y180;
}
for( final SMFace face : this.faces )
{
@ -615,9 +645,13 @@ public class ModelGenerator
bf = new IColoredBakedQuad.ColoredBakedQuad( bf.getVertexData(), face.getColor(), bf.getFace() );
if( face.isEdge() )
{
this.generatedModel.getFaceQuads( myFace ).add( bf );
}
else
{
this.generatedModel.getGeneralQuads().add( bf );
}
}
}

View File

@ -77,7 +77,9 @@ public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileC
for( final Block craftingBlock : AEApi.instance().definitions().blocks().craftingUnit().maybeBlock().asSet() )
{
if( craftingBlock == blk )
{
meta = 0;
}
}
IAESprite nonForward = theIcon;

View File

@ -148,12 +148,16 @@ public class AppEngCraftingSlot extends AppEngSlot
final InventoryCrafting ic = new InventoryCrafting( this.getContainer(), 3, 3 );
for( int x = 0; x < this.craftMatrix.getSizeInventory(); x++ )
{
ic.setInventorySlotContents( x, this.craftMatrix.getStackInSlot( x ) );
}
final ItemStack[] aitemstack = CraftingManager.getInstance().func_180303_b( ic, playerIn.worldObj );
for( int x = 0; x < this.craftMatrix.getSizeInventory(); x++ )
{
this.craftMatrix.setInventorySlotContents( x, ic.getStackInSlot( x ) );
}
net.minecraftforge.common.ForgeHooks.setCraftingPlayer( null );

View File

@ -91,10 +91,14 @@ public final class AECableBusFeatureHandler implements IFeatureHandler
// register the block/item conversion...
if( this.featured != null && this.definition.maybeItem().isPresent() )
{
GameData.getBlockItemMap().put( this.featured, this.definition.maybeItem().get() );
}
if( side == Side.CLIENT )
{
CommonHelper.proxy.configureIcon( this.featured, name );
}
}
}
}

View File

@ -75,7 +75,9 @@ public class MetaRotation implements IOrientable
Axis a = state == null ? null : (Axis) state.getValue( AEBaseBlock.AXIS_ORIENTATION );
if( a == null )
{
a = Axis.Y;
}
switch( a )
{
@ -95,9 +97,13 @@ public class MetaRotation implements IOrientable
if( this.w instanceof World )
{
if( this.useFacing )
{
( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).withProperty( BlockTorch.FACING, up ) );
}
else
{
( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).withProperty( AEBaseBlock.AXIS_ORIENTATION, up.getAxis() ) );
}
}
else
{

View File

@ -63,7 +63,9 @@ public class ItemPaintBall extends AEBaseItem
final ItemStack stack )
{
if( ItemPaintBall.this.isLumen( stack ) )
{
return sloc;
}
return loc;
}

View File

@ -231,7 +231,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
if( data.hasKey( "modid" ) && data.hasKey( "itemname" ) )
{
if( data.getString( "modid" ).equals( "minecraft" ) )
{
return Block.getBlockFromName( data.getString( "itemname" ) );
}
return GameRegistry.findBlock( data.getString( "modid" ), data.getString( "itemname" ) );
}

View File

@ -93,7 +93,9 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
// and this cause sometimes it can go thought walls.
for( final EnumFacing face : EnumFacing.VALUES )
{
Platform.notifyBlocksOfNeighbors( worldObj, this.getTile().getPos().offset( face ) );
}
}
@MENetworkEventSubscribe

View File

@ -125,9 +125,13 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
private void configureNodeSides()
{
if( this.pointAt == AEPartLocation.INTERNAL )
{
this.getProxy().setValidSides( EnumSet.allOf( EnumFacing.class ) );
}
else
{
this.getProxy().setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt.getFacing() ) ) );
}
}
@Override

View File

@ -239,8 +239,12 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
{
final EnumSet<EnumFacing> sides = EnumSet.noneOf( EnumFacing.class );
for( final AEPartLocation dir : this.getConnections() )
{
if( dir != AEPartLocation.INTERNAL )
{
sides.add( dir.getFacing() );
}
}
this.getProxy().setValidSides( sides );
}