Mob Gear

Quick rating

Mob Gear

No reviews yet

A server-side Fabric mod which allows datapacks to decide what gear mobs spawn with using loot tables

QoL & Tweaks
Mod Loaders
Fabric
Minecraft

Community voices

Reviews

Versions
Loading versions…
Match includes

Click once to include, again to exclude, again to clear

Rating Any
Any 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
Min
Max
Play Status
Reviews
Time Played
hrs+
Verified developers only
Has developer response
List view
Grid view
Compact view
Sort by
Date
Rating
Helpful
Unhelpful
Edited
Sort ascending
Delete this review?

This removes your review from the project. You can write a new review after.

Review submitted for moderation

Your review has been sent to moderators, who will check that it meets our guidelines before it appears publicly.

No reviews yet. Be the first to review this project!

Get it on

Available Platforms

Compatibility

Supported Environments

Where It Runs
Server Only

Runs entirely on the server. Also works in singleplayer.

About

Project Details

Type
Mod
License
Creative Commons Zero v1.0 Universal
Latest Version
mobgear-1.0.1.jar

For authors

Embed Badge

If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.

Custom banner text
ModDex rating badge preview

Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.

Identifiers

Platform IDs

CurseForge ID
Modrinth ID

Resources

External Links

Source Issues Wiki Discord

About

Description

MobGear

A server-side fabric mod which adds the ability for datapacks to control what equipment mobs spawn with using loot tables.

This mod can be installed on the server without needing players to install it!

Loot tables matching the entity's resource location under loot_table/mobgear/ folder will determine the type of equipment that entity spawns with. As an example data/minecraft/loot_table/mobgear/zombie.json will control what equipment the zombie will spawn with. For modded mobs the equivalent would be data/modname/loot_table/mobgear/modded_mob.json (this is not tested but it might work!).

How is luck handled?

When generating the equipment loot table, luck is set as the local difficulty. This means the range is following:

  • Peaceful: 0
  • Easy: 0.75 - 1.5
  • Normal: 1.5 - 4.0
  • Hard: 2.25 - 6.75

These ranges can be used to make certain equipment only appear when the difficulty is high enough to really spice up the difficulty.

Read more about local difficulty

New Combined Group loot entry type

Currently vanilla loot tables have no proper way of selecting multiple specific items at once. Introducing mobgear:combinedgroup! CombinedGroup behaves similarly to regular Group but all of the items generated within the children are provided as potential equipment.

Unlike the vanilla loot groups, the combined group also includes weight and quality fields which behave like regular: real weight = max(floor(weight + (quality × luck)),0). If the resulting weight is 0 or less, the group is discarded.

Items inside the combined group can also use weight and quality to filter out items out of the group. Similar to combined group itself if the real weight is 0 or less then the item is discarded.

Example Loot table using CombinedGroup to equip full iron armor:

```json { "type": "minecraft:equipment", "pools": [ { "rolls": 1, "entries": [ { "type": "mobgear:combinedgroup", "weight": 1, "quality": 0, "children": [ { "type": "minecraft:item", "name": "minecraft:iron_helmet" }, { "type": "minecraft:item", "name": "minecraft:iron_chestplate" }, { "type": "minecraft:item", "name": "minecraft:iron_leggings" }, { "type": "minecraft:item", "name": "minecraft:iron_boots" } ] } ] } ] } ```

Equip order

There are only a limited number of slots in a mob which can be filled with items. Items are selected to their corresponding slots in first come first serve order and will attempt to equip the item to it's matching slot. This however can be bypassed using custom data component!

Custom data controls

The equipped items can be controlled using the following custom data components:

mobgear:priority

Number value. Controls item's equip priority. Highest number is equipped first.

mobgear:slot

Possible values:

  • "MAINHAND"
  • "OFFHAND"
  • "FEET"
  • "LEGS"
  • "CHEST"
  • "HEAD"
  • "BODY"
    • Refers to animal body slot. Used with horse armor and Lama carpets.
  • "SADDLE"

Determines which slot this item attempts to occupy. If the slot is already taken, the item will be discarded.

You can put any item to any slot but they might not show up correctly!

Example of putting a black banner on the head:

```json { "type": "minecraft:item", "name": "minecraft:black_banner", "functions": [ { "function": "minecraft:set_custom_data", "tag": { "mobgear:slot": "HEAD" } } ] } ```

Example of dual wielding wooden axes:

```json "entries": [ { "type": "minecraft:item", "name": "minecraft:wooden_axe", "functions": [ { "function": "minecraft:set_custom_data", "tag": { "mobgear:slot": "MAINHAND" } } ] }, { "type": "minecraft:item", "name": "minecraft:wooden_axe", "functions": [ { "function": "minecraft:set_custom_data", "tag": { "mobgear:slot": "OFFHAND" } } ] } ] ```

mobgear:dropchance

Number value between 0-1. Controls % chance of this item being dropped on death. 1 meaning 100%, 0.5 meaning 50% and 0 meaning 0% chance. This is useful for making equipment undroppable even with looting when the equipment was not made to be used by players.

Example of making OP equipment not drop:

```json { "type": "minecraft:item", "name": "minecraft:netherite_chestplate", "functions": [ { "function": "minecraft:set_enchantments", "enchantments": { "minecraft:protection": 10, "minecraft:projectile_protection": 10, "minecraft:blast_protection": 10 } }, { "function": "minecraft:set_custom_data", "tag": { "mobgear:dropchance": 0 } } ] } ```

Example of having 30% chance to drop the equipped zombie head:

```json { "type": "minecraft:item", "name": "minecraft:zombie_head", "functions": [ { "function": "minecraft:set_custom_data", "tag": { "mobgear:dropchance": 0.3, "mobgear:slot": "HEAD" } } ] } ```

mobgear:deathloottable

String value to loot table resource path. This changes the mob's DeathLootTable which determines which Loot table is used to generate the mob's dropped loot. This is the only custom data value that isn't specifically targetting the item but the mob itself.

Example of setting mob's death loot table to desert pyramid's archaeology loot:

```json { "type": "minecraft:equipment", "pools": [ { "rolls": 0, "entries": [ { "type": "minecraft:item", "name": "minecraft:egg", "functions": [ { "function": "minecraft:set_count", "count": { "type": "minecraft:uniform", "min": 3, "max": 7 } }, { "function": "minecraft:set_custom_data", "tag": { "mobgear:deathloottable": "minecraft:archaeology/desert_pyramid" } } ] } ] } ] } ```

Using vanilla equipment logic

Most hostile mobs have pre-existing logic for their equipped gear which can be a hassle to recreate using loot tables. I've implemented a simple solution for having an option to decide whether to use vanilla equipment or to use custom equipment.

If loot table has no valid Loot Pools the vanilla behavior is used! This can be controlled using Loot Pool's conditions.

Example of only using custom equipment if mob spawns in a Stronghold:

> If the location_check condition is false then vanilla behavior is used as none of the available loot pools are valid.
{
  "type": "minecraft:equipment",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        ...
      ],
      "conditions": [
        {
          "condition": "minecraft:location_check",
          "predicate": {
            "structures": "minecraft:stronghold"
          }
        }
      ]
    }
  ]
}

Example of mobs below y=0 use custom equipment:

> If the location_check condition is false then vanilla behavior is used as none of the available loot pools are valid.
{
  "type": "minecraft:equipment",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        ...
      ],
      "conditions": [
        {
          "condition": "minecraft:location_check",
          "predicate": {
            "position": {
              "y": {
                "max": 0
              }
            }
          }
        }
      ]
    }
  ]
}

MobGear

A server-side fabric mod which adds the ability for datapacks to control what equipment mobs spawn with using loot tables.

This mod can be installed on the server without needing players to install it!

Loot tables matching the entity's resource location under loot_table/mobgear/ folder will determine the type of equipment that entity spawns with. As an example data/minecraft/loot_table/mobgear/zombie.json will control what equipment the zombie will spawn with. For modded mobs the equivalent would be data/modname/loot_table/mobgear/modded_mob.json (this is not tested but it might work!).

How is luck handled?

When generating the equipment loot table, luck is set as the local difficulty. This means the range is following:

  • Peaceful: 0
  • Easy: 0.75 - 1.5
  • Normal: 1.5 - 4.0
  • Hard: 2.25 - 6.75

These ranges can be used to make certain equipment only appear when the difficulty is high enough to really spice up the difficulty.

Read more about local difficulty

New Combined Group loot entry type

Currently vanilla loot tables have no proper way of selecting multiple specific items at once. Introducing mobgear:combinedgroup! CombinedGroup behaves similarly to regular Group but all of the items generated within the children are provided as potential equipment.

Unlike the vanilla loot groups, the combined group also includes weight and quality fields which behave like regular: real weight = max(floor(weight + (quality × luck)),0). If the resulting weight is 0 or less, the group is discarded.

Items inside the combined group can also use weight and quality to filter out items out of the group. Similar to combined group itself if the real weight is 0 or less then the item is discarded.

Example Loot table using CombinedGroup to equip full iron armor
{
    "type": "minecraft:equipment",
    "pools": [
        {
            "rolls": 1,
            "entries": [
                {
                    "type": "mobgear:combinedgroup",
                    "weight": 1,
                    "quality": 0,
                    "children": [
                        {
                            "type": "minecraft:item",
                            "name": "minecraft:iron_helmet"
                        },
                        {
                            "type": "minecraft:item",
                            "name": "minecraft:iron_chestplate"
                        },
                        {
                            "type": "minecraft:item",
                            "name": "minecraft:iron_leggings"
                        },
                        {
                            "type": "minecraft:item",
                            "name": "minecraft:iron_boots"
                        }
                    ]
                }
            ]
        }
    ]
}

Equip order

There are only a limited number of slots in a mob which can be filled with items. Items are selected to their corresponding slots in first come first serve order and will attempt to equip the item to it's matching slot. This however can be bypassed using custom data component!

Custom data controls

The equipped items can be controlled using the following custom data components:

mobgear:priority

Number value. Controls item's equip priority. Highest number is equipped first.

mobgear:slot

Possible values:

  • "MAINHAND"
  • "OFFHAND"
  • "FEET"
  • "LEGS"
  • "CHEST"
  • "HEAD"
  • "BODY"
    • Refers to animal body slot. Used with horse armor and Lama carpets.
    • "SADDLE"

Determines which slot this item attempts to occupy. If the slot is already taken, the item will be discarded.

You can put any item to any slot but they might not show up correctly!

Example of putting a black banner on the head
{
    "type": "minecraft:item",
    "name": "minecraft:black_banner",
    "functions": [
        {
            "function": "minecraft:set_custom_data",
            "tag": {
                "mobgear:slot": "HEAD"
            }
        }
    ]
}
Example of dual wielding wooden axes
"entries": [
    {
        "type": "minecraft:item",
        "name": "minecraft:wooden_axe",
        "functions": [
            {
                "function": "minecraft:set_custom_data",
                "tag": {
                    "mobgear:slot": "MAINHAND"
                }
            }
        ]
    },
    {
        "type": "minecraft:item",
        "name": "minecraft:wooden_axe",
        "functions": [
            {
                "function": "minecraft:set_custom_data",
                "tag": {
                    "mobgear:slot": "OFFHAND"
                }
            }
        ]
    }
]

mobgear:dropchance

Number value between 0-1. Controls % chance of this item being dropped on death. 1 meaning 100%, 0.5 meaning 50% and 0 meaning 0% chance. This is useful for making equipment undroppable even with looting when the equipment was not made to be used by players.

Example of making OP equipment not drop
{
    "type": "minecraft:item",
    "name": "minecraft:netherite_chestplate",
    "functions": [
        {
            "function": "minecraft:set_enchantments",
            "enchantments": {
                "minecraft:protection": 10,
                "minecraft:projectile_protection": 10,
                "minecraft:blast_protection": 10
            }
        },
        {
            "function": "minecraft:set_custom_data",
            "tag": {
                "mobgear:dropchance": 0
            }
        }
    ]
}
Example of having 30% chance to drop the equipped zombie head
{
    "type": "minecraft:item",
    "name": "minecraft:zombie_head",
    "functions": [
        {
            "function": "minecraft:set_custom_data",
            "tag": {
                "mobgear:dropchance": 0.3,
                "mobgear:slot": "HEAD"
            }
        }
    ]
}

mobgear:deathloottable

String value to loot table resource path. This changes the mob's DeathLootTable which determines which Loot table is used to generate the mob's dropped loot. This is the only custom data value that isn't specifically targetting the item but the mob itself.

Example of setting mob's death loot table to desert pyramid's archaeology loot
{
  "type": "minecraft:equipment",
  "pools": [
    {
      "rolls": 0,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "minecraft:egg",
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "type": "minecraft:uniform",
                "min": 3,
                "max": 7
              }
            },
            {
              "function": "minecraft:set_custom_data",
              "tag": {
                "mobgear:deathloottable": "minecraft:archaeology/desert_pyramid"
              }
            }
          ]
        }
      ]
    }
  ]
}

Using vanilla equipment logic

Most hostile mobs have pre-existing logic for their equipped gear which can be a hassle to recreate using loot tables. I've implemented a simple solution for having an option to decide whether to use vanilla equipment or to use custom equipment.

If loot table has no valid Loot Pools the vanilla behavior is used! This can be controlled using Loot Pool's conditions.

Example of only using custom equipment if mob spawns in a Stronghold.

If the location_check condition is false then vanilla behavior is used as none of the available loot pools are valid.

{
  "type": "minecraft:equipment",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        ...
      ],
      "conditions": [
        {
          "condition": "minecraft:location_check",
          "predicate": {
            "structures": "minecraft:stronghold"
          }
        }
      ]
    }
  ]
}
Example of mobs below y=0 use custom equipment

If the location_check condition is false then vanilla behavior is used as none of the available loot pools are valid.

{
  "type": "minecraft:equipment",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        ...
      ],
      "conditions": [
        {
          "condition": "minecraft:location_check",
          "predicate": {
            "position": {
              "y": {
                "max": 0
              }
            }
          }
        }
      ]
    }
  ]
}

Screenshots

Gallery

This project has no gallery images yet.

Versions

Files

Relations

Project Relations

More like this

Similar Mods

Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.

On ModDex

Community snapshot

0
Ratings
0
Followers
0
In stacks

By the numbers

Statistics

<1,000
Total Downloads
CurseForge
<1,000
Modrinth
<1,000
Last Updated
CurseForge
Created
CurseForge
Modrinth
Last synced
When ModDex last fetched this project from CurseForge or Modrinth. Every project is re-checked on a schedule, and any project that ships a new file is synced automatically within hours of the release.
New file updates sync automatically
How syncing works