Puts everywhere brackets

This commit is contained in:
thatsIch
2015-04-29 02:30:53 +02:00
parent 23aa8fd72d
commit 64ed05a1b4
465 changed files with 6726 additions and 14 deletions
@@ -66,7 +66,9 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
this.fluid = is.getFluid();
if( this.fluid == null )
{
throw new IllegalArgumentException( "Fluid is null." );
}
this.stackSize = is.amount;
this.setCraftable( false );
@@ -79,7 +81,9 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
{
ItemStack itemstack = ItemStack.loadItemStackFromNBT( i );
if( itemstack == null )
{
return null;
}
AEFluidStack fluid = AEFluidStack.create( itemstack );
// fluid.priority = i.getInteger( "Priority" );
fluid.stackSize = i.getLong( "Cnt" );
@@ -91,11 +95,17 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
public static AEFluidStack create( Object a )
{
if( a == null )
{
return null;
}
if( a instanceof AEFluidStack )
{
( (AEFluidStack) a ).copy();
}
if( a instanceof FluidStack )
{
return new AEFluidStack( (FluidStack) a );
}
return null;
}
@@ -135,7 +145,9 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
FluidStack fluidStack = FluidStack.loadFluidStackFromNBT( d );
if( fluidStack == null )
{
return null;
}
AEFluidStack fluid = AEFluidStack.create( fluidStack );
// fluid.priority = (int) priority;
@@ -149,7 +161,9 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
public void add( IAEFluidStack option )
{
if( option == null )
{
return;
}
// if ( priority < ((AEFluidStack) option).priority )
// priority = ((AEFluidStack) option).priority;
@@ -199,9 +213,13 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
i.setBoolean( "Craft", this.isCraftable() );
if( this.tagCompound != null )
{
i.setTag( "tag", (NBTTagCompound) this.tagCompound );
}
else
{
i.removeTag( "tag" );
}
}
@Override
@@ -287,16 +305,24 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
NBTTagCompound ta = (NBTTagCompound) this.tagCompound;
NBTTagCompound tb = is.tag;
if( ta == tb )
{
return true;
}
if( ( ta == null && tb == null ) || ( ta != null && ta.hasNoTags() && tb == null ) || ( tb != null && tb.hasNoTags() && ta == null ) || ( ta != null && ta.hasNoTags() && tb != null && tb.hasNoTags() ) )
{
return true;
}
if( ( ta == null && tb != null ) || ( ta != null && tb == null ) )
{
return false;
}
if( AESharedNBT.isShared( tb ) )
{
return ta == tb;
}
return Platform.NBTEqualityTest( ta, tb );
}
@@ -319,7 +345,9 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
{
FluidStack is = new FluidStack( this.fluid, (int) Math.min( Integer.MAX_VALUE, this.stackSize ) );
if( this.tagCompound != null )
{
is.tag = this.tagCompound.getNBTTagCompoundCopy();
}
return is;
}
@@ -75,9 +75,13 @@ public class AEItemDef
public boolean equals( Object obj )
{
if( obj == null )
{
return false;
}
if( this.getClass() != obj.getClass() )
{
return false;
}
AEItemDef other = (AEItemDef) obj;
return other.damageValue == this.damageValue && other.item == this.item && this.tagCompound == other.tagCompound;
}
@@ -90,10 +94,14 @@ public class AEItemDef
if( this.item == otherStack.getItem() && dmg == this.damageValue )
{
if( ( this.tagCompound != null ) == otherStack.hasTagCompound() )
{
return true;
}
if( this.tagCompound != null && otherStack.hasTagCompound() )
{
return Platform.NBTEqualityTest( this.tagCompound, otherStack.getTagCompound() );
}
return true;
}
@@ -76,7 +76,9 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
this.def = new AEItemDef( item );
if( this.def.item == null )
{
throw new InvalidParameterException( "This ItemStack is bad, it has a null item." );
}
/*
* Prevent an Item from changing the damage value on me... Either, this or a core mod.
@@ -97,7 +99,9 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
NBTTagCompound tagCompound = is.getTagCompound();
if( tagCompound != null )
{
this.def.tagCompound = (AESharedNBT) AESharedNBT.getSharedTagCompound( tagCompound, is );
}
this.stackSize = is.stackSize;
this.setCraftable( false );
@@ -110,11 +114,15 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
public static IAEItemStack loadItemStackFromNBT( NBTTagCompound i )
{
if( i == null )
{
return null;
}
ItemStack itemstack = ItemStack.loadItemStackFromNBT( i );
if( itemstack == null )
{
return null;
}
AEItemStack item = AEItemStack.create( itemstack );
// item.priority = i.getInteger( "Priority" );
@@ -168,7 +176,9 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
ItemStack itemstack = ItemStack.loadItemStackFromNBT( d );
if( itemstack == null )
{
return null;
}
AEItemStack item = AEItemStack.create( itemstack );
// item.priority = (int) priority;
@@ -182,7 +192,9 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
public void add( IAEItemStack option )
{
if( option == null )
{
return;
}
// if ( priority < ((AEItemStack) option).priority )
// priority = ((AEItemStack) option).priority;
@@ -237,9 +249,13 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
i.setShort( "Damage", (short) this.def.damageValue );
if( this.def.tagCompound != null )
{
i.setTag( "tag", this.def.tagCompound );
}
else
{
i.removeTag( "tag" );
}
}
@Override
@@ -250,7 +266,9 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
IAEItemStack o = (IAEItemStack) st;
if( this.sameOre( o ) )
{
return true;
}
if( o.getItem() == this.getItem() )
{
@@ -401,7 +419,9 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
{
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() );
}
return is;
}
@@ -428,7 +448,9 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
public boolean isSameType( IAEItemStack otherStack )
{
if( otherStack == null )
{
return false;
}
return this.def.equals( ( (AEItemStack) otherStack ).def );
}
@@ -437,7 +459,9 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
public boolean isSameType( ItemStack otherStack )
{
if( otherStack == null )
{
return false;
}
return this.def.isItem( otherStack );
}
@@ -464,16 +488,24 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
NBTTagCompound ta = this.def.tagCompound;
NBTTagCompound tb = is.getTagCompound();
if( ta == tb )
{
return true;
}
if( ( ta == null && tb == null ) || ( ta != null && ta.hasNoTags() && tb == null ) || ( tb != null && tb.hasNoTags() && ta == null ) || ( ta != null && ta.hasNoTags() && tb != null && tb.hasNoTags() ) )
{
return true;
}
if( ( ta == null && tb != null ) || ( ta != null && tb == null ) )
{
return false;
}
if( AESharedNBT.isShared( tb ) )
{
return ta == tb;
}
return Platform.NBTEqualityTest( ta, tb );
}
@@ -492,15 +524,21 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
{
int id = this.def.itemID - b.def.itemID;
if( id != 0 )
{
return id;
}
int damageValue = this.def.damageValue - b.def.damageValue;
if( damageValue != 0 )
{
return damageValue;
}
int displayDamage = this.def.displayDamage - b.def.displayDamage;
if( displayDamage != 0 )
{
return displayDamage;
}
return ( this.def.tagCompound == b.def.tagCompound ) ? 0 : this.compareNBT( b.def );
}
@@ -509,7 +547,9 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
{
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 ) );
}
return nbt;
}
@@ -522,7 +562,9 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
public List getToolTip()
{
if( this.def.tooltip != null )
{
return this.def.tooltip;
}
return this.def.tooltip = Platform.getTooltip( this.getItemStack() );
}
@@ -531,7 +573,9 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
public String getDisplayName()
{
if( this.def.displayName != null )
{
return this.def.displayName;
}
return this.def.displayName = Platform.getItemDisplayName( this.getItemStack() );
}
@@ -540,7 +584,9 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
public String getModID()
{
if( this.def.uniqueID != null )
{
return this.getModName( this.def.uniqueID );
}
return this.getModName( this.def.uniqueID = GameRegistry.findUniqueIdentifierFor( this.def.item ) );
}
@@ -548,7 +594,9 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
private String getModName( UniqueIdentifier uniqueIdentifier )
{
if( uniqueIdentifier == null )
{
return "** Null";
}
return uniqueIdentifier.modId == null ? "** Null" : uniqueIdentifier.modId;
}
@@ -574,9 +622,13 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
else if( fuzzy == FuzzyMode.PERCENT_99 )
{
if( this.def.damageValue == 0 )
{
newDef.displayDamage = 0;
}
else
{
newDef.displayDamage = 1;
}
}
else
{
@@ -613,9 +665,13 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
else if( fuzzy == FuzzyMode.PERCENT_99 )
{
if( this.def.damageValue == 0 )
{
newDef.displayDamage = 0;
}
else
{
newDef.displayDamage = this.def.maxDamage + 1;
}
}
else
{
@@ -77,15 +77,21 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
public static synchronized NBTTagCompound getSharedTagCompound( NBTTagCompound tagCompound, ItemStack s )
{
if( tagCompound.hasNoTags() )
{
return null;
}
Item item = s.getItem();
int meta = -1;
if( s.getItem() != null && s.isItemStackDamageable() && s.getHasSubtypes() )
{
meta = s.getItemDamage();
}
if( isShared( tagCompound ) )
{
return tagCompound;
}
SharedSearchObject sso = new SharedSearchObject( item, meta, tagCompound );
@@ -94,7 +100,9 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
{
SharedSearchObject cg = c.get();
if( cg != null )
{
return cg.shared; // I don't think I really need to check this
}
// as its already certain to exist..
}
@@ -160,7 +168,9 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
public boolean equals( Object par1Obj )
{
if( par1Obj instanceof AESharedNBT )
{
return this == par1Obj;
}
return super.equals( par1Obj );
}
@@ -172,7 +182,9 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
public boolean comparePreciseWithRegistry( AESharedNBT tagCompound )
{
if( this == tagCompound )
{
return true;
}
if( this.comp != null && tagCompound.comp != null )
{
@@ -185,12 +197,18 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
public boolean compareFuzzyWithRegistry( AESharedNBT tagCompound )
{
if( this == tagCompound )
{
return true;
}
if( tagCompound == null )
{
return false;
}
if( this.comp == tagCompound.comp )
{
return true;
}
if( this.comp != null )
{
@@ -154,13 +154,21 @@ public abstract class AEStack<StackType extends IAEStack> implements IAEStack<St
byte getType( long num )
{
if( num <= 255 )
{
return 0;
}
else if( num <= 65535 )
{
return 1;
}
else if( num <= 4294967295L )
{
return 2;
}
else
{
return 3;
}
}
abstract boolean hasTagCompound();
@@ -172,12 +180,20 @@ public abstract class AEStack<StackType extends IAEStack> implements IAEStack<St
void putPacketValue( ByteBuf tag, long num )
{
if( num <= 255 )
{
tag.writeByte( (byte) ( num + Byte.MIN_VALUE ) );
}
else if( num <= 65535 )
{
tag.writeShort( (short) ( num + Short.MIN_VALUE ) );
}
else if( num <= 4294967295L )
{
tag.writeInt( (int) ( num + Integer.MIN_VALUE ) );
}
else
{
tag.writeLong( num );
}
}
}
@@ -57,7 +57,9 @@ public final class ItemList<StackType extends IAEStack> implements IItemList<Sta
public synchronized void add( StackType option )
{
if( this.checkStackType( option ) )
{
return;
}
StackType st = this.records.get( option );
@@ -76,10 +78,14 @@ public final class ItemList<StackType extends IAEStack> implements IItemList<Sta
private boolean checkStackType( StackType st )
{
if( st == null )
{
return true;
}
if( !this.clz.isInstance( st ) )
{
throw new IllegalArgumentException( "WRONG TYPE - got " + st.getClass().getName() + " expected " + this.clz.getName() );
}
return false;
}
@@ -88,7 +94,9 @@ public final class ItemList<StackType extends IAEStack> implements IItemList<Sta
public synchronized StackType findPrecise( StackType i )
{
if( this.checkStackType( i ) )
{
return null;
}
StackType is = this.records.get( i );
if( is != null )
@@ -103,7 +111,9 @@ public final class ItemList<StackType extends IAEStack> implements IItemList<Sta
public Collection<StackType> findFuzzy( StackType filter, FuzzyMode fuzzy )
{
if( this.checkStackType( filter ) )
{
return new ArrayList<StackType>();
}
if( filter instanceof IAEFluidStack )
{
@@ -131,7 +141,9 @@ public final class ItemList<StackType extends IAEStack> implements IItemList<Sta
Collection<StackType> output = new LinkedList<StackType>();
for( IAEItemStack is : or.getAEEquivalents() )
{
output.addAll( this.findFuzzyDamage( (AEItemStack) is, fuzzy, is.getItemDamage() == OreDictionary.WILDCARD_VALUE ) );
}
return output;
}
@@ -158,7 +170,9 @@ public final class ItemList<StackType extends IAEStack> implements IItemList<Sta
// stored.
{
if( this.checkStackType( option ) )
{
return;
}
StackType st = this.records.get( option );
@@ -184,7 +198,9 @@ public final class ItemList<StackType extends IAEStack> implements IItemList<Sta
// craftable.
{
if( this.checkStackType( option ) )
{
return;
}
StackType st = this.records.get( option );
@@ -209,7 +225,9 @@ public final class ItemList<StackType extends IAEStack> implements IItemList<Sta
// requestable.
{
if( this.checkStackType( option ) )
{
return;
}
StackType st = this.records.get( option );
@@ -255,6 +273,8 @@ public final class ItemList<StackType extends IAEStack> implements IItemList<Sta
public synchronized void resetStatus()
{
for( StackType i : this )
{
i.reset();
}
}
}
@@ -46,7 +46,9 @@ public class ItemModList implements IItemContainer<IAEItemStack>
{
over = this.backingStore.findPrecise( option );
if( over == null )
{
this.overrides.add( option );
}
else
{
option.add( over );
@@ -54,7 +56,9 @@ public class ItemModList implements IItemContainer<IAEItemStack>
}
}
else
{
this.overrides.add( option );
}
}
@Override
@@ -62,7 +66,9 @@ public class ItemModList implements IItemContainer<IAEItemStack>
{
IAEItemStack over = this.overrides.findPrecise( i );
if( over == null )
{
return this.backingStore.findPrecise( i );
}
return over;
}
@@ -100,9 +100,13 @@ public class OreHelper
}
if( !set.isEmpty() )
{
this.references.put( ir, ref );
}
else
{
this.references.put( ir, null );
}
}
return this.references.get( ir );
@@ -119,16 +123,22 @@ public class OreHelper
public boolean sameOre( OreReference a, OreReference b )
{
if( a == null || b == null )
{
return false;
}
if( a == b )
{
return true;
}
Collection<Integer> bOres = b.getOres();
for( Integer ore : a.getOres() )
{
if( bOres.contains( ore ) )
{
return true;
}
}
return false;
@@ -138,14 +148,18 @@ public class OreHelper
{
OreReference a = aeItemStack.def.isOre;
if( a == null )
{
return false;
}
for( String oreName : a.getEquivalents() )
{
for( ItemStack oreItem : this.oreDictCache.getUnchecked( oreName ) )
{
if( OreDictionary.itemMatches( oreItem, o, false ) )
{
return true;
}
}
}
@@ -169,9 +183,13 @@ public class OreHelper
this.ref = stack.getItem();
if( stack.getItem().isDamageable() )
{
this.damage = 0; // IGNORED
}
else
{
this.damage = stack.getItemDamage(); // might be important...
}
this.hash = this.ref.hashCode() ^ this.damage;
}
@@ -186,9 +204,13 @@ public class OreHelper
public boolean equals( Object obj )
{
if( obj == null )
{
return false;
}
if( this.getClass() != obj.getClass() )
{
return false;
}
ItemRef other = (ItemRef) obj;
return this.damage == other.damage && this.ref == other.ref;
}
@@ -50,9 +50,13 @@ public class SharedSearchObject
public boolean equals( Object obj )
{
if( obj == null )
{
return false;
}
if( this.getClass() != obj.getClass() )
{
return false;
}
SharedSearchObject other = (SharedSearchObject) obj;
if( this.def == other.def && this.hash == other.hash )
{