Skip to content

Entry Removals in json tag files#4721

Closed
cputnam-a11y wants to merge 92 commits intoFabricMC:26.1.2from
cputnam-a11y:remove-tag-entries-1.21.6
Closed

Entry Removals in json tag files#4721
cputnam-a11y wants to merge 92 commits intoFabricMC:26.1.2from
cputnam-a11y:remove-tag-entries-1.21.6

Conversation

@cputnam-a11y
Copy link
Copy Markdown
Contributor

@cputnam-a11y cputnam-a11y commented Jun 25, 2025

Adds a fabric:remove field to JSON tag files allowing removals from existing contents.

This is useful in cases where you don't want to bring over an entire tag in a new tag, but still want the tag's contents, or in cases where gameplay logic is dictated by tags.

Such as the new Villager Trade tags, which determine which trades show up within professions and their levels. You may want to remove the enchanted book trades from Librarians, and this would offer the ability to do that in a clean and easy way.

{
  "replace": false,
  "fabric:remove": [
    "minecraft:brick"
  ],
  "values": [
    "#c:bricks", // Don't know if this exists, but it existing or not is irrelevant. Just gotta get the point across.
    "minecraft:snowball"
  ]
}

@cputnam-a11y cputnam-a11y changed the title Commit Entry Removals in json tag files Jun 25, 2025
Comment thread fabric-tag-api-v1/src/main/java/net/fabricmc/fabric/mixin/tag/TagEntryMixin.java Outdated
Comment thread fabric-tag-api-v1/src/main/java/net/fabricmc/fabric/mixin/tag/TagEntryMixin.java Outdated
Copy link
Copy Markdown
Member

@modmuss50 modmuss50 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I havent done an indepth review of the impl just yet. Overall I am happy with the propsoal.

I think we should start by having this as fabric:remove. As I said on discord I am hesitant to merge a c:remove without first being 100% sure that neo are also going to adopt this, we have been burnt by this before. Lets concenrate on ourselves first as we can easily add support for c:remove later when the stars have all aligned.

Data generation support is also required for this, and I think there is a lot of scope to improve the tests.

This looks like a great start though 👍

Comment thread fabric-tag-api-v1/src/main/java/net/fabricmc/fabric/mixin/tag/TagEntryMixin.java Outdated
Comment thread fabric-tag-api-v1/src/testmod/java/net/fabricmc/fabric/test/tag/TagAliasTest.java Outdated
@cputnam-a11y cputnam-a11y changed the base branch from 1.21.6 to 1.21.9 September 18, 2025 03:50
# Conflicts:
#	fabric-tag-api-v1/src/main/resources/fabric-tag-api-v1.mixins.json
#	fabric-tag-api-v1/src/testmod/java/net/fabricmc/fabric/test/tag/TagAliasTest.java
@ChrysanthCow
Copy link
Copy Markdown
Contributor

ChrysanthCow commented Feb 5, 2026

Hello, I will be taking over this PR for the time being.

I'd like to ask about changing the JSON format for this PR a bit,

I do like the simplicity of the current system, but I'd like to offer a more extensible system for any future tag related PRs, for example, ordering related fields.

My main concern is that if we keep adding new fields to the root, it leaves little room for other tag PRs to add their own contents, and makes files messier.

I'd also like to suggest a shortened format for remove entries if this is the case. !. This is always prefixed first within the tag entry, before the ID and #. No other short-forms should exist as they cannot be known at a surface level.

{
    // Default vanilla values.
    // It is preferable to use this over 'fabric:values' for any vanilla supported entries.
    // Especially when developing alongside vanilla/multiloader contexts.
    "values": [
        // This exact tag is why an ordering system for tags would be nice to have.
        "#minecraft:tooltip_order"
    ],
    // Any Fabric extended values.
    // I feel this shouldn't be put into "values" mainly to avoid potential breakage within vanilla compatible datapacks.
    // If the Conventional Tags people like this, they are free to adopt this system. 
    "fabric:values": [
        // Removes Mending from this tag, throws if the entry was never within the tag or not removed by somebody else first.
        "!minecraft:mending",
        {
            "id": "minecraft:mending",
            "fabric:remove": true
        },
        // Removes othercoolmod:frost_aspect from this tag, ignored if the content was never in the tag to begin with.
        {
            "id": "othercoolmod:frost_aspect",
            "required": false,
            "fabric:remove": true
        },
        // Order related operations.
        // No short-hand form for before/after.
        {
            "id": "mycoolmod:my_new_intro", // 
            "fabric:order": 0
        },
        {
            "id": "mycoolmod:pharaoh_curse",
            "fabric:before": [
                "#minecraft:curses"
            ]
        },
        {
            "id": "mycoolmod:frost_aspect",
            "fabric:after": [
                "minecraft:fire_aspect"
            ]
        },
        {
            "id": "mycoolmod:pharaoh_curse",
            "fabric:before": [
                "minecraft:vanishing_curse"
            ],
            "fabric:after": [
                "othercoolmod:obabo_curse"
            ]
        }
    ]
}

@ChrysanthCow
Copy link
Copy Markdown
Contributor

ChrysanthCow commented Feb 5, 2026

This is probably going into mega overengineered territory, but I thought I'd suggest the full thing to see if anybody else has a better way to handle this sort of tag extension system.

@ChrysanthCow
Copy link
Copy Markdown
Contributor

ChrysanthCow commented Feb 5, 2026

@cputnam-a11y Could you please change the target to 26.1 with these changes?

@ChrysanthCow
Copy link
Copy Markdown
Contributor

ChrysanthCow commented Feb 5, 2026

Summary of Discord discussion with @cassiancc:

  • I need to update the wording on some of the comments.
  • fabric:values is better than fabric_extended_values
  • Short-hand should only be used for removal operations, not order based ones.

@cputnam-a11y cputnam-a11y marked this pull request as ready for review February 5, 2026 05:14
@cputnam-a11y cputnam-a11y marked this pull request as draft February 5, 2026 05:15
@cputnam-a11y
Copy link
Copy Markdown
Contributor Author

cputnam-a11y commented Feb 5, 2026

@cputnam-a11y Could you please change the target to 26.1 with these changes?

I don't have the dropdown to do so. googling suggested it must be done by someone with write perms to the target repo
(Edit Feb 8): github is just having a skill issue

@ChrysanthCow
Copy link
Copy Markdown
Contributor

Honestly, I've done some thinking about this.

I think fabric:remove is fine, mainly because I doubt we'll have anybody extending fabric:values to add their own tag data.

The order stuff could be fabric:order as a different field with its own syntax instead.

@cputnam-a11y cputnam-a11y changed the base branch from 1.21.9 to 26.1 February 9, 2026 02:58
@ChrysanthCow
Copy link
Copy Markdown
Contributor

This should now be ready.

@cputnam-a11y You're free to make this PR a non-draft.

@cputnam-a11y
Copy link
Copy Markdown
Contributor Author

This should now be ready.

@cputnam-a11y You're free to make this PR a non-draft.

Undrafting. Please be sure to address each unresolved review, and have the existing reviewers re-review

@cputnam-a11y cputnam-a11y marked this pull request as ready for review February 17, 2026 22:07
@cassiancc cassiancc added enhancement New feature or request area: tags PR relates to Minecraft tags labels Feb 22, 2026
@ChrysanthCow
Copy link
Copy Markdown
Contributor

ChrysanthCow commented Apr 27, 2026

I think I'm done now. I'm so sorry for throwing everything off with this last minute bikeshed.

@ChrysanthCow
Copy link
Copy Markdown
Contributor

@cputnam-a11y Could you request re-review from ppl who have reviewed? Thanks.

Comment thread fabric-tag-api-v1/src/main/java/net/fabricmc/fabric/mixin/tag/TagFileMixin.java Outdated
ChrysanthCow and others added 4 commits April 28, 2026 06:00
…TagFileMixin.java

Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
…est/tag/client/v1/ClientTagGameTests.java

Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
@ChrysanthCow
Copy link
Copy Markdown
Contributor

Failing tests are bc of outside factors atp.

Copy link
Copy Markdown
Contributor

@ChrysanthCow ChrysanthCow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the one working on this API, I think it's improved a lot with feedback in mind.

entries.stream()
.filter(entry -> entry.source().equals(sourceId)),
REMOVE_ENTRIES.get()
.getOrDefault(tagId, Collections.emptyList())
Copy link
Copy Markdown
Contributor

@ChrysanthCow ChrysanthCow Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to getOrDefault here because the the remove list is checked for isEmpty prior.

@ChrysanthCow
Copy link
Copy Markdown
Contributor

PR moved over here.

@ChrysanthCow
Copy link
Copy Markdown
Contributor

@cputnam-a11y Could you please close this PR. It has been superseded by the above.

@cputnam-a11y
Copy link
Copy Markdown
Contributor Author

Succeeded by #5365

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tags PR relates to Minecraft tags enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.