Just a wish: Item Filter for Bees
AokuYuki opened this issue · 12 comments
Hi there,
i really love this plugin! Its easy to use and easy to understand.
Is there a way to modify the ItemFilter for sorting bee races?
Forget it o found out that they moved Apiarist Pipe to the Mod BuildCraftCompat BUT they have now a genetic filter, which is not very well documented.
Sorry for the troubly and thanks for readying!
I'm currently working on an Item filter that's based on display name (not available yet!). So if the bee races appear in their Item's name this could theoretically be used to filter them: For example letting it check whether the name contains the keyword Forest
to filter out items named Forest Pricess
, Forest Drone
, etc.
The reason why the normal filter doesn't work for that is probably, that forestry has all bees use the same item and store their genetic data in NBT. But the filters can only either ignore NBT completely or require a full match of the data, so filtering by only specific traits is not possible.
Ah! I didn’t even know it could search on NBT. I’m totally going to check that out. Then yes... always -steal- borrow prior art when possible. :)
No, it can't search by NBT. With similar to JEI I meant the fact that it uses the search string as regular expression.
And unfortunately I just noticed that adding support for tooltip scanning is impossible, because they are client side only :(
There are other mods that access raw NBT data, like Integrated Dynamics. But that's no reason not to make it an option. Everything should be an option. :)
Actually, I remember that one of my very first minecraft mods I ever made (at least the first one with Forge Modloader) added a block that could be attached to any TileEntity and emit redstone signals based on configurable conditions on variables in the TileEntity's NBT-data. The reason I made that mod was because It annoyed me that the internal redstone control features of the old Industrial Craft energy storage blocks were implemented in a way that made them completely useless (that was with MC 1.4, not sure if IC ever fixed this problem even till today).
Maybe I can still find it in the ancient depths of my old hard-drive and 'steal-borrow' a bit. Reading my own old code again might be fun.
When you add the text filter, adding an option to compare it to all the NBT data tags and/or values (even nested tags) would be cool. :)
@Nonsanity do you mean something like:
Items/.+/id=minecraft:cobblestone
as pattern string in NBT mode would match all items that have an NBT tag named Items
that contains any subtag that contains a tag named id
with the value minecraft:cobblestone
. Which would for example filter broken ItemBuffers (or backpacks etc.) by whether they contain cobblestone in their saved inventory.
I was originally thinking just a simple string search with no definition of keys or levels, so just searching for NBT of “cobblestone” would be positive for anything that has “cobblestone” as part of a key (unlikely) or part of a value, like a broken buffer with “minecraft:cobblestone” in it.
But creating a more elaborate and detailed system to specifically target tags by key with wildcards could prevent over-matching in some cases, if it was defined in an easy-to-understand way. I’m not quite sure from looking at your example how the code would parse al those symbols, even knowing what the example is supposed to mean.
(Of course, as soon as you add the ability to match on NBT, people will start wishing for things like: “Match on any key ‘size’ with value > 400”) :)
Another problem with this kind of feature is that one could consider it as cheating because mods might store data in NBT tags that is not supposed to be revealed to the player. For example would such a filter allow sorting the above mentioned Forestry Bees without needing to analyze them first.
In addition to that: In order to make proper use of such a filter a player would need some insight to the data structures in which the individual item features are stored, which is normally not obtainable without debugging tools or messing with mod source code or save games.
So I think if I add such a feature at all, it would be optional and disabled by default config.
But I will definitely extend the Name Filter so it can not only operate on the name itself but also the tooltip. This would at least provide access to those properties that are 'voluntarily' shown to the player.
By the way it is totally possible to do conditions like >=400
with regular expressions so no extra feature required, for example: Charges left: (\d{4,}|[4-9]\d\d)
would match items that mention in their tooltip that they have 400 or more charges left (whatever that might mean).
The original intention of the Name filter was to filter items in a similar way you do with the JEI/NEI search bar. So one could easily test whether the typed in pattern would give the desired results.
By the way because some people wanted a quick release of some bug fix, there is already a prototype version of the Filter in the latest pre-release version here on Github.