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
+51 -51
View File
@@ -73,14 +73,14 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
private ForgeDirection forward = ForgeDirection.UNKNOWN;
private ForgeDirection up = ForgeDirection.UNKNOWN;
public static void registerTileItem( Class<? extends TileEntity> c, IStackSrc wat )
public static void registerTileItem( final Class<? extends TileEntity> c, final IStackSrc wat )
{
ITEM_STACKS.put( c, wat );
}
public boolean dropItems()
{
WeakReference<AEBaseTile> what = DROP_NO_ITEMS.get();
final WeakReference<AEBaseTile> what = DROP_NO_ITEMS.get();
return what == null || what.get() != this;
}
@@ -96,9 +96,9 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
@Nullable
protected ItemStack getItemFromTile( Object obj )
protected ItemStack getItemFromTile( final Object obj )
{
IStackSrc src = ITEM_STACKS.get( obj.getClass() );
final IStackSrc src = ITEM_STACKS.get( obj.getClass() );
if( src == null )
{
return null;
@@ -119,7 +119,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
@Override
// NOTE: WAS FINAL, changed for Immibis
public final void readFromNBT( NBTTagCompound data )
public final void readFromNBT( final NBTTagCompound data )
{
super.readFromNBT( data );
@@ -140,11 +140,11 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
this.up = ForgeDirection.valueOf( data.getString( "orientation_up" ) );
}
}
catch( IllegalArgumentException ignored )
catch( final IllegalArgumentException ignored )
{
}
for( AETileEventHandler h : this.getHandlerListFor( TileEventType.WORLD_NBT_READ ) )
for( final AETileEventHandler h : this.getHandlerListFor( TileEventType.WORLD_NBT_READ ) )
{
h.readFromNBT( this, data );
}
@@ -152,7 +152,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
@Override
// NOTE: WAS FINAL, changed for Immibis
public final void writeToNBT( NBTTagCompound data )
public final void writeToNBT( final NBTTagCompound data )
{
super.writeToNBT( data );
@@ -167,7 +167,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
data.setString( "customName", this.customName );
}
for( AETileEventHandler h : this.getHandlerListFor( TileEventType.WORLD_NBT_WRITE ) )
for( final AETileEventHandler h : this.getHandlerListFor( TileEventType.WORLD_NBT_WRITE ) )
{
h.writeToNBT( this, data );
}
@@ -176,7 +176,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
@Override
public final void updateEntity()
{
for( AETileEventHandler h : this.getHandlerListFor( TileEventType.TICK ) )
for( final AETileEventHandler h : this.getHandlerListFor( TileEventType.TICK ) )
{
h.tick( this );
}
@@ -185,9 +185,9 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
@Override
public Packet getDescriptionPacket()
{
NBTTagCompound data = new NBTTagCompound();
final NBTTagCompound data = new NBTTagCompound();
ByteBuf stream = Unpooled.buffer();
final ByteBuf stream = Unpooled.buffer();
try
{
@@ -197,7 +197,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
return null;
}
}
catch( Throwable t )
catch( final Throwable t )
{
AELog.error( t );
}
@@ -213,20 +213,20 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
return this.hasHandlerFor( TileEventType.TICK );
}
private boolean hasHandlerFor( TileEventType type )
private boolean hasHandlerFor( final TileEventType type )
{
List<AETileEventHandler> list = this.getHandlerListFor( type );
final List<AETileEventHandler> list = this.getHandlerListFor( type );
return !list.isEmpty();
}
@Override
public void onDataPacket( NetworkManager net, S35PacketUpdateTileEntity pkt )
public void onDataPacket( final NetworkManager net, final S35PacketUpdateTileEntity pkt )
{
// / pkt.actionType
if( pkt.func_148853_f() == 64 )
{
ByteBuf stream = Unpooled.copiedBuffer( pkt.func_148857_g().getByteArray( "X" ) );
final ByteBuf stream = Unpooled.copiedBuffer( pkt.func_148857_g().getByteArray( "X" ) );
if( this.readFromStream( stream ) )
{
this.markForUpdate();
@@ -243,7 +243,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
}
public final boolean readFromStream( ByteBuf data )
public final boolean readFromStream( final ByteBuf data )
{
boolean output = false;
@@ -252,10 +252,10 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
if( this.canBeRotated() )
{
ForgeDirection old_Forward = this.forward;
ForgeDirection old_Up = this.up;
final ForgeDirection old_Forward = this.forward;
final ForgeDirection old_Up = this.up;
byte orientation = data.readByte();
final byte orientation = data.readByte();
this.forward = ForgeDirection.getOrientation( orientation & 0x7 );
this.up = ForgeDirection.getOrientation( orientation >> 3 );
@@ -263,7 +263,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
this.renderFragment = 100;
for( AETileEventHandler h : this.getHandlerListFor( TileEventType.NETWORK_READ ) )
for( final AETileEventHandler h : this.getHandlerListFor( TileEventType.NETWORK_READ ) )
{
if( h.readFromStream( this, data ) )
{
@@ -277,7 +277,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
this.renderFragment = 0;
}
catch( Throwable t )
catch( final Throwable t )
{
AELog.error( t );
}
@@ -302,22 +302,22 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
}
public final void writeToStream( ByteBuf data )
public final void writeToStream( final ByteBuf data )
{
try
{
if( this.canBeRotated() )
{
byte orientation = (byte) ( ( this.up.ordinal() << 3 ) | this.forward.ordinal() );
final byte orientation = (byte) ( ( this.up.ordinal() << 3 ) | this.forward.ordinal() );
data.writeByte( orientation );
}
for( AETileEventHandler h : this.getHandlerListFor( TileEventType.NETWORK_WRITE ) )
for( final AETileEventHandler h : this.getHandlerListFor( TileEventType.NETWORK_WRITE ) )
{
h.writeToStream( this, data );
}
}
catch( Throwable t )
catch( final Throwable t )
{
AELog.error( t );
}
@@ -335,7 +335,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
@Nonnull
private List<AETileEventHandler> getHandlerListFor( TileEventType type )
private List<AETileEventHandler> getHandlerListFor( final TileEventType type )
{
final Map<TileEventType, List<AETileEventHandler>> eventToHandlers = this.getEventToHandlers();
final List<AETileEventHandler> handlers = this.getHandlers( eventToHandlers, type );
@@ -355,9 +355,9 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
HANDLERS.put( clazz, newStoredHandlers );
for( Method method : clazz.getMethods() )
for( final Method method : clazz.getMethods() )
{
TileEvent event = method.getAnnotation( TileEvent.class );
final TileEvent event = method.getAnnotation( TileEvent.class );
if( event != null )
{
this.addHandler( newStoredHandlers, event.value(), method );
@@ -373,7 +373,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
@Nonnull
private List<AETileEventHandler> getHandlers( Map<TileEventType, List<AETileEventHandler>> eventToHandlers, TileEventType event )
private List<AETileEventHandler> getHandlers( final Map<TileEventType, List<AETileEventHandler>> eventToHandlers, final TileEventType event )
{
final List<AETileEventHandler> oldHandlers = eventToHandlers.get( event );
@@ -390,7 +390,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
}
private void addHandler( Map<TileEventType, List<AETileEventHandler>> handlerSet, TileEventType value, Method m )
private void addHandler( final Map<TileEventType, List<AETileEventHandler>> handlerSet, final TileEventType value, final Method m )
{
List<AETileEventHandler> list = handlerSet.get( value );
@@ -416,7 +416,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
@Override
public void setOrientation( ForgeDirection inForward, ForgeDirection inUp )
public void setOrientation( final ForgeDirection inForward, final ForgeDirection inUp )
{
this.forward = inForward;
this.up = inUp;
@@ -424,7 +424,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
Platform.notifyBlocksOfNeighbors( this.worldObj, this.xCoord, this.yCoord, this.zCoord );
}
public void onPlacement( ItemStack stack, EntityPlayer player, int side )
public void onPlacement( final ItemStack stack, final EntityPlayer player, final int side )
{
if( stack.hasTagCompound() )
{
@@ -438,11 +438,11 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
* @param from source of settings
* @param compound compound of source
*/
public void uploadSettings( SettingsFrom from, NBTTagCompound compound )
public void uploadSettings( final SettingsFrom from, final NBTTagCompound compound )
{
if( compound != null && this instanceof IConfigurableObject )
{
IConfigManager cm = ( (IConfigurableObject) this ).getConfigManager();
final IConfigManager cm = ( (IConfigurableObject) this ).getConfigManager();
if( cm != null )
{
cm.readFromNBT( compound );
@@ -451,17 +451,17 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
if( this instanceof IPriorityHost )
{
IPriorityHost pHost = (IPriorityHost) this;
final IPriorityHost pHost = (IPriorityHost) this;
pHost.setPriority( compound.getInteger( "priority" ) );
}
if( this instanceof ISegmentedInventory )
{
IInventory inv = ( (ISegmentedInventory) this ).getInventoryByName( "config" );
final IInventory inv = ( (ISegmentedInventory) this ).getInventoryByName( "config" );
if( inv instanceof AppEngInternalAEInventory )
{
AppEngInternalAEInventory target = (AppEngInternalAEInventory) inv;
AppEngInternalAEInventory tmp = new AppEngInternalAEInventory( null, target.getSizeInventory() );
final AppEngInternalAEInventory target = (AppEngInternalAEInventory) inv;
final AppEngInternalAEInventory tmp = new AppEngInternalAEInventory( null, target.getSizeInventory() );
tmp.readFromNBT( compound, "config" );
for( int x = 0; x < tmp.getSizeInventory(); x++ )
{
@@ -481,15 +481,15 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
* @param drops drops of tile entity
*/
@Override
public void getDrops( World w, int x, int y, int z, List<ItemStack> drops )
public void getDrops( final World w, final int x, final int y, final int z, final List<ItemStack> drops )
{
if( this instanceof IInventory )
{
IInventory inv = (IInventory) this;
final IInventory inv = (IInventory) this;
for( int l = 0; l < inv.getSizeInventory(); l++ )
{
ItemStack is = inv.getStackInSlot( l );
final ItemStack is = inv.getStackInSlot( l );
if( is != null )
{
drops.add( is );
@@ -498,7 +498,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
}
}
public void getNoDrops( World w, int x, int y, int z, List<ItemStack> drops )
public void getNoDrops( final World w, final int x, final int y, final int z, final List<ItemStack> drops )
{
}
@@ -515,20 +515,20 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
*
* @return compound of source
*/
public NBTTagCompound downloadSettings( SettingsFrom from )
public NBTTagCompound downloadSettings( final SettingsFrom from )
{
NBTTagCompound output = new NBTTagCompound();
final NBTTagCompound output = new NBTTagCompound();
if( this.hasCustomName() )
{
NBTTagCompound dsp = new NBTTagCompound();
final NBTTagCompound dsp = new NBTTagCompound();
dsp.setString( "Name", this.getCustomName() );
output.setTag( "display", dsp );
}
if( this instanceof IConfigurableObject )
{
IConfigManager cm = ( (IConfigurableObject) this ).getConfigManager();
final IConfigManager cm = ( (IConfigurableObject) this ).getConfigManager();
if( cm != null )
{
cm.writeToNBT( output );
@@ -537,13 +537,13 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
if( this instanceof IPriorityHost )
{
IPriorityHost pHost = (IPriorityHost) this;
final IPriorityHost pHost = (IPriorityHost) this;
output.setInteger( "priority", pHost.getPriority() );
}
if( this instanceof ISegmentedInventory )
{
IInventory inv = ( (ISegmentedInventory) this ).getInventoryByName( "config" );
final IInventory inv = ( (ISegmentedInventory) this ).getInventoryByName( "config" );
if( inv instanceof AppEngInternalAEInventory )
{
( (AppEngInternalAEInventory) inv ).writeToNBT( output, "config" );
@@ -586,7 +586,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
return false;
}
public void setName( String name )
public void setName( final String name )
{
this.customName = name;
}