appeng.api.storage.StorageChannel Java Examples

The following examples show how to use appeng.api.storage.StorageChannel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StorageCellMetaProvider.java    From OpenPeripheral-Integration with MIT License 6 votes vote down vote up
@Override
public Object getMeta(Item target, ItemStack stack) {
	IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell().getCellInventory(stack, null, StorageChannel.ITEMS);// get the inventory handler from ae api
	if (inventory instanceof ICellInventoryHandler) {
		ICellInventoryHandler handler = (ICellInventoryHandler)inventory;
		ICellInventory cellInventory = handler.getCellInv();
		if (cellInventory != null) {
			Map<String, Object> ret = Maps.newHashMap();

			ret.put("preformatted", handler.isPreformatted());
			ret.put("fuzzy", handler.isFuzzy());
			ret.put("freeBytes", cellInventory.getFreeBytes());
			ret.put("totalBytes", cellInventory.getTotalBytes());
			ret.put("usedBytes", cellInventory.getUsedBytes());
			ret.put("totalTypes", cellInventory.getTotalItemTypes());
			ret.put("usedTypes", cellInventory.getStoredItemTypes());
			ret.put("freeTypes", cellInventory.getRemainingItemTypes());

			return ret;
		}
	}

	return null;
}
 
Example #2
Source File: SemiBlockRequester.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
@Optional.Method(modid = ModIds.AE2)
public void onStackChange(IItemList arg0, IAEStack arg1, IAEStack arg2, BaseActionSource arg3, StorageChannel arg4){
    if(craftingGrid != null) {
        ICraftingGrid grid = (ICraftingGrid)craftingGrid;
        for(int i = 0; i < getFilters().getSizeInventory(); i++) {
            ItemStack s = getFilters().getStackInSlot(i);
            if(s != null) {
                if(!grid.isRequesting(AEApi.instance().storage().createItemStack(s))) {
                    getFilters().setInventorySlotContents(i, null);
                    notifyNetworkOfCraftingChange();
                }
            }
        }
    }
}
 
Example #3
Source File: AE2DiskInventoryItemHandler.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void getStacksInItem(ItemStack stack, List<ItemStack> curStacks){
    IMEInventoryHandler<IAEItemStack> cellInventoryHandler = cellRegistry.getCellInventory(stack, null, StorageChannel.ITEMS);
    if(cellInventoryHandler != null) {
        IItemList<IAEItemStack> cellItemList = storageHelper.createItemList();
        cellInventoryHandler.getAvailableItems(cellItemList);
        for(IAEItemStack aeStack : cellItemList) {
            ItemStack st = aeStack.getItemStack();
            st.stackSize = (int)aeStack.getStackSize();//Do another getStacksize, as above retrieval caps to 64.
            curStacks.add(st);
        }
    }
}
 
Example #4
Source File: SemiBlockRequester.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Optional.Method(modid = ModIds.AE2)
public List<IMEInventoryHandler> getCellArray(StorageChannel channel){
    if(channel == StorageChannel.ITEMS) {
        return Arrays.asList((IMEInventoryHandler)this);
    } else {
        return new ArrayList<IMEInventoryHandler>();
    }
}
 
Example #5
Source File: MENetworkStorageEvent.java    From Framez with GNU General Public License v3.0 4 votes vote down vote up
public MENetworkStorageEvent(IMEMonitor o, StorageChannel chan) {
	monitor = o;
	channel = chan;
}
 
Example #6
Source File: MENetworkStorageEvent.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public MENetworkStorageEvent( IMEMonitor o, StorageChannel chan )
{
	this.monitor = o;
	this.channel = chan;
}
 
Example #7
Source File: SemiBlockRequesterAE.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
@Optional.Method(modid = ModIds.AE2)
public StorageChannel getChannel(){
    return StorageChannel.ITEMS;
}
 
Example #8
Source File: IStackWatcherHost.java    From Framez with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Called when a watched item changes amounts.
 * 
 * @param o changed item list
 * @param fullStack old stack
 * @param diffStack new stack
 * @param src action source
 * @param chan storage channel
 */
void onStackChange(IItemList o, IAEStack fullStack, IAEStack diffStack, BaseActionSource src, StorageChannel chan);
 
Example #9
Source File: IStorageGrid.java    From Framez with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Used to inform the network of alterations to the storage system that fall outside of the standard Network
 * operations, Examples, ME Chest inputs from the world, or a Storage Bus detecting modifications made to the chest
 * by an outside force.
 * 
 * Expects the input to have either a negative or a positive stack size to correspond to the injection, or
 * extraction operation.
 * 
 * @param input injected items
 */
void postAlterationOfStoredItems(StorageChannel chan, Iterable<? extends IAEStack> input, BaseActionSource src);
 
Example #10
Source File: IAEStack.java    From Framez with GNU General Public License v3.0 2 votes vote down vote up
/**
 * @return ITEM or FLUID
 */
StorageChannel getChannel();
 
Example #11
Source File: IStackWatcherHost.java    From PneumaticCraft with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Called when a watched item changes amounts.
 *
 * @param o         changed item list
 * @param fullStack old stack
 * @param diffStack new stack
 * @param src       action source
 * @param chan      storage channel
 */
void onStackChange( IItemList o, IAEStack fullStack, IAEStack diffStack, BaseActionSource src, StorageChannel chan );
 
Example #12
Source File: IStorageGrid.java    From PneumaticCraft with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Used to inform the network of alterations to the storage system that fall outside of the standard Network
 * operations, Examples, ME Chest inputs from the world, or a Storage Bus detecting modifications made to the chest
 * by an outside force.
 *
 * Expects the input to have either a negative or a positive stack size to correspond to the injection, or
 * extraction operation.
 *
 * @param input injected items
 */
void postAlterationOfStoredItems( StorageChannel chan, Iterable<? extends IAEStack> input, BaseActionSource src );
 
Example #13
Source File: IAEStack.java    From PneumaticCraft with GNU General Public License v3.0 2 votes vote down vote up
/**
 * @return ITEM or FLUID
 */
StorageChannel getChannel();