Skip to content

Functions

FrankyRay edited this page Nov 22, 2021 · 2 revisions

Functions

Functions are used to provide data in an item. Data in question can be the enchantment, data value, the number of items that can be dropped together, etc.

Function Type

enchant_randomly

Used by: Various Structures
Similar to: enchant_random_gear

Set random enchantment to item. The item must be enchantable.
Optional Parameter:

Name Type Description
treasure Boolean Set treasure enchantment to apply
See the list here

enchant_random_gear

Used by: Various Entity Equipments
Similar to: enchant_randomly

Set a chance for an item to be randomly enchanted. The item must be enchantable.
Parameter:

Name Type Description
chance Float Set a chance
Allow number from 0-1 as 0% - 100%

enchant_with_levels

Used by: Various Structures (mostly End City)

Set a specific enchantment level (similar mechanics with Enchanting Table and Bookshelf) for the item.
Parameters:

Name Type Description
level Integer Set enchantment level
Max possible number is 30
Use min/max parameters to define as a range
treasure Boolean Set treasure enchantment to appear
See the list here

exploration_map

Used by: Shipwreck and Underwater Ruin

Set destination/target location for exploration map.
Parameter:

Name Type Description
destination String Set destination/target location
See the list here

furnace_smelt

Used by: Various Entities

Set cooked items to be dropped when the entity is on fire. Possibly item is food items

{
    "function": "furnace_smelt",
    "conditions": [
        {
            "condition": "entity_properties",
            "entity": "this",
            "properties": {
                "on_fire": true
            }
        }
    ]
}

looting_enchant

Used by: Various Entities

Set additional drop for the items when killed using Looting Enchantment.
Following formula: normalDrop + (lootingDrop * lootingLevel)
Parameters:

Name Type Description
count Integer Set the number to item been dropped when using Looting
Use min/max parameter to define as a range
limit Integer Set the max number to item been dropped when using Looting

random_aux_value

Used by: Shipwreck

Set the random data values to the items.
Parameter:

Name Type Description
values JSON Object Set the values for min/max data value
Use min/max parameter to define as a range

set_banner_detail

Used by: Pillager Captain

Set banner detail/type. Only used by Pillager/Vindicator Captain that holds Illager Banner.
Parameter:

Name Type Description
type Integer Set the banner type

set_count

Used by: Various Structure and Entities

Set the number of items to be dropped. If you didn't define the value or didn't use this function, the item ALWAYS drops 1.
Parameter:

Name Type Description
count Integer Set the number to item been dropped
Use min/max parameter to define as a range

set_damage

Used by: Various Structure, Entities, and Gameplay

Set how much damage to the item. The item must have durability value (Tools).
Parameter:

Name Type Description
damage Integer Set how much damage to the item
Use min/max parameter to define as a range

set_data

Used by: Various Structure and Entities

Set the data value of the item.
Parameter:

Name Type Description
data Integer Set the data value of the item

set_data_from_color_index

Used by: Mooshroom and Sheep
[Sorry, no documentation yet]

Note

Treasure Enchantment

These are lists of treasure enchantment.

  1. Curse of Binding
  2. Curse of Vanishing
  3. Frost Walker
  4. Mending
  5. Soul Speed

See Summary of enchantments from Minecraft Wiki for detailed enchantment

Destination - Exploration Map

These are lists of available destinations. Note: The list that is given a proven checklist can be used

  1. Buried Treasure [burriedTreasure]
  2. Mansion [mansion]
  3. Monument [monument]
  4. Mineshaft [mineshaft]
  5. Fortress [fortress]
  6. Underwater Ruins [ruins]
  7. Stronghold [stronghold]
  8. Village [village]
  9. End City [endcity]
  10. Shipwreck [shipwreck]
  11. Pillager Outpust [pillageroutpost]

This is pure my documentation, so any mistake is my fault :)

Reference Link:
Bedrock Wiki
Microsoft Docs

Not affiliated with Mojang Studio or Microsoft

Clone this wiki locally