use of mcjty.rftools.items.storage.StorageTypeItem in project RFTools by McJty.
the class ModularStorageTileEntity method isItemValidForSlot.
@Override
public boolean isItemValidForSlot(int index, ItemStack stack) {
if (index >= getSizeInventory()) {
return false;
}
switch(index) {
case ModularStorageContainer.SLOT_STORAGE_MODULE:
return !stack.isEmpty() && ModularStorageSetup.storageModuleItem == stack.getItem();
case ModularStorageContainer.SLOT_FILTER_MODULE:
return !stack.isEmpty() && stack.getItem() instanceof StorageFilterItem;
case ModularStorageContainer.SLOT_TYPE_MODULE:
return !stack.isEmpty() && stack.getItem() instanceof StorageTypeItem;
}
if (index < ModularStorageContainer.SLOT_STORAGE) {
return true;
}
if (isStorageAvailableRemotely(index)) {
index -= ModularStorageContainer.SLOT_STORAGE;
RemoteStorageTileEntity storageTileEntity = getRemoteStorage(remoteId);
if (storageTileEntity == null) {
return false;
}
ItemStackList stacks = storageTileEntity.findStacksForId(remoteId);
if (index >= stacks.size()) {
return false;
}
}
if (inventoryHelper.containsItem(ModularStorageContainer.SLOT_FILTER_MODULE)) {
getFilterCache();
if (filterCache != null) {
return filterCache.match(stack);
}
}
return true;
}
Aggregations