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
+2 -2
View File
@@ -29,7 +29,7 @@ public class BlockUpdate implements IWorldCallable<Boolean>
final int y;
final int z;
public BlockUpdate( int x, int y, int z )
public BlockUpdate( final int x, final int y, final int z )
{
this.x = x;
this.y = y;
@@ -37,7 +37,7 @@ public class BlockUpdate implements IWorldCallable<Boolean>
}
@Override
public Boolean call( World world ) throws Exception
public Boolean call( final World world ) throws Exception
{
if( world.blockExists( this.x, this.y, this.z ) )
{
@@ -32,7 +32,7 @@ public class ClassInstantiation<T>
private final Class<? extends T> template;
private final Object[] args;
public ClassInstantiation( Class<? extends T> template, Object... args )
public ClassInstantiation( final Class<? extends T> template, final Object... args )
{
this.template = template;
this.args = args;
@@ -41,18 +41,18 @@ public class ClassInstantiation<T>
public Optional<T> get()
{
@SuppressWarnings( "unchecked" )
Constructor<T>[] constructors = (Constructor<T>[]) this.template.getConstructors();
final Constructor<T>[] constructors = (Constructor<T>[]) this.template.getConstructors();
for( Constructor<T> constructor : constructors )
for( final Constructor<T> constructor : constructors )
{
Class<?>[] paramTypes = constructor.getParameterTypes();
final Class<?>[] paramTypes = constructor.getParameterTypes();
if( paramTypes.length == this.args.length )
{
boolean valid = true;
for( int idx = 0; idx < paramTypes.length; idx++ )
{
Class<?> cz = this.args[idx].getClass();
final Class<?> cz = this.args[idx].getClass();
if( !this.isClassMatch( paramTypes[idx], cz, this.args[idx] ) )
{
valid = false;
@@ -65,15 +65,15 @@ public class ClassInstantiation<T>
{
return Optional.of( constructor.newInstance( this.args ) );
}
catch( InstantiationException e )
catch( final InstantiationException e )
{
e.printStackTrace();
}
catch( IllegalAccessException e )
catch( final IllegalAccessException e )
{
e.printStackTrace();
}
catch( InvocationTargetException e )
catch( final InvocationTargetException e )
{
e.printStackTrace();
}
@@ -85,7 +85,7 @@ public class ClassInstantiation<T>
return Optional.absent();
}
private boolean isClassMatch( Class<?> expected, Class<?> got, Object value )
private boolean isClassMatch( Class<?> expected, Class<?> got, final Object value )
{
if( value == null && !expected.isPrimitive() )
{
@@ -98,11 +98,11 @@ public class ClassInstantiation<T>
return expected == got || expected.isAssignableFrom( got );
}
private Class<?> condense( Class<?> expected, Class<?>... wrappers )
private Class<?> condense( final Class<?> expected, final Class<?>... wrappers )
{
if( expected.isPrimitive() )
{
for( Class clz : wrappers )
for( final Class clz : wrappers )
{
try
{
@@ -111,7 +111,7 @@ public class ClassInstantiation<T>
return clz;
}
}
catch( Throwable t )
catch( final Throwable t )
{
AELog.error( t );
}
+13 -13
View File
@@ -37,7 +37,7 @@ public final class ConfigManager implements IConfigManager
private final Map<Settings, Enum<?>> settings = new EnumMap<Settings, Enum<?>>( Settings.class );
private final IConfigManagerHost target;
public ConfigManager( IConfigManagerHost tile )
public ConfigManager( final IConfigManagerHost tile )
{
this.target = tile;
}
@@ -49,15 +49,15 @@ public final class ConfigManager implements IConfigManager
}
@Override
public void registerSetting( Settings settingName, Enum defaultValue )
public void registerSetting( final Settings settingName, final Enum defaultValue )
{
this.settings.put( settingName, defaultValue );
}
@Override
public Enum<?> getSetting( Settings settingName )
public Enum<?> getSetting( final Settings settingName )
{
Enum<?> oldValue = this.settings.get( settingName );
final Enum<?> oldValue = this.settings.get( settingName );
if( oldValue != null )
{
@@ -68,9 +68,9 @@ public final class ConfigManager implements IConfigManager
}
@Override
public Enum<?> putSetting( Settings settingName, Enum newValue )
public Enum<?> putSetting( final Settings settingName, final Enum newValue )
{
Enum<?> oldValue = this.getSetting( settingName );
final Enum<?> oldValue = this.getSetting( settingName );
this.settings.put( settingName, newValue );
this.target.updateSetting( this, settingName, newValue );
return oldValue;
@@ -82,9 +82,9 @@ public final class ConfigManager implements IConfigManager
* @param tagCompound to be written to compound
*/
@Override
public void writeToNBT( NBTTagCompound tagCompound )
public void writeToNBT( final NBTTagCompound tagCompound )
{
for( Map.Entry<Settings, Enum<?>> entry : this.settings.entrySet() )
for( final Map.Entry<Settings, Enum<?>> entry : this.settings.entrySet() )
{
tagCompound.setString( entry.getKey().name(), this.settings.get( entry.getKey() ).toString() );
}
@@ -96,9 +96,9 @@ public final class ConfigManager implements IConfigManager
* @param tagCompound to be read from compound
*/
@Override
public void readFromNBT( NBTTagCompound tagCompound )
public void readFromNBT( final NBTTagCompound tagCompound )
{
for( Map.Entry<Settings, Enum<?>> entry : this.settings.entrySet() )
for( final Map.Entry<Settings, Enum<?>> entry : this.settings.entrySet() )
{
try
{
@@ -116,14 +116,14 @@ public final class ConfigManager implements IConfigManager
value = LevelEmitterMode.STORABLE_AMOUNT.toString();
}
Enum<?> oldValue = this.settings.get( entry.getKey() );
final Enum<?> oldValue = this.settings.get( entry.getKey() );
Enum<?> newValue = Enum.valueOf( oldValue.getClass(), value );
final Enum<?> newValue = Enum.valueOf( oldValue.getClass(), value );
this.putSetting( entry.getKey(), newValue );
}
}
catch( IllegalArgumentException e )
catch( final IllegalArgumentException e )
{
AELog.error( e );
}
@@ -39,28 +39,28 @@ public class InWorldToolOperationResult
this.Drops = null;
}
public InWorldToolOperationResult( ItemStack block, List<ItemStack> drops )
public InWorldToolOperationResult( final ItemStack block, final List<ItemStack> drops )
{
this.BlockItem = block;
this.Drops = drops;
}
public InWorldToolOperationResult( ItemStack block )
public InWorldToolOperationResult( final ItemStack block )
{
this.BlockItem = block;
this.Drops = null;
}
public static InWorldToolOperationResult getBlockOperationResult( ItemStack[] items )
public static InWorldToolOperationResult getBlockOperationResult( final ItemStack[] items )
{
List<ItemStack> temp = new ArrayList<ItemStack>();
final List<ItemStack> temp = new ArrayList<ItemStack>();
ItemStack b = null;
for( ItemStack l : items )
for( final ItemStack l : items )
{
if( b == null )
{
Block bl = Block.getBlockFromItem( l.getItem() );
final Block bl = Block.getBlockFromItem( l.getItem() );
if( bl != null && !( bl instanceof BlockAir ) )
{
@@ -44,14 +44,14 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
{
// returns an appropriate adaptor, or null
public static InventoryAdaptor getAdaptor( Object te, ForgeDirection d )
public static InventoryAdaptor getAdaptor( final Object te, final ForgeDirection d )
{
if( te == null )
{
return null;
}
IBetterStorage bs = (IBetterStorage) ( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BetterStorage ) ? IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BetterStorage ) : null );
final IBetterStorage bs = (IBetterStorage) ( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BetterStorage ) ? IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BetterStorage ) : null );
if( te instanceof EntityPlayer )
{
@@ -74,8 +74,8 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
}
else if( te instanceof ISidedInventory )
{
ISidedInventory si = (ISidedInventory) te;
int[] slots = si.getAccessibleSlotsFromSide( d.ordinal() );
final ISidedInventory si = (ISidedInventory) te;
final int[] slots = si.getAccessibleSlotsFromSide( d.ordinal() );
if( si.getSizeInventory() > 0 && slots != null && slots.length > 0 )
{
return new AdaptorIInventory( new WrapperMCISidedInventory( si, d ) );
@@ -83,7 +83,7 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
}
else if( te instanceof IInventory )
{
IInventory i = (IInventory) te;
final IInventory i = (IInventory) te;
if( i.getSizeInventory() > 0 )
{
return new AdaptorIInventory( i );
+11 -11
View File
@@ -37,7 +37,7 @@ public class ItemSorters
{
@Override
public int compare( IAEItemStack o1, IAEItemStack o2 )
public int compare( final IAEItemStack o1, final IAEItemStack o2 )
{
if( Direction == SortDir.ASCENDING )
{
@@ -50,10 +50,10 @@ public class ItemSorters
{
@Override
public int compare( IAEItemStack o1, IAEItemStack o2 )
public int compare( final IAEItemStack o1, final IAEItemStack o2 )
{
AEItemStack op1 = (AEItemStack) o1;
AEItemStack op2 = (AEItemStack) o2;
final AEItemStack op1 = (AEItemStack) o1;
final AEItemStack op2 = (AEItemStack) o2;
if( Direction == SortDir.ASCENDING )
{
@@ -62,7 +62,7 @@ public class ItemSorters
return this.secondarySort( op1.getModID().compareToIgnoreCase( op2.getModID() ), o2, o1 );
}
private int secondarySort( int compareToIgnoreCase, IAEItemStack o1, IAEItemStack o2 )
private int secondarySort( final int compareToIgnoreCase, final IAEItemStack o1, final IAEItemStack o2 )
{
if( compareToIgnoreCase == 0 )
{
@@ -76,7 +76,7 @@ public class ItemSorters
{
@Override
public int compare( IAEItemStack o1, IAEItemStack o2 )
public int compare( final IAEItemStack o1, final IAEItemStack o2 )
{
if( Direction == SortDir.ASCENDING )
{
@@ -90,14 +90,14 @@ public class ItemSorters
{
@Override
public int compare( IAEItemStack o1, IAEItemStack o2 )
public int compare( final IAEItemStack o1, final IAEItemStack o2 )
{
if( api == null )
{
return CONFIG_BASED_SORT_BY_NAME.compare( o1, o2 );
}
int cmp = api.compareItems( o1.getItemStack(), o2.getItemStack() );
final int cmp = api.compareItems( o1.getItemStack(), o2.getItemStack() );
if( Direction == SortDir.ASCENDING )
{
@@ -124,7 +124,7 @@ public class ItemSorters
}
}
public static int compareInt( int a, int b )
public static int compareInt( final int a, final int b )
{
if( a == b )
{
@@ -137,7 +137,7 @@ public class ItemSorters
return 1;
}
public static int compareLong( long a, long b )
public static int compareLong( final long a, final long b )
{
if( a == b )
{
@@ -150,7 +150,7 @@ public class ItemSorters
return 1;
}
public static int compareDouble( double a, double b )
public static int compareDouble( final double a, final double b )
{
if( a == b )
{
+1 -1
View File
@@ -28,7 +28,7 @@ public class LookDirection
public final Vec3 a;
public final Vec3 b;
public LookDirection( Vec3 a, Vec3 b )
public LookDirection( final Vec3 a, final Vec3 b )
{
this.a = a;
this.b = b;
File diff suppressed because it is too large Load Diff
@@ -30,7 +30,7 @@ public class ReadOnlyCollection<T> implements IReadOnlyCollection<T>
private final Collection<T> c;
public ReadOnlyCollection( Collection<T> in )
public ReadOnlyCollection( final Collection<T> in )
{
this.c = in;
}
@@ -54,7 +54,7 @@ public class ReadOnlyCollection<T> implements IReadOnlyCollection<T>
}
@Override
public boolean contains( Object node )
public boolean contains( final Object node )
{
return this.c.contains( node );
}
@@ -46,7 +46,7 @@ public enum ReadableNumberConverter implements ISlimReadableNumberConverter, IWi
}
@Override
public String toSlimReadableForm( long number )
public String toSlimReadableForm( final long number )
{
return this.toReadableFormRestrictedByWidth( number, 3 );
}
@@ -59,7 +59,7 @@ public enum ReadableNumberConverter implements ISlimReadableNumberConverter, IWi
*
* @return formatted number restricted by the width limitation
*/
private String toReadableFormRestrictedByWidth( long number, int width )
private String toReadableFormRestrictedByWidth( final long number, final int width )
{
assert number >= 0;
+1 -1
View File
@@ -44,7 +44,7 @@ public final class UUIDMatcher
*
* @return true, if the potential {@link java.util.UUID} is indeed an {@link java.util.UUID}
*/
public boolean isUUID( CharSequence potential )
public boolean isUUID( final CharSequence potential )
{
return PATTERN.matcher( potential ).matches();
}
@@ -39,7 +39,7 @@ public class AdaptorBCPipe extends InventoryAdaptor
private final TileEntity i;
private final ForgeDirection d;
public AdaptorBCPipe( TileEntity s, ForgeDirection dd )
public AdaptorBCPipe( final TileEntity s, final ForgeDirection dd )
{
this.buildCraft = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
@@ -56,31 +56,31 @@ public class AdaptorBCPipe extends InventoryAdaptor
}
@Override
public ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination )
public ItemStack removeItems( final int amount, final ItemStack filter, final IInventoryDestination destination )
{
return null;
}
@Override
public ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination )
public ItemStack simulateRemove( final int amount, final ItemStack filter, final IInventoryDestination destination )
{
return null;
}
@Override
public ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
public ItemStack removeSimilarItems( final int amount, final ItemStack filter, final FuzzyMode fuzzyMode, final IInventoryDestination destination )
{
return null;
}
@Override
public ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
public ItemStack simulateSimilarRemove( final int amount, final ItemStack filter, final FuzzyMode fuzzyMode, final IInventoryDestination destination )
{
return null;
}
@Override
public ItemStack addItems( ItemStack toBeAdded )
public ItemStack addItems( final ItemStack toBeAdded )
{
if( this.i == null )
{
@@ -103,7 +103,7 @@ public class AdaptorBCPipe extends InventoryAdaptor
}
@Override
public ItemStack simulateAdd( ItemStack toBeSimulated )
public ItemStack simulateAdd( final ItemStack toBeSimulated )
{
if( this.i == null )
{
@@ -35,21 +35,21 @@ public class AdaptorIInventory extends InventoryAdaptor
private final IInventory i;
private final boolean wrapperEnabled;
public AdaptorIInventory( IInventory s )
public AdaptorIInventory( final IInventory s )
{
this.i = s;
this.wrapperEnabled = s instanceof IInventoryWrapper;
}
@Override
public ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination )
public ItemStack removeItems( int amount, ItemStack filter, final IInventoryDestination destination )
{
int s = this.i.getSizeInventory();
final int s = this.i.getSizeInventory();
ItemStack rv = null;
for( int x = 0; x < s && amount > 0; x++ )
{
ItemStack is = this.i.getStackInSlot( x );
final ItemStack is = this.i.getStackInSlot( x );
if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.isSameItemPrecise( is, filter ) ) )
{
int boundAmounts = amount;
@@ -84,7 +84,7 @@ public class AdaptorIInventory extends InventoryAdaptor
}
else
{
ItemStack po = is.copy();
final ItemStack po = is.copy();
po.stackSize -= boundAmounts;
this.i.setInventorySlotContents( x, po );
this.i.markDirty();
@@ -100,14 +100,14 @@ public class AdaptorIInventory extends InventoryAdaptor
}
@Override
public ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination )
public ItemStack simulateRemove( int amount, final ItemStack filter, final IInventoryDestination destination )
{
int s = this.i.getSizeInventory();
final int s = this.i.getSizeInventory();
ItemStack rv = null;
for( int x = 0; x < s && amount > 0; x++ )
{
ItemStack is = this.i.getStackInSlot( x );
final ItemStack is = this.i.getStackInSlot( x );
if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.isSameItemPrecise( is, filter ) ) )
{
int boundAmount = amount;
@@ -141,12 +141,12 @@ public class AdaptorIInventory extends InventoryAdaptor
}
@Override
public ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
public ItemStack removeSimilarItems( final int amount, final ItemStack filter, final FuzzyMode fuzzyMode, final IInventoryDestination destination )
{
int s = this.i.getSizeInventory();
final int s = this.i.getSizeInventory();
for( int x = 0; x < s; x++ )
{
ItemStack is = this.i.getStackInSlot( x );
final ItemStack is = this.i.getStackInSlot( x );
if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.isSameItemFuzzy( is, filter, fuzzyMode ) ) )
{
int newAmount = amount;
@@ -172,7 +172,7 @@ public class AdaptorIInventory extends InventoryAdaptor
}
else
{
ItemStack po = is.copy();
final ItemStack po = is.copy();
po.stackSize -= rv.stackSize;
this.i.setInventorySlotContents( x, po );
this.i.markDirty();
@@ -190,12 +190,12 @@ public class AdaptorIInventory extends InventoryAdaptor
}
@Override
public ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
public ItemStack simulateSimilarRemove( final int amount, final ItemStack filter, final FuzzyMode fuzzyMode, final IInventoryDestination destination )
{
int s = this.i.getSizeInventory();
final int s = this.i.getSizeInventory();
for( int x = 0; x < s; x++ )
{
ItemStack is = this.i.getStackInSlot( x );
final ItemStack is = this.i.getStackInSlot( x );
if( is != null && this.canRemoveStackFromSlot( x, is ) && ( filter == null || Platform.isSameItemFuzzy( is, filter, fuzzyMode ) ) )
{
@@ -211,7 +211,7 @@ public class AdaptorIInventory extends InventoryAdaptor
if( boundAmount > 0 )
{
ItemStack rv = is.copy();
final ItemStack rv = is.copy();
rv.stackSize = boundAmount;
return rv;
}
@@ -221,13 +221,13 @@ public class AdaptorIInventory extends InventoryAdaptor
}
@Override
public ItemStack addItems( ItemStack toBeAdded )
public ItemStack addItems( final ItemStack toBeAdded )
{
return this.addItems( toBeAdded, true );
}
@Override
public ItemStack simulateAdd( ItemStack toBeSimulated )
public ItemStack simulateAdd( final ItemStack toBeSimulated )
{
return this.addItems( toBeSimulated, false );
}
@@ -235,7 +235,7 @@ public class AdaptorIInventory extends InventoryAdaptor
@Override
public boolean containsItems()
{
int s = this.i.getSizeInventory();
final int s = this.i.getSizeInventory();
for( int x = 0; x < s; x++ )
{
if( this.i.getStackInSlot( x ) != null )
@@ -258,26 +258,26 @@ public class AdaptorIInventory extends InventoryAdaptor
*
* @return the left itemstack, which could not be added
*/
private ItemStack addItems( ItemStack itemsToAdd, boolean modulate )
private ItemStack addItems( final ItemStack itemsToAdd, final boolean modulate )
{
if( itemsToAdd == null || itemsToAdd.stackSize == 0 )
{
return null;
}
ItemStack left = itemsToAdd.copy();
int stackLimit = itemsToAdd.getMaxStackSize();
int perOperationLimit = Math.min( this.i.getInventoryStackLimit(), stackLimit );
int inventorySize = this.i.getSizeInventory();
final ItemStack left = itemsToAdd.copy();
final int stackLimit = itemsToAdd.getMaxStackSize();
final int perOperationLimit = Math.min( this.i.getInventoryStackLimit(), stackLimit );
final int inventorySize = this.i.getSizeInventory();
for( int slot = 0; slot < inventorySize; slot++ )
{
ItemStack next = left.copy();
final ItemStack next = left.copy();
next.stackSize = Math.min( perOperationLimit, next.stackSize );
if( this.i.isItemValidForSlot( slot, next ) )
{
ItemStack is = this.i.getStackInSlot( slot );
final ItemStack is = this.i.getStackInSlot( slot );
if( is == null )
{
left.stackSize -= next.stackSize;
@@ -295,8 +295,8 @@ public class AdaptorIInventory extends InventoryAdaptor
}
else if( Platform.isSameItemPrecise( is, left ) && is.stackSize < perOperationLimit )
{
int room = perOperationLimit - is.stackSize;
int used = Math.min( left.stackSize, room );
final int room = perOperationLimit - is.stackSize;
final int used = Math.min( left.stackSize, room );
if( modulate )
{
@@ -317,7 +317,7 @@ public class AdaptorIInventory extends InventoryAdaptor
return left;
}
boolean canRemoveStackFromSlot( int x, ItemStack is )
boolean canRemoveStackFromSlot( final int x, final ItemStack is )
{
if( this.wrapperEnabled )
{
@@ -347,7 +347,7 @@ public class AdaptorIInventory extends InventoryAdaptor
@Override
public ItemSlot next()
{
ItemStack iss = AdaptorIInventory.this.i.getStackInSlot( this.x );
final ItemStack iss = AdaptorIInventory.this.i.getStackInSlot( this.x );
this.is.isExtractable = AdaptorIInventory.this.canRemoveStackFromSlot( this.x, iss );
this.is.setItemStack( iss );
+20 -20
View File
@@ -35,18 +35,18 @@ public class AdaptorList extends InventoryAdaptor
private final List<ItemStack> i;
public AdaptorList( List<ItemStack> s )
public AdaptorList( final List<ItemStack> s )
{
this.i = s;
}
@Override
public ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination )
public ItemStack removeItems( int amount, final ItemStack filter, final IInventoryDestination destination )
{
int s = this.i.size();
final int s = this.i.size();
for( int x = 0; x < s; x++ )
{
ItemStack is = this.i.get( x );
final ItemStack is = this.i.get( x );
if( is != null && ( filter == null || Platform.isSameItemPrecise( is, filter ) ) )
{
if( amount > is.stackSize )
@@ -60,7 +60,7 @@ public class AdaptorList extends InventoryAdaptor
if( amount > 0 )
{
ItemStack rv = is.copy();
final ItemStack rv = is.copy();
rv.stackSize = amount;
is.stackSize -= amount;
@@ -78,9 +78,9 @@ public class AdaptorList extends InventoryAdaptor
}
@Override
public ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination )
public ItemStack simulateRemove( int amount, final ItemStack filter, final IInventoryDestination destination )
{
for( ItemStack is : this.i )
for( final ItemStack is : this.i )
{
if( is != null && ( filter == null || Platform.isSameItemPrecise( is, filter ) ) )
{
@@ -95,7 +95,7 @@ public class AdaptorList extends InventoryAdaptor
if( amount > 0 )
{
ItemStack rv = is.copy();
final ItemStack rv = is.copy();
rv.stackSize = amount;
return rv;
}
@@ -105,12 +105,12 @@ public class AdaptorList extends InventoryAdaptor
}
@Override
public ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
public ItemStack removeSimilarItems( int amount, final ItemStack filter, final FuzzyMode fuzzyMode, final IInventoryDestination destination )
{
int s = this.i.size();
final int s = this.i.size();
for( int x = 0; x < s; x++ )
{
ItemStack is = this.i.get( x );
final ItemStack is = this.i.get( x );
if( is != null && ( filter == null || Platform.isSameItemFuzzy( is, filter, fuzzyMode ) ) )
{
if( amount > is.stackSize )
@@ -124,7 +124,7 @@ public class AdaptorList extends InventoryAdaptor
if( amount > 0 )
{
ItemStack rv = is.copy();
final ItemStack rv = is.copy();
rv.stackSize = amount;
is.stackSize -= amount;
@@ -142,9 +142,9 @@ public class AdaptorList extends InventoryAdaptor
}
@Override
public ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
public ItemStack simulateSimilarRemove( int amount, final ItemStack filter, final FuzzyMode fuzzyMode, final IInventoryDestination destination )
{
for( ItemStack is : this.i )
for( final ItemStack is : this.i )
{
if( is != null && ( filter == null || Platform.isSameItemFuzzy( is, filter, fuzzyMode ) ) )
{
@@ -159,7 +159,7 @@ public class AdaptorList extends InventoryAdaptor
if( amount > 0 )
{
ItemStack rv = is.copy();
final ItemStack rv = is.copy();
rv.stackSize = amount;
return rv;
}
@@ -169,7 +169,7 @@ public class AdaptorList extends InventoryAdaptor
}
@Override
public ItemStack addItems( ItemStack toBeAdded )
public ItemStack addItems( final ItemStack toBeAdded )
{
if( toBeAdded == null )
{
@@ -180,9 +180,9 @@ public class AdaptorList extends InventoryAdaptor
return null;
}
ItemStack left = toBeAdded.copy();
final ItemStack left = toBeAdded.copy();
for( ItemStack is : this.i )
for( final ItemStack is : this.i )
{
if( Platform.isSameItem( is, left ) )
{
@@ -196,7 +196,7 @@ public class AdaptorList extends InventoryAdaptor
}
@Override
public ItemStack simulateAdd( ItemStack toBeSimulated )
public ItemStack simulateAdd( final ItemStack toBeSimulated )
{
return null;
}
@@ -204,7 +204,7 @@ public class AdaptorList extends InventoryAdaptor
@Override
public boolean containsItems()
{
for( ItemStack is : this.i )
for( final ItemStack is : this.i )
{
if( is != null )
{
@@ -38,15 +38,15 @@ public class AdaptorPlayerHand extends InventoryAdaptor
private final EntityPlayer player;
public AdaptorPlayerHand( EntityPlayer player )
public AdaptorPlayerHand( final EntityPlayer player )
{
this.player = player;
}
@Override
public ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination )
public ItemStack removeItems( final int amount, final ItemStack filter, final IInventoryDestination destination )
{
ItemStack hand = this.player.inventory.getItemStack();
final ItemStack hand = this.player.inventory.getItemStack();
if( hand == null )
{
return null;
@@ -54,7 +54,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
if( filter == null || Platform.isSameItemPrecise( filter, hand ) )
{
ItemStack result = hand.copy();
final ItemStack result = hand.copy();
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
hand.stackSize -= amount;
if( hand.stackSize <= 0 )
@@ -68,10 +68,10 @@ public class AdaptorPlayerHand extends InventoryAdaptor
}
@Override
public ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination )
public ItemStack simulateRemove( final int amount, final ItemStack filter, final IInventoryDestination destination )
{
ItemStack hand = this.player.inventory.getItemStack();
final ItemStack hand = this.player.inventory.getItemStack();
if( hand == null )
{
return null;
@@ -79,7 +79,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
if( filter == null || Platform.isSameItemPrecise( filter, hand ) )
{
ItemStack result = hand.copy();
final ItemStack result = hand.copy();
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
return result;
}
@@ -88,9 +88,9 @@ public class AdaptorPlayerHand extends InventoryAdaptor
}
@Override
public ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
public ItemStack removeSimilarItems( final int amount, final ItemStack filter, final FuzzyMode fuzzyMode, final IInventoryDestination destination )
{
ItemStack hand = this.player.inventory.getItemStack();
final ItemStack hand = this.player.inventory.getItemStack();
if( hand == null )
{
return null;
@@ -98,7 +98,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
if( filter == null || Platform.isSameItemFuzzy( filter, hand, fuzzyMode ) )
{
ItemStack result = hand.copy();
final ItemStack result = hand.copy();
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
hand.stackSize -= amount;
if( hand.stackSize <= 0 )
@@ -112,10 +112,10 @@ public class AdaptorPlayerHand extends InventoryAdaptor
}
@Override
public ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
public ItemStack simulateSimilarRemove( final int amount, final ItemStack filter, final FuzzyMode fuzzyMode, final IInventoryDestination destination )
{
ItemStack hand = this.player.inventory.getItemStack();
final ItemStack hand = this.player.inventory.getItemStack();
if( hand == null )
{
return null;
@@ -123,7 +123,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
if( filter == null || Platform.isSameItemFuzzy( filter, hand, fuzzyMode ) )
{
ItemStack result = hand.copy();
final ItemStack result = hand.copy();
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
return result;
}
@@ -132,7 +132,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
}
@Override
public ItemStack addItems( ItemStack toBeAdded )
public ItemStack addItems( final ItemStack toBeAdded )
{
if( toBeAdded == null )
@@ -152,7 +152,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
return toBeAdded;
}
ItemStack hand = this.player.inventory.getItemStack();
final ItemStack hand = this.player.inventory.getItemStack();
if( hand != null && !Platform.isSameItemPrecise( toBeAdded, hand ) )
{
@@ -175,7 +175,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
if( newHand.stackSize > newHand.getMaxStackSize() )
{
newHand.stackSize = newHand.getMaxStackSize();
ItemStack B = toBeAdded.copy();
final ItemStack B = toBeAdded.copy();
B.stackSize -= newHand.stackSize - original;
this.player.inventory.setItemStack( newHand );
return B;
@@ -186,9 +186,9 @@ public class AdaptorPlayerHand extends InventoryAdaptor
}
@Override
public ItemStack simulateAdd( ItemStack toBeSimulated )
public ItemStack simulateAdd( final ItemStack toBeSimulated )
{
ItemStack hand = this.player.inventory.getItemStack();
final ItemStack hand = this.player.inventory.getItemStack();
if( toBeSimulated == null )
{
return null;
@@ -215,7 +215,7 @@ public class AdaptorPlayerHand extends InventoryAdaptor
if( newHand.stackSize > newHand.getMaxStackSize() )
{
newHand.stackSize = newHand.getMaxStackSize();
ItemStack B = toBeSimulated.copy();
final ItemStack B = toBeSimulated.copy();
B.stackSize -= newHand.stackSize - original;
return B;
}
@@ -31,7 +31,7 @@ public class AdaptorPlayerInventory implements IInventory
private final int min = 0;
private final int size = 36;
public AdaptorPlayerInventory( IInventory playerInv, boolean swap )
public AdaptorPlayerInventory( final IInventory playerInv, final boolean swap )
{
if( swap )
@@ -51,25 +51,25 @@ public class AdaptorPlayerInventory implements IInventory
}
@Override
public ItemStack getStackInSlot( int var1 )
public ItemStack getStackInSlot( final int var1 )
{
return this.src.getStackInSlot( var1 + this.min );
}
@Override
public ItemStack decrStackSize( int var1, int var2 )
public ItemStack decrStackSize( final int var1, final int var2 )
{
return this.src.decrStackSize( this.min + var1, var2 );
}
@Override
public ItemStack getStackInSlotOnClosing( int var1 )
public ItemStack getStackInSlotOnClosing( final int var1 )
{
return this.src.getStackInSlotOnClosing( this.min + var1 );
}
@Override
public void setInventorySlotContents( int var1, ItemStack var2 )
public void setInventorySlotContents( final int var1, final ItemStack var2 )
{
this.src.setInventorySlotContents( var1 + this.min, var2 );
}
@@ -99,7 +99,7 @@ public class AdaptorPlayerInventory implements IInventory
}
@Override
public boolean isUseableByPlayer( EntityPlayer var1 )
public boolean isUseableByPlayer( final EntityPlayer var1 )
{
return this.src.isUseableByPlayer( var1 );
}
@@ -117,7 +117,7 @@ public class AdaptorPlayerInventory implements IInventory
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return this.src.isItemValidForSlot( i, itemstack );
}
+16 -16
View File
@@ -43,7 +43,7 @@ public class IMEAdaptor extends InventoryAdaptor
final BaseActionSource src;
int maxSlots = 0;
public IMEAdaptor( IMEInventory<IAEItemStack> input, BaseActionSource src )
public IMEAdaptor( final IMEInventory<IAEItemStack> input, final BaseActionSource src )
{
this.target = input;
this.src = src;
@@ -61,18 +61,18 @@ public class IMEAdaptor extends InventoryAdaptor
}
@Override
public ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination )
public ItemStack removeItems( final int amount, final ItemStack filter, final IInventoryDestination destination )
{
return this.doRemoveItems( amount, filter, destination, Actionable.MODULATE );
}
public ItemStack doRemoveItems( int amount, ItemStack filter, IInventoryDestination destination, Actionable type )
public ItemStack doRemoveItems( final int amount, final ItemStack filter, final IInventoryDestination destination, final Actionable type )
{
IAEItemStack req = null;
if( filter == null )
{
IItemList<IAEItemStack> list = this.getList();
final IItemList<IAEItemStack> list = this.getList();
if( !list.isEmpty() )
{
req = list.getFirstItem();
@@ -100,13 +100,13 @@ public class IMEAdaptor extends InventoryAdaptor
}
@Override
public ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination )
public ItemStack simulateRemove( final int amount, final ItemStack filter, final IInventoryDestination destination )
{
return this.doRemoveItems( amount, filter, destination, Actionable.SIMULATE );
}
@Override
public ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
public ItemStack removeSimilarItems( final int amount, final ItemStack filter, final FuzzyMode fuzzyMode, final IInventoryDestination destination )
{
if( filter == null )
{
@@ -115,9 +115,9 @@ public class IMEAdaptor extends InventoryAdaptor
return this.doRemoveItemsFuzzy( amount, filter, destination, Actionable.MODULATE, fuzzyMode );
}
public ItemStack doRemoveItemsFuzzy( int amount, ItemStack filter, IInventoryDestination destination, Actionable type, FuzzyMode fuzzyMode )
public ItemStack doRemoveItemsFuzzy( final int amount, final ItemStack filter, final IInventoryDestination destination, final Actionable type, final FuzzyMode fuzzyMode )
{
IAEItemStack reqFilter = AEItemStack.create( filter );
final IAEItemStack reqFilter = AEItemStack.create( filter );
if( reqFilter == null )
{
return null;
@@ -125,7 +125,7 @@ public class IMEAdaptor extends InventoryAdaptor
IAEItemStack out = null;
for( IAEItemStack req : ImmutableList.copyOf( this.getList().findFuzzy( reqFilter, fuzzyMode ) ) )
for( final IAEItemStack req : ImmutableList.copyOf( this.getList().findFuzzy( reqFilter, fuzzyMode ) ) )
{
if( req != null )
{
@@ -142,7 +142,7 @@ public class IMEAdaptor extends InventoryAdaptor
}
@Override
public ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
public ItemStack simulateSimilarRemove( final int amount, final ItemStack filter, final FuzzyMode fuzzyMode, final IInventoryDestination destination )
{
if( filter == null )
{
@@ -152,12 +152,12 @@ public class IMEAdaptor extends InventoryAdaptor
}
@Override
public ItemStack addItems( ItemStack toBeAdded )
public ItemStack addItems( final ItemStack toBeAdded )
{
IAEItemStack in = AEItemStack.create( toBeAdded );
final IAEItemStack in = AEItemStack.create( toBeAdded );
if( in != null )
{
IAEItemStack out = this.target.injectItems( in, Actionable.MODULATE, this.src );
final IAEItemStack out = this.target.injectItems( in, Actionable.MODULATE, this.src );
if( out != null )
{
return out.getItemStack();
@@ -167,12 +167,12 @@ public class IMEAdaptor extends InventoryAdaptor
}
@Override
public ItemStack simulateAdd( ItemStack toBeSimulated )
public ItemStack simulateAdd( final ItemStack toBeSimulated )
{
IAEItemStack in = AEItemStack.create( toBeSimulated );
final IAEItemStack in = AEItemStack.create( toBeSimulated );
if( in != null )
{
IAEItemStack out = this.target.injectItems( in, Actionable.SIMULATE, this.src );
final IAEItemStack out = this.target.injectItems( in, Actionable.SIMULATE, this.src );
if( out != null )
{
return out.getItemStack();
@@ -35,7 +35,7 @@ public final class IMEAdaptorIterator implements Iterator<ItemSlot>
private int offset = 0;
private boolean hasNext;
public IMEAdaptorIterator( IMEAdaptor parent, IItemList<IAEItemStack> availableItems )
public IMEAdaptorIterator( final IMEAdaptor parent, final IItemList<IAEItemStack> availableItems )
{
this.stack = availableItems.iterator();
this.containerSize = parent.maxSlots;
@@ -63,7 +63,7 @@ public final class IMEAdaptorIterator implements Iterator<ItemSlot>
if( this.hasNext )
{
IAEItemStack item = this.stack.next();
final IAEItemStack item = this.stack.next();
this.slot.setAEItemStack( item );
return this.slot;
}
@@ -32,13 +32,13 @@ public class IMEInventoryDestination implements IInventoryDestination
final IMEInventory<IAEItemStack> me;
public IMEInventoryDestination( IMEInventory<IAEItemStack> o )
public IMEInventoryDestination( final IMEInventory<IAEItemStack> o )
{
this.me = o;
}
@Override
public boolean canInsert( ItemStack stack )
public boolean canInsert( final ItemStack stack )
{
if( stack == null )
@@ -46,7 +46,7 @@ public class IMEInventoryDestination implements IInventoryDestination
return false;
}
IAEItemStack failed = this.me.injectItems( AEItemStack.create( stack ), Actionable.SIMULATE, null );
final IAEItemStack failed = this.me.injectItems( AEItemStack.create( stack ), Actionable.SIMULATE, null );
if( failed == null )
{
@@ -32,7 +32,7 @@ public class ItemListIgnoreCrafting<T extends IAEStack> implements IItemList<T>
final IItemList<T> target;
public ItemListIgnoreCrafting( IItemList<T> cla )
public ItemListIgnoreCrafting( final IItemList<T> cla )
{
this.target = cla;
}
@@ -50,13 +50,13 @@ public class ItemListIgnoreCrafting<T extends IAEStack> implements IItemList<T>
}
@Override
public T findPrecise( T i )
public T findPrecise( final T i )
{
return this.target.findPrecise( i );
}
@Override
public Collection<T> findFuzzy( T input, FuzzyMode fuzzy )
public Collection<T> findFuzzy( final T input, final FuzzyMode fuzzy )
{
return this.target.findFuzzy( input, fuzzy );
}
@@ -68,19 +68,19 @@ public class ItemListIgnoreCrafting<T extends IAEStack> implements IItemList<T>
}
@Override
public void addStorage( T option )
public void addStorage( final T option )
{
this.target.addStorage( option );
}
@Override
public void addCrafting( T option )
public void addCrafting( final T option )
{
// nothing.
}
@Override
public void addRequestable( T option )
public void addRequestable( final T option )
{
this.target.addRequestable( option );
}
+2 -2
View File
@@ -39,7 +39,7 @@ public class ItemSlot
return this.itemStack == null ? ( this.aeItemStack == null ? null : ( this.itemStack = this.aeItemStack.getItemStack() ) ) : this.itemStack;
}
public void setItemStack( ItemStack is )
public void setItemStack( final ItemStack is )
{
this.aeItemStack = null;
this.itemStack = is;
@@ -50,7 +50,7 @@ public class ItemSlot
return this.aeItemStack == null ? ( this.itemStack == null ? null : ( this.aeItemStack = AEItemStack.create( this.itemStack ) ) ) : this.aeItemStack;
}
public void setAEItemStack( IAEItemStack is )
public void setAEItemStack( final IAEItemStack is )
{
this.aeItemStack = is;
this.itemStack = null;
@@ -37,7 +37,7 @@ public class WrapperBCPipe implements IInventory
private final TileEntity ad;
private final ForgeDirection dir;
public WrapperBCPipe( TileEntity te, ForgeDirection d )
public WrapperBCPipe( final TileEntity te, final ForgeDirection d )
{
this.bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
this.ad = te;
@@ -51,25 +51,25 @@ public class WrapperBCPipe implements IInventory
}
@Override
public ItemStack getStackInSlot( int i )
public ItemStack getStackInSlot( final int i )
{
return null;
}
@Override
public ItemStack decrStackSize( int i, int j )
public ItemStack decrStackSize( final int i, final int j )
{
return null;
}
@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 )
{
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
@@ -102,7 +102,7 @@ public class WrapperBCPipe implements IInventory
}
@Override
public boolean isUseableByPlayer( EntityPlayer entityplayer )
public boolean isUseableByPlayer( final EntityPlayer entityplayer )
{
return false;
}
@@ -120,7 +120,7 @@ public class WrapperBCPipe implements IInventory
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return this.bc.canAddItemsToPipe( this.ad, itemstack, this.dir );
}
@@ -38,12 +38,12 @@ public class WrapperChainedInventory implements IInventory
private List<IInventory> l;
private Map<Integer, InvOffset> offsets;
public WrapperChainedInventory( IInventory... inventories )
public WrapperChainedInventory( final IInventory... inventories )
{
this.setInventory( inventories );
}
public void setInventory( IInventory... a )
public void setInventory( final IInventory... a )
{
this.l = ImmutableList.copyOf( a );
this.calculateSizes();
@@ -54,9 +54,9 @@ public class WrapperChainedInventory implements IInventory
this.offsets = new HashMap<Integer, WrapperChainedInventory.InvOffset>();
int offset = 0;
for( IInventory in : this.l )
for( final IInventory in : this.l )
{
InvOffset io = new InvOffset();
final InvOffset io = new InvOffset();
io.offset = offset;
io.size = in.getSizeInventory();
io.i = in;
@@ -72,12 +72,12 @@ public class WrapperChainedInventory implements IInventory
this.fullSize = offset;
}
public WrapperChainedInventory( List<IInventory> inventories )
public WrapperChainedInventory( final List<IInventory> inventories )
{
this.setInventory( inventories );
}
public void setInventory( List<IInventory> a )
public void setInventory( final List<IInventory> a )
{
this.l = a;
this.calculateSizes();
@@ -87,7 +87,7 @@ public class WrapperChainedInventory implements IInventory
{
if( this.l.size() > 1 )
{
List<IInventory> newOrder = new ArrayList<IInventory>( this.l.size() );
final List<IInventory> newOrder = new ArrayList<IInventory>( this.l.size() );
newOrder.add( this.l.get( this.l.size() - 1 ) );
for( int x = 0; x < this.l.size() - 1; x++ )
{
@@ -97,9 +97,9 @@ public class WrapperChainedInventory implements IInventory
}
}
public IInventory getInv( int idx )
public IInventory getInv( final int idx )
{
InvOffset io = this.offsets.get( idx );
final InvOffset io = this.offsets.get( idx );
if( io != null )
{
return io.i;
@@ -107,9 +107,9 @@ public class WrapperChainedInventory implements IInventory
return null;
}
public int getInvSlot( int idx )
public int getInvSlot( final int idx )
{
InvOffset io = this.offsets.get( idx );
final InvOffset io = this.offsets.get( idx );
if( io != null )
{
return idx - io.offset;
@@ -124,9 +124,9 @@ public class WrapperChainedInventory implements IInventory
}
@Override
public ItemStack getStackInSlot( int idx )
public ItemStack getStackInSlot( final int idx )
{
InvOffset io = this.offsets.get( idx );
final InvOffset io = this.offsets.get( idx );
if( io != null )
{
return io.i.getStackInSlot( idx - io.offset );
@@ -135,9 +135,9 @@ public class WrapperChainedInventory implements IInventory
}
@Override
public ItemStack decrStackSize( int idx, int var2 )
public ItemStack decrStackSize( final int idx, final int var2 )
{
InvOffset io = this.offsets.get( idx );
final InvOffset io = this.offsets.get( idx );
if( io != null )
{
return io.i.decrStackSize( idx - io.offset, var2 );
@@ -146,9 +146,9 @@ public class WrapperChainedInventory implements IInventory
}
@Override
public ItemStack getStackInSlotOnClosing( int idx )
public ItemStack getStackInSlotOnClosing( final int idx )
{
InvOffset io = this.offsets.get( idx );
final InvOffset io = this.offsets.get( idx );
if( io != null )
{
return io.i.getStackInSlotOnClosing( idx - io.offset );
@@ -157,9 +157,9 @@ public class WrapperChainedInventory implements IInventory
}
@Override
public void setInventorySlotContents( int idx, ItemStack var2 )
public void setInventorySlotContents( final int idx, final ItemStack var2 )
{
InvOffset io = this.offsets.get( idx );
final InvOffset io = this.offsets.get( idx );
if( io != null )
{
io.i.setInventorySlotContents( idx - io.offset, var2 );
@@ -183,7 +183,7 @@ public class WrapperChainedInventory implements IInventory
{
int smallest = 64;
for( IInventory i : this.l )
for( final IInventory i : this.l )
{
smallest = Math.min( smallest, i.getInventoryStackLimit() );
}
@@ -194,14 +194,14 @@ public class WrapperChainedInventory implements IInventory
@Override
public void markDirty()
{
for( IInventory i : this.l )
for( final IInventory i : this.l )
{
i.markDirty();
}
}
@Override
public boolean isUseableByPlayer( EntityPlayer var1 )
public boolean isUseableByPlayer( final EntityPlayer var1 )
{
return false;
}
@@ -217,9 +217,9 @@ public class WrapperChainedInventory implements IInventory
}
@Override
public boolean isItemValidForSlot( int idx, ItemStack itemstack )
public boolean isItemValidForSlot( final int idx, final ItemStack itemstack )
{
InvOffset io = this.offsets.get( idx );
final InvOffset io = this.offsets.get( idx );
if( io != null )
{
return io.i.isItemValidForSlot( idx - io.offset, itemstack );
@@ -29,17 +29,17 @@ public class WrapperInvSlot
private final IInventory inv;
public WrapperInvSlot( IInventory inv )
public WrapperInvSlot( final IInventory inv )
{
this.inv = inv;
}
public IInventory getWrapper( int slot )
public IInventory getWrapper( final int slot )
{
return new InternalInterfaceWrapper( this.inv, slot );
}
protected boolean isItemValid( ItemStack itemstack )
protected boolean isItemValid( final ItemStack itemstack )
{
return true;
}
@@ -50,7 +50,7 @@ public class WrapperInvSlot
private final IInventory inv;
private final int slot;
public InternalInterfaceWrapper( IInventory target, int slot )
public InternalInterfaceWrapper( final IInventory target, final int slot )
{
this.inv = target;
this.slot = slot;
@@ -63,25 +63,25 @@ public class WrapperInvSlot
}
@Override
public ItemStack getStackInSlot( int i )
public ItemStack getStackInSlot( final int i )
{
return this.inv.getStackInSlot( this.slot );
}
@Override
public ItemStack decrStackSize( int i, int num )
public ItemStack decrStackSize( final int i, final int num )
{
return this.inv.decrStackSize( this.slot, num );
}
@Override
public ItemStack getStackInSlotOnClosing( int i )
public ItemStack getStackInSlotOnClosing( final int i )
{
return this.inv.getStackInSlotOnClosing( this.slot );
}
@Override
public void setInventorySlotContents( int i, ItemStack itemstack )
public void setInventorySlotContents( final int i, final ItemStack itemstack )
{
this.inv.setInventorySlotContents( this.slot, itemstack );
}
@@ -111,7 +111,7 @@ public class WrapperInvSlot
}
@Override
public boolean isUseableByPlayer( EntityPlayer entityplayer )
public boolean isUseableByPlayer( final EntityPlayer entityplayer )
{
return this.inv.isUseableByPlayer( entityplayer );
}
@@ -129,7 +129,7 @@ public class WrapperInvSlot
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return WrapperInvSlot.this.isItemValid( itemstack ) && this.inv.isItemValidForSlot( this.slot, itemstack );
}
@@ -31,7 +31,7 @@ public class WrapperInventoryRange implements IInventory
protected boolean ignoreValidItems = false;
int[] slots;
public WrapperInventoryRange( IInventory a, int[] s, boolean ignoreValid )
public WrapperInventoryRange( final IInventory a, final int[] s, final boolean ignoreValid )
{
this.src = a;
this.slots = s;
@@ -44,7 +44,7 @@ public class WrapperInventoryRange implements IInventory
this.ignoreValidItems = ignoreValid;
}
public WrapperInventoryRange( IInventory a, int min, int size, boolean ignoreValid )
public WrapperInventoryRange( final IInventory a, final int min, final int size, final boolean ignoreValid )
{
this.src = a;
this.slots = new int[size];
@@ -55,12 +55,12 @@ public class WrapperInventoryRange implements IInventory
this.ignoreValidItems = ignoreValid;
}
public static String concatLines( int[] s, String separator )
public static String concatLines( final int[] s, final String separator )
{
if( s.length > 0 )
{
StringBuilder sb = new StringBuilder();
for( int value : s )
final StringBuilder sb = new StringBuilder();
for( final int value : s )
{
if( sb.length() > 0 )
{
@@ -80,25 +80,25 @@ public class WrapperInventoryRange implements IInventory
}
@Override
public ItemStack getStackInSlot( int var1 )
public ItemStack getStackInSlot( final int var1 )
{
return this.src.getStackInSlot( this.slots[var1] );
}
@Override
public ItemStack decrStackSize( int var1, int var2 )
public ItemStack decrStackSize( final int var1, final int var2 )
{
return this.src.decrStackSize( this.slots[var1], var2 );
}
@Override
public ItemStack getStackInSlotOnClosing( int var1 )
public ItemStack getStackInSlotOnClosing( final int var1 )
{
return this.src.getStackInSlotOnClosing( this.slots[var1] );
}
@Override
public void setInventorySlotContents( int var1, ItemStack var2 )
public void setInventorySlotContents( final int var1, final ItemStack var2 )
{
this.src.setInventorySlotContents( this.slots[var1], var2 );
}
@@ -128,7 +128,7 @@ public class WrapperInventoryRange implements IInventory
}
@Override
public boolean isUseableByPlayer( EntityPlayer var1 )
public boolean isUseableByPlayer( final EntityPlayer var1 )
{
return this.src.isUseableByPlayer( var1 );
}
@@ -146,7 +146,7 @@ public class WrapperInventoryRange implements IInventory
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
if( this.ignoreValidItems )
{
@@ -30,7 +30,7 @@ public class WrapperMCISidedInventory extends WrapperInventoryRange implements I
final ISidedInventory side;
private final ForgeDirection dir;
public WrapperMCISidedInventory( ISidedInventory a, ForgeDirection d )
public WrapperMCISidedInventory( final ISidedInventory a, final ForgeDirection d )
{
super( a, a.getAccessibleSlotsFromSide( d.ordinal() ), false );
this.side = a;
@@ -38,7 +38,7 @@ public class WrapperMCISidedInventory extends WrapperInventoryRange implements I
}
@Override
public ItemStack decrStackSize( int var1, int var2 )
public ItemStack decrStackSize( final int var1, final int var2 )
{
if( this.canRemoveItemFromSlot( var1, this.getStackInSlot( var1 ) ) )
{
@@ -48,7 +48,7 @@ public class WrapperMCISidedInventory extends WrapperInventoryRange implements I
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
if( this.ignoreValidItems )
@@ -65,7 +65,7 @@ public class WrapperMCISidedInventory extends WrapperInventoryRange implements I
}
@Override
public boolean canRemoveItemFromSlot( int i, ItemStack is )
public boolean canRemoveItemFromSlot( final int i, final ItemStack is )
{
if( is == null )
{
@@ -32,7 +32,7 @@ public class WrapperTEPipe implements IInventory
final TileEntity ad;
final ForgeDirection dir;
public WrapperTEPipe( TileEntity te, ForgeDirection d )
public WrapperTEPipe( final TileEntity te, final ForgeDirection d )
{
this.ad = te;
this.dir = d;
@@ -45,25 +45,25 @@ public class WrapperTEPipe implements IInventory
}
@Override
public ItemStack getStackInSlot( int i )
public ItemStack getStackInSlot( final int i )
{
return null;
}
@Override
public ItemStack decrStackSize( int i, int j )
public ItemStack decrStackSize( final int i, final int j )
{
return null;
}
@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 )
{
// ITE.addItemsToPipe( ad, itemstack, dir );
}
@@ -93,7 +93,7 @@ public class WrapperTEPipe implements IInventory
}
@Override
public boolean isUseableByPlayer( EntityPlayer entityplayer )
public boolean isUseableByPlayer( final EntityPlayer entityplayer )
{
return false;
}
@@ -111,7 +111,7 @@ public class WrapperTEPipe implements IInventory
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
public boolean isItemValidForSlot( final int i, final ItemStack itemstack )
{
return false;
}
@@ -51,7 +51,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
private final Fluid fluid;
private IAETagCompound tagCompound;
private AEFluidStack( AEFluidStack is )
private AEFluidStack( final AEFluidStack is )
{
this.fluid = is.fluid;
@@ -64,7 +64,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
this.myHash = is.myHash;
}
private AEFluidStack( @Nonnull FluidStack is )
private AEFluidStack( @Nonnull final FluidStack is )
{
this.fluid = is.getFluid();
@@ -80,14 +80,14 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
this.myHash = this.fluid.hashCode() ^ ( this.tagCompound == null ? 0 : System.identityHashCode( this.tagCompound ) );
}
public static IAEFluidStack loadFluidStackFromNBT( NBTTagCompound i )
public static IAEFluidStack loadFluidStackFromNBT( final NBTTagCompound i )
{
ItemStack itemstack = ItemStack.loadItemStackFromNBT( i );
final ItemStack itemstack = ItemStack.loadItemStackFromNBT( i );
if( itemstack == null )
{
return null;
}
AEFluidStack fluid = AEFluidStack.create( itemstack );
final AEFluidStack fluid = AEFluidStack.create( itemstack );
// fluid.priority = i.getInteger( "Priority" );
fluid.stackSize = i.getLong( "Cnt" );
fluid.setCountRequestable( i.getLong( "Req" ) );
@@ -95,7 +95,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
return fluid;
}
public static AEFluidStack create( Object a )
public static AEFluidStack create( final Object a )
{
if( a == null )
{
@@ -112,20 +112,20 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
return null;
}
public static IAEFluidStack loadFluidStackFromPacket( ByteBuf data ) throws IOException
public static IAEFluidStack loadFluidStackFromPacket( final ByteBuf data ) throws IOException
{
byte mask = data.readByte();
final byte mask = data.readByte();
// byte PriorityType = (byte) (mask & 0x03);
byte stackType = (byte) ( ( mask & 0x0C ) >> 2 );
byte countReqType = (byte) ( ( mask & 0x30 ) >> 4 );
boolean isCraftable = ( mask & 0x40 ) > 0;
boolean hasTagCompound = ( mask & 0x80 ) > 0;
final byte stackType = (byte) ( ( mask & 0x0C ) >> 2 );
final byte countReqType = (byte) ( ( mask & 0x30 ) >> 4 );
final boolean isCraftable = ( mask & 0x40 ) > 0;
final boolean hasTagCompound = ( mask & 0x80 ) > 0;
// don't send this...
NBTTagCompound d = new NBTTagCompound();
final NBTTagCompound d = new NBTTagCompound();
byte len2 = data.readByte();
byte[] name = new byte[len2];
final byte len2 = data.readByte();
final byte[] name = new byte[len2];
data.readBytes( name, 0, len2 );
d.setString( "FluidName", new String( name, "UTF-8" ) );
@@ -133,26 +133,26 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
if( hasTagCompound )
{
int len = data.readInt();
final int len = data.readInt();
byte[] bd = new byte[len];
final byte[] bd = new byte[len];
data.readBytes( bd );
DataInputStream di = new DataInputStream( new ByteArrayInputStream( bd ) );
final DataInputStream di = new DataInputStream( new ByteArrayInputStream( bd ) );
d.setTag( "tag", CompressedStreamTools.read( di ) );
}
// long priority = getPacketValue( PriorityType, data );
long stackSize = getPacketValue( stackType, data );
long countRequestable = getPacketValue( countReqType, data );
final long stackSize = getPacketValue( stackType, data );
final long countRequestable = getPacketValue( countReqType, data );
FluidStack fluidStack = FluidStack.loadFluidStackFromNBT( d );
final FluidStack fluidStack = FluidStack.loadFluidStackFromNBT( d );
if( fluidStack == null )
{
return null;
}
AEFluidStack fluid = AEFluidStack.create( fluidStack );
final AEFluidStack fluid = AEFluidStack.create( fluidStack );
// fluid.priority = (int) priority;
fluid.stackSize = stackSize;
fluid.setCountRequestable( countRequestable );
@@ -161,7 +161,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
}
@Override
public void add( IAEFluidStack option )
public void add( final IAEFluidStack option )
{
if( option == null )
{
@@ -177,7 +177,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
}
@Override
public void writeToNBT( NBTTagCompound i )
public void writeToNBT( final NBTTagCompound i )
{
/*
* Mojang Fucked this over ; GC Optimization - Ugly Yes, but it saves a lot in the memory department.
@@ -226,7 +226,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
}
@Override
public boolean fuzzyComparison( Object st, FuzzyMode mode )
public boolean fuzzyComparison( final Object st, final FuzzyMode mode )
{
if( st instanceof FluidStack )
{
@@ -250,7 +250,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
@Override
public IAEFluidStack empty()
{
IAEFluidStack dup = this.copy();
final IAEFluidStack dup = this.copy();
dup.reset();
return dup;
}
@@ -280,9 +280,9 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
}
@Override
public int compareTo( AEFluidStack b )
public int compareTo( final AEFluidStack b )
{
int diff = this.hashCode() - b.hashCode();
final int diff = this.hashCode() - b.hashCode();
return diff > 0 ? 1 : ( diff < 0 ? -1 : 0 );
}
@@ -293,7 +293,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
}
@Override
public boolean equals( Object ia )
public boolean equals( final Object ia )
{
if( ia instanceof AEFluidStack )
{
@@ -301,12 +301,12 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
}
else if( ia instanceof FluidStack )
{
FluidStack is = (FluidStack) ia;
final FluidStack is = (FluidStack) ia;
if( is.getFluidID() == this.fluid.getID() )
{
NBTTagCompound ta = (NBTTagCompound) this.tagCompound;
NBTTagCompound tb = is.tag;
final NBTTagCompound ta = (NBTTagCompound) this.tagCompound;
final NBTTagCompound tb = is.tag;
if( ta == tb )
{
return true;
@@ -346,25 +346,25 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
}
@Override
void writeIdentity( ByteBuf i ) throws IOException
void writeIdentity( final ByteBuf i ) throws IOException
{
byte[] name = this.fluid.getName().getBytes( "UTF-8" );
final byte[] name = this.fluid.getName().getBytes( "UTF-8" );
i.writeByte( (byte) name.length );
i.writeBytes( name );
}
@Override
void readNBT( ByteBuf i ) throws IOException
void readNBT( final ByteBuf i ) throws IOException
{
if( this.hasTagCompound() )
{
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
DataOutputStream data = new DataOutputStream( bytes );
final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
final DataOutputStream data = new DataOutputStream( bytes );
CompressedStreamTools.write( (NBTTagCompound) this.tagCompound, data );
byte[] tagBytes = bytes.toByteArray();
int size = tagBytes.length;
final byte[] tagBytes = bytes.toByteArray();
final int size = tagBytes.length;
i.writeInt( size );
i.writeBytes( tagBytes );
@@ -374,7 +374,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
@Override
public FluidStack getFluidStack()
{
FluidStack is = new FluidStack( this.fluid, (int) Math.min( Integer.MAX_VALUE, this.stackSize ) );
final FluidStack is = new FluidStack( this.fluid, (int) Math.min( Integer.MAX_VALUE, this.stackSize ) );
if( this.tagCompound != null )
{
is.tag = this.tagCompound.getNBTTagCompoundCopy();
@@ -53,7 +53,7 @@ public class AEItemDef
public UniqueIdentifier uniqueID;
public OreReference isOre;
public AEItemDef( Item it )
public AEItemDef( final Item it )
{
this.item = it;
this.itemID = Item.getIdFromItem( it );
@@ -61,7 +61,7 @@ public class AEItemDef
public AEItemDef copy()
{
AEItemDef t = new AEItemDef( this.item );
final AEItemDef t = new AEItemDef( this.item );
t.def = this.def;
t.damageValue = this.damageValue;
t.displayDamage = this.displayDamage;
@@ -72,7 +72,7 @@ public class AEItemDef
}
@Override
public boolean equals( Object obj )
public boolean equals( final Object obj )
{
if( obj == null )
{
@@ -82,14 +82,14 @@ public class AEItemDef
{
return false;
}
AEItemDef other = (AEItemDef) obj;
final AEItemDef other = (AEItemDef) obj;
return other.damageValue == this.damageValue && other.item == this.item && this.tagCompound == other.tagCompound;
}
public boolean isItem( ItemStack otherStack )
public boolean isItem( final ItemStack otherStack )
{
// hackery!
int dmg = this.getDamageValueHack( otherStack );
final int dmg = this.getDamageValueHack( otherStack );
if( this.item == otherStack.getItem() && dmg == this.damageValue )
{
@@ -108,7 +108,7 @@ public class AEItemDef
return false;
}
public int getDamageValueHack( ItemStack is )
public int getDamageValueHack( final ItemStack is )
{
return Items.blaze_rod.getDamage( is );
}
+70 -70
View File
@@ -53,7 +53,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
AEItemDef def;
private AEItemStack( AEItemStack is )
private AEItemStack( final AEItemStack is )
{
this.def = is.def;
this.stackSize = is.stackSize;
@@ -61,7 +61,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
this.setCountRequestable( is.getCountRequestable() );
}
private AEItemStack( ItemStack is )
private AEItemStack( final ItemStack is )
{
if( is == null )
{
@@ -97,7 +97,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
this.def.displayDamage = is.getItemDamageForDisplay();
this.def.maxDamage = is.getMaxDamage();
NBTTagCompound tagCompound = is.getTagCompound();
final NBTTagCompound tagCompound = is.getTagCompound();
if( tagCompound != null )
{
this.def.tagCompound = (AESharedNBT) AESharedNBT.getSharedTagCompound( tagCompound, is );
@@ -111,20 +111,20 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
this.def.isOre = OreHelper.INSTANCE.isOre( is );
}
public static IAEItemStack loadItemStackFromNBT( NBTTagCompound i )
public static IAEItemStack loadItemStackFromNBT( final NBTTagCompound i )
{
if( i == null )
{
return null;
}
ItemStack itemstack = ItemStack.loadItemStackFromNBT( i );
final ItemStack itemstack = ItemStack.loadItemStackFromNBT( i );
if( itemstack == null )
{
return null;
}
AEItemStack item = AEItemStack.create( itemstack );
final AEItemStack item = AEItemStack.create( itemstack );
// item.priority = i.getInteger( "Priority" );
item.stackSize = i.getLong( "Cnt" );
item.setCountRequestable( i.getLong( "Req" ) );
@@ -133,7 +133,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
}
@Nullable
public static AEItemStack create( ItemStack stack )
public static AEItemStack create( final ItemStack stack )
{
if( stack == null )
{
@@ -143,17 +143,17 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
return new AEItemStack( stack );
}
public static IAEItemStack loadItemStackFromPacket( ByteBuf data ) throws IOException
public static IAEItemStack loadItemStackFromPacket( final ByteBuf data ) throws IOException
{
byte mask = data.readByte();
final byte mask = data.readByte();
// byte PriorityType = (byte) (mask & 0x03);
byte stackType = (byte) ( ( mask & 0x0C ) >> 2 );
byte countReqType = (byte) ( ( mask & 0x30 ) >> 4 );
boolean isCraftable = ( mask & 0x40 ) > 0;
boolean hasTagCompound = ( mask & 0x80 ) > 0;
final byte stackType = (byte) ( ( mask & 0x0C ) >> 2 );
final byte countReqType = (byte) ( ( mask & 0x30 ) >> 4 );
final boolean isCraftable = ( mask & 0x40 ) > 0;
final boolean hasTagCompound = ( mask & 0x80 ) > 0;
// don't send this...
NBTTagCompound d = new NBTTagCompound();
final NBTTagCompound d = new NBTTagCompound();
d.setShort( "id", data.readShort() );
d.setShort( "Damage", data.readShort() );
@@ -161,26 +161,26 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
if( hasTagCompound )
{
int len = data.readInt();
final int len = data.readInt();
byte[] bd = new byte[len];
final byte[] bd = new byte[len];
data.readBytes( bd );
ByteArrayInputStream di = new ByteArrayInputStream( bd );
final ByteArrayInputStream di = new ByteArrayInputStream( bd );
d.setTag( "tag", CompressedStreamTools.read( new DataInputStream( di ) ) );
}
// long priority = getPacketValue( PriorityType, data );
long stackSize = getPacketValue( stackType, data );
long countRequestable = getPacketValue( countReqType, data );
final long stackSize = getPacketValue( stackType, data );
final long countRequestable = getPacketValue( countReqType, data );
ItemStack itemstack = ItemStack.loadItemStackFromNBT( d );
final ItemStack itemstack = ItemStack.loadItemStackFromNBT( d );
if( itemstack == null )
{
return null;
}
AEItemStack item = AEItemStack.create( itemstack );
final AEItemStack item = AEItemStack.create( itemstack );
// item.priority = (int) priority;
item.stackSize = stackSize;
item.setCountRequestable( countRequestable );
@@ -189,7 +189,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
}
@Override
public void add( IAEItemStack option )
public void add( final IAEItemStack option )
{
if( option == null )
{
@@ -205,7 +205,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
}
@Override
public void writeToNBT( NBTTagCompound i )
public void writeToNBT( final NBTTagCompound i )
{
/*
* Mojang Fucked this over ; GC Optimization - Ugly Yes, but it saves a lot in the memory department.
@@ -259,11 +259,11 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
}
@Override
public boolean fuzzyComparison( Object st, FuzzyMode mode )
public boolean fuzzyComparison( final Object st, final FuzzyMode mode )
{
if( st instanceof IAEItemStack )
{
IAEItemStack o = (IAEItemStack) st;
final IAEItemStack o = (IAEItemStack) st;
if( this.sameOre( o ) )
{
@@ -274,8 +274,8 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
{
if( this.def.item.isDamageable() )
{
ItemStack a = this.getItemStack();
ItemStack b = o.getItemStack();
final ItemStack a = this.getItemStack();
final ItemStack b = o.getItemStack();
try
{
@@ -289,13 +289,13 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
}
else
{
float percentDamageOfA = 1.0f - (float) a.getItemDamageForDisplay() / (float) a.getMaxDamage();
float percentDamageOfB = 1.0f - (float) b.getItemDamageForDisplay() / (float) b.getMaxDamage();
final float percentDamageOfA = 1.0f - (float) a.getItemDamageForDisplay() / (float) a.getMaxDamage();
final float percentDamageOfB = 1.0f - (float) b.getItemDamageForDisplay() / (float) b.getMaxDamage();
return ( percentDamageOfA > mode.breakPoint ) == ( percentDamageOfB > mode.breakPoint );
}
}
catch( Throwable e )
catch( final Throwable e )
{
if( mode == FuzzyMode.IGNORE_ALL )
{
@@ -307,8 +307,8 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
}
else
{
float percentDamageOfA = (float) a.getItemDamage() / (float) a.getMaxDamage();
float percentDamageOfB = (float) b.getItemDamage() / (float) b.getMaxDamage();
final float percentDamageOfA = (float) a.getItemDamage() / (float) a.getMaxDamage();
final float percentDamageOfB = (float) b.getItemDamage() / (float) b.getMaxDamage();
return ( percentDamageOfA > mode.breakPoint ) == ( percentDamageOfB > mode.breakPoint );
}
@@ -321,7 +321,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
if( st instanceof ItemStack )
{
ItemStack o = (ItemStack) st;
final ItemStack o = (ItemStack) st;
OreHelper.INSTANCE.sameOre( this, o );
@@ -329,7 +329,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
{
if( this.def.item.isDamageable() )
{
ItemStack a = this.getItemStack();
final ItemStack a = this.getItemStack();
try
{
@@ -343,13 +343,13 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
}
else
{
float percentDamageOfA = 1.0f - (float) a.getItemDamageForDisplay() / (float) a.getMaxDamage();
float percentDamageOfB = 1.0f - (float) o.getItemDamageForDisplay() / (float) o.getMaxDamage();
final float percentDamageOfA = 1.0f - (float) a.getItemDamageForDisplay() / (float) a.getMaxDamage();
final float percentDamageOfB = 1.0f - (float) o.getItemDamageForDisplay() / (float) o.getMaxDamage();
return ( percentDamageOfA > mode.breakPoint ) == ( percentDamageOfB > mode.breakPoint );
}
}
catch( Throwable e )
catch( final Throwable e )
{
if( mode == FuzzyMode.IGNORE_ALL )
{
@@ -361,8 +361,8 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
}
else
{
float percentDamageOfA = (float) a.getItemDamage() / (float) a.getMaxDamage();
float percentDamageOfB = (float) o.getItemDamage() / (float) o.getMaxDamage();
final float percentDamageOfA = (float) a.getItemDamage() / (float) a.getMaxDamage();
final float percentDamageOfB = (float) o.getItemDamage() / (float) o.getMaxDamage();
return ( percentDamageOfA > mode.breakPoint ) == ( percentDamageOfB > mode.breakPoint );
}
@@ -385,7 +385,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
@Override
public IAEItemStack empty()
{
IAEItemStack dup = this.copy();
final IAEItemStack dup = this.copy();
dup.reset();
return dup;
}
@@ -417,7 +417,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
@Override
public ItemStack getItemStack()
{
ItemStack is = new ItemStack( this.def.item, (int) Math.min( Integer.MAX_VALUE, this.stackSize ), this.def.damageValue );
final ItemStack is = new ItemStack( this.def.item, (int) Math.min( Integer.MAX_VALUE, this.stackSize ), this.def.damageValue );
if( this.def.tagCompound != null )
{
is.setTagCompound( this.def.tagCompound.getNBTTagCompoundCopy() );
@@ -439,13 +439,13 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
}
@Override
public boolean sameOre( IAEItemStack is )
public boolean sameOre( final IAEItemStack is )
{
return OreHelper.INSTANCE.sameOre( this, is );
}
@Override
public boolean isSameType( IAEItemStack otherStack )
public boolean isSameType( final IAEItemStack otherStack )
{
if( otherStack == null )
{
@@ -456,7 +456,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
}
@Override
public boolean isSameType( ItemStack otherStack )
public boolean isSameType( final ItemStack otherStack )
{
if( otherStack == null )
{
@@ -473,7 +473,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
}
@Override
public boolean equals( Object ia )
public boolean equals( final Object ia )
{
if( ia instanceof AEItemStack )
{
@@ -482,12 +482,12 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
}
else if( ia instanceof ItemStack )
{
ItemStack is = (ItemStack) ia;
final ItemStack is = (ItemStack) ia;
if( is.getItem() == this.def.item && is.getItemDamage() == this.def.damageValue )
{
NBTTagCompound ta = this.def.tagCompound;
NBTTagCompound tb = is.getTagCompound();
final NBTTagCompound ta = this.def.tagCompound;
final NBTTagCompound tb = is.getTagCompound();
if( ta == tb )
{
return true;
@@ -521,21 +521,21 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
}
@Override
public int compareTo( AEItemStack b )
public int compareTo( final AEItemStack b )
{
int id = this.def.itemID - b.def.itemID;
final int id = this.def.itemID - b.def.itemID;
if( id != 0 )
{
return id;
}
int damageValue = this.def.damageValue - b.def.damageValue;
final int damageValue = this.def.damageValue - b.def.damageValue;
if( damageValue != 0 )
{
return damageValue;
}
int displayDamage = this.def.displayDamage - b.def.displayDamage;
final int displayDamage = this.def.displayDamage - b.def.displayDamage;
if( displayDamage != 0 )
{
return displayDamage;
@@ -544,9 +544,9 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
return ( this.def.tagCompound == b.def.tagCompound ) ? 0 : this.compareNBT( b.def );
}
private int compareNBT( AEItemDef b )
private int compareNBT( final AEItemDef b )
{
int nbt = this.compare( ( this.def.tagCompound == null ? 0 : this.def.tagCompound.getHash() ), ( b.tagCompound == null ? 0 : b.tagCompound.getHash() ) );
final int nbt = this.compare( ( this.def.tagCompound == null ? 0 : this.def.tagCompound.getHash() ), ( b.tagCompound == null ? 0 : b.tagCompound.getHash() ) );
if( nbt == 0 )
{
return this.compare( System.identityHashCode( this.def.tagCompound ), System.identityHashCode( b.tagCompound ) );
@@ -554,7 +554,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
return nbt;
}
private int compare( int l, int m )
private int compare( final int l, final int m )
{
return l < m ? -1 : ( l > m ? 1 : 0 );
}
@@ -592,7 +592,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
return this.getModName( this.def.uniqueID = GameRegistry.findUniqueIdentifierFor( this.def.item ) );
}
private String getModName( UniqueIdentifier uniqueIdentifier )
private String getModName( final UniqueIdentifier uniqueIdentifier )
{
if( uniqueIdentifier == null )
{
@@ -602,10 +602,10 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
return uniqueIdentifier.modId == null ? "** Null" : uniqueIdentifier.modId;
}
public IAEItemStack getLow( FuzzyMode fuzzy, boolean ignoreMeta )
public IAEItemStack getLow( final FuzzyMode fuzzy, final boolean ignoreMeta )
{
AEItemStack bottom = new AEItemStack( this );
AEItemDef newDef = bottom.def = bottom.def.copy();
final AEItemStack bottom = new AEItemStack( this );
final AEItemDef newDef = bottom.def = bottom.def.copy();
if( ignoreMeta )
{
@@ -633,7 +633,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
}
else
{
int breakpoint = fuzzy.calculateBreakPoint( this.def.maxDamage );
final int breakpoint = fuzzy.calculateBreakPoint( this.def.maxDamage );
newDef.displayDamage = breakpoint <= this.def.displayDamage ? breakpoint : 0;
}
@@ -645,10 +645,10 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
return bottom;
}
public IAEItemStack getHigh( FuzzyMode fuzzy, boolean ignoreMeta )
public IAEItemStack getHigh( final FuzzyMode fuzzy, final boolean ignoreMeta )
{
AEItemStack top = new AEItemStack( this );
AEItemDef newDef = top.def = top.def.copy();
final AEItemStack top = new AEItemStack( this );
final AEItemDef newDef = top.def = top.def.copy();
if( ignoreMeta )
{
@@ -676,7 +676,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
}
else
{
int breakpoint = fuzzy.calculateBreakPoint( this.def.maxDamage );
final int breakpoint = fuzzy.calculateBreakPoint( this.def.maxDamage );
newDef.displayDamage = this.def.displayDamage < breakpoint ? breakpoint - 1 : this.def.maxDamage + 1;
}
@@ -694,24 +694,24 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
}
@Override
void writeIdentity( ByteBuf i ) throws IOException
void writeIdentity( final ByteBuf i ) throws IOException
{
i.writeShort( Item.itemRegistry.getIDForObject( this.def.item ) );
i.writeShort( this.getItemDamage() );
}
@Override
void readNBT( ByteBuf i ) throws IOException
void readNBT( final ByteBuf i ) throws IOException
{
if( this.hasTagCompound() )
{
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
DataOutputStream data = new DataOutputStream( bytes );
final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
final DataOutputStream data = new DataOutputStream( bytes );
CompressedStreamTools.write( (NBTTagCompound) this.getTagCompound(), data );
byte[] tagBytes = bytes.toByteArray();
int size = tagBytes.length;
final byte[] tagBytes = bytes.toByteArray();
final int size = tagBytes.length;
i.writeInt( size );
i.writeBytes( tagBytes );
+18 -18
View File
@@ -48,13 +48,13 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
private int hash;
private IItemComparison comp;
private AESharedNBT( Item itemID, int damageValue )
private AESharedNBT( final Item itemID, final int damageValue )
{
this.item = itemID;
this.meta = damageValue;
}
public AESharedNBT( int fakeValue )
public AESharedNBT( final int fakeValue )
{
this.item = null;
this.meta = 0;
@@ -72,14 +72,14 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
/*
* Returns an NBT Compound that is used for accelerating comparisons.
*/
public static synchronized NBTTagCompound getSharedTagCompound( NBTTagCompound tagCompound, ItemStack s )
public static synchronized NBTTagCompound getSharedTagCompound( final NBTTagCompound tagCompound, final ItemStack s )
{
if( tagCompound.hasNoTags() )
{
return null;
}
Item item = s.getItem();
final Item item = s.getItem();
int meta = -1;
if( s.getItem() != null && s.isItemStackDamageable() && s.getHasSubtypes() )
{
@@ -91,12 +91,12 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
return tagCompound;
}
SharedSearchObject sso = new SharedSearchObject( item, meta, tagCompound );
final SharedSearchObject sso = new SharedSearchObject( item, meta, tagCompound );
WeakReference<SharedSearchObject> c = SHARED_TAG_COMPOUND.get( sso );
final WeakReference<SharedSearchObject> c = SHARED_TAG_COMPOUND.get( sso );
if( c != null )
{
SharedSearchObject cg = c.get();
final SharedSearchObject cg = c.get();
if( cg != null )
{
return cg.shared; // I don't think I really need to check this
@@ -104,7 +104,7 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
// as its already certain to exist..
}
AESharedNBT clone = AESharedNBT.createFromCompound( item, meta, tagCompound );
final AESharedNBT clone = AESharedNBT.createFromCompound( item, meta, tagCompound );
sso.compound = (NBTTagCompound) sso.compound.copy(); // prevent
// modification
// of data based
@@ -120,25 +120,25 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
/*
* returns true if the compound is part of the shared compound system ( and can thus be compared directly ).
*/
public static boolean isShared( NBTTagCompound ta )
public static boolean isShared( final NBTTagCompound ta )
{
return ta instanceof AESharedNBT;
}
public static AESharedNBT createFromCompound( Item itemID, int damageValue, NBTTagCompound c )
public static AESharedNBT createFromCompound( final Item itemID, final int damageValue, final NBTTagCompound c )
{
AESharedNBT x = new AESharedNBT( itemID, damageValue );
final AESharedNBT x = new AESharedNBT( itemID, damageValue );
// c.getTags()
for( Object o : c.func_150296_c() )
for( final Object o : c.func_150296_c() )
{
String name = (String) o;
final String name = (String) o;
x.setTag( name, c.getTag( name ).copy() );
}
x.hash = Platform.NBTOrderlessHash( c );
ItemStack isc = new ItemStack( itemID, 1, damageValue );
final ItemStack isc = new ItemStack( itemID, 1, damageValue );
isc.setTagCompound( c );
x.comp = AEApi.instance().registries().specialComparison().getSpecialComparison( isc );
@@ -163,7 +163,7 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
}
@Override
public boolean equals( Object par1Obj )
public boolean equals( final Object par1Obj )
{
if( par1Obj instanceof AESharedNBT )
{
@@ -172,12 +172,12 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
return super.equals( par1Obj );
}
public boolean matches( Item item, int meta, int orderlessHash )
public boolean matches( final Item item, final int meta, final int orderlessHash )
{
return item == this.item && this.meta == meta && this.hash == orderlessHash;
}
public boolean comparePreciseWithRegistry( AESharedNBT tagCompound )
public boolean comparePreciseWithRegistry( final AESharedNBT tagCompound )
{
if( this == tagCompound )
{
@@ -192,7 +192,7 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
return false;
}
public boolean compareFuzzyWithRegistry( AESharedNBT tagCompound )
public boolean compareFuzzyWithRegistry( final AESharedNBT tagCompound )
{
if( this == tagCompound )
{
+12 -12
View File
@@ -33,7 +33,7 @@ public abstract class AEStack<StackType extends IAEStack> implements IAEStack<St
protected long stackSize;
protected long countRequestable;
static long getPacketValue( byte type, ByteBuf tag )
static long getPacketValue( final byte type, final ByteBuf tag )
{
if( type == 0 )
{
@@ -64,7 +64,7 @@ public abstract class AEStack<StackType extends IAEStack> implements IAEStack<St
}
@Override
public StackType setStackSize( long ss )
public StackType setStackSize( final long ss )
{
this.stackSize = ss;
return (StackType) this;
@@ -77,7 +77,7 @@ public abstract class AEStack<StackType extends IAEStack> implements IAEStack<St
}
@Override
public StackType setCountRequestable( long countRequestable )
public StackType setCountRequestable( final long countRequestable )
{
this.countRequestable = countRequestable;
return (StackType) this;
@@ -90,7 +90,7 @@ public abstract class AEStack<StackType extends IAEStack> implements IAEStack<St
}
@Override
public StackType setCraftable( boolean isCraftable )
public StackType setCraftable( final boolean isCraftable )
{
this.isCraftable = isCraftable;
return (StackType) this;
@@ -113,33 +113,33 @@ public abstract class AEStack<StackType extends IAEStack> implements IAEStack<St
}
@Override
public void incStackSize( long i )
public void incStackSize( final long i )
{
this.stackSize += i;
}
@Override
public void decStackSize( long i )
public void decStackSize( final long i )
{
this.stackSize -= i;
}
@Override
public void incCountRequestable( long i )
public void incCountRequestable( final long i )
{
this.countRequestable += i;
}
@Override
public void decCountRequestable( long i )
public void decCountRequestable( final long i )
{
this.countRequestable -= i;
}
@Override
public void writeToPacket( ByteBuf i ) throws IOException
public void writeToPacket( final ByteBuf i ) throws IOException
{
byte mask = (byte) ( this.getType( 0 ) | ( this.getType( this.stackSize ) << 2 ) | ( this.getType( this.countRequestable ) << 4 ) | ( (byte) ( this.isCraftable ? 1 : 0 ) << 6 ) | ( this.hasTagCompound() ? 1 : 0 ) << 7 );
final byte mask = (byte) ( this.getType( 0 ) | ( this.getType( this.stackSize ) << 2 ) | ( this.getType( this.countRequestable ) << 4 ) | ( (byte) ( this.isCraftable ? 1 : 0 ) << 6 ) | ( this.hasTagCompound() ? 1 : 0 ) << 7 );
i.writeByte( mask );
this.writeIdentity( i );
@@ -151,7 +151,7 @@ public abstract class AEStack<StackType extends IAEStack> implements IAEStack<St
this.putPacketValue( i, this.countRequestable );
}
byte getType( long num )
byte getType( final long num )
{
if( num <= 255 )
{
@@ -177,7 +177,7 @@ public abstract class AEStack<StackType extends IAEStack> implements IAEStack<St
abstract void readNBT( ByteBuf i ) throws IOException;
void putPacketValue( ByteBuf tag, long num )
void putPacketValue( final ByteBuf tag, final long num )
{
if( num <= 255 )
{
+10 -10
View File
@@ -36,7 +36,7 @@ public final class FluidList implements IItemList<IAEFluidStack>
private final Map<IAEFluidStack, IAEFluidStack> records = new HashMap<IAEFluidStack, IAEFluidStack>();
@Override
public void add( IAEFluidStack option )
public void add( final IAEFluidStack option )
{
if( option == null )
{
@@ -57,7 +57,7 @@ public final class FluidList implements IItemList<IAEFluidStack>
}
@Override
public IAEFluidStack findPrecise( IAEFluidStack fluidStack )
public IAEFluidStack findPrecise( final IAEFluidStack fluidStack )
{
if( fluidStack == null )
{
@@ -68,7 +68,7 @@ public final class FluidList implements IItemList<IAEFluidStack>
}
@Override
public Collection<IAEFluidStack> findFuzzy( IAEFluidStack filter, FuzzyMode fuzzy )
public Collection<IAEFluidStack> findFuzzy( final IAEFluidStack filter, final FuzzyMode fuzzy )
{
if( filter == null )
{
@@ -85,7 +85,7 @@ public final class FluidList implements IItemList<IAEFluidStack>
}
@Override
public void addStorage( IAEFluidStack option )
public void addStorage( final IAEFluidStack option )
{
if( option == null )
{
@@ -111,7 +111,7 @@ public final class FluidList implements IItemList<IAEFluidStack>
*/
@Override
public void addCrafting( IAEFluidStack option )
public void addCrafting( final IAEFluidStack option )
{
if( option == null )
{
@@ -134,7 +134,7 @@ public final class FluidList implements IItemList<IAEFluidStack>
}
@Override
public void addRequestable( IAEFluidStack option )
public void addRequestable( final IAEFluidStack option )
{
if( option == null )
{
@@ -160,7 +160,7 @@ public final class FluidList implements IItemList<IAEFluidStack>
@Override
public IAEFluidStack getFirstItem()
{
for( IAEFluidStack stackType : this )
for( final IAEFluidStack stackType : this )
{
return stackType;
}
@@ -183,18 +183,18 @@ public final class FluidList implements IItemList<IAEFluidStack>
@Override
public void resetStatus()
{
for( IAEFluidStack i : this )
for( final IAEFluidStack i : this )
{
i.reset();
}
}
private IAEFluidStack getFluidRecord( IAEFluidStack fluid )
private IAEFluidStack getFluidRecord( final IAEFluidStack fluid )
{
return this.records.get( fluid );
}
private IAEFluidStack putFluidRecord( IAEFluidStack fluid )
private IAEFluidStack putFluidRecord( final IAEFluidStack fluid )
{
return this.records.put( fluid, fluid );
}
+13 -13
View File
@@ -42,7 +42,7 @@ public final class ItemList implements IItemList<IAEItemStack>
private final Map<Item, NavigableMap<IAEItemStack, IAEItemStack>> records = new IdentityHashMap<Item, NavigableMap<IAEItemStack, IAEItemStack>>();
@Override
public void add( IAEItemStack option )
public void add( final IAEItemStack option )
{
if( option == null )
{
@@ -63,7 +63,7 @@ public final class ItemList implements IItemList<IAEItemStack>
}
@Override
public IAEItemStack findPrecise( IAEItemStack itemStack )
public IAEItemStack findPrecise( final IAEItemStack itemStack )
{
if( itemStack == null )
{
@@ -74,7 +74,7 @@ public final class ItemList implements IItemList<IAEItemStack>
}
@Override
public Collection<IAEItemStack> findFuzzy( IAEItemStack filter, FuzzyMode fuzzy )
public Collection<IAEItemStack> findFuzzy( final IAEItemStack filter, final FuzzyMode fuzzy )
{
if( filter == null )
{
@@ -97,7 +97,7 @@ public final class ItemList implements IItemList<IAEItemStack>
{
final Collection<IAEItemStack> output = new LinkedList<IAEItemStack>();
for( IAEItemStack is : or.getAEEquivalents() )
for( final IAEItemStack is : or.getAEEquivalents() )
{
output.addAll( this.findFuzzyDamage( (AEItemStack) is, fuzzy, is.getItemDamage() == OreDictionary.WILDCARD_VALUE ) );
}
@@ -116,7 +116,7 @@ public final class ItemList implements IItemList<IAEItemStack>
}
@Override
public void addStorage( IAEItemStack option )
public void addStorage( final IAEItemStack option )
{
if( option == null )
{
@@ -142,7 +142,7 @@ public final class ItemList implements IItemList<IAEItemStack>
*/
@Override
public void addCrafting( IAEItemStack option )
public void addCrafting( final IAEItemStack option )
{
if( option == null )
{
@@ -165,7 +165,7 @@ public final class ItemList implements IItemList<IAEItemStack>
}
@Override
public void addRequestable( IAEItemStack option )
public void addRequestable( final IAEItemStack option )
{
if( option == null )
{
@@ -191,7 +191,7 @@ public final class ItemList implements IItemList<IAEItemStack>
@Override
public IAEItemStack getFirstItem()
{
for( IAEItemStack stackType : this )
for( final IAEItemStack stackType : this )
{
return stackType;
}
@@ -204,7 +204,7 @@ public final class ItemList implements IItemList<IAEItemStack>
{
int size = 0;
for( Map<IAEItemStack, IAEItemStack> element : this.records.values() )
for( final Map<IAEItemStack, IAEItemStack> element : this.records.values() )
{
size += element.size();
}
@@ -221,13 +221,13 @@ public final class ItemList implements IItemList<IAEItemStack>
@Override
public void resetStatus()
{
for( IAEItemStack i : this )
for( final IAEItemStack i : this )
{
i.reset();
}
}
private NavigableMap<IAEItemStack, IAEItemStack> getItemRecord( Item item )
private NavigableMap<IAEItemStack, IAEItemStack> getItemRecord( final Item item )
{
NavigableMap<IAEItemStack, IAEItemStack> itemRecords = this.records.get( item );
@@ -240,12 +240,12 @@ public final class ItemList implements IItemList<IAEItemStack>
return itemRecords;
}
private IAEItemStack putItemRecord( IAEItemStack itemStack )
private IAEItemStack putItemRecord( final IAEItemStack itemStack )
{
return this.getItemRecord( itemStack.getItem() ).put( itemStack, itemStack );
}
private Collection<IAEItemStack> findFuzzyDamage( AEItemStack filter, FuzzyMode fuzzy, boolean ignoreMeta )
private Collection<IAEItemStack> findFuzzyDamage( final AEItemStack filter, final FuzzyMode fuzzy, final boolean ignoreMeta )
{
final IAEItemStack low = filter.getLow( fuzzy, ignoreMeta );
final IAEItemStack high = filter.getHigh( fuzzy, ignoreMeta );
@@ -33,13 +33,13 @@ public class ItemModList implements IItemContainer<IAEItemStack>
final IItemContainer<IAEItemStack> backingStore;
final IItemContainer<IAEItemStack> overrides = AEApi.instance().storage().createItemList();
public ItemModList( IItemContainer<IAEItemStack> backend )
public ItemModList( final IItemContainer<IAEItemStack> backend )
{
this.backingStore = backend;
}
@Override
public void add( IAEItemStack option )
public void add( final IAEItemStack option )
{
IAEItemStack over = this.overrides.findPrecise( option );
if( over == null )
@@ -62,9 +62,9 @@ public class ItemModList implements IItemContainer<IAEItemStack>
}
@Override
public IAEItemStack findPrecise( IAEItemStack i )
public IAEItemStack findPrecise( final IAEItemStack i )
{
IAEItemStack over = this.overrides.findPrecise( i );
final IAEItemStack over = this.overrides.findPrecise( i );
if( over == null )
{
return this.backingStore.findPrecise( i );
@@ -73,7 +73,7 @@ public class ItemModList implements IItemContainer<IAEItemStack>
}
@Override
public Collection<IAEItemStack> findFuzzy( IAEItemStack input, FuzzyMode fuzzy )
public Collection<IAEItemStack> findFuzzy( final IAEItemStack input, final FuzzyMode fuzzy )
{
return this.overrides.findFuzzy( input, fuzzy );
}
@@ -31,7 +31,7 @@ public class MeaningfulFluidIterator<T extends IAEStack> implements Iterator<T>
private final Iterator<T> parent;
private T next;
public MeaningfulFluidIterator( Iterator<T> iterator )
public MeaningfulFluidIterator( final Iterator<T> iterator )
{
this.parent = iterator;
}
@@ -33,7 +33,7 @@ public class MeaningfulItemIterator<T extends IAEItemStack> implements Iterator<
private Iterator<T> innerIterater = null;
private T next;
public MeaningfulItemIterator( Iterator<NavigableMap<T, T>> iterator )
public MeaningfulItemIterator( final Iterator<NavigableMap<T, T>> iterator )
{
this.parent = iterator;
+21 -21
View File
@@ -48,7 +48,7 @@ public class OreHelper
private final LoadingCache<String, List<ItemStack>> oreDictCache = CacheBuilder.newBuilder().build( new CacheLoader<String, List<ItemStack>>()
{
@Override
public List<ItemStack> load( String oreName )
public List<ItemStack> load( final String oreName )
{
return OreDictionary.getOres( oreName );
}
@@ -63,9 +63,9 @@ public class OreHelper
*
* @return true if an ore entry exists, false otherwise
*/
public OreReference isOre( ItemStack itemStack )
public OreReference isOre( final ItemStack itemStack )
{
ItemRef ir = new ItemRef( itemStack );
final ItemRef ir = new ItemRef( itemStack );
if( !this.references.containsKey( ir ) )
{
@@ -73,9 +73,9 @@ public class OreHelper
final Collection<Integer> ores = ref.getOres();
final Collection<String> set = ref.getEquivalents();
Set<String> toAdd = new HashSet<String>();
final Set<String> toAdd = new HashSet<String>();
for( String ore : OreDictionary.getOreNames() )
for( final String ore : OreDictionary.getOreNames() )
{
// skip ore if it is a match already or null.
if( ore == null || toAdd.contains( ore ) )
@@ -83,7 +83,7 @@ public class OreHelper
continue;
}
for( ItemStack oreItem : this.oreDictCache.getUnchecked( ore ) )
for( final ItemStack oreItem : this.oreDictCache.getUnchecked( ore ) )
{
if( OreDictionary.itemMatches( oreItem, itemStack, false ) )
{
@@ -93,7 +93,7 @@ public class OreHelper
}
}
for( String ore : toAdd )
for( final String ore : toAdd )
{
set.add( ore );
ores.add( OreDictionary.getOreID( ore ) );
@@ -112,15 +112,15 @@ public class OreHelper
return this.references.get( ir );
}
public boolean sameOre( AEItemStack aeItemStack, IAEItemStack is )
public boolean sameOre( final AEItemStack aeItemStack, final IAEItemStack is )
{
OreReference a = aeItemStack.def.isOre;
OreReference b = aeItemStack.def.isOre;
final OreReference a = aeItemStack.def.isOre;
final OreReference b = aeItemStack.def.isOre;
return this.sameOre( a, b );
}
public boolean sameOre( OreReference a, OreReference b )
public boolean sameOre( final OreReference a, final OreReference b )
{
if( a == null || b == null )
{
@@ -132,8 +132,8 @@ public class OreHelper
return true;
}
Collection<Integer> bOres = b.getOres();
for( Integer ore : a.getOres() )
final Collection<Integer> bOres = b.getOres();
for( final Integer ore : a.getOres() )
{
if( bOres.contains( ore ) )
{
@@ -144,17 +144,17 @@ public class OreHelper
return false;
}
public boolean sameOre( AEItemStack aeItemStack, ItemStack o )
public boolean sameOre( final AEItemStack aeItemStack, final ItemStack o )
{
OreReference a = aeItemStack.def.isOre;
final OreReference a = aeItemStack.def.isOre;
if( a == null )
{
return false;
}
for( String oreName : a.getEquivalents() )
for( final String oreName : a.getEquivalents() )
{
for( ItemStack oreItem : this.oreDictCache.getUnchecked( oreName ) )
for( final ItemStack oreItem : this.oreDictCache.getUnchecked( oreName ) )
{
if( OreDictionary.itemMatches( oreItem, o, false ) )
{
@@ -166,7 +166,7 @@ public class OreHelper
return false;
}
public List<ItemStack> getCachedOres( String oreName )
public List<ItemStack> getCachedOres( final String oreName )
{
return this.oreDictCache.getUnchecked( oreName );
}
@@ -178,7 +178,7 @@ public class OreHelper
private final int damage;
private final int hash;
ItemRef( ItemStack stack )
ItemRef( final ItemStack stack )
{
this.ref = stack.getItem();
@@ -201,7 +201,7 @@ public class OreHelper
}
@Override
public boolean equals( Object obj )
public boolean equals( final Object obj )
{
if( obj == null )
{
@@ -211,7 +211,7 @@ public class OreHelper
{
return false;
}
ItemRef other = (ItemRef) obj;
final ItemRef other = (ItemRef) obj;
return this.damage == other.damage && this.ref == other.ref;
}
@@ -50,9 +50,9 @@ public class OreReference
this.aeOtherOptions = new ArrayList<IAEItemStack>( this.otherOptions.size() );
// SUMMON AE STACKS!
for( String oreName : this.otherOptions )
for( final String oreName : this.otherOptions )
{
for( ItemStack is : OreHelper.INSTANCE.getCachedOres( oreName ) )
for( final ItemStack is : OreHelper.INSTANCE.getCachedOres( oreName ) )
{
if( is.getItem() != null )
{
@@ -33,7 +33,7 @@ public class SharedSearchObject
public AESharedNBT shared;
NBTTagCompound compound;
public SharedSearchObject( Item itemID, int damageValue, NBTTagCompound tagCompound )
public SharedSearchObject( final Item itemID, final int damageValue, final NBTTagCompound tagCompound )
{
this.def = ( damageValue << Platform.DEF_OFFSET ) | Item.itemRegistry.getIDForObject( itemID );
this.hash = Platform.NBTOrderlessHash( tagCompound );
@@ -47,7 +47,7 @@ public class SharedSearchObject
}
@Override
public boolean equals( Object obj )
public boolean equals( final Object obj )
{
if( obj == null )
{
@@ -57,7 +57,7 @@ public class SharedSearchObject
{
return false;
}
SharedSearchObject other = (SharedSearchObject) obj;
final SharedSearchObject other = (SharedSearchObject) obj;
if( this.def == other.def && this.hash == other.hash )
{
return Platform.NBTEqualityTest( this.compound, other.compound );
@@ -32,7 +32,7 @@ public final class AEInvIterator implements Iterator<IAEItemStack>
private int counter = 0;
public AEInvIterator( AppEngInternalAEInventory inventory )
public AEInvIterator( final AppEngInternalAEInventory inventory )
{
this.inventory = inventory;
this.size = this.inventory.getSizeInventory();
@@ -28,7 +28,7 @@ public final class ChainedIterator<T> implements Iterator<T>
private int offset = 0;
public ChainedIterator( T... list )
public ChainedIterator( final T... list )
{
this.list = list;
}
@@ -42,7 +42,7 @@ public final class ChainedIterator<T> implements Iterator<T>
@Override
public T next()
{
T result = this.list[this.offset];
final T result = this.list[this.offset];
this.offset++;
return result;
}
@@ -32,7 +32,7 @@ public final class InvIterator implements Iterator<ItemStack>
private int counter = 0;
public InvIterator( IInventory inventory )
public InvIterator( final IInventory inventory )
{
this.inventory = inventory;
this.size = this.inventory.getSizeInventory();
@@ -47,7 +47,7 @@ public final class InvIterator implements Iterator<ItemStack>
@Override
public ItemStack next()
{
ItemStack result = this.inventory.getStackInSlot( this.counter );
final ItemStack result = this.inventory.getStackInSlot( this.counter );
this.counter++;
return result;
@@ -31,7 +31,7 @@ public final class ProxyNodeIterator implements Iterator<IGridNode>
{
private final Iterator<IGridHost> hosts;
public ProxyNodeIterator( Iterator<IGridHost> hosts )
public ProxyNodeIterator( final Iterator<IGridHost> hosts )
{
this.hosts = hosts;
}
@@ -45,7 +45,7 @@ public final class ProxyNodeIterator implements Iterator<IGridNode>
@Override
public IGridNode next()
{
IGridHost host = this.hosts.next();
final IGridHost host = this.hosts.next();
return host.getGridNode( ForgeDirection.UNKNOWN );
}
@@ -33,7 +33,7 @@ public class StackToSlotIterator implements Iterator<ItemSlot>
final Iterator<ItemStack> is;
int x = 0;
public StackToSlotIterator( Iterator<ItemStack> is )
public StackToSlotIterator( final Iterator<ItemStack> is )
{
this.is = is;
}
@@ -31,7 +31,7 @@ public class DefaultPriorityList<T extends IAEStack<T>> implements IPartitionLis
static final List NULL_LIST = new ArrayList();
@Override
public boolean isListed( T input )
public boolean isListed( final T input )
{
return false;
}
@@ -32,16 +32,16 @@ public class FuzzyPriorityList<T extends IAEStack<T>> implements IPartitionList<
final IItemList<T> list;
final FuzzyMode mode;
public FuzzyPriorityList( IItemList<T> in, FuzzyMode mode )
public FuzzyPriorityList( final IItemList<T> in, final FuzzyMode mode )
{
this.list = in;
this.mode = mode;
}
@Override
public boolean isListed( T input )
public boolean isListed( final T input )
{
Collection<T> out = this.list.findFuzzy( input, this.mode );
final Collection<T> out = this.list.findFuzzy( input, this.mode );
return out != null && !out.isEmpty();
}
@@ -31,7 +31,7 @@ public final class MergedPriorityList<T extends IAEStack<T>> implements IPartiti
private final Collection<IPartitionList<T>> positive = new ArrayList<IPartitionList<T>>();
private final Collection<IPartitionList<T>> negative = new ArrayList<IPartitionList<T>>();
public void addNewList( IPartitionList<T> list, boolean isWhitelist )
public void addNewList( final IPartitionList<T> list, final boolean isWhitelist )
{
if( isWhitelist )
{
@@ -44,9 +44,9 @@ public final class MergedPriorityList<T extends IAEStack<T>> implements IPartiti
}
@Override
public boolean isListed( T input )
public boolean isListed( final T input )
{
for( IPartitionList<T> l : this.negative )
for( final IPartitionList<T> l : this.negative )
{
if( l.isListed( input ) )
{
@@ -56,7 +56,7 @@ public final class MergedPriorityList<T extends IAEStack<T>> implements IPartiti
if( !this.positive.isEmpty() )
{
for( IPartitionList<T> l : this.positive )
for( final IPartitionList<T> l : this.positive )
{
if( l.isListed( input ) )
{
@@ -28,13 +28,13 @@ public class PrecisePriorityList<T extends IAEStack<T>> implements IPartitionLis
final IItemList<T> list;
public PrecisePriorityList( IItemList<T> in )
public PrecisePriorityList( final IItemList<T> in )
{
this.list = in;
}
@Override
public boolean isListed( T input )
public boolean isListed( final T input )
{
return this.list.findPrecise( input ) != null;
}