-
Notifications
You must be signed in to change notification settings - Fork 2
[1.21.1] NBT Data
Some InsaneLib features store some NBT data on entities or item stacks instead of (or in addition to) config options, so that they can be controlled per-entity/per-item by data packs, command blocks, or other mods to change some behaviours.
These are plain NBT values, not Item Components — they live in the vanilla persistent-data storage rather than the item's component map, and can be read/written with the standard /data commands.
Every value is nested inside a compound tag using its namespace, then (for InsaneLib's own tags) tags, then the tag name. On entities this compound lives under NeoForge's own persistent data tag, NeoForgeData. For example the explosion_causes_fire tag is stored at NeoForgeData.insanelib.tags.explosion_causes_fire.
| Target | Where to find it |
|---|---|
| Entity | Under NeoForgeData in the entity's data, e.g. /data get entity @e[type=minecraft:creeper,limit=1] NeoForgeData
|
| Item | The item's minecraft:custom_data component, e.g. /data get entity @p Inventory[{Slot:0b}].item.components."minecraft:custom_data"
|
Since it's stored as regular NBT/custom data, you can set these values yourself with /data merge. For example, this makes a targeted creeper's explosion always cause fire:
/data merge entity @e[type=minecraft:creeper,limit=1] {NeoForgeData:{insanelib:{tags:{explosion_causes_fire:1b}}}}
These are all set on living entities by the always-enabled Tags feature, under NeoForgeData.insanelib.tags.
| Tag | Type | Info |
|---|---|---|
explosion_causes_fire |
Boolean | If true, explosions directly caused by this entity (e.g. a creeper) will ignite fire, regardless of the explosion's own fire setting. |
xp_multiplier |
Double | Multiplies the experience dropped by this entity when it dies. |
no_ammo_consumption |
Boolean | If true, this entity does not consume ammunition (e.g. arrows or fireworks in the offhand for pillagers) when using ranged weapons. |
sky_light |
Integer | Sky light level at the entity's position. Refreshed automatically every couple of ticks — read-only, not meant to be set manually. |
block_light |
Integer | Block light level at the entity's position. Refreshed automatically every couple of ticks — read-only, not meant to be set manually. |
These keys are built from the namespace of the mod that owns the feature (insanelib for InsaneLib itself) plus the feature's name, so other mods built on top of InsaneLib expose their own tags the same way under their own namespace/feature name.
InsaneLib also registers a couple of its own item Custom Data Components, which are a separate mechanism from the NBT tags on this page.