---
title: Filters
hide_meta: true
---

Filters pick which items a rule applies to.

## All filters

| Filter | What it matches | Example |
| :--- | :--- | :--- |
| `items` | Item IDs or item tags | `["minecraft:tnt", "#minecraft:logs"]` |
| `blocks` | Block IDs or block tags | `["minecraft:anvil", "#minecraft:beds"]` |
| `fluids` | Fluid IDs or tags | `["minecraft:lava"]` |
| `effects` | Status effect IDs or tags | `["minecraft:poison"]` |
| `enchantments` | Enchantment IDs or tags | `["minecraft:mending", "#minecraft:curse"]` |
| `tags` | Tags (without the `#`) | `["minecraft:logs"]` |
| `mod` | Everything from a mod | `["farmersdelight"]` |
| `patterns` | Regex against the ID | `["/.*_sword/"]` |
| `components` / `nbt` | Item data, like damage or enchantments | `["[damage=0]"]` (1.21+)<br/>`["{Damage:0}"]` (1.20.1) |
| `dimensions` | Only in these dimensions | `["minecraft:the_nether"]` |
| `entities` | Only on these mobs | `["minecraft:zombie"]` |
| `not` | Exceptions | `{ "items": ["minecraft:stick"] }` |
| `tag_type` | Only remove from item tags or block tags | `["item"]` |
| `registry` | Only apply in certain places | `["loot"]` |
| `replace_with` | What to swap the item for | `"minecraft:emerald"` |

Any list with one entry can be written as a plain string, so `"items": "minecraft:tnt"` works too.

## How filters combine

**These add more items** to the rule: `items`, `blocks`, `fluids`, `effects`, `tags`, `patterns`. This rule removes TNT, Bedrock **and** every log:

```json
{
  "action": "remove",
  "items": ["minecraft:tnt", "minecraft:bedrock"],
  "tags": ["minecraft:logs"]
}
```

**These narrow the rule down**: `mod`, `dimensions`, `entities`, `components`, and `enchantments` (except in `remove_enchantment`, where it picks the enchantment to remove). This rule removes swords, but **only** from Minecraft. Modded swords are left alone:

```json
{
  "action": "remove",
  "mod": ["minecraft"],
  "patterns": ["/.*_sword/"]
}
```

## Tags

Put a `#` in front of a tag in `items`, `blocks`, `fluids`, `effects` or `enchantments`:

```json
{
  "action": "remove",
  "items": ["#minecraft:logs"]
}
```

## Mods

Everything from Farmer's Delight:

```json
{
  "action": "remove",
  "mod": ["farmersdelight"]
}
```

The mod ID is the part before the `:` in an item ID (`farmersdelight:cabbage`).

## Regex patterns

Wrap the pattern in slashes. The pattern has to match the **whole** ID, including the `modid:` part.

| Pattern | Matches |
| :--- | :--- |
| `/.*_sword/` | `minecraft:diamond_sword`, `othermod:copper_sword` |
| `/minecraft:.*_sword/` | `minecraft:diamond_sword`, but not `othermod:copper_sword` |
| `/.*_spawn_egg/` | Every spawn egg |
| `/minecraft:.*_log/` | Every vanilla log |
| `/_sword/` | **Nothing**. It doesn't cover the rest of the ID. Use `/.*_sword/`. |

```json
{
  "action": "remove",
  "patterns": ["/.*_spawn_egg/"]
}
```

## Dimensions

Only remove water buckets in the Nether:

```json
{
  "action": "remove",
  "items": ["minecraft:water_bucket"],
  "dimensions": ["minecraft:the_nether"]
}
```

[More dimension examples](/project/reliable-remover/latest/docs/reliable-remover/examples/dimension-rules)

## Entities

`entities` limits the rule to certain mobs. What that means depends on the action.

Zombies can't hold diamond swords (players still can):

```json
{
  "action": "remove",
  "items": ["minecraft:diamond_sword"],
  "entities": ["minecraft:zombie"]
}
```

Players can't attack villagers with any item:

```json
{
  "action": "remove_attacks",
  "entities": ["minecraft:villager"]
}
```

Players can't saddle pigs (horses are fine):

```json
{
  "action": "remove_interactions",
  "items": ["minecraft:saddle"],
  "entities": ["minecraft:pig"]
}
```

## Exceptions with `not`

Anything inside `not` is excluded from the rule. It accepts the same filters as a normal rule.

Remove all of AE2 except Certus Quartz:

```json
{
  "action": "remove",
  "mod": ["ae2"],
  "not": {
    "items": ["ae2:certus_quartz_crystal"]
  }
}
```

Block Ender Pearls everywhere except the End:

```json
{
  "action": "remove_interactions",
  "items": ["minecraft:ender_pearl"],
  "not": {
    "dimensions": ["minecraft:the_end"]
  }
}
```

## Item data (components / NBT)

Use this to match items with specific data, like damage, enchantments or custom data. The rule applies if **any** entry matches. You can write `components` or `nbt`, they're the same field.

The syntax depends on your Minecraft version.

### 1.21 and newer

Uses the same syntax as `/clear` and `/execute if items`.

| Entry | Matches |
| :--- | :--- |
| `"[damage=0]"` | Undamaged items |
| `"minecraft:diamond_sword[damage=0]"` | Undamaged diamond swords only |
| `"[enchantments~[{enchantments:\"minecraft:sharpness\"}]]"` | Items with Sharpness (any level) |
| `"[stored_enchantments~[{enchantments:\"minecraft:mending\"}]]"` | Enchanted books with Mending |
| `"[custom_data~{my_pack:{banned:true}}]"` | Items whose custom data includes `{my_pack:{banned:true}}` |
| `"[damage=0,rarity=epic]"` | Undamaged **and** epic rarity |
| `"/.*custom_model_data.*/"` | Regex against all of the item's components |

Use `=` for an exact match and `~` for a partial match.

Old-style NBT like `"{Damage:0}"` does **not** work on 1.21+. Those entries are skipped and an error is logged.

### 1.20.1

Uses NBT. The item matches if its NBT **contains** what you write.

| Entry | Matches |
| :--- | :--- |
| `"{Damage:0}"` | Undamaged items |
| `"{CustomModelData:1}"` | Items with `CustomModelData` 1 |
| `"{StoredEnchantments:[{id:\"minecraft:mending\"}]}"` | Enchanted books with Mending |
| `"/.*StoredEnchantments.*/"` | Regex against the item's full NBT |

### Example

Remove enchanted books with Mending, but leave other books alone:

```json
{
  "action": "remove",
  "items": ["minecraft:enchanted_book"],
  "components": ["[stored_enchantments~[{enchantments:\"minecraft:mending\"}]]"]
}
```

To get rid of Mending everywhere (tables, loot, trades), [`remove_enchantment`](/project/reliable-remover/latest/docs/reliable-remover/removal-actions#remove_enchantment) is usually easier.

## Replacing items (`replace_with`)

Removes the item, but swaps it into every recipe that used it. Here, any recipe that needed a diamond now needs an emerald:

```json
{
  "action": "remove",
  "items": ["minecraft:diamond"],
  "replace_with": "minecraft:emerald"
}
```

The replacement keeps the original item's damage, enchantments and name. To change that, add components after the ID, the same way you would in `/give`. This turns Netherite Swords into half-broken Diamond Swords with no enchantments:

```json
{
  "action": "remove",
  "items": ["minecraft:netherite_sword"],
  "replace_with": "minecraft:diamond_sword[damage=500,!enchantments]"
}
```

On 1.20.1, use NBT instead: `"minecraft:diamond_sword{Damage:500}"`.

You can also put the components in a separate `replace_components` field. This does the same thing:

```json
{
  "action": "remove",
  "items": ["minecraft:netherite_sword"],
  "replace_with": "minecraft:diamond_sword",
  "replace_components": "[damage=500,!enchantments]"
}
```

`replace_with` also works with [`remove_inventory`, `remove_storage`, `remove_drops` and `remove_equipment`](/project/reliable-remover/latest/docs/reliable-remover/removal-actions#deleting-items-from-the-world) (swap the item instead of deleting it) and [`remove_effect`](/project/reliable-remover/latest/docs/reliable-remover/removal-actions#remove_effect) (swap the effect).

## Tag type and registry

These limit where `remove` applies.

`registry` picks the places: for example `["loot"]` only removes the item from loot, and `["tag"]` only removes it from tags.

`tag_type` picks which tags: `["item"]` or `["block"]`.

Together, they let you take an item out of tags without removing it. Here, oak logs stay in the game but stop counting as `#minecraft:logs` in recipes. The placed block keeps its block tags, so axes still mine it quickly:

```json
{
  "action": "remove",
  "items": ["minecraft:oak_log"],
  "registry": ["tag"],
  "tag_type": ["item"]
}
```

Without `registry`, the item would be removed everywhere, and `tag_type` would only keep it in block tags.
