Tutorials/Creating custom entity add-ons

This tutorial is a guide to creating a custom entity add-on for. This is not a guide to creating a behavior pack. See Tutorials/Creating behavior packs for a guide on creating behavior packs.

Entities
Defines the behavior of the custom entity. Located at

You want to create a behavior similar to vanilla entities, but for custom entity, not changing vanilla one.

First, make sure to define the identifier for your custom entity (prefix can be anything), then if you want your entity to have a spawn egg in creative inventory, set "is_spawnable" to. Set "is_summonable" to to make it not summonable using  commands. For more information about entity component add-ons see: Entity JSON Documentation

Loot tables
Loot tables are used if you want your entity to have equipment or drop loot upon death, or to drop items upon interaction. Example of how drowned have loot table for drops and natural equipment: //Drops "minecraft:loot": { "table": "loot_tables/entities/drowned.json" }

//Natural equipment "minecraft:equipment": { "table": "loot_tables/entities/drowned_ranged_equipment.json", "slot_drop_chance": [ {       "slot": "slot.weapon.offhand", "drop_chance": 1.0 }     ]    }

The components of loot table.json in Bedrock Edition add-ons are similar to loot table.json in Java Edition with some slight differences.

Trading
This one is optional. Trading is used if your custom entity can be traded with. Here's an example of adding the ability for trading with a custom entity: "minecraft:trade_table": { "display_name": "entity.custom:the_trader.name", "table": "trading/the_trader_trades.json", "new_screen": false },

"minecraft:behavior.trade_with_player": { "priority": 1 },     "minecraft:behavior.look_at_trading_player": { "priority": 2 }

Trade tables are stored as json files and you can create one similar to vanilla trades prior village & pillage which use the old trading system or after village & pillage which uses a economic trade(like wandering trader trades).

Spawn Rules
Spawn rules are used to make your custom entity spawn naturally in specific biomes. This isn't needed if your entity is spawned using commands only, or spawned from other entities only, such as being ridden or summoned by other mobs.


 * description

Identifier of the entity(must match from entities) There are 3 pools that entities can be assigned to : -animal -lava_animal -water
 * identifier:
 * population_control:


 * Components


 * {| class="wikitable sortable"

! Name !! Description
 * minecraft:spawns_on_surface
 * This component allows the mob to spawn on the ground.
 * minecraft:spawns_underground
 * This component allows the mob to spawn underground.
 * minecraft:spawns_underwater
 * This component allows the mob to spawn underwater.
 * minecraft:spawns_on_block_filter
 * Blocks this entity can spawn on.
 * minecraft:world_age_filter
 * min: minimum time of world for entity to start spawning.
 * minecraft:brightness_filter
 * This component allows players to set the light level range that causes the mob to spawn.
 * Parameters
 * minecraft:world_age_filter
 * min: minimum time of world for entity to start spawning.
 * minecraft:brightness_filter
 * This component allows players to set the light level range that causes the mob to spawn.
 * Parameters
 * Parameters


 * {| class="wikitable"

! Type !! Name !! Default Value !! Description
 * Decimal
 * min
 * 0.100
 * This is the minimum light level value that allows the mob to spawn
 * Decimal
 * max
 * 0.0
 * This is the maximum light level value that allows the mob to spawn
 * Boolean
 * adjust_for_weather
 * false
 * This determines if weather can affect the light level conditions that cause the mob to spawn (e.g. Allowing hostile mobs to spawn during the day when it rains.)
 * }
 * minecraft:distance_filter
 * Distance between the player and the custom entity are allowed to spawn.
 * }
 * minecraft:distance_filter
 * Distance between the player and the custom entity are allowed to spawn.
 * Distance between the player and the custom entity are allowed to spawn.


 * Parameters


 * {| class="wikitable"

! Type !! Name !! Default Value !! Description
 * Decimal
 * min
 * minimum distance
 * Decimal
 * max
 * maximum distance
 * }
 * minecraft:density_limit
 * Density of mobs spawning.
 * maximum distance
 * }
 * minecraft:density_limit
 * Density of mobs spawning.
 * Density of mobs spawning.


 * Parameters


 * {| class="wikitable"

! Type !! Name !! Default Value !! Description
 * Int
 * surface
 * surface density
 * Int
 * underground
 * underground density
 * }
 * minecraft:weight
 * This component allows players to give a priority to how often that mob should spawn.
 * Parameters
 * }
 * minecraft:weight
 * This component allows players to give a priority to how often that mob should spawn.
 * Parameters
 * Parameters


 * {| class="wikitable"

! Type !! Name !! Default Value !! Description
 * Decimal
 * default
 * 0.0
 * This is the priority of the mob spawning
 * }
 * minecraft:difficulty_filter
 * This component allows players determine what mobs spawn when certain difficulty levels are set.
 * Parameters
 * This component allows players determine what mobs spawn when certain difficulty levels are set.
 * Parameters


 * {| class="wikitable"

! Type !! Name !! Default Value !! Description
 * String
 * min
 * This is the minimum difficulty level that a mob spawns
 * String
 * max
 * This is the maximum difficulty level that a mob spawns
 * }
 * minecraft:herd
 * This component allows players to determine the herd size of entities.
 * This is the maximum difficulty level that a mob spawns
 * }
 * minecraft:herd
 * This component allows players to determine the herd size of entities.
 * This component allows players to determine the herd size of entities.


 * Parameters


 * {| class="wikitable"

! Type !! Name !! Default Value !! Description
 * Decimal
 * min_size
 * This is the minimum number of mobs that spawn in a herd
 * Decimal
 * max_size
 * This is the maximum number of mobs that spawn in a herd
 * -100
 * String
 * event
 * This is an event that can be triggered from spawning
 * Decimal
 * event_skip_count
 * This is the number of mobs spawned before the specified event is triggered
 * }
 * minecraft:permute_type
 * Allows the current entity to spawn as another entity.
 * minecraft:biome_filter
 * This component allows the players to specify which biomes the mob spawns in.
 * }
 * This is the number of mobs spawned before the specified event is triggered
 * }
 * minecraft:permute_type
 * Allows the current entity to spawn as another entity.
 * minecraft:biome_filter
 * This component allows the players to specify which biomes the mob spawns in.
 * }
 * This component allows the players to specify which biomes the mob spawns in.
 * }

Entity
Defines everything the custom entity needs in the resource pack, such as an identifier(must match with behavior pack, including prefix), materials, models, textures, animations, animation controllers, render controllers, and the spawn_egg color(Optional). Usually named  but   may also work. Example: { "format_version": "1.8.0", "minecraft:client_entity": { "description": { "identifier": "custom:the_trader", "min_engine_version": "1.8.0", "materials": { "default": "entity_alphatest" },     "textures": { "default": "textures/entity/steve" },     "geometry": { "default": "geometry.zombie.v1.8" },     "spawn_egg": { "texture": "spawn_egg", "texture_index": 1 },     "scripts": { "pre_animation": [ "variable.tcos0 = (Math.cos(query.modified_distance_moved * 38.17) * query.modified_move_speed / variable.gliding_speed_value) * 57.3;" ]     },      "animations": {water "humanoid_big_head": "animation.humanoid.big_head", "look_at_target_default": "animation.humanoid.look_at_target.default", "look_at_target_gliding": "animation.humanoid.look_at_target.gliding", "look_at_target_swimming": "animation.humanoid.look_at_target.swimming", "move": "animation.humanoid.move", "riding.arms": "animation.humanoid.riding.arms", "riding.legs": "animation.humanoid.riding.legs", "holding": "animation.humanoid.holding", "brandish_spear": "animation.humanoid.brandish_spear", "charging": "animation.humanoid.charging", "attack.rotations": "animation.humanoid.attack.rotations", "sneaking": "animation.humanoid.sneaking", "bob": "animation.humanoid.bob", "damage_nearby_mobs": "animation.humanoid.damage_nearby_mobs", "bow_and_arrow": "animation.humanoid.bow_and_arrow", "swimming": "animation.humanoid.swimming", "use_item_progress": "animation.humanoid.use_item_progress", "zombie_attack_bare_hand": "animation.zombie.attack_bare_hand", "zombie_swimming": "animation.zombie.swimming" },     "animation_controllers": [ { "humanoid_baby_big_head": "controller.animation.humanoid.baby_big_head" }, { "look_at_target": "controller.animation.humanoid.look_at_target" }, { "move": "controller.animation.humanoid.move" }, { "riding": "controller.animation.humanoid.riding" }, { "holding": "controller.animation.humanoid.holding" }, { "brandish_spear": "controller.animation.humanoid.brandish_spear" }, { "charging": "controller.animation.humanoid.charging" }, { "attack": "controller.animation.humanoid.attack" }, { "sneaking": "controller.animation.humanoid.sneaking" }, { "bob": "controller.animation.humanoid.bob" }, { "damage_nearby_mobs": "controller.animation.humanoid.damage_nearby_mobs" }, { "bow_and_arrow": "controller.animation.humanoid.bow_and_arrow" }, { "swimming": "controller.animation.humanoid.swimming" }, { "use_item_progress": "controller.animation.humanoid.use_item_progress" }, { "zombie_attack_bare_hand": "controller.animation.zombie.attack_bare_hand" }, { "zombie_swimming": "controller.animation.zombie.swimming" } ],     "render_controllers": [ "controller.render.skeleton" ], "enable_attachables": true } } } If spawn egg not defined, egg will use blank black textures.

Animation Controllers
Defines specific animations to be used at a certain state, such as blaze flame particles when charging to shoot fireballs.

Animation
Animations used for the custom entity. The custom entity can also use vanilla animations instead of custom one. If there are no animation listed, the custom entity will move in a static pose.

Models
The geometry used for the custom entity. See also Tutorials/Changing Minecraft entity models

Texts
Usually used for the spawn egg and the custom entity name by modifying  file located in. If no name is given, it will default to a placeholder name. Example of texts usage in custom entities: entity.custom:the_trader.name=The Trader item.spawn_egg.entity.custom:the_trader.name=This is §1The §eTrader§r Spawn Egg
 * 1) Entity Name
 * 1) Spawn Egg Name

Textures
Textures used for custom entity, usually at. If no texture is given, entities will have magenta-black checkerboard texture instead.

Render Controllers
Define how the custom entity is rendered, such as using multiple textures or models, visible model parts, and different skins per variants. Your custom entity can also use vanilla render controllers instead of creating a new one. If a render controller is not defined, custom entity will float into the air.

Sounds
Custom sound can be used for custom entities, but can also use vanilla one with modified pitch. Entity sound can be added in  located in. If no sounds are given, the custom entity will use player hurt sounds.

[[Category:Tutorials]

教程/自定义实体