Changed access to use this qualifier
This commit is contained in:
@@ -69,29 +69,29 @@ public class CellInventory implements ICellInventory
|
||||
final protected ISaveProvider container;
|
||||
|
||||
protected CellInventory(NBTTagCompound data, ISaveProvider container) {
|
||||
tagCompound = data;
|
||||
this.tagCompound = data;
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
protected void loadCellItems()
|
||||
{
|
||||
if ( cellItems == null )
|
||||
cellItems = AEApi.instance().storage().createItemList();
|
||||
if ( this.cellItems == null )
|
||||
this.cellItems = AEApi.instance().storage().createItemList();
|
||||
|
||||
cellItems.resetStatus(); // clears totals and stuff.
|
||||
this.cellItems.resetStatus(); // clears totals and stuff.
|
||||
|
||||
int types = (int) getStoredItemTypes();
|
||||
int types = (int) this.getStoredItemTypes();
|
||||
|
||||
for (int x = 0; x < types; x++)
|
||||
{
|
||||
ItemStack t = ItemStack.loadItemStackFromNBT( tagCompound.getCompoundTag( ITEM_SLOT_ARR[x] ) );
|
||||
ItemStack t = ItemStack.loadItemStackFromNBT( this.tagCompound.getCompoundTag( ITEM_SLOT_ARR[x] ) );
|
||||
if ( t != null )
|
||||
{
|
||||
t.stackSize = tagCompound.getInteger( ITEM_SLOT_COUNT_ARR[x] );
|
||||
t.stackSize = this.tagCompound.getInteger( ITEM_SLOT_COUNT_ARR[x] );
|
||||
|
||||
if ( t.stackSize > 0 )
|
||||
{
|
||||
cellItems.add( AEItemStack.create( t ) );
|
||||
this.cellItems.add( AEItemStack.create( t ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,11 +106,11 @@ public class CellInventory implements ICellInventory
|
||||
|
||||
// add new pretty stuff...
|
||||
int x = 0;
|
||||
for (IAEItemStack v : cellItems)
|
||||
for (IAEItemStack v : this.cellItems)
|
||||
{
|
||||
itemCount += v.getStackSize();
|
||||
|
||||
NBTBase c = tagCompound.getTag( ITEM_SLOT_ARR[x] );
|
||||
NBTBase c = this.tagCompound.getTag( ITEM_SLOT_ARR[x] );
|
||||
if ( c instanceof NBTTagCompound )
|
||||
{
|
||||
v.writeToNBT( (NBTTagCompound) c );
|
||||
@@ -119,21 +119,21 @@ public class CellInventory implements ICellInventory
|
||||
{
|
||||
NBTTagCompound g = new NBTTagCompound();
|
||||
v.writeToNBT( g );
|
||||
tagCompound.setTag( ITEM_SLOT_ARR[x], g );
|
||||
this.tagCompound.setTag( ITEM_SLOT_ARR[x], g );
|
||||
}
|
||||
|
||||
/*
|
||||
* NBTBase tagSlotCount = tagCompound.getTag( ITEM_SLOT_COUNT_ARR[x] ); if ( tagSlotCount instanceof
|
||||
* NBTTagInt ) ((NBTTagInt) tagSlotCount).data = (int) v.getStackSize(); else
|
||||
*/
|
||||
tagCompound.setInteger( ITEM_SLOT_COUNT_ARR[x], (int) v.getStackSize() );
|
||||
this.tagCompound.setInteger( ITEM_SLOT_COUNT_ARR[x], (int) v.getStackSize() );
|
||||
|
||||
x++;
|
||||
}
|
||||
|
||||
// NBTBase tagType = tagCompound.getTag( ITEM_TYPE_TAG );
|
||||
// NBTBase tagCount = tagCompound.getTag( ITEM_COUNT_TAG );
|
||||
short oldStoredItems = storedItems;
|
||||
short oldStoredItems = this.storedItems;
|
||||
|
||||
/*
|
||||
* if ( tagType instanceof NBTTagShort ) ((NBTTagShort) tagType).data = storedItems = (short) cellItems.size();
|
||||
@@ -163,23 +163,23 @@ public class CellInventory implements ICellInventory
|
||||
}
|
||||
|
||||
// clean any old crusty stuff...
|
||||
for (; x < oldStoredItems && x < MAX_ITEM_TYPES; x++)
|
||||
for (; x < oldStoredItems && x < this.MAX_ITEM_TYPES; x++)
|
||||
{
|
||||
tagCompound.removeTag( ITEM_SLOT_ARR[x] );
|
||||
tagCompound.removeTag( ITEM_SLOT_COUNT_ARR[x] );
|
||||
this.tagCompound.removeTag( ITEM_SLOT_ARR[x] );
|
||||
this.tagCompound.removeTag( ITEM_SLOT_COUNT_ARR[x] );
|
||||
}
|
||||
|
||||
if ( container != null )
|
||||
container.saveChanges( this );
|
||||
if ( this.container != null )
|
||||
this.container.saveChanges( this );
|
||||
}
|
||||
|
||||
protected CellInventory(ItemStack o, ISaveProvider container) throws AppEngException {
|
||||
if ( ITEM_SLOT_ARR == null )
|
||||
{
|
||||
ITEM_SLOT_ARR = new String[MAX_ITEM_TYPES];
|
||||
ITEM_SLOT_COUNT_ARR = new String[MAX_ITEM_TYPES];
|
||||
ITEM_SLOT_ARR = new String[this.MAX_ITEM_TYPES];
|
||||
ITEM_SLOT_COUNT_ARR = new String[this.MAX_ITEM_TYPES];
|
||||
|
||||
for (int x = 0; x < MAX_ITEM_TYPES; x++)
|
||||
for (int x = 0; x < this.MAX_ITEM_TYPES; x++)
|
||||
{
|
||||
ITEM_SLOT_ARR[x] = ITEM_SLOT + x;
|
||||
ITEM_SLOT_COUNT_ARR[x] = ITEM_SLOT_COUNT + x;
|
||||
@@ -191,60 +191,60 @@ public class CellInventory implements ICellInventory
|
||||
throw new AppEngException( "ItemStack was used as a cell, but was not a cell!" );
|
||||
}
|
||||
|
||||
CellType = null;
|
||||
i = o;
|
||||
this.CellType = null;
|
||||
this.i = o;
|
||||
|
||||
Item type = i.getItem();
|
||||
Item type = this.i.getItem();
|
||||
if ( type instanceof IStorageCell )
|
||||
{
|
||||
CellType = (IStorageCell) i.getItem();
|
||||
MAX_ITEM_TYPES = CellType.getTotalTypes( i );
|
||||
this.CellType = (IStorageCell) this.i.getItem();
|
||||
this.MAX_ITEM_TYPES = this.CellType.getTotalTypes( this.i );
|
||||
}
|
||||
|
||||
if ( CellType == null )
|
||||
if ( this.CellType == null )
|
||||
{
|
||||
throw new AppEngException( "ItemStack was used as a cell, but was not a cell!" );
|
||||
}
|
||||
|
||||
if ( !CellType.isStorageCell( i ) )
|
||||
if ( !this.CellType.isStorageCell( this.i ) )
|
||||
{
|
||||
throw new AppEngException( "ItemStack was used as a cell, but was not a cell!" );
|
||||
}
|
||||
|
||||
if ( MAX_ITEM_TYPES > 63 )
|
||||
MAX_ITEM_TYPES = 63;
|
||||
if ( MAX_ITEM_TYPES < 1 )
|
||||
MAX_ITEM_TYPES = 1;
|
||||
if ( this.MAX_ITEM_TYPES > 63 )
|
||||
this.MAX_ITEM_TYPES = 63;
|
||||
if ( this.MAX_ITEM_TYPES < 1 )
|
||||
this.MAX_ITEM_TYPES = 1;
|
||||
|
||||
this.container = container;
|
||||
tagCompound = Platform.openNbtData( o );
|
||||
storedItems = tagCompound.getShort( ITEM_TYPE_TAG );
|
||||
storedItemCount = tagCompound.getInteger( ITEM_COUNT_TAG );
|
||||
cellItems = null;
|
||||
this.tagCompound = Platform.openNbtData( o );
|
||||
this.storedItems = this.tagCompound.getShort( ITEM_TYPE_TAG );
|
||||
this.storedItemCount = this.tagCompound.getInteger( ITEM_COUNT_TAG );
|
||||
this.cellItems = null;
|
||||
}
|
||||
|
||||
IItemList<IAEItemStack> getCellItems()
|
||||
{
|
||||
if ( cellItems == null )
|
||||
if ( this.cellItems == null )
|
||||
{
|
||||
cellItems = AEApi.instance().storage().createItemList();
|
||||
loadCellItems();
|
||||
this.cellItems = AEApi.instance().storage().createItemList();
|
||||
this.loadCellItems();
|
||||
}
|
||||
|
||||
return cellItems;
|
||||
return this.cellItems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytesPerType()
|
||||
{
|
||||
return CellType.BytePerType( i );
|
||||
return this.CellType.BytePerType( this.i );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHoldNewItem()
|
||||
{
|
||||
long bytesFree = getFreeBytes();
|
||||
return (bytesFree > getBytesPerType() || (bytesFree == getBytesPerType() && getUnusedItemCount() > 0)) && getRemainingItemTypes() > 0;
|
||||
long bytesFree = this.getFreeBytes();
|
||||
return (bytesFree > this.getBytesPerType() || (bytesFree == this.getBytesPerType() && this.getUnusedItemCount() > 0)) && this.getRemainingItemTypes() > 0;
|
||||
}
|
||||
|
||||
public static IMEInventoryHandler getCell(ItemStack o, ISaveProvider container2)
|
||||
@@ -301,64 +301,64 @@ public class CellInventory implements ICellInventory
|
||||
@Override
|
||||
public long getTotalBytes()
|
||||
{
|
||||
return CellType.getBytes( i );
|
||||
return this.CellType.getBytes( this.i );
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getFreeBytes()
|
||||
{
|
||||
return getTotalBytes() - getUsedBytes();
|
||||
return this.getTotalBytes() - this.getUsedBytes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getUsedBytes()
|
||||
{
|
||||
long bytesForItemCount = (getStoredItemCount() + getUnusedItemCount()) / 8;
|
||||
return getStoredItemTypes() * getBytesPerType() + bytesForItemCount;
|
||||
long bytesForItemCount = (this.getStoredItemCount() + this.getUnusedItemCount()) / 8;
|
||||
return this.getStoredItemTypes() * this.getBytesPerType() + bytesForItemCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTotalItemTypes()
|
||||
{
|
||||
return MAX_ITEM_TYPES;
|
||||
return this.MAX_ITEM_TYPES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getStoredItemTypes()
|
||||
{
|
||||
return storedItems;
|
||||
return this.storedItems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getStoredItemCount()
|
||||
{
|
||||
return storedItemCount;
|
||||
return this.storedItemCount;
|
||||
}
|
||||
|
||||
private void updateItemCount(long delta)
|
||||
{
|
||||
tagCompound.setInteger( ITEM_COUNT_TAG, storedItemCount = (int) (storedItemCount + delta) );
|
||||
this.tagCompound.setInteger( ITEM_COUNT_TAG, this.storedItemCount = (int) (this.storedItemCount + delta) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRemainingItemTypes()
|
||||
{
|
||||
long basedOnStorage = getFreeBytes() / getBytesPerType();
|
||||
long baseOnTotal = getTotalItemTypes() - getStoredItemTypes();
|
||||
long basedOnStorage = this.getFreeBytes() / this.getBytesPerType();
|
||||
long baseOnTotal = this.getTotalItemTypes() - this.getStoredItemTypes();
|
||||
return basedOnStorage > baseOnTotal ? baseOnTotal : basedOnStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getRemainingItemCount()
|
||||
{
|
||||
long remaining = getFreeBytes() * 8 + getUnusedItemCount();
|
||||
long remaining = this.getFreeBytes() * 8 + this.getUnusedItemCount();
|
||||
return remaining > 0 ? remaining : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUnusedItemCount()
|
||||
{
|
||||
int div = (int) (getStoredItemCount() % 8);
|
||||
int div = (int) (this.getStoredItemCount() % 8);
|
||||
|
||||
if ( div == 0 )
|
||||
{
|
||||
@@ -395,7 +395,7 @@ public class CellInventory implements ICellInventory
|
||||
if ( input.getStackSize() == 0 )
|
||||
return null;
|
||||
|
||||
if ( isBlackListed( input ) || CellType.isBlackListed( i, input ) )
|
||||
if ( isBlackListed( input ) || this.CellType.isBlackListed( this.i, input ) )
|
||||
return input;
|
||||
|
||||
ItemStack sharedItemStack = input.getItemStack();
|
||||
@@ -403,14 +403,14 @@ public class CellInventory implements ICellInventory
|
||||
if ( CellInventory.isStorageCell( sharedItemStack ) )
|
||||
{
|
||||
IMEInventory meInventory = getCell( sharedItemStack, null );
|
||||
if ( meInventory != null && !isEmpty( meInventory ) )
|
||||
if ( meInventory != null && !this.isEmpty( meInventory ) )
|
||||
return input;
|
||||
}
|
||||
|
||||
IAEItemStack l = getCellItems().findPrecise( input );
|
||||
IAEItemStack l = this.getCellItems().findPrecise( input );
|
||||
if ( l != null )
|
||||
{
|
||||
long remainingItemSlots = getRemainingItemCount();
|
||||
long remainingItemSlots = this.getRemainingItemCount();
|
||||
if ( remainingItemSlots < 0 )
|
||||
return input;
|
||||
|
||||
@@ -421,8 +421,8 @@ public class CellInventory implements ICellInventory
|
||||
if ( mode == Actionable.MODULATE )
|
||||
{
|
||||
l.setStackSize( l.getStackSize() + remainingItemSlots );
|
||||
updateItemCount( remainingItemSlots );
|
||||
saveChanges();
|
||||
this.updateItemCount( remainingItemSlots );
|
||||
this.saveChanges();
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@@ -431,16 +431,16 @@ public class CellInventory implements ICellInventory
|
||||
if ( mode == Actionable.MODULATE )
|
||||
{
|
||||
l.setStackSize( l.getStackSize() + input.getStackSize() );
|
||||
updateItemCount( input.getStackSize() );
|
||||
saveChanges();
|
||||
this.updateItemCount( input.getStackSize() );
|
||||
this.saveChanges();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if ( canHoldNewItem() ) // room for new type, and for at least one item!
|
||||
if ( this.canHoldNewItem() ) // room for new type, and for at least one item!
|
||||
{
|
||||
int remainingItemCount = (int) getRemainingItemCount() - getBytesPerType() * 8;
|
||||
int remainingItemCount = (int) this.getRemainingItemCount() - this.getBytesPerType() * 8;
|
||||
if ( remainingItemCount > 0 )
|
||||
{
|
||||
if ( input.getStackSize() > remainingItemCount )
|
||||
@@ -452,19 +452,19 @@ public class CellInventory implements ICellInventory
|
||||
ItemStack toWrite = Platform.cloneItemStack( sharedItemStack );
|
||||
toWrite.stackSize = remainingItemCount;
|
||||
|
||||
cellItems.add( AEItemStack.create( toWrite ) );
|
||||
updateItemCount( toWrite.stackSize );
|
||||
this.cellItems.add( AEItemStack.create( toWrite ) );
|
||||
this.updateItemCount( toWrite.stackSize );
|
||||
|
||||
saveChanges();
|
||||
this.saveChanges();
|
||||
}
|
||||
return AEItemStack.create( toReturn );
|
||||
}
|
||||
|
||||
if ( mode == Actionable.MODULATE )
|
||||
{
|
||||
updateItemCount( input.getStackSize() );
|
||||
cellItems.add( input );
|
||||
saveChanges();
|
||||
this.updateItemCount( input.getStackSize() );
|
||||
this.cellItems.add( input );
|
||||
this.saveChanges();
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -485,7 +485,7 @@ public class CellInventory implements ICellInventory
|
||||
|
||||
IAEItemStack Results = null;
|
||||
|
||||
IAEItemStack l = getCellItems().findPrecise( request );
|
||||
IAEItemStack l = this.getCellItems().findPrecise( request );
|
||||
if ( l != null )
|
||||
{
|
||||
Results = l.copy();
|
||||
@@ -495,9 +495,9 @@ public class CellInventory implements ICellInventory
|
||||
Results.setStackSize( l.getStackSize() );
|
||||
if ( mode == Actionable.MODULATE )
|
||||
{
|
||||
updateItemCount( -l.getStackSize() );
|
||||
this.updateItemCount( -l.getStackSize() );
|
||||
l.setStackSize( 0 );
|
||||
saveChanges();
|
||||
this.saveChanges();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -506,8 +506,8 @@ public class CellInventory implements ICellInventory
|
||||
if ( mode == Actionable.MODULATE )
|
||||
{
|
||||
l.setStackSize( l.getStackSize() - size );
|
||||
updateItemCount( -size );
|
||||
saveChanges();
|
||||
this.updateItemCount( -size );
|
||||
this.saveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -518,7 +518,7 @@ public class CellInventory implements ICellInventory
|
||||
@Override
|
||||
public IItemList getAvailableItems(IItemList out)
|
||||
{
|
||||
for (IAEItemStack i : getCellItems())
|
||||
for (IAEItemStack i : this.getCellItems())
|
||||
out.add( i );
|
||||
|
||||
return out;
|
||||
@@ -533,33 +533,33 @@ public class CellInventory implements ICellInventory
|
||||
@Override
|
||||
public double getIdleDrain()
|
||||
{
|
||||
return CellType.getIdleDrain();
|
||||
return this.CellType.getIdleDrain();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FuzzyMode getFuzzyMode()
|
||||
{
|
||||
return CellType.getFuzzyMode( this.i );
|
||||
return this.CellType.getFuzzyMode( this.i );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getConfigInventory()
|
||||
{
|
||||
return CellType.getConfigInventory( this.i );
|
||||
return this.CellType.getConfigInventory( this.i );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getUpgradesInventory()
|
||||
{
|
||||
return CellType.getUpgradesInventory( this.i );
|
||||
return this.CellType.getUpgradesInventory( this.i );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusForCell()
|
||||
{
|
||||
if ( canHoldNewItem() )
|
||||
if ( this.canHoldNewItem() )
|
||||
return 1;
|
||||
if ( getRemainingItemCount() > 0 )
|
||||
if ( this.getRemainingItemCount() > 0 )
|
||||
return 2;
|
||||
return 3;
|
||||
}
|
||||
@@ -567,7 +567,7 @@ public class CellInventory implements ICellInventory
|
||||
@Override
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
return i;
|
||||
return this.i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
|
||||
|
||||
NBTTagCompound openNbtData()
|
||||
{
|
||||
return Platform.openNbtData( getCellInv().getItemStack() );
|
||||
return Platform.openNbtData( this.getCellInv().getItemStack() );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -59,7 +59,7 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
|
||||
CellInventoryHandler(IMEInventory c) {
|
||||
super( c, StorageChannel.ITEMS );
|
||||
|
||||
ICellInventory ci = getCellInv();
|
||||
ICellInventory ci = this.getCellInv();
|
||||
if ( ci != null )
|
||||
{
|
||||
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
|
||||
@@ -100,14 +100,14 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
|
||||
priorityList.add( AEItemStack.create( is ) );
|
||||
}
|
||||
|
||||
myWhitelist = hasInverter ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST;
|
||||
this.myWhitelist = hasInverter ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST;
|
||||
|
||||
if ( !priorityList.isEmpty() )
|
||||
{
|
||||
if ( hasFuzzy )
|
||||
myPartitionList = new FuzzyPriorityList<IAEItemStack>( priorityList, fzMode );
|
||||
this.myPartitionList = new FuzzyPriorityList<IAEItemStack>( priorityList, fzMode );
|
||||
else
|
||||
myPartitionList = new PrecisePriorityList<IAEItemStack>( priorityList );
|
||||
this.myPartitionList = new PrecisePriorityList<IAEItemStack>( priorityList );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,26 +115,26 @@ public class CellInventoryHandler extends MEInventoryHandler<IAEItemStack> imple
|
||||
@Override
|
||||
public boolean isPreformatted()
|
||||
{
|
||||
return ! myPartitionList.isEmpty();
|
||||
return ! this.myPartitionList.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFuzzy()
|
||||
{
|
||||
return myPartitionList instanceof FuzzyPriorityList;
|
||||
return this.myPartitionList instanceof FuzzyPriorityList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IncludeExclude getIncludeExcludeMode()
|
||||
{
|
||||
return myWhitelist;
|
||||
return this.myWhitelist;
|
||||
}
|
||||
|
||||
public int getStatusForCell()
|
||||
{
|
||||
int val = getCellInv().getStatusForCell();
|
||||
int val = this.getCellInv().getStatusForCell();
|
||||
|
||||
if ( val == 1 && isPreformatted() )
|
||||
if ( val == 1 && this.isPreformatted() )
|
||||
val = 2;
|
||||
|
||||
return val;
|
||||
|
||||
@@ -48,14 +48,14 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
{
|
||||
IAEItemStack i = AEItemStack.create( is );
|
||||
i.setStackSize( Integer.MAX_VALUE );
|
||||
itemListCache.add( i );
|
||||
this.itemListCache.add( i );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
IAEItemStack local = itemListCache.findPrecise( input );
|
||||
IAEItemStack local = this.itemListCache.findPrecise( input );
|
||||
if ( local == null )
|
||||
return input;
|
||||
|
||||
@@ -65,7 +65,7 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
@Override
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
IAEItemStack local = itemListCache.findPrecise( request );
|
||||
IAEItemStack local = this.itemListCache.findPrecise( request );
|
||||
if ( local == null )
|
||||
return null;
|
||||
|
||||
@@ -75,7 +75,7 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getAvailableItems(IItemList out)
|
||||
{
|
||||
for (IAEItemStack ais : itemListCache)
|
||||
for (IAEItemStack ais : this.itemListCache)
|
||||
out.add( ais );
|
||||
return out;
|
||||
}
|
||||
@@ -95,13 +95,13 @@ public class CreativeCellInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
@Override
|
||||
public boolean isPrioritized(IAEItemStack input)
|
||||
{
|
||||
return itemListCache.findPrecise( input ) != null;
|
||||
return this.itemListCache.findPrecise( input ) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAccept(IAEItemStack input)
|
||||
{
|
||||
return itemListCache.findPrecise( input ) != null;
|
||||
return this.itemListCache.findPrecise( input ) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,8 +37,8 @@ public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T>
|
||||
public DriveWatcher(IMEInventory<T> i, ItemStack is, ICellHandler han, IChestOrDrive cod) {
|
||||
super( i, i.getChannel() );
|
||||
this.is = is;
|
||||
handler = han;
|
||||
cord = cod;
|
||||
this.handler = han;
|
||||
this.cord = cod;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,11 +50,11 @@ public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T>
|
||||
|
||||
if ( a == null || a.getStackSize() != size )
|
||||
{
|
||||
int newStatus = handler.getStatusForCell( is, getInternal() );
|
||||
int newStatus = this.handler.getStatusForCell( this.is, this.getInternal() );
|
||||
|
||||
if ( newStatus != oldStatus )
|
||||
if ( newStatus != this.oldStatus )
|
||||
{
|
||||
cord.blinkCell( getSlot() );
|
||||
this.cord.blinkCell( this.getSlot() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,11 +68,11 @@ public class DriveWatcher<T extends IAEStack<T>> extends MEInventoryHandler<T>
|
||||
|
||||
if ( a != null )
|
||||
{
|
||||
int newStatus = handler.getStatusForCell( is, getInternal() );
|
||||
int newStatus = this.handler.getStatusForCell( this.is, this.getInternal() );
|
||||
|
||||
if ( newStatus != oldStatus )
|
||||
if ( newStatus != this.oldStatus )
|
||||
{
|
||||
cord.blinkCell( getSlot() );
|
||||
this.cord.blinkCell( this.getSlot() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,27 +41,27 @@ public class ItemWatcher implements IStackWatcher
|
||||
IAEStack myLast;
|
||||
|
||||
public ItemWatcherIterator(ItemWatcher parent, Iterator<IAEStack> i) {
|
||||
watcher = parent;
|
||||
interestIterator = i;
|
||||
this.watcher = parent;
|
||||
this.interestIterator = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext()
|
||||
{
|
||||
return interestIterator.hasNext();
|
||||
return this.interestIterator.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEStack next()
|
||||
{
|
||||
return myLast = interestIterator.next();
|
||||
return this.myLast = this.interestIterator.next();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove()
|
||||
{
|
||||
gsc.interestManager.remove( myLast, watcher );
|
||||
interestIterator.remove();
|
||||
ItemWatcher.this.gsc.interestManager.remove( this.myLast, this.watcher );
|
||||
this.interestIterator.remove();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -71,22 +71,22 @@ public class ItemWatcher implements IStackWatcher
|
||||
final HashSet<IAEStack> myInterests = new HashSet<IAEStack>();
|
||||
|
||||
public ItemWatcher(GridStorageCache cache, IStackWatcherHost host) {
|
||||
gsc = cache;
|
||||
myObject = host;
|
||||
this.gsc = cache;
|
||||
this.myObject = host;
|
||||
}
|
||||
|
||||
public IStackWatcherHost getHost()
|
||||
{
|
||||
return myObject;
|
||||
return this.myObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(IAEStack e)
|
||||
{
|
||||
if ( myInterests.contains( e ) )
|
||||
if ( this.myInterests.contains( e ) )
|
||||
return false;
|
||||
|
||||
return myInterests.add( e.copy() ) && gsc.interestManager.put( e, this );
|
||||
return this.myInterests.add( e.copy() ) && this.gsc.interestManager.put( e, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,7 +95,7 @@ public class ItemWatcher implements IStackWatcher
|
||||
boolean didChange = false;
|
||||
|
||||
for (IAEStack o : c)
|
||||
didChange = add( o ) || didChange;
|
||||
didChange = this.add( o ) || didChange;
|
||||
|
||||
return didChange;
|
||||
}
|
||||
@@ -103,10 +103,10 @@ public class ItemWatcher implements IStackWatcher
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
Iterator<IAEStack> i = myInterests.iterator();
|
||||
Iterator<IAEStack> i = this.myInterests.iterator();
|
||||
while (i.hasNext())
|
||||
{
|
||||
gsc.interestManager.remove( i.next(), this );
|
||||
this.gsc.interestManager.remove( i.next(), this );
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
@@ -114,31 +114,31 @@ public class ItemWatcher implements IStackWatcher
|
||||
@Override
|
||||
public boolean contains(Object o)
|
||||
{
|
||||
return myInterests.contains( o );
|
||||
return this.myInterests.contains( o );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(Collection<?> c)
|
||||
{
|
||||
return myInterests.containsAll( c );
|
||||
return this.myInterests.containsAll( c );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return myInterests.isEmpty();
|
||||
return this.myInterests.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<IAEStack> iterator()
|
||||
{
|
||||
return new ItemWatcherIterator( this, myInterests.iterator() );
|
||||
return new ItemWatcherIterator( this, this.myInterests.iterator() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o)
|
||||
{
|
||||
return myInterests.remove( o ) && gsc.interestManager.remove( (IAEStack)o, this );
|
||||
return this.myInterests.remove( o ) && this.gsc.interestManager.remove( (IAEStack)o, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -146,7 +146,7 @@ public class ItemWatcher implements IStackWatcher
|
||||
{
|
||||
boolean didSomething = false;
|
||||
for (Object o : c)
|
||||
didSomething = remove( o ) || didSomething;
|
||||
didSomething = this.remove( o ) || didSomething;
|
||||
return didSomething;
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ public class ItemWatcher implements IStackWatcher
|
||||
public boolean retainAll(Collection<?> c)
|
||||
{
|
||||
boolean changed = false;
|
||||
Iterator<IAEStack> i = iterator();
|
||||
Iterator<IAEStack> i = this.iterator();
|
||||
|
||||
while (i.hasNext())
|
||||
{
|
||||
@@ -171,19 +171,19 @@ public class ItemWatcher implements IStackWatcher
|
||||
@Override
|
||||
public int size()
|
||||
{
|
||||
return myInterests.size();
|
||||
return this.myInterests.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] toArray()
|
||||
{
|
||||
return myInterests.toArray();
|
||||
return this.myInterests.toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T[] toArray(T[] a)
|
||||
{
|
||||
return myInterests.toArray( a );
|
||||
return this.myInterests.toArray( a );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
|
||||
protected final InventoryAdaptor adaptor;
|
||||
|
||||
public MEIInventoryWrapper(IInventory m, InventoryAdaptor ia) {
|
||||
target = m;
|
||||
adaptor = ia;
|
||||
this.target = m;
|
||||
this.adaptor = ia;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,9 +52,9 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
|
||||
{
|
||||
ItemStack input = iox.getItemStack();
|
||||
|
||||
if ( adaptor != null )
|
||||
if ( this.adaptor != null )
|
||||
{
|
||||
ItemStack is = mode == Actionable.SIMULATE ? adaptor.simulateAdd( input ) : adaptor.addItems( input );
|
||||
ItemStack is = mode == Actionable.SIMULATE ? this.adaptor.simulateAdd( input ) : this.adaptor.addItems( input );
|
||||
if ( is == null )
|
||||
return null;
|
||||
return AEItemStack.create( is );
|
||||
@@ -64,20 +64,20 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
|
||||
|
||||
if ( mode == Actionable.MODULATE ) // absolutely no need for a first run in simulate mode.
|
||||
{
|
||||
for (int x = 0; x < target.getSizeInventory(); x++)
|
||||
for (int x = 0; x < this.target.getSizeInventory(); x++)
|
||||
{
|
||||
ItemStack t = target.getStackInSlot( x );
|
||||
ItemStack t = this.target.getStackInSlot( x );
|
||||
|
||||
if ( Platform.isSameItem( t, input ) )
|
||||
{
|
||||
int oriStack = t.stackSize;
|
||||
t.stackSize += out.stackSize;
|
||||
|
||||
target.setInventorySlotContents( x, t );
|
||||
this.target.setInventorySlotContents( x, t );
|
||||
|
||||
if ( t.stackSize > target.getInventoryStackLimit() )
|
||||
if ( t.stackSize > this.target.getInventoryStackLimit() )
|
||||
{
|
||||
t.stackSize = target.getInventoryStackLimit();
|
||||
t.stackSize = this.target.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
if ( t.stackSize > t.getMaxStackSize() )
|
||||
@@ -95,23 +95,23 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
|
||||
}
|
||||
}
|
||||
|
||||
for (int x = 0; x < target.getSizeInventory(); x++)
|
||||
for (int x = 0; x < this.target.getSizeInventory(); x++)
|
||||
{
|
||||
ItemStack t = target.getStackInSlot( x );
|
||||
ItemStack t = this.target.getStackInSlot( x );
|
||||
|
||||
if ( t == null )
|
||||
{
|
||||
t = Platform.cloneItemStack( input );
|
||||
t.stackSize = out.stackSize;
|
||||
|
||||
if ( t.stackSize > target.getInventoryStackLimit() )
|
||||
if ( t.stackSize > this.target.getInventoryStackLimit() )
|
||||
{
|
||||
t.stackSize = target.getInventoryStackLimit();
|
||||
t.stackSize = this.target.getInventoryStackLimit();
|
||||
}
|
||||
|
||||
out.stackSize -= t.stackSize;
|
||||
if ( mode == Actionable.MODULATE )
|
||||
target.setInventorySlotContents( x, t );
|
||||
this.target.setInventorySlotContents( x, t );
|
||||
|
||||
if ( out.stackSize <= 0 )
|
||||
{
|
||||
@@ -138,9 +138,9 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
|
||||
|
||||
Req.stackSize = request_stackSize;
|
||||
|
||||
if ( adaptor != null )
|
||||
if ( this.adaptor != null )
|
||||
{
|
||||
Gathered = adaptor.removeItems( Req.stackSize, Req, null );
|
||||
Gathered = this.adaptor.removeItems( Req.stackSize, Req, null );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -148,9 +148,9 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
|
||||
Gathered.stackSize = 0;
|
||||
|
||||
// try to find matching inventories that already have it...
|
||||
for (int x = 0; x < target.getSizeInventory(); x++)
|
||||
for (int x = 0; x < this.target.getSizeInventory(); x++)
|
||||
{
|
||||
ItemStack sub = target.getStackInSlot( x );
|
||||
ItemStack sub = this.target.getStackInSlot( x );
|
||||
|
||||
if ( Platform.isSameItem( sub, Req ) )
|
||||
{
|
||||
@@ -174,9 +174,9 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
|
||||
}
|
||||
|
||||
if ( sub.stackSize <= 0 )
|
||||
target.setInventorySlotContents( x, null );
|
||||
this.target.setInventorySlotContents( x, null );
|
||||
else
|
||||
target.setInventorySlotContents( x, sub );
|
||||
this.target.setInventorySlotContents( x, sub );
|
||||
|
||||
if ( retrieved != null )
|
||||
{
|
||||
@@ -204,9 +204,9 @@ public class MEIInventoryWrapper implements IMEInventory<IAEItemStack>
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> out)
|
||||
{
|
||||
for (int x = 0; x < target.getSizeInventory(); x++)
|
||||
for (int x = 0; x < this.target.getSizeInventory(); x++)
|
||||
{
|
||||
out.addStorage( AEItemStack.create( target.getStackInSlot( x ) ) );
|
||||
out.addStorage( AEItemStack.create( this.target.getStackInSlot( x ) ) );
|
||||
}
|
||||
|
||||
return out;
|
||||
|
||||
@@ -47,11 +47,11 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
|
||||
this.channel = channel;
|
||||
|
||||
if ( i instanceof IMEInventoryHandler )
|
||||
internal = (IMEInventoryHandler<T>) i;
|
||||
this.internal = (IMEInventoryHandler<T>) i;
|
||||
else
|
||||
internal = new MEPassThrough<T>( i, channel );
|
||||
this.internal = new MEPassThrough<T>( i, channel );
|
||||
|
||||
monitor = internal instanceof IMEMonitor ? (IMEMonitor<T>) internal : null;
|
||||
this.monitor = this.internal instanceof IMEMonitor ? (IMEMonitor<T>) this.internal : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -60,75 +60,75 @@ public class MEInventoryHandler<T extends IAEStack<T>> implements IMEInventoryHa
|
||||
if ( !this.canAccept( input ) )
|
||||
return input;
|
||||
|
||||
return internal.injectItems( input, type, src );
|
||||
return this.internal.injectItems( input, type, src );
|
||||
}
|
||||
|
||||
@Override
|
||||
public T extractItems(T request, Actionable type, BaseActionSource src)
|
||||
{
|
||||
if ( !getAccess().hasPermission( AccessRestriction.READ ) )
|
||||
if ( !this.getAccess().hasPermission( AccessRestriction.READ ) )
|
||||
return null;
|
||||
|
||||
return internal.extractItems( request, type, src );
|
||||
return this.internal.extractItems( request, type, src );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<T> getAvailableItems(IItemList<T> out)
|
||||
{
|
||||
if ( !getAccess().hasPermission( AccessRestriction.READ ) )
|
||||
if ( !this.getAccess().hasPermission( AccessRestriction.READ ) )
|
||||
return out;
|
||||
|
||||
return internal.getAvailableItems( out );
|
||||
return this.internal.getAvailableItems( out );
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
{
|
||||
return internal.getChannel();
|
||||
return this.internal.getChannel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessRestriction getAccess()
|
||||
{
|
||||
return myAccess.restrictPermissions( internal.getAccess() );
|
||||
return this.myAccess.restrictPermissions( this.internal.getAccess() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrioritized(T input)
|
||||
{
|
||||
if ( myWhitelist == IncludeExclude.WHITELIST )
|
||||
return myPartitionList.isListed( input ) || internal.isPrioritized( input );
|
||||
if ( this.myWhitelist == IncludeExclude.WHITELIST )
|
||||
return this.myPartitionList.isListed( input ) || this.internal.isPrioritized( input );
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAccept(T input)
|
||||
{
|
||||
if ( !getAccess().hasPermission( AccessRestriction.WRITE ) )
|
||||
if ( !this.getAccess().hasPermission( AccessRestriction.WRITE ) )
|
||||
return false;
|
||||
|
||||
if ( myWhitelist == IncludeExclude.BLACKLIST && myPartitionList.isListed( input ) )
|
||||
if ( this.myWhitelist == IncludeExclude.BLACKLIST && this.myPartitionList.isListed( input ) )
|
||||
return false;
|
||||
if ( myPartitionList.isEmpty() || myWhitelist == IncludeExclude.BLACKLIST )
|
||||
return internal.canAccept( input );
|
||||
return myPartitionList.isListed( input ) && internal.canAccept( input );
|
||||
if ( this.myPartitionList.isEmpty() || this.myWhitelist == IncludeExclude.BLACKLIST )
|
||||
return this.internal.canAccept( input );
|
||||
return this.myPartitionList.isListed( input ) && this.internal.canAccept( input );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority()
|
||||
{
|
||||
return myPriority;
|
||||
return this.myPriority;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlot()
|
||||
{
|
||||
return internal.getSlot();
|
||||
return this.internal.getSlot();
|
||||
}
|
||||
|
||||
public IMEInventory<T> getInternal()
|
||||
{
|
||||
return internal;
|
||||
return this.internal;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,13 +52,13 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
|
||||
{
|
||||
if ( is == null )
|
||||
{
|
||||
itemStack = null;
|
||||
aeStack = null;
|
||||
this.itemStack = null;
|
||||
this.aeStack = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemStack = is.copy();
|
||||
aeStack = AEApi.instance().storage().createItemStack( is );
|
||||
this.itemStack = is.copy();
|
||||
this.aeStack = AEApi.instance().storage().createItemStack( is );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,19 +78,19 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
|
||||
@Override
|
||||
public void addListener(IMEMonitorHandlerReceiver<IAEItemStack> l, Object verificationToken)
|
||||
{
|
||||
listeners.put( l, verificationToken );
|
||||
this.listeners.put( l, verificationToken );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(IMEMonitorHandlerReceiver<IAEItemStack> l)
|
||||
{
|
||||
listeners.remove( l );
|
||||
this.listeners.remove( l );
|
||||
}
|
||||
|
||||
public MEMonitorIInventory(InventoryAdaptor adaptor)
|
||||
{
|
||||
this.adaptor = adaptor;
|
||||
memory = new ConcurrentSkipListMap<Integer, CachedItemStack>();
|
||||
this.memory = new ConcurrentSkipListMap<Integer, CachedItemStack>();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,11 +99,11 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
|
||||
ItemStack out = null;
|
||||
|
||||
if ( type == Actionable.SIMULATE )
|
||||
out = adaptor.simulateAdd( input.getItemStack() );
|
||||
out = this.adaptor.simulateAdd( input.getItemStack() );
|
||||
else
|
||||
out = adaptor.addItems( input.getItemStack() );
|
||||
out = this.adaptor.addItems( input.getItemStack() );
|
||||
|
||||
onTick();
|
||||
this.onTick();
|
||||
|
||||
if ( out == null )
|
||||
return null;
|
||||
@@ -147,13 +147,13 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getStorageList()
|
||||
{
|
||||
return list;
|
||||
return this.list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getAvailableItems(IItemList out)
|
||||
{
|
||||
for (CachedItemStack is : memory.values())
|
||||
for (CachedItemStack is : this.memory.values())
|
||||
out.addStorage( is.aeStack );
|
||||
|
||||
return out;
|
||||
@@ -165,9 +165,9 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
|
||||
ItemStack out = null;
|
||||
|
||||
if ( type == Actionable.SIMULATE )
|
||||
out = adaptor.simulateRemove( (int) request.getStackSize(), request.getItemStack(), null );
|
||||
out = this.adaptor.simulateRemove( (int) request.getStackSize(), request.getItemStack(), null );
|
||||
else
|
||||
out = adaptor.removeItems( (int) request.getStackSize(), request.getItemStack(), null );
|
||||
out = this.adaptor.removeItems( (int) request.getStackSize(), request.getItemStack(), null );
|
||||
|
||||
if ( out == null )
|
||||
return null;
|
||||
@@ -176,7 +176,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
|
||||
IAEItemStack o = request.copy();
|
||||
o.setStackSize( out.stackSize );
|
||||
|
||||
onTick();
|
||||
this.onTick();
|
||||
|
||||
return o;
|
||||
}
|
||||
@@ -188,19 +188,19 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
|
||||
LinkedList<IAEItemStack> changes = new LinkedList<IAEItemStack>();
|
||||
|
||||
int high = 0;
|
||||
list.resetStatus();
|
||||
for (ItemSlot is : adaptor)
|
||||
this.list.resetStatus();
|
||||
for (ItemSlot is : this.adaptor)
|
||||
{
|
||||
CachedItemStack old = memory.get( is.slot );
|
||||
CachedItemStack old = this.memory.get( is.slot );
|
||||
high = Math.max( high, is.slot );
|
||||
|
||||
ItemStack newIS = !is.isExtractable && mode == StorageFilter.EXTRACTABLE_ONLY ? null : is.getItemStack();
|
||||
ItemStack newIS = !is.isExtractable && this.mode == StorageFilter.EXTRACTABLE_ONLY ? null : is.getItemStack();
|
||||
ItemStack oldIS = old == null ? null : old.itemStack;
|
||||
|
||||
if ( isDifferent( newIS, oldIS ) )
|
||||
if ( this.isDifferent( newIS, oldIS ) )
|
||||
{
|
||||
CachedItemStack cis = new CachedItemStack( is.getItemStack() );
|
||||
memory.put( is.slot, cis );
|
||||
this.memory.put( is.slot, cis );
|
||||
|
||||
if ( old != null && old.aeStack != null )
|
||||
{
|
||||
@@ -211,7 +211,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
|
||||
if ( cis.aeStack != null )
|
||||
{
|
||||
changes.add( cis.aeStack );
|
||||
list.add( cis.aeStack );
|
||||
this.list.add( cis.aeStack );
|
||||
}
|
||||
|
||||
changed = true;
|
||||
@@ -225,13 +225,13 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
|
||||
if ( stack != null )
|
||||
{
|
||||
stack.setStackSize( newSize );
|
||||
list.add( stack );
|
||||
this.list.add( stack );
|
||||
}
|
||||
|
||||
if ( diff != 0 && stack != null )
|
||||
{
|
||||
CachedItemStack cis = new CachedItemStack( is.getItemStack() );
|
||||
memory.put( is.slot, cis );
|
||||
this.memory.put( is.slot, cis );
|
||||
|
||||
IAEItemStack a = stack.copy();
|
||||
a.setStackSize( diff );
|
||||
@@ -242,7 +242,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
|
||||
}
|
||||
|
||||
// detect dropped items; should fix non IISided Inventory Changes.
|
||||
NavigableMap<Integer, CachedItemStack> end = memory.tailMap( high, false );
|
||||
NavigableMap<Integer, CachedItemStack> end = this.memory.tailMap( high, false );
|
||||
if ( !end.isEmpty() )
|
||||
{
|
||||
for (CachedItemStack cis : end.values())
|
||||
@@ -259,7 +259,7 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
|
||||
}
|
||||
|
||||
if ( !changes.isEmpty() )
|
||||
postDifference( changes );
|
||||
this.postDifference( changes );
|
||||
|
||||
return changed ? TickRateModulation.URGENT : TickRateModulation.SLOWER;
|
||||
}
|
||||
@@ -280,13 +280,13 @@ public class MEMonitorIInventory implements IMEMonitor<IAEItemStack>
|
||||
// AELog.info( a.getItemStack().getUnlocalizedName() + " @ " + a.getStackSize() );
|
||||
if ( a != null )
|
||||
{
|
||||
Iterator<Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object>> i = listeners.entrySet().iterator();
|
||||
Iterator<Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object>> i = this.listeners.entrySet().iterator();
|
||||
while (i.hasNext())
|
||||
{
|
||||
Entry<IMEMonitorHandlerReceiver<IAEItemStack>, Object> l = i.next();
|
||||
IMEMonitorHandlerReceiver<IAEItemStack> key = l.getKey();
|
||||
if ( key.isValid( l.getValue() ) )
|
||||
key.postChange( this, a, mySource );
|
||||
key.postChange( this, a, this.mySource );
|
||||
else
|
||||
i.remove();
|
||||
}
|
||||
|
||||
@@ -44,30 +44,30 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
|
||||
public MEMonitorPassThrough(IMEInventory<T> i, StorageChannel channel) {
|
||||
super( i, channel );
|
||||
if ( i instanceof IMEMonitor )
|
||||
monitor = (IMEMonitor<T>) i;
|
||||
this.monitor = (IMEMonitor<T>) i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInternal(IMEInventory<T> i)
|
||||
{
|
||||
if ( monitor != null )
|
||||
monitor.removeListener( this );
|
||||
if ( this.monitor != null )
|
||||
this.monitor.removeListener( this );
|
||||
|
||||
monitor = null;
|
||||
IItemList<T> before = getInternal() == null ? channel.createList() : getInternal()
|
||||
.getAvailableItems( new ItemListIgnoreCrafting( channel.createList() ) );
|
||||
this.monitor = null;
|
||||
IItemList<T> before = this.getInternal() == null ? this.channel.createList() : this.getInternal()
|
||||
.getAvailableItems( new ItemListIgnoreCrafting( this.channel.createList() ) );
|
||||
|
||||
super.setInternal( i );
|
||||
if ( i instanceof IMEMonitor )
|
||||
monitor = (IMEMonitor<T>) i;
|
||||
this.monitor = (IMEMonitor<T>) i;
|
||||
|
||||
IItemList<T> after = getInternal() == null ? channel.createList() : getInternal()
|
||||
.getAvailableItems( new ItemListIgnoreCrafting( channel.createList() ) );
|
||||
IItemList<T> after = this.getInternal() == null ? this.channel.createList() : this.getInternal()
|
||||
.getAvailableItems( new ItemListIgnoreCrafting( this.channel.createList() ) );
|
||||
|
||||
if ( monitor != null )
|
||||
monitor.addListener( this, monitor );
|
||||
if ( this.monitor != null )
|
||||
this.monitor.addListener( this, this.monitor );
|
||||
|
||||
Platform.postListChanges( before, after, this, changeSource );
|
||||
Platform.postListChanges( before, after, this, this.changeSource );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,37 +80,37 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
|
||||
@Override
|
||||
public void addListener(IMEMonitorHandlerReceiver<T> l, Object verificationToken)
|
||||
{
|
||||
listeners.put( l, verificationToken );
|
||||
this.listeners.put( l, verificationToken );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(IMEMonitorHandlerReceiver<T> l)
|
||||
{
|
||||
listeners.remove( l );
|
||||
this.listeners.remove( l );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<T> getStorageList()
|
||||
{
|
||||
if ( monitor == null )
|
||||
if ( this.monitor == null )
|
||||
{
|
||||
IItemList<T> out = channel.createList();
|
||||
getInternal().getAvailableItems( new ItemListIgnoreCrafting( out ) );
|
||||
IItemList<T> out = this.channel.createList();
|
||||
this.getInternal().getAvailableItems( new ItemListIgnoreCrafting( out ) );
|
||||
return out;
|
||||
}
|
||||
return monitor.getStorageList();
|
||||
return this.monitor.getStorageList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(Object verificationToken)
|
||||
{
|
||||
return verificationToken == monitor;
|
||||
return verificationToken == this.monitor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postChange(IBaseMonitor<T> monitor, Iterable<T> change, BaseActionSource source)
|
||||
{
|
||||
Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = listeners.entrySet().iterator();
|
||||
Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = this.listeners.entrySet().iterator();
|
||||
while (i.hasNext())
|
||||
{
|
||||
Entry<IMEMonitorHandlerReceiver<T>, Object> e = i.next();
|
||||
@@ -125,7 +125,7 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
|
||||
@Override
|
||||
public void onListUpdate()
|
||||
{
|
||||
Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = listeners.entrySet().iterator();
|
||||
Iterator<Entry<IMEMonitorHandlerReceiver<T>, Object>> i = this.listeners.entrySet().iterator();
|
||||
while (i.hasNext())
|
||||
{
|
||||
Entry<IMEMonitorHandlerReceiver<T>, Object> e = i.next();
|
||||
|
||||
@@ -35,41 +35,41 @@ public class MEPassThrough<T extends IAEStack<T>> implements IMEInventoryHandler
|
||||
|
||||
protected IMEInventory<T> getInternal()
|
||||
{
|
||||
return internal;
|
||||
return this.internal;
|
||||
}
|
||||
|
||||
public MEPassThrough(IMEInventory<T> i, StorageChannel channel) {
|
||||
this.channel = channel;
|
||||
setInternal( i );
|
||||
this.setInternal( i );
|
||||
}
|
||||
|
||||
public void setInternal(IMEInventory<T> i)
|
||||
{
|
||||
internal = i;
|
||||
this.internal = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T injectItems(T input, Actionable type, BaseActionSource src)
|
||||
{
|
||||
return internal.injectItems( input, type, src );
|
||||
return this.internal.injectItems( input, type, src );
|
||||
}
|
||||
|
||||
@Override
|
||||
public T extractItems(T request, Actionable type, BaseActionSource src)
|
||||
{
|
||||
return internal.extractItems( request, type, src );
|
||||
return this.internal.extractItems( request, type, src );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<T> getAvailableItems(IItemList out)
|
||||
{
|
||||
return internal.getAvailableItems( out );
|
||||
return this.internal.getAvailableItems( out );
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
{
|
||||
return internal.getChannel();
|
||||
return this.internal.getChannel();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -62,17 +62,17 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
||||
private final NavigableMap<Integer, List<IMEInventoryHandler<T>>> priorityInventory;
|
||||
|
||||
public NetworkInventoryHandler(StorageChannel chan, SecurityCache security) {
|
||||
myChannel = chan;
|
||||
this.myChannel = chan;
|
||||
this.security = security;
|
||||
priorityInventory = new ConcurrentSkipListMap<Integer, List<IMEInventoryHandler<T>>>( prioritySorter ); // TreeMultimap.create( prioritySorter, hashSorter );
|
||||
this.priorityInventory = new ConcurrentSkipListMap<Integer, List<IMEInventoryHandler<T>>>( prioritySorter ); // TreeMultimap.create( prioritySorter, hashSorter );
|
||||
}
|
||||
|
||||
public void addNewStorage(IMEInventoryHandler<T> h)
|
||||
{
|
||||
int priority = h.getPriority();
|
||||
List<IMEInventoryHandler<T>> list = priorityInventory.get( priority );
|
||||
List<IMEInventoryHandler<T>> list = this.priorityInventory.get( priority );
|
||||
if ( list == null )
|
||||
priorityInventory.put( priority, list = new ArrayList<IMEInventoryHandler<T>>() );
|
||||
this.priorityInventory.put( priority, list = new ArrayList<IMEInventoryHandler<T>>() );
|
||||
|
||||
list.add( h );
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
||||
|
||||
private boolean diveList(NetworkInventoryHandler<T> networkInventoryHandler, Actionable type)
|
||||
{
|
||||
LinkedList cDepth = getDepth( type );
|
||||
LinkedList cDepth = this.getDepth( type );
|
||||
if ( cDepth.contains( networkInventoryHandler ) )
|
||||
return true;
|
||||
|
||||
@@ -106,18 +106,18 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
||||
|
||||
private boolean diveIteration(NetworkInventoryHandler<T> networkInventoryHandler, Actionable type)
|
||||
{
|
||||
LinkedList cDepth = getDepth( type );
|
||||
LinkedList cDepth = this.getDepth( type );
|
||||
if ( cDepth.isEmpty() )
|
||||
{
|
||||
currentPass++;
|
||||
myPass = currentPass;
|
||||
this.myPass = currentPass;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( currentPass == myPass )
|
||||
if ( currentPass == this.myPass )
|
||||
return true;
|
||||
else
|
||||
myPass = currentPass;
|
||||
this.myPass = currentPass;
|
||||
}
|
||||
|
||||
cDepth.push( this );
|
||||
@@ -126,7 +126,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
||||
|
||||
private void surface(NetworkInventoryHandler<T> networkInventoryHandler, Actionable type)
|
||||
{
|
||||
if ( getDepth( type ).pop() != this )
|
||||
if ( this.getDepth( type ).pop() != this )
|
||||
throw new RuntimeException( "Invalid Access to Networked Storage API detected." );
|
||||
}
|
||||
|
||||
@@ -134,26 +134,26 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
||||
{
|
||||
if ( src.isPlayer() )
|
||||
{
|
||||
if ( !security.hasPermission( ((PlayerSource) src).player, permission ) )
|
||||
if ( !this.security.hasPermission( ((PlayerSource) src).player, permission ) )
|
||||
return true;
|
||||
}
|
||||
else if ( src.isMachine() )
|
||||
{
|
||||
if ( security.isAvailable() )
|
||||
if ( this.security.isAvailable() )
|
||||
{
|
||||
IGridNode n = ((MachineSource) src).via.getActionableNode();
|
||||
if ( n == null )
|
||||
return true;
|
||||
|
||||
IGrid gn = n.getGrid();
|
||||
if ( gn != security.myGrid )
|
||||
if ( gn != this.security.myGrid )
|
||||
{
|
||||
int playerID = -1;
|
||||
|
||||
ISecurityGrid sg = gn.getCache( ISecurityGrid.class );
|
||||
playerID = sg.getOwner();
|
||||
|
||||
if ( !security.hasPermission( playerID, permission ) )
|
||||
if ( !this.security.hasPermission( playerID, permission ) )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -165,16 +165,16 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
||||
@Override
|
||||
public T injectItems(T input, Actionable type, BaseActionSource src)
|
||||
{
|
||||
if ( diveList( this, type ) )
|
||||
if ( this.diveList( this, type ) )
|
||||
return input;
|
||||
|
||||
if ( testPermission( src, SecurityPermissions.INJECT ) )
|
||||
if ( this.testPermission( src, SecurityPermissions.INJECT ) )
|
||||
{
|
||||
surface( this, type );
|
||||
this.surface( this, type );
|
||||
return input;
|
||||
}
|
||||
|
||||
for (List<IMEInventoryHandler<T>> invList : priorityInventory.values())
|
||||
for (List<IMEInventoryHandler<T>> invList : this.priorityInventory.values())
|
||||
{
|
||||
Iterator<IMEInventoryHandler<T>> ii = invList.iterator();
|
||||
while (ii.hasNext() && input != null)
|
||||
@@ -199,7 +199,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
||||
}
|
||||
}
|
||||
|
||||
surface( this, type );
|
||||
this.surface( this, type );
|
||||
|
||||
return input;
|
||||
}
|
||||
@@ -207,16 +207,16 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
||||
@Override
|
||||
public T extractItems(T request, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
if ( diveList( this, mode ) )
|
||||
if ( this.diveList( this, mode ) )
|
||||
return null;
|
||||
|
||||
if ( testPermission( src, SecurityPermissions.EXTRACT ) )
|
||||
if ( this.testPermission( src, SecurityPermissions.EXTRACT ) )
|
||||
{
|
||||
surface( this, mode );
|
||||
this.surface( this, mode );
|
||||
return null;
|
||||
}
|
||||
|
||||
Iterator<List<IMEInventoryHandler<T>>> i = priorityInventory.descendingMap().values().iterator();// priorityInventory.asMap().descendingMap().entrySet().iterator();
|
||||
Iterator<List<IMEInventoryHandler<T>>> i = this.priorityInventory.descendingMap().values().iterator();// priorityInventory.asMap().descendingMap().entrySet().iterator();
|
||||
|
||||
T output = request.copy();
|
||||
request = request.copy();
|
||||
@@ -237,7 +237,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
||||
}
|
||||
}
|
||||
|
||||
surface( this, mode );
|
||||
this.surface( this, mode );
|
||||
|
||||
if ( output.getStackSize() <= 0 )
|
||||
return null;
|
||||
@@ -248,15 +248,15 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
||||
@Override
|
||||
public IItemList<T> getAvailableItems(IItemList out)
|
||||
{
|
||||
if ( diveIteration( this, Actionable.SIMULATE ) )
|
||||
if ( this.diveIteration( this, Actionable.SIMULATE ) )
|
||||
return out;
|
||||
|
||||
// for (Entry<Integer, IMEInventoryHandler<T>> h : priorityInventory.entries())
|
||||
for (List<IMEInventoryHandler<T>> i : priorityInventory.values())
|
||||
for (List<IMEInventoryHandler<T>> i : this.priorityInventory.values())
|
||||
for (IMEInventoryHandler<T> j : i)
|
||||
out = j.getAvailableItems( out );
|
||||
|
||||
surface( this, Actionable.SIMULATE );
|
||||
this.surface( this, Actionable.SIMULATE );
|
||||
|
||||
return out;
|
||||
}
|
||||
@@ -264,7 +264,7 @@ public class NetworkInventoryHandler<T extends IAEStack<T>> implements IMEInvent
|
||||
@Override
|
||||
public StorageChannel getChannel()
|
||||
{
|
||||
return myChannel;
|
||||
return this.myChannel;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,7 +41,7 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
final public IItemList<IAEItemStack> storedItems = AEApi.instance().storage().createItemList();
|
||||
|
||||
public SecurityInventory(TileSecurity ts) {
|
||||
securityTile = ts;
|
||||
this.securityTile = ts;
|
||||
}
|
||||
|
||||
private boolean hasPermission(BaseActionSource src)
|
||||
@@ -50,7 +50,7 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
{
|
||||
try
|
||||
{
|
||||
return securityTile.getProxy().getSecurity().hasPermission( ((PlayerSource) src).player, SecurityPermissions.SECURITY );
|
||||
return this.securityTile.getProxy().getSecurity().hasPermission( ((PlayerSource) src).player, SecurityPermissions.SECURITY );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -63,15 +63,15 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
@Override
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable type, BaseActionSource src)
|
||||
{
|
||||
if ( hasPermission( src ) && AEApi.instance().items().itemBiometricCard.sameAsStack( input.getItemStack() ) )
|
||||
if ( this.hasPermission( src ) && AEApi.instance().items().itemBiometricCard.sameAsStack( input.getItemStack() ) )
|
||||
{
|
||||
if ( canAccept( input ) )
|
||||
if ( this.canAccept( input ) )
|
||||
{
|
||||
if ( type == Actionable.SIMULATE )
|
||||
return null;
|
||||
|
||||
storedItems.add( input );
|
||||
securityTile.inventoryChanged();
|
||||
this.storedItems.add( input );
|
||||
this.securityTile.inventoryChanged();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -81,9 +81,9 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
@Override
|
||||
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src)
|
||||
{
|
||||
if ( hasPermission( src ) )
|
||||
if ( this.hasPermission( src ) )
|
||||
{
|
||||
IAEItemStack target = storedItems.findPrecise( request );
|
||||
IAEItemStack target = this.storedItems.findPrecise( request );
|
||||
if ( target != null )
|
||||
{
|
||||
IAEItemStack output = target.copy();
|
||||
@@ -92,7 +92,7 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
return output;
|
||||
|
||||
target.setStackSize( 0 );
|
||||
securityTile.inventoryChanged();
|
||||
this.securityTile.inventoryChanged();
|
||||
return output;
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getAvailableItems(IItemList out)
|
||||
{
|
||||
for (IAEItemStack ais : storedItems)
|
||||
for (IAEItemStack ais : this.storedItems)
|
||||
out.add( ais );
|
||||
|
||||
return out;
|
||||
@@ -135,10 +135,10 @@ public class SecurityInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
GameProfile newUser = tbc.getProfile( input.getItemStack() );
|
||||
|
||||
int PlayerID = AEApi.instance().registries().players().getID( newUser );
|
||||
if ( securityTile.getOwner() == PlayerID )
|
||||
if ( this.securityTile.getOwner() == PlayerID )
|
||||
return false;
|
||||
|
||||
for (IAEItemStack ais : storedItems)
|
||||
for (IAEItemStack ais : this.storedItems)
|
||||
{
|
||||
if ( ais.isMeaningful() )
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ public class VoidFluidInventory implements IMEInventoryHandler<IAEFluidStack>
|
||||
|
||||
public VoidFluidInventory( TileCondenser te )
|
||||
{
|
||||
target = te;
|
||||
this.target = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,7 +46,7 @@ public class VoidFluidInventory implements IMEInventoryHandler<IAEFluidStack>
|
||||
return null;
|
||||
|
||||
if ( input != null )
|
||||
target.addPower( input.getStackSize() / 1000.0 );
|
||||
this.target.addPower( input.getStackSize() / 1000.0 );
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class VoidItemInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
|
||||
public VoidItemInventory( TileCondenser te )
|
||||
{
|
||||
target = te;
|
||||
this.target = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,7 +46,7 @@ public class VoidItemInventory implements IMEInventoryHandler<IAEItemStack>
|
||||
return null;
|
||||
|
||||
if ( input != null )
|
||||
target.addPower( input.getStackSize() );
|
||||
this.target.addPower( input.getStackSize() );
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user