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 Loot Tables, Spawn Rules & Crafting Recipes
  • 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
    • Multi-Blocks
    • Troubleshooting Blocks
      help
  • Sound & Visuals
    • Intro to Block Visuals
      guide
    • Block Culling
    • Block Models
      guide
    • Block Sounds
    • Block Texture Animation
    • Block Texture Variation
    • Block Tinting
  • Tutorials
    • Applying Effects
      Scripts
    • Avoiding State Limit
    • Block Orientation
    • Fake Blocks
      Scripts
    • Intercardinal Orientation
      Scripts
    • Ore Loot Tables
      Scripts
    • Tool-Based Destruction
  • Vanilla Re-Creations
    • Custom Crops
      Scripts
    • Custom Glass
    • Custom Glazed Terracotta
    • Custom Heads
      Scripts
    • Custom Trapdoors
      Scripts
  • Documentation
    • Block Co-Location
    • Block Format History
    • Block Shapes
    • Redstone Components
    • Vanilla Block Models
    • Vanilla Block Sounds
    • Vanilla Block Tags
    • Vanilla Voxel Shapes
Commands
  • General
    • Intro to Command Blocks
    • Understanding Selectors
    • Functions
      guide
    • Block States
    • Coordinate System
    • Giving NBT Items
    • Scoreboard Operations
  • Commands
    • Damage
    • Execute
    • Playanimation
    • Playsound
  • On Event Systems
    • On First World Load
      function
    • On Player First Join
    • On Player Join
    • On Player Leave
    • On Player Death
    • On Player Respawn
  • Scoreboard Systems
    • Entity Counter
    • Scoreboard Timers
    • Comparing And Retrieving Scores
  • Detection Systems
    • Look Detection
    • Item Drop Detection
    • Movement Detections
    • Rain Detection
  • Techniques
    • Execute Logic Gates
      concept
    • Execute at Block Variant
    • Execution Forking
      concept
    • Binary in Commands
      concept
    • MBE - Max's Block Entity
    • FMBE - A New Way to Create Display Entities
    • Dynamic Displays
    • Orbital Camera
  • Useful Creations
    • Sphere Command
    • Compass Display
    • Custom Crafting
    • Multiplayer Position Rearrangement
      function
Concepts
  • contents.json
  • Molang
  • Namespaces
  • Overwriting Assets
  • Shaders
  • Sounds
  • Subpacks
  • Texture Atlases
  • textures_list.json
Documentation
  • Advanced Molang
  • File Types
  • Fog IDs
  • Material Configuration Description
  • Molang Queries
  • Pack Folder Structure
  • Shared Constructs
  • Sound Definitions
  • Vanilla Materials
Entities
  • General
    • Intro to Entities BP
      guide
    • Intro to Entities RP
      guide
    • Troubleshooting Entities
      help
    • Entity Events
    • Entity Properties
    • NPC Dialogue
    • Render Controllers
    • Spawn Rules
  • Tutorials
    • Area Effect Clouds
    • Coordinate Space Conversion
    • Creating Boats
    • Detecting Other Entities
    • Disabling Team Damage
    • Dummy Entities
    • Entity Attacks
    • Entity Movement
    • Entity Timers
    • Holding Items
    • Invulnerable Entities
    • Look at Entity
    • Riding Flying Entities
    • 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
    • Item Catalog
    • Troubleshooting Items
      help
  • Tutorials
    • Equipment-Based Commands
    • Spawning Items
    • Throwable Items
  • Vanilla Re-Creations
    • Custom Armor
    • Custom Food
      Scripts
    • Custom Pottery Sherds
    • Custom Weapons
  • Documentation
    • Enchantments
    • Attachables
    • Item Format History
    • Numerical Item IDs
    • Vanilla Item Groups
    • Vanilla Item Tags
    • Vanilla Usage Components
JSON UI
  • General
    • Intro to JSON UI
      guide
    • Best Practices
      guide
  • Tutorials
    • Adding HUD Elements
    • Aseprite Animations
    • Buttons and Toggles
    • Dynamic Content Generation
    • 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
    • Enabling Experiments by Editing NBT
    • 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
    • Script Core Features
    • Block Placement Prevention
    • Custom Commands
    • GameTests
    • Script Privileges
    • Script Requests API
    • Server Forms
  • Documentation
    • Engine Environment
    • Script Resources
    • Script Watchdog
    • Troubleshooting JavaScript
    • TypeScript
Servers
  • Software
    • Bedrock Server Software
  • Protocols
    • Bedrock Protocol
    • NetherNet Protocol
    • RakNet Protocol
Text & Localization
  • General
    • Intro to Text & Localization
    • Raw Text
    • Splashes
  • Emojis & Symbols
    • Fonts
    • Intro to Emojis
    • Custom Emojis
    • Input Keys
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
    • Jigsaw Structures
  • Tutorials
    • Block Conditions for Features
    • Generating Custom Ores
    • Generating Custom Structures
    • Generating Patches
    • Heightmap Noise
  • Documentation
    • Biome Tags

Adding Loot Tables, Spawn Rules & Crafting Recipes

Adding Loot Tables, Spawn Rules & Crafting Recipes
  • Loot Tables
  • Spawn Rules
  • Crafting Recipes
  • What You Have Learned
  • Your Progress So Far

Next, we'll enhance the custom Ghost entity by adding some more basic mechanics to it:

Loot Tables ​

First, we'll make the ghost drop Ectoplasm upon death: create the following file:

📝 BP/loot_tables/wiki/entities/ghost.json
json
{
    "pools": [
        {
            "rolls": 1,
            "entries": [
                {
                    "type": "item",
                    "name": "wiki:ectoplasm",
                    "weight": 1,
                    "functions": [
                        {
                            "function": "set_count",
                            "count": {
                                "min": 1,
                                "max": 3
                            }
                        }
                    ]
                }
            ]
        }
    ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  • Loot tables consist of pools. Each pool defines a different set of loot that will be dropped. A pool consists of 3 parts, rolls, entries and conditions. The conditions are optional and won't be covered in this guide.

  • The rolls section defines how many times a random entry will be chosen from the following entries object.

  • The entries part defines the items from which the loot table can choose. Each roll a new item will be chosen.

  • type defines what will be chosen. You can set it to item or loot_table to either chose an item or an different loot table.

  • name defines the identifier of the item (with its namespace) that will be selected.

  • weight is optional and defines how likely it is, that this item will be selected. If there is more than one item in the entries section, the weight attribute can be used to make the probability of one item more or less likely. If it isn't set, it defaults to 1.

  • functions provide a powerful way of customizing the item that will be returned. They can add enchantments to an item, set an item's name or simply setting the number of items that will be dropped. To define the number of items, we use set_count. It takes the count attribute, which sets the maximum and minimum amount of items that will be dropped.

For more information on loot tables, see our extended guide: Loot Tables!

Spawn Rules ​

Next, we'll make the ghost spawn in deserts at night:

📝 BP/spawn_rules/ghost.json
json
{
    "format_version": "1.8.0",
    "minecraft:spawn_rules": {
        "description": {
            "identifier": "wiki:ghost",
            "population_control": "monster"
        },
        "conditions": [
            {
                "minecraft:spawns_on_surface": {},
                "minecraft:brightness_filter": {
                    "min": 0,
                    "max": 7,
                    "adjust_for_weather": true
                },
                "minecraft:difficulty_filter": {
                    "min": "easy",
                    "max": "hard"
                },
                "minecraft:weight": {
                    "default": 80
                },
                "minecraft:herd": {
                    "min_size": 1,
                    "max_size": 3
                },
                "minecraft:biome_filter": {
                    "test": "has_biome_tag",
                    "operator": "==",
                    "value": "desert"
                }
            }
        ]
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  • You already know what format_version does.
  • Inside the minecraft:spawn_rules part we define our spawn rules.
  • The description defines the basic properties of the file.
    • The identifier is used to define which entity these spawn rules apply to.
    • population_control is used to limit the amount of entities that will be spawned. Once the pool that is defined inside of population_control is full, no more entities will be spawned.
  • With conditions we can define rules that limit the spawning of this entity to special cases. We will shortly describe each condition used here, but you can learn more conditions and how to use them here.
    • spawns_on_surface allows the mob to only spawn on surfaces.
    • minecraft:brightness_filter limits the spawning to areas with a lighting level thats between the defined values. If adjust_for_weather is true, the light level decrease during rain and storms will be ignored.
    • minecraft:difficulty_filter defines the difficulty level needed to spawn the entity.
    • weight defines how often this entity will spawn. The higher this value, the more often the mob will spawn.
    • minecraft:herddefines how many entities will be spawned at once.
    • With minecraft:biome_filter we define the biomes in which the entity is able to spawn.

To learn more about spawn rules, take a look at our list of vanilla spawn rules.

Crafting Recipes ​

And finally, as an introduction to recipes, we'll make the Ectoplasm craftable into Ectoplasm Blocks:

📝 BP/recipes/ectoplasm_block.json
json
{
    "format_version": "1.20.10",
    "minecraft:recipe_shaped": {
        "description": {
            "identifier": "wiki:ectoplasm_block"
        },
        "tags": ["crafting_table"],
        "pattern": [
            // 3×3 grid of Ectoplasm items
            "###",
            "###",
            "###"
        ],
        "key": {
            "#": {
                "item": "wiki:ectoplasm"
            }
        },
        "unlock": [
            {
                "item": "wiki:ectoplasm" // Unlock this recipe when the player acquires an Ectoplasm item
            }
        ],
        "result": {
            "item": "wiki:ectoplasm_block"
        }
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  • format_version is already known.
  • With recipe_shaped we define, that each ingredient has a set place in the crafting grid. There are some other types that can be used, you can find more information here.
  • Inside description we define the identifier of this recipe, which is the name of the recipe.
  • tags is a list of crafting tags which determine the blocks (crafting table, furnace, etc) that are able to use this recipe.
  • pattern defines the arrangement of the items inside the crafting grid. Each # represents the item that is set under key. In this case, the whole 3x3 grid has to be filled with "wiki:ectoplasm", our own item. It is possible to define more items, just add an entry to key and set the key to a character, that you can use inside pattern.
  • result contains an item, which is set to the item that will be the output of this recipe.

For more information on this topic, visit our page about recipes!

What You Have Learned ​

What you have learned:

  • How to create a loot table and define which items a mob is able to drop
  • How to set the rules for a mob to spawn
  • How to create new crafting recipes

Your Progress So Far ​

What you've done:

  • Setup your pack
  • Create a custom item
  • Create a custom entity
  • Create the entity's loot, spawn rules, and a custom recipe

Congratulations! you have finished the Guide and created your first Add-on. 🎉

Contributors

Edit Adding Loot Tables, Spawn Rules & Crafting Recipes 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