Bedrock Wiki
  • Discord
  • Contribute
  • bedrock.dev
  • MS Learn
Beginner's Guide
  • Guide
    • 1. Introduction
      guide
    • 2. Add-Ons Explained
    • 3. Software & Preparation
    • 4. Project Setup
    • 5. Create a Custom Item
    • 6. Create a Custom Entity
    • 7. Blockbench: Modeling, Texturing & Animating
    • 8. Adding a Loot Table, Spawn Rule & Crafting Recipe
  • Extra
    • a. Understanding JSON
    • b. Download Example Packs
    • c. Troubleshooting
      help
    • d. Advanced Manifest
    • e. Format Versions
    • f. Project Setup Android
Animation Controllers
  • Intro to Animation Controllers
    guide
  • Entity Commands
  • AFK Detector
  • Death Commands
  • Molang into Scoreboard
  • Respawn Commands
Blocks
  • General
    • Intro to Blocks
      guide
    • Block Components
    • Block Tags
    • Block States
    • Block Traits
    • Block Permutations
    • Block Events
      Scripts
    • Block Event Migration
      help
    • Blocks as Items
    • Troubleshooting Blocks
      help
  • Visuals
    • Block Culling
    • Block Models
      guide
    • Block Texture Animation
    • Block Texture Variation
    • Block Tinting
  • Tutorials
    • Applying Constant Effects
      Scripts
    • Avoiding State Limit
    • Fake Blocks
    • Ore Loot Tables
      Scripts
    • Precise Interaction
      Scripts
    • Precise Rotation
      Scripts
    • Rotatable Blocks
  • Vanilla Re-Creations
    • Custom Crops
      Scripts
    • Custom Glass
    • Custom Glazed Terracotta
    • Custom Trapdoors
      Scripts
  • Documentation
    • Block Format History
    • Block Shapes
    • Block Sounds
    • Vanilla Block Models
Commands
  • General
    • Intro to Command Blocks
    • Functions
    • Block States
    • Coordinate System
    • NBT Commands
    • Scoreboard Operations
    • Understanding Selectors
  • Commands
    • Damage
    • Execute
    • Playanimation
    • Playsound
  • On Event Systems
    • On Player First Join
    • On Player Join
    • On Player Leave
    • On Player Death
    • On Player Respawn
    • On First World Load
  • Scoreboard Systems
    • Entity Counter
    • Scoreboard Timers
    • Comparing And Retrieving Scores
  • Techniques
    • Execute Logic Gates
    • MBE - Max's Block Entity
    • FMBE - A New Way to Create Display Entities
    • Look Detection
    • Movement Detections
    • Orbital Camera
  • Useful Creations
    • Custom Crafter
    • Multiplayer Position Rearrangement
      function
Concepts
  • contents.json
  • Emojis & Symbols
  • Molang
  • Namespaces
  • Overwriting Assets
  • Raw Text
  • Shaders
  • Sounds
  • Subpacks
  • Text and Localization
  • Texture Atlases
  • textures_list.json
Documentation
  • Shared Constructs
  • Advanced Molang
  • File Types
  • Fog IDs
  • Material Configuration Description
  • Menu Categories
  • Molang Queries
  • Pack Folder Structure
  • Sound Definitions
  • Vanilla Materials
Entities
  • General
    • Intro to Entities BP
      guide
    • Intro to Entities RP
      guide
    • Troubleshooting Entities
      help
    • Entity Events
    • Entity Properties
    • NPC Dialogues
    • Render Controllers
    • Spawn Rules
  • Tutorials
    • Convert Points Between Any Space (World, Entity, Bones)
    • Creating Boats
    • Detecting Other Entities
    • Disabling Team Damage
    • Dummy Entities
    • Entity Attacks
    • Entity Holds Item
    • Entity Movement
    • Entity Timers
    • Flying Entities
    • Introduction to AOE Clouds
    • Invulnerable Entities
    • Look at Entity
    • Sleeping Entities
    • Solid Entities
    • Spawning Tamed Entities
      Scripts
    • Village Mechanic
  • Documentation
    • Dummy Components
    • Non-Mob Runtime Identifiers
    • Projectiles
    • Runtime Identifiers
    • Vanilla Usage Components
    • Vanilla Usage Spawn Rules
Items
  • General
    • Intro to Items
      guide
    • Item Components
    • Item Tags
    • Item Events
      Scripts
    • Item Event Migration
      help
    • Troubleshooting Items
      help
  • Tutorials
    • Custom Armor
    • Custom Food
      Scripts
    • Custom Pottery Sherds
    • Custom Weapons
    • Equipment-Based Commands
    • High Resolution Items
    • Spawning Items
    • Throwable Items
  • Documentation
    • Enchantments
    • Attachables
    • Item Format History
    • Numerical Item IDs
    • Vanilla Item Identifiers
    • Vanilla Usage Components
JSON UI
  • General
    • Intro to JSON UI
      guide
    • Best Practices
      guide
  • Tutorials
    • Adding HUD Elements
    • Aseprite Animations
    • Buttons and Toggles
    • Modifying Server Forms
    • Preserve Title Texts
    • String to Number
  • Documentation
    • JSON UI Documentation
Loot, Recipes & Trading
  • General
    • Trading Behavior
  • Documentation
    • Loot Tables
    • Trade Tables
    • Recipes
    • Item Functions
  • Tutorials
    • Randomized Structure Loot
Meta
  • Add-On Performance
  • Style Guide
  • Useful Links
  • Using Schemas
  • Version Control
  • Q&A
    • Blocks and Items Q&A 2024/08/30
    • Deferred Technical Preview Q&A 2024/02/23
    • GameTest Q&A 2021/08/06
    • Scripting and Editor Q&A 2023/09/22
    • World Generation Q&A 2024/11/15
NBT
  • General
    • .mcstructure
  • Tutorials
    • Experiments in Education Edition
    • Extending Structure Limits
  • NBT in Depth
    • About NBT (Named Binary Tag)
    • NBT Libraries
    • Reading NBT Example
Particles
  • General
    • Intro to Particles
      guide
  • Tutorials
    • Disabling Particles
  • Documentation
    • Vanilla Particles
Scripting
  • General
    • Intro to Scripting
    • What is Script API?
    • API Modules
  • Tutorials
    • Block Placement Prevention
    • GameTests
    • Script Core Features
    • Script Forms
    • Script Requests API
    • Simple Chat Commands
  • Documentation
    • Engine Environment
    • Script Resources
    • Script Watchdog
    • Troubleshooting JavaScript
    • TypeScript
Servers
  • Software
    • Bedrock Server Software
  • Protocols
    • Bedrock Protocol
    • NetherNet Protocol
    • RakNet Protocol
Visuals
  • General
    • Introduction to Entity Visuals
      guide
    • Bedrock Modeling
    • Custom Death Animations
    • Effects in Animations
    • Material Creations
    • Materials
    • Math-Based Animations
    • Skin Packs
  • Tutorials
    • Entity Texture Animation
    • Glowing Entity Texture
    • Hurt Animations
    • Leash Position
    • Player Geometry
    • Remove Entity Shadows
    • Retexturing Spawn Eggs
  • Ideas
    • Structure Presentation
World Generation
  • General
    • Intro to World Generation
      guide
    • Biomes
      guide
    • Feature Types
  • Tutorials
    • Block Conditions for Features
    • Generating Custom Ores
    • Generating Custom Structures
    • Generating Patches
    • Heightmap Noise
  • Documentation
    • Biome Tags

Item Functions

Item Functions
  • General
    • Count
    • Name
    • Lore
    • Data
    • Block State
    • Aux Value
    • Durability
  • Item-Specific Data
    • Heat Item
    • Book Contents
    • Exploration Map
    • Banner Type
    • Random Dyeing
    • Spawn Eggs
    • Container Contents
  • Enchanting
    • Enchant for Trading
    • Level-Based Enchantments
    • Random Enchantments
    • Enchant Gear
    • Specific Enchantments
  • External Factors
    • Held Tool Looting Enchantment
    • Explosion Decay
    • Entity Color
    • Trader Material Type

Item functions modify the nature of an item in loot tables and trade tables.

TODO can enchantments be prefixed with minecraft:/whatever?

Functions Note that every single thing tested here was in trade tables only Usable in loot tables and trade tables only Are objects with function and other props… None accept Molang No Java additional functions or properties were successful All may be prefixed with any sequence of text followed by a colon, like minecraft:exploration_map or d1245436576u:fio2ejfoijfiowejf::::::exploration_map

General ​

A handful of functions are available for basic item properties. These functions are usable on any item.

FunctionContainer LootBlock DropsFishingEntity DropsEntity EquipmentTrade Tables
set_count✅✅✅✅✅❌
set_name✅✅✅✅✅✅
set_lore✅✅✅✅✅✅
set_data✅✅✅✅✅✅
random_block_state✅✅✅✅✅✅
random_aux_value✅✅✅✅✅✅
set_damage✅✅✅✅✅✅

Count ​

UsageUsable
Container loot✅
Block drops✅
Fishing✅
Entity drops✅
Entity equipment✅
Trade table❌

NOTE

Trade tables use the "quantity" property to set their count.

The set_count function sets the count for that item entry.

Count Function
json
{
    "function": "set_count",

    "count": {
        "min": 2,
        "max": 4
    }
}
1
2
3
4
5
6
7
8

The "count" property determines how many of that item should be yielded; it can either be provided as an integer or a range object. Provided counts values may be larger than the stack size for that item. When this happens, the item will leak into other slots if in a container or separate into multiple different item stacks if dropped into the world. The count property actually defaults to 0, so it should always be included.

Name ​

UsageUsable
Container loot✅
Block drops✅
Fishing✅
Entity drops✅
Entity equipment✅
Trade table✅

The name of an item can be set using the set_name function. Names are visible in the user interface when hovering over an item. Names can be changed by players using anvils.

Name Function
json
{
    "function": "set_name",

    "name": "Cursed Bow"
}
1
2
3
4
5

The name to give the item is given with the string "name" property. By default, name text appears italicized. However, item names support format codes, and §r can be inserted at the start of the text to reset it to non-italics. Raw text is unsupported in item names. \n can be used for newlines.

Lore ​

UsageUsable
Container loot✅
Block drops✅
Fishing✅
Entity drops✅
Entity equipment✅
Trade table✅

The set_lore function sets the lore for an item.

Lore Function
json
{
    "function": "set_lore",

    "lore": ["", ""]
}
1
2
3
4
5

The "lore" property configures the lore. It can be represented as either a string or an array of strings. All lore strings support format codes but do not support localization. In the array form, each string represents a new line of lore. Each such string's formatting context is independent, meaning formatting will reset with each string. By default, purple and italicized text is used for lore; this can be reset by prepending the reset format code (§r) to each string as necessary. \n can be used within any lore string to form a newline while preserving the current formatting context.

Data ​

UsageUsable
Container loot✅
Block drops✅
Fishing✅
Entity drops✅
Entity equipment✅
Trade table✅

set_data establishes the data for the given item, similar to the argument in the /give command. If used on a block, it will set the block's data value. If used on an item, it will set it's aux value. Unlike the command, however, set_data cannot set the durability of an item. For that, use durability.

Data Function
json
{
    "function": "set_data",

    "data": 2
}
1
2
3
4
5

The "data" property sets the item's data. If not provided, it will default to 0. "data" can either be provided as an integer or a range object.

As an integer:

json
"data": 1
1

As a range object:

json
"data": {
	"min": 0,
	"max": 5
}
1
2
3
4

The object form will randomly select a data value inclusively between the provided minimum and maximum each instance this function's item entry is selected.

Block State ​

UsageUsable
Container loot✅
Block drops✅
Fishing✅
Entity drops✅
Entity equipment✅
Trade table✅

random_block_state sets an individual block state for a block.

Block State Function
json
{
    "function": "random_block_state",

    "block_state": "wiki:color",
    "values": 3
}
1
2
3
4
5
6

Sets a block state for a block block_state Required string name of block state values Can be number or min/max object Defaults to 0… kinda required otherwise pointless? IDK…

Aux Value ​

UsageUsable
Container loot✅
Block drops✅
Fishing✅
Entity drops✅
Entity equipment✅
Trade table✅

random_aux_value

Aux Value Function
json
{
    "function": "random_aux_value",

    "values": {
        "min": 2,
        "max": 4
    }
}
1
2
3
4
5
6
7
8

Sets aux value of an item values Can be integer or min/max object Min/max object chosen uniformly randomly Only used for aux value; won't, for example, set damage of a tool but will set color of wool Overrides any provided aux value as identifier :suffix, like minecraft:wool:10 Works on block data, too

Durability ​

UsageUsable
Container loot✅
Block drops✅
Fishing✅
Entity drops✅
Entity equipment✅
Trade table✅

Item durability can be set using the set_damage function.

Durability Function
json
{
    "function": "set_damage",

    "damage": {
        "min": 0.5,
        "max": 1
    }
}
1
2
3
4
5
6
7
8

The "damage" property sets the item's durability. It can be represented either as a number or a range object. Values are intended to range from 0 to 1, where 0 is the minimum possible durability for an item and 1 is undamaged.

Item-Specific Data ​

Some functions are only usable by a certain set of items. See each function for which items are relevant.

FunctionContainer LootBlock DropsFishingEntity DropsEntity EquipmentTrade Tables
furnace_smelt❌❌❌✅❌❌
set_book_contents✅✅✅✅✅✅
exploration_map✅✅✅✅✅⚠️
set_banner_details✅✅✅✅✅✅
random_dye✅✅✅✅✅✅
set_actor_id✅✅✅✅✅✅
fill_container✅✅✅✅✅✅

Heat Item ​

UsageUsable
Container loot❌
Block drops❌
Fishing❌
Entity drops✅
Entity equipment❌
Trade table❌

furnace_smelt

Heat Item Function
json
{
    "function": "furnace_smelt"
}
1
2
3

auto-implies that the entity must’ve been on fire when they died Vanilla files use a function condition for this, but even removing that condition still implies that the entity must’ve died on fire for the furnace_smelt function to trigger

Book Contents ​

UsageUsable
Container loot✅
Block drops✅
Fishing✅
Entity drops✅
Entity equipment✅
Trade table✅

set_book_contents

Book Contents Function
json
{
    "function": "set_book_contents",

    "title": "",
    "author": "",

    "pages": ["", ""]
}
1
2
3
4
5
6
7
8

Sets data for a book Can only be used on writable_book or written_book author String name of the author title String name of the book pages Array of strings — each string is the contents of that page Supports up to 50 strings and 798 characters per string 12,800‌ character limit across all pages Use \n in the string (not \\n) to add newlines Can’t use tabs Can use color codes; Each different page string resets the color codes each time

Exploration Map ​

UsageUsable
Container loot✅
Block drops✅
Fishing✅
Entity drops✅
Entity equipment✅
Trade table✅

exploration_map

Exploration Map Function
json
{
    "function": "exploration_map",

    "destination": "village"
}
1
2
3
4
5

trade table info: destination Currently only monument mansion. Nothing else, not even buried treasure (this one looks like it’ll work — names the map right instead of Unknown Map like the others, but it doesn’t point anywhere). 😦

Loot table info: Destination Works for any /locate location (see old recipe notes for caveats there; this is for container loot tables) Only works if in the appropriate dimension If a mansion or monument, gets named, colored, and icon’d correctly, corresponding to the right marker decoration If invalid or no destination is given, shows no marker but still has the river and ocean lines on the map Works in containers and both entity equipment and drops Keep in mind how only 2 locations worked from traders

Banner Type ​

UsageUsable
Container loot✅
Block drops✅
Fishing✅
Entity drops✅
Entity equipment✅
Trade table✅

set_banner_details

Banner Type Function
json
{
    "function": "set_banner_details"
}
1
2
3

Sets type of a banner (only usable on this) type Can only be 0 or 1 0 is just a white banner 1 is illager banner

Random Dyeing ​

UsageUsable
Container loot✅
Block drops✅
Fishing✅
Entity drops✅
Entity equipment✅
Trade table✅

random_dye

Random Dyeing Function
json
{
    "function": "random_dye"
}
1
2
3

Randomly dyes leather armor or horse armor Doesn’t work on wool or whatever

Spawn Eggs ​

UsageUsable
Container loot✅
Block drops✅
Fishing✅
Entity drops✅
Entity equipment✅
Trade table✅

set_actor_id

Spawn Eggs Function
json
{
    "function": "set_actor_id"
}
1
2
3

Usable with spawn eggs id Should be the identifier for the mob in trade tables, defaults to trader's entity type

Container Contents ​

UsageUsable
Container loot✅
Block drops✅
Fishing✅
Entity drops✅
Entity equipment✅
Trade table✅

fill_container

Container Contents Function
json
{
    "function": "fill_container"
}
1
2
3

Sets the contents of a container block loot_table Path to loot table file from behavior pack root

loot_table needed or will just be the normal item Cannot point to that current loot table Works in containers and both entity stuff and blocks

Enchanting ​

FunctionContainer LootBlock DropsFishingEntity DropsEntity EquipmentTrade Tables
enchant_book_for_trading✅✅✅✅✅✅
enchant_with_levels✅✅✅✅✅✅
enchant_randomly✅✅✅✅✅✅
enchant_random_gear✅✅✅✅✅✅
specific_enchants✅✅✅✅✅✅

Enchant for Trading ​

UsageUsable
Container loot✅
Block drops✅
Fishing✅
Entity drops✅
Entity equipment✅
Trade table✅

enchant_book_for_trading

Enchant for Trading Function
json
{
    "function": "enchant_book_for_trading"
}
1
2
3

documented in trade tables

Level-Based Enchantments ​

UsageUsable
Container loot✅
Block drops✅
Fishing✅
Entity drops✅
Entity equipment✅
Trade table✅

enchant_with_levels enchants items using enchantment table logic, optionally allowing for treasure enchantments.

Level-Based Enchantments Function
json
{
    "function": "enchant_with_levels",

    "levels": {
        "min": 15,
        "max": 21
    },
    "treasure": true
}
1
2
3
4
5
6
7
8
9

Enchants books as though off an enchantment table with the given levels Unlike enchanting table, doesn’t cap at 30, otherwise seems symmetrical level 99999 gives ludicrously powerful books… with pretty much every possible enchantment on them treasure Enables treasure enchantments as possibilities for that item boolean, defaults to false If false, curses can't appear as possibilities; if true, they can levels Can be number or min/max object Defaults to 0 Can be negative, but will just be remapped as though 0.

Random Enchantments ​

UsageUsable
Container loot✅
Block drops✅
Fishing✅
Entity drops✅
Entity equipment✅
Trade table✅

enchant_randomly

Random Enchantments Function
json
{
    "function": "enchant_randomly"
}
1
2
3

Randomly picks a count of enchantments and their strengths for the given item treasure Enables treasure enchantments as possibilities for that item boolean, defaults to false

Enchant Gear ​

UsageUsable
Container loot✅
Block drops✅
Fishing✅
Entity drops✅
Entity equipment✅
Trade table✅

enchant_random_gear

Enchant Gear Function
json
{
    "function": "enchant_random_gear"
}
1
2
3

Randomly picks a count of enchantments and their strengths for the given item Pretty much like enchant_randomly, but seemingly no treasure enchantments Not working on shears, but does even work on carrot-on-a-stick chance Number from 0 to 1 Chance that the item is enchanted at all Defaults to 0 Going over 1 doesn't make it "more" enchanted

Specific Enchantments ​

UsageUsable
Container loot✅
Block drops✅
Fishing✅
Entity drops✅
Entity equipment✅
Trade table✅

specific_enchants

Specific Enchantments Function
json
{
    "function": "specific_enchants"
}
1
2
3

Applies a specific set of enchantments enchants Can be string array or object For array, any mix of strings or objects (see below) For string, an enchantment id For object: id The identifier for the enchantment See below for names level Optional, defaults to 1 Can be an exact number or a 2-valued array, representing min and max, inclusive

External Factors ​

FunctionContainer LootBlock DropsFishingEntity DropsEntity EquipmentTrade Tables
looting_enchant❌❌❌✅❌❌
explosion_decay❌✅❌❌❌❌
set_data_from_color_index❌❌❌❌❌✅
trader_material_type❌❌❌❌❌✅

Held Tool Looting Enchantment ​

UsageUsable
Container loot❌
Block drops❌
Fishing❌
Entity drops✅
Entity equipment❌
Trade table❌

looting_enchant

Held Tool Looting Function
json
{
    "function": "looting_enchant",

    "count": {
        "min": 0,
        "max": 1
    }
}
1
2
3
4
5
6
7
8

Count can be an integer or min/max

Explosion Decay ​

UsageUsable
Container loot❌
Block drops✅
Fishing❌
Entity drops❌
Entity equipment❌
Trade table❌

explosion_decay

Explosion Decay Function
json
{
    "function": "explosion_decay"
}
1
2
3

By default, always survives. If in an explosion, has a chance of not dropping based on explosion power at that block’s location

Entity Color ​

UsageUsable
Container loot❌
Block drops❌
Fishing❌
Entity drops❌
Entity equipment❌
Trade table✅

set_data_from_color_index

Entity Color Function
json
{
    "function": "set_data_from_color_index"
}
1
2
3

Sets the data value of the block to the value of the minecraft:color component on the entity

Trader Material Type ​

UsageUsable
Container loot❌
Block drops❌
Fishing❌
Entity drops❌
Entity equipment❌
Trade table✅

trader_material_type

Trader Material Type Function
json
{
    "function": "trader_material_type"
}
1
2
3

Only in trades? Maybe it can work somewhere in loot

Contributors

Edit Item Functions on GitHub

Bedrock Wiki by Bedrock OSS

"Minecraft" is a trademark of Mojang AB.

Bedrock OSS, Bedrock Wiki and bedrock.dev are not affiliated in any way with Microsoft or Mojang AB.

  • Privacy Policy
  • Join our Discord
  • Learn how to Contribute
  • Visit our Repository