final variables and parameters

seeing some methods it does actually help to enforce the parameters
This commit is contained in:
thatsIch
2015-09-25 23:10:56 +02:00
parent e52400bf26
commit 410d2f1e0d
819 changed files with 9390 additions and 9396 deletions
@@ -46,13 +46,13 @@ public class BlockChunkloader extends AEBaseTileBlock implements LoadingCallback
}
@Override
public void ticketsLoaded( List<Ticket> tickets, World world )
public void ticketsLoaded( final List<Ticket> tickets, final World world )
{
}
@Override
public void registerBlockIcons( IIconRegister iconRegistry )
public void registerBlockIcons( final IIconRegister iconRegistry )
{
this.registerNoIcons();
}
@@ -41,9 +41,9 @@ public class BlockCubeGenerator extends AEBaseTileBlock
}
@Override
public boolean onActivated( World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ )
public boolean onActivated( final World w, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX, final float hitY, final float hitZ )
{
TileCubeGenerator tcg = this.getTileEntity( w, x, y, z );
final TileCubeGenerator tcg = this.getTileEntity( w, x, y, z );
if( tcg != null )
{
tcg.click( player );
@@ -53,7 +53,7 @@ public class BlockCubeGenerator extends AEBaseTileBlock
}
@Override
public void registerBlockIcons( IIconRegister iconRegistry )
public void registerBlockIcons( final IIconRegister iconRegistry )
{
this.registerNoIcons();
}
+1 -1
View File
@@ -39,7 +39,7 @@ public class BlockItemGen extends AEBaseTileBlock
}
@Override
public void registerBlockIcons( IIconRegister iconRegistry )
public void registerBlockIcons( final IIconRegister iconRegistry )
{
this.registerNoIcons();
}
@@ -41,15 +41,15 @@ public class BlockPhantomNode extends AEBaseTileBlock
}
@Override
public boolean onActivated( World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ )
public boolean onActivated( final World w, final int x, final int y, final int z, final EntityPlayer player, final int side, final float hitX, final float hitY, final float hitZ )
{
TilePhantomNode tpn = this.getTileEntity( w, x, y, z );
final TilePhantomNode tpn = this.getTileEntity( w, x, y, z );
tpn.triggerCrashMode();
return true;
}
@Override
public void registerBlockIcons( IIconRegister iconRegistry )
public void registerBlockIcons( final IIconRegister iconRegistry )
{
this.registerNoIcons();
}
@@ -66,11 +66,11 @@ public class TileChunkLoader extends AEBaseTile
if( this.ct == null )
{
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
final MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
if( server != null )
{
List<EntityPlayerMP> pl = server.getConfigurationManager().playerEntityList;
for( EntityPlayerMP p : pl )
final List<EntityPlayerMP> pl = server.getConfigurationManager().playerEntityList;
for( final EntityPlayerMP p : pl )
{
p.addChatMessage( new ChatComponentText( "Can't chunk load.." ) );
}
@@ -49,7 +49,7 @@ public class TileCubeGenerator extends AEBaseTile
if( this.countdown % 20 == 0 )
{
for( EntityPlayer e : CommonHelper.proxy.getPlayers() )
for( final EntityPlayer e : CommonHelper.proxy.getPlayers() )
{
e.addChatMessage( new ChatComponentText( "Spawning in... " + ( this.countdown / 20 ) ) );
}
@@ -66,10 +66,10 @@ public class TileCubeGenerator extends AEBaseTile
{
this.worldObj.setBlock( this.xCoord, this.yCoord, this.zCoord, Platform.AIR_BLOCK, 0, 3 );
Item i = this.is.getItem();
int side = ForgeDirection.UP.ordinal();
final Item i = this.is.getItem();
final int side = ForgeDirection.UP.ordinal();
int half = (int) Math.floor( this.size / 2 );
final int half = (int) Math.floor( this.size / 2 );
for( int y = 0; y < this.size; y++ )
{
@@ -83,11 +83,11 @@ public class TileCubeGenerator extends AEBaseTile
}
}
public void click( EntityPlayer player )
public void click( final EntityPlayer player )
{
if( Platform.isServer() )
{
ItemStack hand = player.inventory.getCurrentItem();
final ItemStack hand = player.inventory.getCurrentItem();
this.who = player;
if( hand == null )
+12 -12
View File
@@ -41,9 +41,9 @@ public class TileItemGen extends AEBaseTile implements IInventory
{
if( POSSIBLE_ITEMS.isEmpty() )
{
for( Object obj : Item.itemRegistry )
for( final Object obj : Item.itemRegistry )
{
Item mi = (Item) obj;
final Item mi = (Item) obj;
if( mi != null )
{
if( mi.isDamageable() )
@@ -55,7 +55,7 @@ public class TileItemGen extends AEBaseTile implements IInventory
}
else
{
List<ItemStack> list = new ArrayList<ItemStack>();
final List<ItemStack> list = new ArrayList<ItemStack>();
mi.getSubItems( mi, mi.getCreativeTab(), list );
POSSIBLE_ITEMS.addAll( list );
}
@@ -71,7 +71,7 @@ public class TileItemGen extends AEBaseTile implements IInventory
}
@Override
public ItemStack getStackInSlot( int i )
public ItemStack getStackInSlot( final int i )
{
return this.getRandomItem();
}
@@ -82,24 +82,24 @@ public class TileItemGen extends AEBaseTile implements IInventory
}
@Override
public ItemStack decrStackSize( int i, int j )
public ItemStack decrStackSize( final int i, final int j )
{
ItemStack a = POSSIBLE_ITEMS.poll();
ItemStack out = a.copy();
final ItemStack a = POSSIBLE_ITEMS.poll();
final ItemStack out = a.copy();
POSSIBLE_ITEMS.add( a );
return out;
}
@Override
public ItemStack getStackInSlotOnClosing( int i )
public ItemStack getStackInSlotOnClosing( final int i )
{
return null;
}
@Override
public void setInventorySlotContents( int i, ItemStack itemstack )
public void setInventorySlotContents( final int i, final ItemStack itemstack )
{
ItemStack a = POSSIBLE_ITEMS.poll();
final ItemStack a = POSSIBLE_ITEMS.poll();
POSSIBLE_ITEMS.add( a );
}
@@ -122,7 +122,7 @@ public class TileItemGen extends AEBaseTile implements IInventory
}
@Override
public boolean isUseableByPlayer( EntityPlayer entityplayer )
public boolean isUseableByPlayer( final EntityPlayer entityplayer )
{
return false;
}
@@ -140,7 +140,7 @@ public class TileItemGen extends AEBaseTile implements IInventory
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return false;
}
@@ -35,7 +35,7 @@ public class TilePhantomNode extends AENetworkTile
boolean crashMode = false;
@Override
public IGridNode getGridNode( ForgeDirection dir )
public IGridNode getGridNode( final ForgeDirection dir )
{
if( !this.crashMode )
{
+24 -24
View File
@@ -60,7 +60,7 @@ public class ToolDebugCard extends AEBaseItem
}
@Override
public boolean onItemUseFirst( ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
public boolean onItemUseFirst( final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y, final int z, final int side, final float hitX, final float hitY, final float hitZ )
{
if( Platform.isClient() )
{
@@ -72,7 +72,7 @@ public class ToolDebugCard extends AEBaseItem
int grids = 0;
int totalNodes = 0;
for( Grid g : TickHandler.INSTANCE.getGridList() )
for( final Grid g : TickHandler.INSTANCE.getGridList() )
{
grids++;
totalNodes += g.getNodes().size();
@@ -83,42 +83,42 @@ public class ToolDebugCard extends AEBaseItem
}
else
{
TileEntity te = world.getTileEntity( x, y, z );
final TileEntity te = world.getTileEntity( x, y, z );
if( te instanceof IGridHost )
{
GridNode node = (GridNode) ( (IGridHost) te ).getGridNode( ForgeDirection.getOrientation( side ) );
final GridNode node = (GridNode) ( (IGridHost) te ).getGridNode( ForgeDirection.getOrientation( side ) );
if( node != null )
{
Grid g = node.getInternalGrid();
IGridNode center = g.getPivot();
final Grid g = node.getInternalGrid();
final IGridNode center = g.getPivot();
this.outputMsg( player, "This Node: " + node.toString() );
this.outputMsg( player, "Center Node: " + center.toString() );
IPathingGrid pg = g.getCache( IPathingGrid.class );
final IPathingGrid pg = g.getCache( IPathingGrid.class );
if( pg.getControllerState() == ControllerState.CONTROLLER_ONLINE )
{
Set<IGridNode> next = new HashSet<IGridNode>();
next.add( node );
int maxLength = 10000;
final int maxLength = 10000;
int length = 0;
outer:
while( !next.isEmpty() )
{
Iterable<IGridNode> current = next;
final Iterable<IGridNode> current = next;
next = new HashSet<IGridNode>();
for( IGridNode n : current )
for( final IGridNode n : current )
{
if( n.getMachine() instanceof TileController )
{
break outer;
}
for( IGridConnection c : n.getConnections() )
for( final IGridConnection c : n.getConnections() )
{
next.add( c.getOtherSide( n ) );
}
@@ -140,12 +140,12 @@ public class ToolDebugCard extends AEBaseItem
this.outputMsg( player, "Freq: " + ( (PartP2PTunnel) center.getMachine() ).freq );
}
TickManagerCache tmc = g.getCache( ITickManager.class );
for( Class<? extends IGridHost> c : g.getMachineClasses() )
final TickManagerCache tmc = g.getCache( ITickManager.class );
for( final Class<? extends IGridHost> c : g.getMachineClasses() )
{
int o = 0;
long nanos = 0;
for( IGridNode oj : g.getMachines( c ) )
for( final IGridNode oj : g.getMachines( c ) )
{
o++;
nanos += tmc.getAvgNanoTime( oj );
@@ -173,15 +173,15 @@ public class ToolDebugCard extends AEBaseItem
if( te instanceof IPartHost )
{
IPart center = ( (IPartHost) te ).getPart( ForgeDirection.UNKNOWN );
final IPart center = ( (IPartHost) te ).getPart( ForgeDirection.UNKNOWN );
( (IPartHost) te ).markForUpdate();
if( center != null )
{
GridNode n = (GridNode) center.getGridNode();
final GridNode n = (GridNode) center.getGridNode();
this.outputMsg( player, "Node Channels: " + n.usedChannels() );
for( IGridConnection gc : n.getConnections() )
for( final IGridConnection gc : n.getConnections() )
{
ForgeDirection fd = gc.getDirection( n );
final ForgeDirection fd = gc.getDirection( n );
if( fd != ForgeDirection.UNKNOWN )
{
this.outputMsg( player, fd.toString() + ": " + gc.getUsedChannels() );
@@ -192,15 +192,15 @@ public class ToolDebugCard extends AEBaseItem
if( te instanceof IAEPowerStorage )
{
IAEPowerStorage ps = (IAEPowerStorage) te;
final IAEPowerStorage ps = (IAEPowerStorage) te;
this.outputMsg( player, "Energy: " + ps.getAECurrentPower() + " / " + ps.getAEMaxPower() );
if( te instanceof IGridHost )
{
IGridNode node = ( (IGridHost) te ).getGridNode( ForgeDirection.getOrientation( side ) );
final IGridNode node = ( (IGridHost) te ).getGridNode( ForgeDirection.getOrientation( side ) );
if( node != null && node.getGrid() != null )
{
IEnergyGrid eg = node.getGrid().getCache( IEnergyGrid.class );
final IEnergyGrid eg = node.getGrid().getCache( IEnergyGrid.class );
this.outputMsg( player, "GridEnergy: " + eg.getStoredPower() + " : " + eg.getEnergyDemand( Double.MAX_VALUE ) );
}
}
@@ -209,14 +209,14 @@ public class ToolDebugCard extends AEBaseItem
return true;
}
private void outputMsg( ICommandSender player, String string )
private void outputMsg( final ICommandSender player, final String string )
{
player.addChatMessage( new ChatComponentText( string ) );
}
public String timeMeasurement( long nanos )
public String timeMeasurement( final long nanos )
{
long ms = nanos / 100000;
final long ms = nanos / 100000;
if( nanos <= 100000 )
{
return nanos + "ns";
+9 -9
View File
@@ -49,21 +49,21 @@ public class ToolEraser extends AEBaseItem
}
@Override
public void registerIcons( IIconRegister par1IconRegister )
public void registerIcons( final IIconRegister par1IconRegister )
{
this.itemIcon = new MissingIcon( this );
}
@Override
public boolean onItemUseFirst( ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
public boolean onItemUseFirst( final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y, final int z, final int side, final float hitX, final float hitY, final float hitZ )
{
if( Platform.isClient() )
{
return false;
}
Block blk = world.getBlock( x, y, z );
int meta = world.getBlockMetadata( x, y, z );
final Block blk = world.getBlock( x, y, z );
final int meta = world.getBlockMetadata( x, y, z );
List<WorldCoord> next = new LinkedList<WorldCoord>();
next.add( new WorldCoord( x, y, z ) );
@@ -71,13 +71,13 @@ public class ToolEraser extends AEBaseItem
int blocks = 0;
while( blocks < BLOCK_ERASE_LIMIT && !next.isEmpty() )
{
List<WorldCoord> c = next;
final List<WorldCoord> c = next;
next = new LinkedList<WorldCoord>();
for( WorldCoord wc : c )
for( final WorldCoord wc : c )
{
Block c_blk = world.getBlock( wc.x, wc.y, wc.z );
int c_meta = world.getBlockMetadata( wc.x, wc.y, wc.z );
final Block c_blk = world.getBlock( wc.x, wc.y, wc.z );
final int c_meta = world.getBlockMetadata( wc.x, wc.y, wc.z );
if( c_blk == blk && c_meta == meta )
{
@@ -99,7 +99,7 @@ public class ToolEraser extends AEBaseItem
return true;
}
private void wrappedAdd( World world, int i, int y, int z, Collection<WorldCoord> next )
private void wrappedAdd( final World world, final int i, final int y, final int z, final Collection<WorldCoord> next )
{
next.add( new WorldCoord( i, y, z ) );
}
@@ -43,21 +43,21 @@ public class ToolMeteoritePlacer extends AEBaseItem
}
@Override
public void registerIcons( IIconRegister par1IconRegister )
public void registerIcons( final IIconRegister par1IconRegister )
{
this.itemIcon = new MissingIcon( this );
}
@Override
public boolean onItemUseFirst( ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
public boolean onItemUseFirst( final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y, final int z, final int side, final float hitX, final float hitY, final float hitZ )
{
if( Platform.isClient() )
{
return false;
}
MeteoritePlacer mp = new MeteoritePlacer();
boolean worked = mp.spawnMeteorite( new StandardWorld( world ), x, y, z );
final MeteoritePlacer mp = new MeteoritePlacer();
final boolean worked = mp.spawnMeteorite( new StandardWorld( world ), x, y, z );
if( !worked )
{
@@ -50,7 +50,7 @@ public class ToolReplicatorCard extends AEBaseItem
}
@Override
public boolean onItemUseFirst( ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
public boolean onItemUseFirst( final ItemStack stack, final EntityPlayer player, final World world, int x, int y, int z, final int side, final float hitX, final float hitY, final float hitZ )
{
if( Platform.isClient() )
{
@@ -61,7 +61,7 @@ public class ToolReplicatorCard extends AEBaseItem
{
if( world.getTileEntity( x, y, z ) instanceof IGridHost )
{
NBTTagCompound tag = new NBTTagCompound();
final NBTTagCompound tag = new NBTTagCompound();
tag.setInteger( "x", x );
tag.setInteger( "y", y );
tag.setInteger( "z", z );
@@ -76,49 +76,49 @@ public class ToolReplicatorCard extends AEBaseItem
}
else
{
NBTTagCompound ish = stack.getTagCompound();
final NBTTagCompound ish = stack.getTagCompound();
if( ish != null )
{
int src_x = ish.getInteger( "x" );
int src_y = ish.getInteger( "y" );
int src_z = ish.getInteger( "z" );
int src_side = ish.getInteger( "side" );
int dimid = ish.getInteger( "dimid" );
World src_w = DimensionManager.getWorld( dimid );
final int src_x = ish.getInteger( "x" );
final int src_y = ish.getInteger( "y" );
final int src_z = ish.getInteger( "z" );
final int src_side = ish.getInteger( "side" );
final int dimid = ish.getInteger( "dimid" );
final World src_w = DimensionManager.getWorld( dimid );
TileEntity te = src_w.getTileEntity( src_x, src_y, src_z );
final TileEntity te = src_w.getTileEntity( src_x, src_y, src_z );
if( te instanceof IGridHost )
{
IGridHost gh = (IGridHost) te;
ForgeDirection sideOff = ForgeDirection.getOrientation( src_side );
ForgeDirection currentSideOff = ForgeDirection.getOrientation( side );
IGridNode n = gh.getGridNode( sideOff );
final IGridHost gh = (IGridHost) te;
final ForgeDirection sideOff = ForgeDirection.getOrientation( src_side );
final ForgeDirection currentSideOff = ForgeDirection.getOrientation( side );
final IGridNode n = gh.getGridNode( sideOff );
if( n != null )
{
IGrid g = n.getGrid();
final IGrid g = n.getGrid();
if( g != null )
{
ISpatialCache sc = g.getCache( ISpatialCache.class );
final ISpatialCache sc = g.getCache( ISpatialCache.class );
if( sc.isValidRegion() )
{
DimensionalCoord min = sc.getMin();
DimensionalCoord max = sc.getMax();
final DimensionalCoord min = sc.getMin();
final DimensionalCoord max = sc.getMax();
x += currentSideOff.offsetX;
y += currentSideOff.offsetY;
z += currentSideOff.offsetZ;
int min_x = min.x;
int min_y = min.y;
int min_z = min.z;
final int min_x = min.x;
final int min_y = min.y;
final int min_z = min.z;
int rel_x = min.x - src_x + x;
int rel_y = min.y - src_y + y;
int rel_z = min.z - src_z + z;
final int rel_x = min.x - src_x + x;
final int rel_y = min.y - src_y + y;
final int rel_z = min.z - src_z + z;
int scale_x = max.x - min.x;
int scale_y = max.y - min.y;
int scale_z = max.z - min.z;
final int scale_x = max.x - min.x;
final int scale_y = max.y - min.y;
final int scale_z = max.z - min.z;
for( int i = 1; i < scale_x; i++ )
{
@@ -126,15 +126,15 @@ public class ToolReplicatorCard extends AEBaseItem
{
for( int k = 1; k < scale_z; k++ )
{
Block blk = src_w.getBlock( min_x + i, min_y + j, min_z + k );
int meta = src_w.getBlockMetadata( min_x + i, min_y + j, min_z + k );
final Block blk = src_w.getBlock( min_x + i, min_y + j, min_z + k );
final int meta = src_w.getBlockMetadata( min_x + i, min_y + j, min_z + k );
world.setBlock( i + rel_x, j + rel_y, k + rel_z, blk, meta, 4 );
if( blk != null && blk.hasTileEntity( meta ) )
{
TileEntity ote = src_w.getTileEntity( min_x + i, min_y + j, min_z + k );
TileEntity nte = blk.createTileEntity( world, meta );
NBTTagCompound data = new NBTTagCompound();
final TileEntity ote = src_w.getTileEntity( min_x + i, min_y + j, min_z + k );
final TileEntity nte = blk.createTileEntity( world, meta );
final NBTTagCompound data = new NBTTagCompound();
ote.writeToNBT( data );
nte.readFromNBT( (NBTTagCompound) data.copy() );
world.setTileEntity( i + rel_x, j + rel_y, k + rel_z, nte );
@@ -172,7 +172,7 @@ public class ToolReplicatorCard extends AEBaseItem
return true;
}
private void outputMsg( ICommandSender player, String string )
private void outputMsg( final ICommandSender player, final String string )
{
player.addChatMessage( new ChatComponentText( string ) );
}