What are you searching for?

Tag Exclusion
Tag Exclusion

Tag Exclusion

Library & utility for removing entries from tags

download 2 Downloads · favorite 0 Followers · Updated 5 days ago
Fabric Library Utility 1.21.11

Versions

inventory_2
Tag Exclusion 1.1.0+mc1.21.11

1.1.0+mc1.21.11 · 5 days ago · 20.46 KB

Release download
Fabric 1.21.11

About

A library & utility to allow removing entries from tags, to avoid having to use "replace": true in datapacks.

Syntax

There is now an abbreivated syntax for tag entries. You can add a ? at the end of an entry to mark it as optional and a ! at the beginning of an entry to mark it as an exclusion entry.

Exclusion entries will be removed from the tag, including from previous entries in the same tag file and from entries in lower packs.

Example:

{
  "values": [
    
    "#minecraft:doors",
    // Add all doors
    "!minecraft:spruce_door",
    // Except the spruce door
    
    "#minecraft:logs",
    // Add all logs
    "!#minecraft:logs_that_burn",
    // But not the ones that burn
    
    "create:brass_casing?",
    // Add create brass casing, if it's installed
    
    "!#enderscape:veiled_logs?"
    // Remove enderscape veiled logs, if it's installed
    
  ]
}

The standard expanded format is also extended.

{
  "values": [
    "#minecraft:logs",
    {
      "id": "#minecraft:logs_that_burn",
      "tagex:exclude": true
    }
  ]
}

Depending on Tag Exclusion

Currently, it is recommended to use JitPack to add the mod in Gradle and to jar-in-jar it.

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    modImplementation include("com.github.ThePotatoArchivist:TagExclusion:${project.tagex_version}")
}

Note: For some reason, JitPack cannot have + in version names, so when specifying the version in Gradle you must use - instead, e.g. 1.0.0-mc1.21.11. The version in the mod metadata still uses +, only the maven version uses -.

Data Generation

To add tag exclusions in data generation, use the extension methods to TagAppender.

valueLookupBuilder(ItemTags.ANVIL)
        .tagex_exclude(Items.CHIPPED_ANVIL);

valueLookupBuilder(ItemTags.LOGS_THAT_BURN)
        .tagex_forceExcludeTag(ItemTags.DARK_OAK_LOGS);

If you're using Kotlin, there are also extension functions that don't have tagex_ in the name.

with (valueLookupBuilder(ItemTags.ANVIL)) {
    exclude(Items.CHIPPED_ANVIL)
}

To avoid messing with datagen when it's not supposed to, datagen will only produce tag entries in abbreviated form if the generating mod has specified its mod id for datagen and declares a hard dependency on tagex.

In build.gradle:

fabricApi {
    configureDataGeneration {
        // ...
        modId = "testmod"
    }
}

You may need to regenerate your IDE run configurations.

In fabric.mod.json:

{
  // ...
  "depends": {
    // ...
    "tagex": "^1.0.0"
  }
}
open_in_new View on Modrinth
Compatibility
Client: Unsupported Server: Required
gavel MIT

Conversation

What are your thoughts?

Related projects

Library
Fabric API
Fabric API

by modmuss50

Lightweight and modular API providing common hooks and intercompatibility measures utilized by mods using the Fabric toolchain.

download 128.4M
favorite 27,401
Library
Cloth Config API
Cloth Config API

by shedaniel

Configuration Library for Minecraft Mods

download 94.4M
favorite 13,670
Optimization Utility
FerriteCore
FerriteCore

by malte0811

Memory usage optimizations

download 84.3M
favorite 12,712
Utility
Mod Menu
Mod Menu

by Prospector

Adds a mod menu to view the list of mods you have installed.

download 77.7M
favorite 22,127
lock Cookie consent

SkinMC uses cookies to provide functionality and features.