final variables and parameters
This commit is contained in:
@@ -51,7 +51,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;
|
||||
@@ -59,7 +59,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 )
|
||||
{
|
||||
@@ -96,7 +96,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
this.def.displayDamage = ( int ) ( is.getItem().getDurabilityForDisplay( is ) * Integer.MAX_VALUE );
|
||||
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 );
|
||||
@@ -110,20 +110,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" ) );
|
||||
@@ -132,7 +132,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 )
|
||||
{
|
||||
@@ -142,17 +142,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() );
|
||||
@@ -160,26 +160,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 );
|
||||
@@ -188,7 +188,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 )
|
||||
{
|
||||
@@ -204,7 +204,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.
|
||||
@@ -258,11 +258,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 ) )
|
||||
{
|
||||
@@ -273,8 +273,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
|
||||
{
|
||||
@@ -284,23 +284,23 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
}
|
||||
else if( mode == FuzzyMode.PERCENT_99 )
|
||||
{
|
||||
Item ai = a.getItem();
|
||||
Item bi = b.getItem();
|
||||
final Item ai = a.getItem();
|
||||
final Item bi = b.getItem();
|
||||
|
||||
return ( ai.getDurabilityForDisplay( a ) < 0.001f ) == ( bi.getDurabilityForDisplay( b ) < 0.001f );
|
||||
}
|
||||
else
|
||||
{
|
||||
Item ai = a.getItem();
|
||||
Item bi = b.getItem();
|
||||
final Item ai = a.getItem();
|
||||
final Item bi = b.getItem();
|
||||
|
||||
float percentDamageOfA = 1.0f - (float) ai.getDurabilityForDisplay(a);
|
||||
float percentDamageOfB = 1.0f - (float) bi.getDurabilityForDisplay(b);
|
||||
final float percentDamageOfA = 1.0f - (float) ai.getDurabilityForDisplay(a);
|
||||
final float percentDamageOfB = 1.0f - (float) bi.getDurabilityForDisplay(b);
|
||||
|
||||
return ( percentDamageOfA > mode.breakPoint ) == ( percentDamageOfB > mode.breakPoint );
|
||||
}
|
||||
}
|
||||
catch( Throwable e )
|
||||
catch( final Throwable e )
|
||||
{
|
||||
if( mode == FuzzyMode.IGNORE_ALL )
|
||||
{
|
||||
@@ -312,8 +312,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 );
|
||||
}
|
||||
@@ -326,7 +326,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 );
|
||||
|
||||
@@ -334,7 +334,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
|
||||
{
|
||||
@@ -344,23 +344,23 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
|
||||
}
|
||||
else if( mode == FuzzyMode.PERCENT_99 )
|
||||
{
|
||||
Item ai = a.getItem();
|
||||
Item bi = o.getItem();
|
||||
final Item ai = a.getItem();
|
||||
final Item bi = o.getItem();
|
||||
|
||||
return ( ai.getDurabilityForDisplay( a ) < 0.001f ) == ( bi.getDurabilityForDisplay( o ) < 0.001f );
|
||||
}
|
||||
else
|
||||
{
|
||||
Item ai = a.getItem();
|
||||
Item bi = o.getItem();
|
||||
final Item ai = a.getItem();
|
||||
final Item bi = o.getItem();
|
||||
|
||||
float percentDamageOfA = 1.0f - (float) ai.getDurabilityForDisplay(a);
|
||||
float percentDamageOfB = 1.0f - (float) bi.getDurabilityForDisplay(o);
|
||||
final float percentDamageOfA = 1.0f - (float) ai.getDurabilityForDisplay(a);
|
||||
final float percentDamageOfB = 1.0f - (float) bi.getDurabilityForDisplay(o);
|
||||
|
||||
return ( percentDamageOfA > mode.breakPoint ) == ( percentDamageOfB > mode.breakPoint );
|
||||
}
|
||||
}
|
||||
catch( Throwable e )
|
||||
catch( final Throwable e )
|
||||
{
|
||||
if( mode == FuzzyMode.IGNORE_ALL )
|
||||
{
|
||||
@@ -372,8 +372,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 );
|
||||
}
|
||||
@@ -396,7 +396,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;
|
||||
}
|
||||
@@ -428,7 +428,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() );
|
||||
@@ -450,13 +450,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 )
|
||||
{
|
||||
@@ -467,7 +467,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 )
|
||||
{
|
||||
@@ -484,7 +484,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 )
|
||||
{
|
||||
@@ -492,12 +492,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;
|
||||
@@ -531,21 +531,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;
|
||||
@@ -554,9 +554,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 ) );
|
||||
@@ -564,7 +564,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 );
|
||||
}
|
||||
@@ -602,7 +602,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 )
|
||||
{
|
||||
@@ -612,10 +612,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 )
|
||||
{
|
||||
@@ -643,7 +643,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;
|
||||
}
|
||||
|
||||
@@ -655,10 +655,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 )
|
||||
{
|
||||
@@ -686,7 +686,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;
|
||||
}
|
||||
|
||||
@@ -704,24 +704,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 );
|
||||
|
||||
Reference in New Issue
Block a user