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
@@ -44,7 +44,9 @@ public class BlockUpdate implements Callable
public Object call() throws Exception
{
if( this.w.blockExists( this.x, this.y, this.z ) )
{
this.w.notifyBlocksOfNeighborChange( this.x, this.y, this.z, Platform.AIR );
}
return true;
}
@@ -54,7 +54,9 @@ public class ClassInstantiation<T>
{
Class<?> cz = this.args[idx].getClass();
if( !this.isClassMatch( paramTypes[idx], cz, this.args[idx] ) )
{
valid = false;
}
}
if( valid )
@@ -86,7 +88,9 @@ public class ClassInstantiation<T>
private boolean isClassMatch( Class<?> expected, Class<?> got, Object value )
{
if( value == null && !expected.isPrimitive() )
{
return true;
}
expected = this.condense( expected, Boolean.class, Character.class, Byte.class, Short.class, Integer.class, Long.class, Float.class, Double.class );
got = this.condense( got, Boolean.class, Character.class, Byte.class, Short.class, Integer.class, Long.class, Float.class, Double.class );
@@ -103,7 +107,9 @@ public class ClassInstantiation<T>
try
{
if( expected == clz.getField( "TYPE" ).get( null ) )
{
return clz;
}
}
catch( Throwable t )
{
@@ -60,7 +60,9 @@ public final class ConfigManager implements IConfigManager
Enum<?> oldValue = this.settings.get( settingName );
if( oldValue != null )
{
return oldValue;
}
throw new IllegalStateException( "Invalid Config setting. Expected a non-null value for " + settingName );
}
@@ -47,7 +47,9 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
public static InventoryAdaptor getAdaptor( Object te, ForgeDirection d )
{
if( te == null )
{
return null;
}
IBetterStorage bs = (IBetterStorage) ( AppEng.instance.isIntegrationEnabled( IntegrationType.BetterStorage ) ? AppEng.instance.getIntegration( IntegrationType.BetterStorage ) : null );
@@ -75,13 +77,17 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
ISidedInventory si = (ISidedInventory) te;
int[] slots = si.getAccessibleSlotsFromSide( d.ordinal() );
if( si.getSizeInventory() > 0 && slots != null && slots.length > 0 )
{
return new AdaptorIInventory( new WrapperMCISidedInventory( si, d ) );
}
}
else if( te instanceof IInventory )
{
IInventory i = (IInventory) te;
if( i.getSizeInventory() > 0 )
{
return new AdaptorIInventory( i );
}
}
return null;
@@ -40,7 +40,9 @@ public class ItemSorters
public int compare( IAEItemStack o1, IAEItemStack o2 )
{
if( Direction == SortDir.ASCENDING )
{
return Platform.getItemDisplayName( o1 ).compareToIgnoreCase( Platform.getItemDisplayName( o2 ) );
}
return Platform.getItemDisplayName( o2 ).compareToIgnoreCase( Platform.getItemDisplayName( o1 ) );
}
};
@@ -54,14 +56,18 @@ public class ItemSorters
AEItemStack op2 = (AEItemStack) o2;
if( Direction == SortDir.ASCENDING )
{
return this.secondarySort( op2.getModID().compareToIgnoreCase( op1.getModID() ), o1, o2 );
}
return this.secondarySort( op1.getModID().compareToIgnoreCase( op2.getModID() ), o2, o1 );
}
private int secondarySort( int compareToIgnoreCase, IAEItemStack o1, IAEItemStack o2 )
{
if( compareToIgnoreCase == 0 )
{
return Platform.getItemDisplayName( o2 ).compareToIgnoreCase( Platform.getItemDisplayName( o1 ) );
}
return compareToIgnoreCase;
}
@@ -73,7 +79,9 @@ public class ItemSorters
public int compare( IAEItemStack o1, IAEItemStack o2 )
{
if( Direction == SortDir.ASCENDING )
{
return compareLong( o2.getStackSize(), o1.getStackSize() );
}
return compareLong( o1.getStackSize(), o2.getStackSize() );
}
};
@@ -85,12 +93,16 @@ public class ItemSorters
public int compare( IAEItemStack o1, IAEItemStack o2 )
{
if( api == null )
{
return CONFIG_BASED_SORT_BY_NAME.compare( o1, o2 );
}
int cmp = api.compareItems( o1.getItemStack(), o2.getItemStack() );
if( Direction == SortDir.ASCENDING )
{
return cmp;
}
return -cmp;
}
};
@@ -98,38 +110,56 @@ public class ItemSorters
public static void init()
{
if( api != null )
{
return;
}
if( AppEng.instance.isIntegrationEnabled( IntegrationType.InvTweaks ) )
{
api = (IInvTweaks) AppEng.instance.getIntegration( IntegrationType.InvTweaks );
}
else
{
api = null;
}
}
public static int compareInt( int a, int b )
{
if( a == b )
{
return 0;
}
if( a < b )
{
return -1;
}
return 1;
}
public static int compareLong( long a, long b )
{
if( a == b )
{
return 0;
}
if( a < b )
{
return -1;
}
return 1;
}
public static int compareDouble( double a, double b )
{
if( a == b )
{
return 0;
}
if( a < b )
{
return -1;
}
return 1;
}
}
+176
View File
@@ -196,10 +196,14 @@ public class Platform
String unitName = displayUnits.name();
if( displayUnits == PowerUnits.WA )
{
unitName = "J";
}
if( displayUnits == PowerUnits.MK )
{
unitName = "J";
}
while( p > 1000 && offset < preFixes.length )
{
@@ -244,9 +248,13 @@ public class Platform
do
{
if( backwards )
{
ce = prevEnum( ce );
}
else
{
ce = nextEnum( ce );
}
}
while( !ValidOptions.contains( ce ) || isNotValidSetting( ce ) );
@@ -262,16 +270,22 @@ public class Platform
int pLoc = ce.ordinal() - 1;
if( pLoc < 0 )
{
pLoc = valList.size() - 1;
}
if( pLoc < 0 || pLoc >= valList.size() )
{
pLoc = 0;
}
int pos = 0;
for( Object g : valList )
{
if( pos == pLoc )
{
return (T) g;
}
pos++;
}
@@ -287,16 +301,22 @@ public class Platform
int pLoc = ce.ordinal() + 1;
if( pLoc >= valList.size() )
{
pLoc = 0;
}
if( pLoc < 0 || pLoc >= valList.size() )
{
pLoc = 0;
}
int pos = 0;
for( Object g : valList )
{
if( pos == pLoc )
{
return (T) g;
}
pos++;
}
@@ -306,13 +326,19 @@ public class Platform
private static boolean isNotValidSetting( Enum e )
{
if( e == SortOrder.INVTWEAKS && !AppEng.instance.isIntegrationEnabled( IntegrationType.InvTweaks ) )
{
return true;
}
if( e == SearchBoxMode.NEI_AUTOSEARCH && !AppEng.instance.isIntegrationEnabled( IntegrationType.NEI ) )
{
return true;
}
if( e == SearchBoxMode.NEI_MANUAL_SEARCH && !AppEng.instance.isIntegrationEnabled( IntegrationType.NEI ) )
{
return true;
}
return false;
}
@@ -320,7 +346,9 @@ public class Platform
public static void openGUI( @Nonnull EntityPlayer p, @Nullable TileEntity tile, @Nullable ForgeDirection side, @Nonnull GuiBridge type )
{
if( isClient() )
{
return;
}
int x = (int) p.posX;
int y = (int) p.posY;
@@ -335,11 +363,17 @@ public class Platform
if( ( type.getType().isItem() && tile == null ) || type.hasPermissions( tile, x, y, z, side, p ) )
{
if( tile == null && type.getType() == GuiHostType.ITEM )
{
p.openGui( AppEng.instance, type.ordinal() << 4 | ( 0 << 3 ), p.getEntityWorld(), p.inventory.currentItem, 0, 0 );
}
else if( tile == null || type.getType() == GuiHostType.ITEM )
{
p.openGui( AppEng.instance, type.ordinal() << 4 | ( 1 << 3 ), p.getEntityWorld(), x, y, z );
}
else
{
p.openGui( AppEng.instance, type.ordinal() << 4 | ( side.ordinal() ), tile.getWorldObj(), x, y, z );
}
}
}
@@ -378,22 +412,34 @@ public class Platform
public static boolean sameStackStags( ItemStack a, ItemStack b )
{
if( a == null && b == null )
{
return true;
}
if( a == null || b == null )
{
return false;
}
if( a == b )
{
return true;
}
NBTTagCompound ta = a.getTagCompound();
NBTTagCompound tb = b.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 both tags are shared this is easy...
if( AESharedNBT.isShared( ta ) && AESharedNBT.isShared( tb ) )
@@ -426,7 +472,9 @@ public class Platform
Set<String> cB = ctB.func_150296_c();
if( cA.size() != cB.size() )
{
return false;
}
for( String name : cA )
{
@@ -451,20 +499,28 @@ public class Platform
NBTTagList lA = (NBTTagList) A;
NBTTagList lB = (NBTTagList) B;
if( lA.tagCount() != lB.tagCount() )
{
return false;
}
List<NBTBase> tag = tagList( lA );
List<NBTBase> aTag = tagList( lB );
if( tag.size() != aTag.size() )
{
return false;
}
for( int x = 0; x < tag.size(); x++ )
{
if( aTag.get( x ) == null )
{
return false;
}
if( !NBTEqualityTest( tag.get( x ), aTag.get( x ) ) )
{
return false;
}
}
return true;
@@ -624,7 +680,9 @@ public class Platform
}
if( out == null )
{
return new ItemStack[0];
}
return out.toArray( new ItemStack[out.size()] );
}
@@ -739,7 +797,9 @@ public class Platform
{
teB = teA.getWorldObj().getTileEntity( teA.xCoord + 1, teA.yCoord, teA.zCoord );
if( !( teB instanceof TileEntityChest ) )
{
teB = null;
}
}
if( teB == null )
@@ -748,7 +808,9 @@ public class Platform
{
teB = teA.getWorldObj().getTileEntity( teA.xCoord - 1, teA.yCoord, teA.zCoord );
if( !( teB instanceof TileEntityChest ) )
{
teB = null;
}
else
{
TileEntityChest x = teA;
@@ -764,7 +826,9 @@ public class Platform
{
teB = teA.getWorldObj().getTileEntity( teA.xCoord, teA.yCoord, teA.zCoord + 1 );
if( !( teB instanceof TileEntityChest ) )
{
teB = null;
}
}
}
@@ -774,7 +838,9 @@ public class Platform
{
teB = teA.getWorldObj().getTileEntity( teA.xCoord, teA.yCoord, teA.zCoord - 1 );
if( !( teB instanceof TileEntityChest ) )
{
teB = null;
}
else
{
TileEntityChest x = teA;
@@ -785,7 +851,9 @@ public class Platform
}
if( teB == null )
{
return teA;
}
return new InventoryLargeChest( "", teA, (TileEntityChest) teB );
}
@@ -820,7 +888,9 @@ public class Platform
public static List getTooltip( Object o )
{
if( o == null )
{
return new ArrayList();
}
ItemStack itemStack = null;
if( o instanceof AEItemStack )
@@ -829,9 +899,13 @@ public class Platform
return ais.getToolTip();
}
else if( o instanceof ItemStack )
{
itemStack = (ItemStack) o;
}
else
{
return new ArrayList();
}
try
{
@@ -846,7 +920,9 @@ public class Platform
public static String getModId( IAEItemStack is )
{
if( is == null )
{
return "** Null";
}
String n = ( (AEItemStack) is ).getModID();
return n == null ? "** Null" : n;
@@ -855,7 +931,9 @@ public class Platform
public static String getItemDisplayName( Object o )
{
if( o == null )
{
return "** Null";
}
ItemStack itemStack = null;
if( o instanceof AEItemStack )
@@ -864,15 +942,21 @@ public class Platform
return n == null ? "** Null" : n;
}
else if( o instanceof ItemStack )
{
itemStack = (ItemStack) o;
}
else
{
return "**Invalid Object";
}
try
{
String name = itemStack.getDisplayName();
if( name == null || name.isEmpty() )
{
name = itemStack.getItem().getUnlocalizedName( itemStack );
}
return name == null ? "** Null" : name;
}
catch( Exception errA )
@@ -892,10 +976,14 @@ public class Platform
public static boolean hasSpecialComparison( IAEItemStack willAdd )
{
if( willAdd == null )
{
return false;
}
IAETagCompound tag = willAdd.getTagCompound();
if( tag != null && tag.getSpecialComparison() != null )
{
return true;
}
return false;
}
@@ -904,7 +992,9 @@ public class Platform
if( AESharedNBT.isShared( willAdd.getTagCompound() ) )
{
if( ( (AESharedNBT) willAdd.getTagCompound() ).getSpecialComparison() != null )
{
return true;
}
}
return false;
}
@@ -938,7 +1028,9 @@ public class Platform
public static boolean isChargeable( ItemStack i )
{
if( i == null )
{
return false;
}
Item it = i.getItem();
if( it instanceof IAEItemPowerStorage )
{
@@ -950,11 +1042,15 @@ public class Platform
public static EntityPlayer getPlayer( WorldServer w )
{
if( w == null )
{
throw new InvalidParameterException( "World is null." );
}
EntityPlayer wrp = FAKE_PLAYERS.get( w );
if( wrp != null )
{
return wrp;
}
EntityPlayer p = FakePlayerFactory.getMinecraft( w );
FAKE_PLAYERS.put( w, p );
@@ -998,7 +1094,9 @@ public class Platform
for( int x = 0; x < l.length; x++ )
{
if( l[x] == null )
{
return x;
}
}
return -1;
}
@@ -1014,14 +1112,18 @@ public class Platform
}
index--;
if( i.hasNext() )
{
return i.next();
}
return null; // wtf?
}
public static ForgeDirection rotateAround( ForgeDirection forward, ForgeDirection axis )
{
if( axis == ForgeDirection.UNKNOWN || forward == ForgeDirection.UNKNOWN )
{
return forward;
}
switch( forward )
{
@@ -1201,7 +1303,9 @@ public class Platform
OreReference bOR = OreHelper.INSTANCE.isOre( b );
if( OreHelper.INSTANCE.sameOre( aOR, bOR ) )
{
return true;
}
/*
* // test ore dictionary.. int OreID = getOreID( a ); if ( OreID != -1 ) return OreID == getOreID( b );
@@ -1286,7 +1390,9 @@ public class Platform
{
// prevent killing / flying of mounts.
if( entity1.riddenByEntity == p )
{
continue;
}
f1 = 0.3F;
AxisAlignedBB boundingBox = entity1.boundingBox.expand( f1, f1, f1 );
@@ -1341,7 +1447,9 @@ public class Platform
long retrieved = 0;
if( possible != null )
{
retrieved = possible.getStackSize();
}
double availablePower = energy.extractAEPower( retrieved, Actionable.SIMULATE, PowerMultiplier.CONFIG );
@@ -1371,7 +1479,9 @@ public class Platform
long stored = input.getStackSize();
if( possible != null )
{
stored -= possible.getStackSize();
}
double availablePower = energy.extractAEPower( stored, Actionable.SIMULATE, PowerMultiplier.CONFIG );
@@ -1424,7 +1534,9 @@ public class Platform
if( myItems != null )
{
for( IAEItemStack is : myItems.getAvailableItems( itemChanges ) )
{
is.setStackSize( -is.getStackSize() );
}
}
IMEInventory<IAEFluidStack> myFluids = AEApi.instance().registries().cell().getCellInventory( removed, null, StorageChannel.FLUIDS );
@@ -1432,7 +1544,9 @@ public class Platform
if( myFluids != null )
{
for( IAEFluidStack is : myFluids.getAvailableItems( fluidChanges ) )
{
is.setStackSize( -is.getStackSize() );
}
}
}
@@ -1441,12 +1555,16 @@ public class Platform
IMEInventory<IAEItemStack> myItems = AEApi.instance().registries().cell().getCellInventory( added, null, StorageChannel.ITEMS );
if( myItems != null )
{
myItems.getAvailableItems( itemChanges );
}
IMEInventory<IAEFluidStack> myFluids = AEApi.instance().registries().cell().getCellInventory( added, null, StorageChannel.FLUIDS );
if( myFluids != null )
{
myFluids.getAvailableItems( fluidChanges );
}
}
gs.postAlterationOfStoredItems( StorageChannel.ITEMS, itemChanges, src );
@@ -1457,10 +1575,14 @@ public class Platform
LinkedList<T> changes = new LinkedList<T>();
for( T is : before )
{
is.setStackSize( -is.getStackSize() );
}
for( T is : after )
{
before.add( is );
}
for( T is : before )
{
@@ -1471,30 +1593,44 @@ public class Platform
}
if( !changes.isEmpty() )
{
meMonitorPassthrough.postChange( null, changes, source );
}
}
public static int generateTileHash( TileEntity target )
{
if( target == null )
{
return 0;
}
int hash = target.hashCode();
if( target instanceof ITileStorageMonitorable )
{
return 0;
}
else if( target instanceof TileEntityChest )
{
TileEntityChest chest = (TileEntityChest) target;
chest.checkForAdjacentChests();
if( chest.adjacentChestZNeg != null )
{
hash ^= chest.adjacentChestZNeg.hashCode();
}
else if( chest.adjacentChestZPos != null )
{
hash ^= chest.adjacentChestZPos.hashCode();
}
else if( chest.adjacentChestXPos != null )
{
hash ^= chest.adjacentChestXPos.hashCode();
}
else if( chest.adjacentChestXNeg != null )
{
hash ^= chest.adjacentChestXNeg.hashCode();
}
}
else if( target instanceof IInventory )
{
@@ -1509,7 +1645,9 @@ public class Platform
int[] sides = ( (ISidedInventory) target ).getAccessibleSlotsFromSide( dir.ordinal() );
if( sides == null )
{
return 0;
}
for( Integer Side : sides )
{
@@ -1527,9 +1665,13 @@ public class Platform
public static boolean securityCheck( GridNode a, GridNode b )
{
if( a.lastSecurityKey == -1 && b.lastSecurityKey == -1 )
{
return false;
}
else if( a.lastSecurityKey == b.lastSecurityKey )
{
return false;
}
boolean a_isSecure = isPowered( a.getGrid() ) && a.lastSecurityKey != -1;
boolean b_isSecure = isPowered( b.getGrid() ) && b.lastSecurityKey != -1;
@@ -1541,13 +1683,19 @@ public class Platform
// can't do that son...
if( a_isSecure && b_isSecure )
{
return true;
}
if( !a_isSecure && b_isSecure )
{
return checkPlayerPermissions( b.getGrid(), a.playerID );
}
if( a_isSecure && !b_isSecure )
{
return checkPlayerPermissions( a.getGrid(), b.playerID );
}
return false;
}
@@ -1555,7 +1703,9 @@ public class Platform
private static boolean isPowered( IGrid grid )
{
if( grid == null )
{
return false;
}
IEnergyGrid eg = grid.getCache( IEnergyGrid.class );
return eg.isNetworkPowered();
@@ -1564,15 +1714,21 @@ public class Platform
private static boolean checkPlayerPermissions( IGrid grid, int playerID )
{
if( grid == null )
{
return false;
}
ISecurityGrid gs = grid.getCache( ISecurityGrid.class );
if( gs == null )
{
return false;
}
if( !gs.isAvailable() )
{
return false;
}
return !gs.hasPermission( playerID, SecurityPermissions.BUILD );
}
@@ -1629,13 +1785,17 @@ public class Platform
IActionHost te = ( (MachineSource) src ).via;
IGridNode n = te.getActionableNode();
if( n == null )
{
return false;
}
int playerID = n.getPlayerID();
return gridProxy.getSecurity().hasPermission( playerID, SecurityPermissions.BUILD );
}
else
{
return false;
}
}
catch( GridAccessException gae )
{
@@ -1648,7 +1808,9 @@ public class Platform
if( energySrc.extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.9 )
{
if( providedTemplate == null )
{
return null;
}
AEItemStack ae_req = AEItemStack.create( providedTemplate );
ae_req.setStackSize( 1 );
@@ -1706,7 +1868,9 @@ public class Platform
if( ol != null && op != null && ol.getItem() == op.getItem() )
{
if( ol.isItemStackDamageable() )
{
return true;
}
return ol.getItemDamage() == ol.getItemDamage();
}
return false;
@@ -1725,7 +1889,9 @@ public class Platform
public static ItemStack getContainerItem( ItemStack stackInSlot )
{
if( stackInSlot == null )
{
return null;
}
Item i = stackInSlot.getItem();
if( i == null || !i.hasContainerItem( stackInSlot ) )
@@ -1740,7 +1906,9 @@ public class Platform
ItemStack ci = i.getContainerItem( stackInSlot.copy() );
if( ci != null && ci.isItemStackDamageable() && ci.getItemDamage() == ci.getMaxDamage() )
{
ci = null;
}
return ci;
}
@@ -1748,13 +1916,17 @@ public class Platform
public static void notifyBlocksOfNeighbors( World worldObj, int xCoord, int yCoord, int zCoord )
{
if( !worldObj.isRemote )
{
TickHandler.INSTANCE.addCallable( worldObj, new BlockUpdate( worldObj, xCoord, yCoord, zCoord ) );
}
}
public static boolean canRepair( AEFeature type, ItemStack a, ItemStack b )
{
if( b == null || a == null )
{
return false;
}
if( type == AEFeature.CertusQuartzTools )
{
@@ -1764,7 +1936,9 @@ public class Platform
}
if( type == AEFeature.NetherQuartzTools )
{
return Items.quartz == b.getItem();
}
return false;
}
@@ -1824,7 +1998,9 @@ public class Platform
}
if( sendToAllPlayersWatchingChunk != null )
{
sendToAllPlayersWatchingChunk.invoke( playerInstance, new S21PacketChunkData( c, false, verticalBits ) );
}
}
}
}
@@ -66,7 +66,9 @@ public enum ReadableNumberConverter implements ISlimReadableNumberConverter, IWi
final String numberString = Long.toString( number );
int numberSize = numberString.length();
if( numberSize <= width )
{
return numberString;
}
long base = number;
double last = base * 1000;
@@ -84,14 +84,22 @@ public class AdaptorBCPipe extends InventoryAdaptor
public ItemStack addItems( ItemStack toBeAdded )
{
if( this.i == null )
{
return toBeAdded;
}
if( toBeAdded == null )
{
return null;
}
if( toBeAdded.stackSize == 0 )
{
return null;
}
if( this.bc.addItemsToPipe( this.i, toBeAdded, this.d ) )
{
return null;
}
return toBeAdded;
}
@@ -99,7 +107,9 @@ public class AdaptorBCPipe extends InventoryAdaptor
public ItemStack simulateAdd( ItemStack toBeSimulated )
{
if( this.i == null )
{
return toBeSimulated;
}
return null;
}
@@ -54,9 +54,13 @@ public class AdaptorIInventory extends InventoryAdaptor
{
int boundAmounts = amount;
if( boundAmounts > is.stackSize )
{
boundAmounts = is.stackSize;
}
if( destination != null && !destination.canInsert( is ) )
{
boundAmounts = 0;
}
if( boundAmounts > 0 )
{
@@ -108,9 +112,13 @@ public class AdaptorIInventory extends InventoryAdaptor
{
int boundAmount = amount;
if( boundAmount > is.stackSize )
{
boundAmount = is.stackSize;
}
if( destination != null && !destination.canInsert( is ) )
{
boundAmount = 0;
}
if( boundAmount > 0 )
{
@@ -143,9 +151,13 @@ public class AdaptorIInventory extends InventoryAdaptor
{
int newAmount = amount;
if( newAmount > is.stackSize )
{
newAmount = is.stackSize;
}
if( destination != null && !destination.canInsert( is ) )
{
newAmount = 0;
}
ItemStack rv = null;
if( newAmount > 0 )
@@ -189,9 +201,13 @@ public class AdaptorIInventory extends InventoryAdaptor
{
int boundAmount = amount;
if( boundAmount > is.stackSize )
{
boundAmount = is.stackSize;
}
if( destination != null && !destination.canInsert( is ) )
{
boundAmount = 0;
}
if( boundAmount > 0 )
{
@@ -223,7 +239,9 @@ public class AdaptorIInventory extends InventoryAdaptor
for( int x = 0; x < s; x++ )
{
if( this.i.getStackInSlot( x ) != null )
{
return true;
}
}
return false;
}
@@ -302,7 +320,9 @@ public class AdaptorIInventory extends InventoryAdaptor
boolean canRemoveStackFromSlot( int x, ItemStack is )
{
if( this.wrapperEnabled )
{
return ( (IInventoryWrapper) this.i ).canRemoveItemFromSlot( x, is );
}
return true;
}
@@ -50,9 +50,13 @@ public class AdaptorList extends InventoryAdaptor
if( is != null && ( filter == null || Platform.isSameItemPrecise( is, filter ) ) )
{
if( amount > is.stackSize )
{
amount = is.stackSize;
}
if( destination != null && !destination.canInsert( is ) )
{
amount = 0;
}
if( amount > 0 )
{
@@ -62,7 +66,9 @@ public class AdaptorList extends InventoryAdaptor
// remove it..
if( is.stackSize <= 0 )
{
this.i.remove( x );
}
return rv;
}
@@ -108,9 +114,13 @@ public class AdaptorList extends InventoryAdaptor
if( is != null && ( filter == null || Platform.isSameItemFuzzy( is, filter, fuzzyMode ) ) )
{
if( how_many > is.stackSize )
{
how_many = is.stackSize;
}
if( destination != null && !destination.canInsert( is ) )
{
how_many = 0;
}
if( how_many > 0 )
{
@@ -120,7 +130,9 @@ public class AdaptorList extends InventoryAdaptor
// remove it..
if( is.stackSize <= 0 )
{
this.i.remove( x );
}
return rv;
}
@@ -160,9 +172,13 @@ public class AdaptorList extends InventoryAdaptor
public ItemStack addItems( ItemStack toBeAdded )
{
if( toBeAdded == null )
{
return null;
}
if( toBeAdded.stackSize == 0 )
{
return null;
}
ItemStack left = toBeAdded.copy();
@@ -48,7 +48,9 @@ public class AdaptorPlayerHand extends InventoryAdaptor
{
ItemStack hand = this.p.inventory.getItemStack();
if( hand == null )
{
return null;
}
if( filter == null || Platform.isSameItemPrecise( filter, hand ) )
{
@@ -56,7 +58,9 @@ public class AdaptorPlayerHand extends InventoryAdaptor
result.stackSize = hand.stackSize > amount ? amount : hand.stackSize;
hand.stackSize -= amount;
if( hand.stackSize <= 0 )
{
this.p.inventory.setItemStack( null );
}
return result;
}
@@ -69,7 +73,9 @@ public class AdaptorPlayerHand extends InventoryAdaptor
ItemStack hand = this.p.inventory.getItemStack();
if( hand == null )
{
return null;
}
if( filter == null || Platform.isSameItemPrecise( filter, hand ) )
{
@@ -86,7 +92,9 @@ public class AdaptorPlayerHand extends InventoryAdaptor
{
ItemStack hand = this.p.inventory.getItemStack();
if( hand == null )
{
return null;
}
if( Filter == null || Platform.isSameItemFuzzy( Filter, hand, fuzzyMode ) )
{
@@ -94,7 +102,9 @@ public class AdaptorPlayerHand extends InventoryAdaptor
result.stackSize = hand.stackSize > how_many ? how_many : hand.stackSize;
hand.stackSize -= how_many;
if( hand.stackSize <= 0 )
{
this.p.inventory.setItemStack( null );
}
return result;
}
@@ -107,7 +117,9 @@ public class AdaptorPlayerHand extends InventoryAdaptor
ItemStack hand = this.p.inventory.getItemStack();
if( hand == null )
{
return null;
}
if( Filter == null || Platform.isSameItemFuzzy( Filter, hand, fuzzyMode ) )
{
@@ -124,23 +136,35 @@ public class AdaptorPlayerHand extends InventoryAdaptor
{
if( toBeAdded == null )
{
return null;
}
if( toBeAdded.stackSize == 0 )
{
return null;
}
if( this.p == null )
{
return toBeAdded;
}
if( this.p.inventory == null )
{
return toBeAdded;
}
ItemStack hand = this.p.inventory.getItemStack();
if( hand != null && !Platform.isSameItemPrecise( toBeAdded, hand ) )
{
return toBeAdded;
}
int original = 0;
ItemStack newHand = null;
if( hand == null )
{
newHand = toBeAdded.copy();
}
else
{
newHand = hand;
@@ -166,15 +190,21 @@ public class AdaptorPlayerHand extends InventoryAdaptor
{
ItemStack hand = this.p.inventory.getItemStack();
if( toBeSimulated == null )
{
return null;
}
if( hand != null && !Platform.isSameItem( toBeSimulated, hand ) )
{
return toBeSimulated;
}
int original = 0;
ItemStack newHand = null;
if( hand == null )
{
newHand = toBeSimulated.copy();
}
else
{
newHand = hand.copy();
@@ -35,9 +35,13 @@ public class AdaptorPlayerInventory implements IInventory
{
if( swap )
{
this.src = new WrapperChainedInventory( new WrapperInventoryRange( playerInv, 9, this.size - 9, false ), new WrapperInventoryRange( playerInv, 0, 9, false ) );
}
else
{
this.src = playerInv;
}
}
@Override
@@ -74,10 +74,14 @@ public class IMEAdaptor extends InventoryAdaptor
{
IItemList<IAEItemStack> list = this.getList();
if( !list.isEmpty() )
{
req = list.getFirstItem();
}
}
else
{
req = AEItemStack.create( Filter );
}
IAEItemStack out = null;
@@ -88,7 +92,9 @@ public class IMEAdaptor extends InventoryAdaptor
}
if( out != null )
{
return out.getItemStack();
}
return null;
}
@@ -103,7 +109,9 @@ public class IMEAdaptor extends InventoryAdaptor
public ItemStack removeSimilarItems( int how_many, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
{
if( filter == null )
{
return this.doRemoveItems( how_many, null, destination, Actionable.MODULATE );
}
return this.doRemoveItemsFuzzy( how_many, filter, destination, Actionable.MODULATE, fuzzyMode );
}
@@ -111,7 +119,9 @@ public class IMEAdaptor extends InventoryAdaptor
{
IAEItemStack reqFilter = AEItemStack.create( Filter );
if( reqFilter == null )
{
return null;
}
IAEItemStack out = null;
@@ -122,7 +132,9 @@ public class IMEAdaptor extends InventoryAdaptor
req.setStackSize( how_many );
out = this.target.extractItems( req, type, this.src );
if( out != null )
{
return out.getItemStack();
}
}
}
@@ -133,7 +145,9 @@ public class IMEAdaptor extends InventoryAdaptor
public ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
{
if( filter == null )
{
return this.doRemoveItems( amount, null, destination, Actionable.SIMULATE );
}
return this.doRemoveItemsFuzzy( amount, filter, destination, Actionable.SIMULATE, fuzzyMode );
}
@@ -145,7 +159,9 @@ public class IMEAdaptor extends InventoryAdaptor
{
IAEItemStack out = this.target.injectItems( in, Actionable.MODULATE, this.src );
if( out != null )
{
return out.getItemStack();
}
}
return null;
}
@@ -158,7 +174,9 @@ public class IMEAdaptor extends InventoryAdaptor
{
IAEItemStack out = this.target.injectItems( in, Actionable.SIMULATE, this.src );
if( out != null )
{
return out.getItemStack();
}
}
return null;
}
@@ -57,7 +57,9 @@ public final class IMEAdaptorIterator implements Iterator<ItemSlot>
this.slot.isExtractable = true;
if( this.parent.maxSlots < this.offset )
{
this.parent.maxSlots = this.offset;
}
if( this.hasNext )
{
@@ -42,12 +42,16 @@ public class IMEInventoryDestination implements IInventoryDestination
{
if( stack == null )
{
return false;
}
IAEItemStack failed = this.me.injectItems( AEItemStack.create( stack ), Actionable.SIMULATE, null );
if( failed == null )
{
return true;
}
return failed.getStackSize() != stack.stackSize;
}
}
@@ -89,7 +89,9 @@ public class WrapperChainedInventory implements IInventory
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++ )
{
newOrder.add( this.l.get( x ) );
}
this.setInventory( newOrder );
}
}
@@ -181,7 +183,9 @@ public class WrapperChainedInventory implements IInventory
int smallest = 64;
for( IInventory i : this.l )
{
smallest = Math.min( smallest, i.getInventoryStackLimit() );
}
return smallest;
}
@@ -37,7 +37,9 @@ public class WrapperInventoryRange implements IInventory
this.slots = s;
if( this.slots == null )
{
this.slots = new int[0];
}
this.ignoreValidItems = ignoreValid;
}
@@ -47,7 +49,9 @@ public class WrapperInventoryRange implements IInventory
this.src = a;
this.slots = new int[_size];
for( int x = 0; x < _size; x++ )
{
this.slots[x] = _min + x;
}
this.ignoreValidItems = ignoreValid;
}
@@ -145,7 +149,9 @@ public class WrapperInventoryRange implements IInventory
public boolean isItemValidForSlot( int i, ItemStack itemstack )
{
if( this.ignoreValidItems )
{
return true;
}
return this.src.isItemValidForSlot( this.slots[i], itemstack );
}
@@ -41,7 +41,9 @@ public class WrapperMCISidedInventory extends WrapperInventoryRange implements I
public ItemStack decrStackSize( int var1, int var2 )
{
if( this.canRemoveItemFromSlot( var1, this.getStackInSlot( var1 ) ) )
{
return super.decrStackSize( var1, var2 );
}
return null;
}
@@ -50,10 +52,14 @@ public class WrapperMCISidedInventory extends WrapperInventoryRange implements I
{
if( this.ignoreValidItems )
{
return true;
}
if( this.side.isItemValidForSlot( this.slots[i], itemstack ) )
{
return this.side.canInsertItem( this.slots[i], itemstack, this.dir.ordinal() );
}
return false;
}
@@ -62,7 +68,9 @@ public class WrapperMCISidedInventory extends WrapperInventoryRange implements I
public boolean canRemoveItemFromSlot( int i, ItemStack is )
{
if( is == null )
{
return false;
}
return this.side.canExtractItem( this.slots[i], is, this.dir.ordinal() );
}
@@ -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 )
{
@@ -34,23 +34,35 @@ public final class MergedPriorityList<T extends IAEStack<T>> implements IPartiti
public void addNewList( IPartitionList<T> list, boolean isWhitelist )
{
if( isWhitelist )
{
this.positive.add( list );
}
else
{
this.negative.add( list );
}
}
@Override
public boolean isListed( T input )
{
for( IPartitionList<T> l : this.negative )
{
if( l.isListed( input ) )
{
return false;
}
}
if( !this.positive.isEmpty() )
{
for( IPartitionList<T> l : this.positive )
{
if( l.isListed( input ) )
{
return true;
}
}
return false;
}