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
@@ -169,7 +169,9 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
{ {
final Class<? extends BaseBlockRender> re = this.getRenderer(); final Class<? extends BaseBlockRender> re = this.getRenderer();
if( re == null ) if( re == null )
{
return null; // use 1.8 models. return null; // use 1.8 models.
}
final BaseBlockRender renderer = re.newInstance(); final BaseBlockRender renderer = re.newInstance();
this.renderInfo = new BlockRenderInfo( renderer ); this.renderInfo = new BlockRenderInfo( renderer );
@@ -250,7 +252,9 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
final IOrientable ori = this.getOrientable( w, pos ); final IOrientable ori = this.getOrientable( w, pos );
if( ori == null ) if( ori == null )
{
return this.getIcon( side, state ); return this.getIcon( side, state );
}
return this.getIcon( this.mapRotation( ori, 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 ) if( b == null )
{
b = new AxisAlignedBB( 16d, 16d, 16d, 0d, 0d, 0d ); b = new AxisAlignedBB( 16d, 16d, 16d, 0d, 0d, 0d );
}
else 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() ); 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; return b;
} }
@@ -597,7 +605,9 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
} }
if( west == null ) if( west == null )
{
return dir; return dir;
}
if( dir == forward ) if( dir == forward )
{ {
@@ -226,7 +226,9 @@ public class BlockCableBus extends AEBaseTileBlock // implements IRedNetConnecti
EnumFacing side ) EnumFacing side )
{ {
if( side == null ) if( side == null )
{
side = EnumFacing.UP; side = EnumFacing.UP;
}
return this.cb( w, pos ).canConnectRedstone( EnumSet.of( side ) ); return this.cb( w, pos ).canConnectRedstone( EnumSet.of( side ) );
} }
@@ -48,7 +48,9 @@ public class ModelGenerator
{ {
this.general = new ArrayList<BakedQuad>(); this.general = new ArrayList<BakedQuad>();
for( final EnumFacing f : EnumFacing.VALUES ) for( final EnumFacing f : EnumFacing.VALUES )
{
this.faces[f.ordinal()] = new ArrayList<BakedQuad>(); this.faces[f.ordinal()] = new ArrayList<BakedQuad>();
}
} }
@Override @Override
@@ -147,7 +149,9 @@ public class ModelGenerator
final Block block ) final Block block )
{ {
if( block == null ) if( block == null )
{
return; return;
}
this.setRenderMinX( block.getBlockBoundsMinX() ); this.setRenderMinX( block.getBlockBoundsMinX() );
this.setRenderMinY( block.getBlockBoundsMinY() ); this.setRenderMinY( block.getBlockBoundsMinY() );
@@ -245,18 +249,24 @@ public class ModelGenerator
final Item it = is.getItem(); final Item it = is.getItem();
if( it instanceof ItemMultiPart ) if( it instanceof ItemMultiPart )
{
return ( (ItemMultiPart) it ).getIcon( is ); return ( (ItemMultiPart) it ).getIcon( is );
}
final Block blk = Block.getBlockFromItem( it ); final Block blk = Block.getBlockFromItem( it );
if( blk != null ) if( blk != null )
{
return this.getIcon( blk.getStateFromMeta( is.getMetadata() ) )[0]; return this.getIcon( blk.getStateFromMeta( is.getMetadata() ) )[0];
}
if( it instanceof AEBaseItem ) if( it instanceof AEBaseItem )
{ {
final IAESprite ico = ( (AEBaseItem) it ).getIcon( is ); final IAESprite ico = ( (AEBaseItem) it ).getIcon( is );
if( ico != null ) if( ico != null )
{
return ico; return ico;
}
} }
return new MissingIcon( is ); return new MissingIcon( is );
@@ -272,7 +282,9 @@ public class ModelGenerator
{ {
final AEBaseBlock base = (AEBaseBlock) blk; final AEBaseBlock base = (AEBaseBlock) blk;
for( final EnumFacing face : EnumFacing.VALUES ) for( final EnumFacing face : EnumFacing.VALUES )
{
out[face.ordinal()] = base.getIcon( face, state ); out[face.ordinal()] = base.getIcon( face, state );
}
} }
else else
{ {
@@ -312,7 +324,9 @@ public class ModelGenerator
final AEBaseBlock base = (AEBaseBlock) blk; final AEBaseBlock base = (AEBaseBlock) blk;
for( final EnumFacing face : EnumFacing.VALUES ) for( final EnumFacing face : EnumFacing.VALUES )
{
out[face.ordinal()] = base.getIcon( world, pos, face ); out[face.ordinal()] = base.getIcon( world, pos, face );
}
return out; return out;
} }
@@ -566,7 +580,9 @@ public class ModelGenerator
IAESprite texture ) IAESprite texture )
{ {
if( this.getOverrideBlockTexture() != null ) if( this.getOverrideBlockTexture() != null )
{
texture = this.getOverrideBlockTexture(); texture = this.getOverrideBlockTexture();
}
this.faces.add( new SMFace( face, isEdge, this.color, to, from, defUVs2, new IconUnwrapper( texture ) ) ); 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 ) final float z )
{ {
if( x > 0.5 ) if( x > 0.5 )
{
this.currentFace = EnumFacing.EAST; this.currentFace = EnumFacing.EAST;
}
if( x < -0.5 ) if( x < -0.5 )
{
this.currentFace = EnumFacing.WEST; this.currentFace = EnumFacing.WEST;
}
if( y > 0.5 ) if( y > 0.5 )
{
this.currentFace = EnumFacing.UP; this.currentFace = EnumFacing.UP;
}
if( y < -0.5 ) if( y < -0.5 )
{
this.currentFace = EnumFacing.DOWN; this.currentFace = EnumFacing.DOWN;
}
if( z > 0.5 ) if( z > 0.5 )
{
this.currentFace = EnumFacing.SOUTH; this.currentFace = EnumFacing.SOUTH;
}
if( z < -0.5 ) if( z < -0.5 )
{
this.currentFace = EnumFacing.NORTH; this.currentFace = EnumFacing.NORTH;
}
} }
public void setOverrideBlockTexture( public void setOverrideBlockTexture(
@@ -601,7 +629,9 @@ public class ModelGenerator
ModelRotation mr = ModelRotation.X0_Y0; ModelRotation mr = ModelRotation.X0_Y0;
if( Flip ) if( Flip )
{
mr = ModelRotation.X0_Y180; mr = ModelRotation.X0_Y180;
}
for( final SMFace face : this.faces ) for( final SMFace face : this.faces )
{ {
@@ -615,9 +645,13 @@ public class ModelGenerator
bf = new IColoredBakedQuad.ColoredBakedQuad( bf.getVertexData(), face.getColor(), bf.getFace() ); bf = new IColoredBakedQuad.ColoredBakedQuad( bf.getVertexData(), face.getColor(), bf.getFace() );
if( face.isEdge() ) if( face.isEdge() )
{
this.generatedModel.getFaceQuads( myFace ).add( bf ); this.generatedModel.getFaceQuads( myFace ).add( bf );
}
else else
{
this.generatedModel.getGeneralQuads().add( bf ); this.generatedModel.getGeneralQuads().add( bf );
}
} }
} }
@@ -77,7 +77,9 @@ public class RenderBlockCraftingCPU<B extends BlockCraftingUnit, T extends TileC
for( final Block craftingBlock : AEApi.instance().definitions().blocks().craftingUnit().maybeBlock().asSet() ) for( final Block craftingBlock : AEApi.instance().definitions().blocks().craftingUnit().maybeBlock().asSet() )
{ {
if( craftingBlock == blk ) if( craftingBlock == blk )
{
meta = 0; meta = 0;
}
} }
IAESprite nonForward = theIcon; IAESprite nonForward = theIcon;
@@ -148,12 +148,16 @@ public class AppEngCraftingSlot extends AppEngSlot
final InventoryCrafting ic = new InventoryCrafting( this.getContainer(), 3, 3 ); final InventoryCrafting ic = new InventoryCrafting( this.getContainer(), 3, 3 );
for( int x = 0; x < this.craftMatrix.getSizeInventory(); x++ ) for( int x = 0; x < this.craftMatrix.getSizeInventory(); x++ )
{
ic.setInventorySlotContents( x, this.craftMatrix.getStackInSlot( x ) ); ic.setInventorySlotContents( x, this.craftMatrix.getStackInSlot( x ) );
}
final ItemStack[] aitemstack = CraftingManager.getInstance().func_180303_b( ic, playerIn.worldObj ); final ItemStack[] aitemstack = CraftingManager.getInstance().func_180303_b( ic, playerIn.worldObj );
for( int x = 0; x < this.craftMatrix.getSizeInventory(); x++ ) for( int x = 0; x < this.craftMatrix.getSizeInventory(); x++ )
{
this.craftMatrix.setInventorySlotContents( x, ic.getStackInSlot( x ) ); this.craftMatrix.setInventorySlotContents( x, ic.getStackInSlot( x ) );
}
net.minecraftforge.common.ForgeHooks.setCraftingPlayer( null ); net.minecraftforge.common.ForgeHooks.setCraftingPlayer( null );
@@ -91,10 +91,14 @@ public final class AECableBusFeatureHandler implements IFeatureHandler
// register the block/item conversion... // register the block/item conversion...
if( this.featured != null && this.definition.maybeItem().isPresent() ) if( this.featured != null && this.definition.maybeItem().isPresent() )
{
GameData.getBlockItemMap().put( this.featured, this.definition.maybeItem().get() ); GameData.getBlockItemMap().put( this.featured, this.definition.maybeItem().get() );
}
if( side == Side.CLIENT ) if( side == Side.CLIENT )
{
CommonHelper.proxy.configureIcon( this.featured, name ); CommonHelper.proxy.configureIcon( this.featured, name );
}
} }
} }
} }
@@ -75,7 +75,9 @@ public class MetaRotation implements IOrientable
Axis a = state == null ? null : (Axis) state.getValue( AEBaseBlock.AXIS_ORIENTATION ); Axis a = state == null ? null : (Axis) state.getValue( AEBaseBlock.AXIS_ORIENTATION );
if( a == null ) if( a == null )
{
a = Axis.Y; a = Axis.Y;
}
switch( a ) switch( a )
{ {
@@ -95,9 +97,13 @@ public class MetaRotation implements IOrientable
if( this.w instanceof World ) if( this.w instanceof World )
{ {
if( this.useFacing ) if( this.useFacing )
{
( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).withProperty( BlockTorch.FACING, up ) ); ( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).withProperty( BlockTorch.FACING, up ) );
}
else else
{
( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).withProperty( AEBaseBlock.AXIS_ORIENTATION, up.getAxis() ) ); ( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).withProperty( AEBaseBlock.AXIS_ORIENTATION, up.getAxis() ) );
}
} }
else else
{ {
@@ -63,7 +63,9 @@ public class ItemPaintBall extends AEBaseItem
final ItemStack stack ) final ItemStack stack )
{ {
if( ItemPaintBall.this.isLumen( stack ) ) if( ItemPaintBall.this.isLumen( stack ) )
{
return sloc; return sloc;
}
return loc; return loc;
} }
@@ -231,7 +231,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
if( data.hasKey( "modid" ) && data.hasKey( "itemname" ) ) if( data.hasKey( "modid" ) && data.hasKey( "itemname" ) )
{ {
if( data.getString( "modid" ).equals( "minecraft" ) ) if( data.getString( "modid" ).equals( "minecraft" ) )
{
return Block.getBlockFromName( data.getString( "itemname" ) ); return Block.getBlockFromName( data.getString( "itemname" ) );
}
return GameRegistry.findBlock( data.getString( "modid" ), data.getString( "itemname" ) ); return GameRegistry.findBlock( data.getString( "modid" ), data.getString( "itemname" ) );
} }
@@ -93,7 +93,9 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
// and this cause sometimes it can go thought walls. // and this cause sometimes it can go thought walls.
for( final EnumFacing face : EnumFacing.VALUES ) for( final EnumFacing face : EnumFacing.VALUES )
{
Platform.notifyBlocksOfNeighbors( worldObj, this.getTile().getPos().offset( face ) ); Platform.notifyBlocksOfNeighbors( worldObj, this.getTile().getPos().offset( face ) );
}
} }
@MENetworkEventSubscribe @MENetworkEventSubscribe
@@ -125,9 +125,13 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
private void configureNodeSides() private void configureNodeSides()
{ {
if( this.pointAt == AEPartLocation.INTERNAL ) if( this.pointAt == AEPartLocation.INTERNAL )
{
this.getProxy().setValidSides( EnumSet.allOf( EnumFacing.class ) ); this.getProxy().setValidSides( EnumSet.allOf( EnumFacing.class ) );
}
else else
{
this.getProxy().setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt.getFacing() ) ) ); this.getProxy().setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt.getFacing() ) ) );
}
} }
@Override @Override
@@ -239,8 +239,12 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
{ {
final EnumSet<EnumFacing> sides = EnumSet.noneOf( EnumFacing.class ); final EnumSet<EnumFacing> sides = EnumSet.noneOf( EnumFacing.class );
for( final AEPartLocation dir : this.getConnections() ) for( final AEPartLocation dir : this.getConnections() )
{
if( dir != AEPartLocation.INTERNAL ) if( dir != AEPartLocation.INTERNAL )
{
sides.add( dir.getFacing() ); sides.add( dir.getFacing() );
}
}
this.getProxy().setValidSides( sides ); this.getProxy().setValidSides( sides );
} }