Ender IO Endergy

Ender IO Endergy

12M Downloads

[Feature Request] Limited Existing Item Filter

borg286 opened this issue ยท 6 comments

commented

Would it be possible to either add a Limited capability to the Existing Item Filter, or to make a new filter that combines Existing Item Filter with Limited Item Filter. Please note, I'm not asking for the Limited Item Filter's whitelist of items, only a numeric field it uses to know how much of a given item is allowed to be pushed into the inventory.

My main use case is that I'd like to have my main crafting chest/crate only have a single stack of a given item and to skip pulling in items that I already have enough of. I'm not asking it to suck back items that I have too much of. The Inverted Limited Item Filter that is proposed could easily handle doing that, if accepted.

commented

Just to help with being clear with my request, in here
https://github.com/SleepyTrousers/EnderIO/blob/b6d85929f4d411a81f48680eed564b4314739b2c/enderio-base/src/main/java/crazypants/enderio/base/filter/item/ExistingItemFilter.java#L45
I'm proposing we keep track of the total quantity of a particular item scanned, and to have a second check that the item being imported wouldn't put us over this limit.

commented

The inverted filter suggestion is about forcing the size of the stack that is transferred, regardless of the stack in the inventory. It would better be expressed as "speed upgrade that forces the given transfer amount".

Your suggestion would be a variant of the existing filter that has a single numeric value for the whole filter that works like the stack size of the limited filter, I think? That should be possible, I'll need to have a detailed look at this later.

commented

Yes, a single numeric value for the whole filter.
One complication I thought of would be how to handle items and rejecting only some of them (want 64, have 62, importing 4). Currently if an item matches either the inventory or snapshot it either accepts as much as the inventory can handle or fails the filter test and rejects the transfer attempt. I assume the code already handles cases when the inventory is full and can only accept some of a stack then we should be able to reuse this same experience.

commented

The limited filter handles that by returning the number of items that can be inserted instead of just "allow/deny". In fact, when creating it, I mapped all of the allow/deny checks to return "maxInt/nothing" (I think it's a default method in the IFilter interface). So that part is already handled.

PS: It's the IItemFilter, line 39.

commented

One complication I just thought of that hampers my use case. What happens when I use up all the items in my main inventory and would like it refilled. In this case the "existing" aspect of the filter is an undesirable trait. Perhaps a new filter that pulls in items but only up to a limit, however uses the attached inventory to read the size rather than the quantity in the whitelist of items that the current Limited Item Filter does.
For example it could be a Limited Count Filter. Rather than opening a UI that you can provide ghost items and counts you want in the attached inventory, you simply specify a count. The filter passes all items as long as the attached inventory doesn't have up to the configured quantity.

commented

i'm closing this temp for now