Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Match Item Tag - Toggle Tag List #15

Open
JoshMayberry opened this issue Aug 23, 2020 · 5 comments
Open

Suggestion: Match Item Tag - Toggle Tag List #15

JoshMayberry opened this issue Aug 23, 2020 · 5 comments

Comments

@JoshMayberry
Copy link

Looking at the source code, it think this filtering option is supposed to group items together based on their minecraft ID.
(You code very beautifully btw. Great use of comments, descriptive function names, etc.).

According to this site, the Oak Wood Plank block has an ID of 5 and the Spruce Wood Plank has an ID of 5:1. If I put oak planks in a filter with this advanced filtering option turned on- it lets both of them pass through, which was expected.

Likewise, Stone has an ID of 1, Granite has an ID of 1:1, and Polished Granite has an ID of 1:2- so I would expect all three of these to pass through the filter if I were to put stone in the filter- but none of them do, not even stone.
If I put granite (ID of 1:1) in the filter, it lets granite (ID of 1:1), diorite (ID of 1:3), and cobblestone (ID of 4) through- but not stone (ID of 1) or polished granite (ID of 1:2).

So, it does not seem to work the way I think it does.
Or, is it possible that the ID list on my server does not match up with the one on that site?
Or, is there a bug somewhere causing it to not function correctly?

@JoshMayberry
Copy link
Author

Looking at the match mod origin flag, I think I was misunderstanding the Match Item Tag flag, and don't understand how it works.

I think something like this is what I was imagining:

if (flags[FilteredPipeBlockEntity.MATCH_ITEM_ID_FLAG]) {
    Set<String> validItemIds = itemStacks.stream()
            .filter(itemStack -> !itemStack.isEmpty())
            .map(ItemStack::getItem)
            .map(Registry.ITEM::getId)
            .collect(Collectors.toSet());

    boolean passes = validItemIds.contains(Registry.ITEM.getId(queryStack.getItem()));

    queryStackParityPasses.add(passes);
    flagPasses.add(passes);
}

(It's just the match mod origin flag without the namespace portion)

My ultimate goal is to not need to put every type of log in a filter to filter all log types, or every type of wool in a filter to filter all wool colors, etc. :)
I guess the ore dictionary is a forge thing- not a minecraft thing; that was what I thought could originally do this- but sorting by block ID should work as well?

@cakewhip
Copy link
Collaborator

I'm not sure that blocks and items are still backed by a predefined integer (the registry system does use identifying integers underneath depending on when they were loaded in, but I haven't dug deep enough to reach it). But it's unrelated as the filter option actually looks at the item tags that the item is a part of. Truth be told, this is a horrible system. Many of the tags produce functionality that the user may not desire, such as the "guarded_by_piglins" tag. The reason it exists is because of a lack of (AFAIK) an ore dictionary in the Fabric ecosystem. I haven't thought of a better way of grouping items in an extensible, user-intuitive way. But for now I would suggest making use of the obscenely large filter inventory and even chaining the filter pipes in an OR fashion (one pipe connects to multiple filtered pipes, each one allowing opening a new path).

@JoshMayberry
Copy link
Author

I see. So, the flag is looking for an intersection in tags. For example, if I put gold in the filter- then anything with the tag "guarded_by_piglins" would pass through- because they both share that tag.

That makes sense. :)
I will do as you suggest with the large filters. I don't think this will be intuitively possible until fabric has some kind of ore dictionary.
Thank you for helping me understand this option a bit better. :) It was confusing, but now I understand.

@JoshMayberry
Copy link
Author

Just to double check, I have the the F3 debug screen shows some lines with a '#'under Targeted Block.
Those are tags (correct?). If I look at planks, they don't have any odd tags associated with them such as "#guarded_by_piglins":
image

So, this would be a safe block to use in a filter with Match Item Tag.

A gold block though should not be used in such a filter though because it has "#guarded_by_piglins" and "#beacon_base_blocks":
image

So, as long as I confirm things with the debug screen, I should be just fine using the Match Item Tag filter. For items that have odd tags, combine that filter with a chain of other filters that have every single variant of it.

Netherack would be horrible to use because it has so many tags:
image

Suggestion

What if there was a way to toggle which tags of the block I wanted to have applied, and which could be ignored? Kind of like this (the side bar would only appear if "Match Item Tag was turned on in the advanced filtering menu):
image

@JoshMayberry JoshMayberry reopened this Aug 23, 2020
@JoshMayberry JoshMayberry changed the title Advanced Filtering: Match Item Tag Mismatching Advanced Filtering: Match Item Tag - Toggle Tag List Aug 23, 2020
@JoshMayberry JoshMayberry changed the title Advanced Filtering: Match Item Tag - Toggle Tag List Suggestion: Match Item Tag - Toggle Tag List Aug 23, 2020
@JoshMayberry
Copy link
Author

JoshMayberry commented Aug 23, 2020

I also think that mod tags are ignored, which is probably a good thing- unless they were toggled off by default.

For example, the mod Cotton adds the tag #strip_command to a log, as well as to diorite, but putting a log in the filter does not let diorite pass through.
image
image

Also, I do not think my F3 screen is showing all tags, because #stones does not show up for diorite- but it does if I search it in REI:
image
It also is not in the list of item tags here, so I'm not too sure.

I haven't been able to find a good mod for fabric that will let me view tags like this one for forge.

So, I built this machine. It has one of every single block in those chests (took forever to populate). I have been using this to verify what will go through the filter when set to Match Item Tag.
image
Some odd ones, both stone and netherrack let nothing pass through- not even themselves. Golden carrots let LOTS of random things pass through.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants