Malorolam / LootBags

Other
21 stars 31 forks source link

[1.12.2] [Request] Bag config White/Black list RegEx support #139

Closed Andronomos closed 6 years ago

Andronomos commented 6 years ago

Is it possible to add the ability to use regular expressions in the white and black lists so you can add every item from a mod to the list without having to manually add each item one by one?

For example:

$STARTWHITELIST
    minecraft:.*
$ENDWHITELIST

Would load every item in minecraft into the whitelist.

Or perhaps some other method for whitelisting an entire mod?

Malorolam commented 6 years ago

Blacklists already have a mod-wide option, just blacklist the mod id and no other fields on that line. 1.12.2 also introduced the lootbags_dumpinventory command, which duplicates the effect of the helditemdump command but for your entire inventory.

For whitelisting an entire mod; in short, no.
I have no way of handling a blanket inclusion like that and exclude items or blocks that are intended to not be handled by the player. In minecraft alone there are fire, spawners, nether portal blocks, end portal blocks, end portal frame, water source, water still, lava source, lava still, bedrock, and enchant-less enchanted books; all incidental blocks or items that aren't intended to be obtained in inventory stack form because they either need extra data generated on them or they produce an in-game effect. That's just what I remember from minecraft, adding in all of the various random things mod authors tend to do just adds more situations where the system will cause issues. Case in point, many mods, most notably Tinker's Construct and Thermal Expansion, have crafting processes that give items with NBT data. I have no way of generating that data correctly short of creating a handler to generate that information, either personally or asking the developers of those mods to incorporate it for me. This is the optimal case, assuming that none of these inaccessible items are WIP or deprecated components of the mod that crash the game. Ignoring those problems, this also adds the problem of drop stack variance and weights. I would have to arbitrarily assign that data to the items, which in the simplest case means that everything has the same data, making nether stars as likely to occur as cobblestone. Building a system to dynamically determine this, based exclusively off of name, crafting recipes (requiring another custom handler to parse the recipes early), mob drops, and any other data I can scrape out of the game would likely be a programming problem on par with many capstone or graduate-level programming projects.

Andronomos commented 6 years ago

Thanks for the reply. As a programmer, I understand how a simple feature becomes a huge project. I hadn't thought about items not intended to be handled by the player.

I'm currently using the dumpinventory command and it is extremely useful but still very time consuming if you have hundreds of items to whitelist. That's why I was hoping there was an alternative. Speaking of the command, would it be difficult to add an ignore feature for empty slots rather than outputting minecraft:air?

I didn't know the blacklist supported a mod wide feature, thanks for the tip.

Malorolam commented 6 years ago

The air block thing will be fixed in the next version.