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

Entity Movement

Entity Movement
  • Movement Speed
  • Movement Type
  • Movement Modifiers
  • Navigation
  • Navigation Abilities
  • AI Goals
    • Pathfinding
  • Other

In Minecraft, entities have the ability to move through the world, either by walking, swimming or flying. To get these behaviors, your entity will generally need quite a few behaviors, broken out into various types.

As you read this tutorial, keep in mind that your entity will need at least:

  • A component that sets the entities movement speed.
  • A component to set how the entity will move (walking, flying, etc)
  • A component to set the entities navigation abilities, so it can generate paths.
  • A component that sets where/when the entity should move (AI Goals).

TIP

The best way to create a moving entity is by picking a similar entity from the vanilla behavior pack, and copying the components into your entity.

For example entities like Phantom, or Ghast, or Parrot are all flying entities, but have very different in-game behavior! Use the closest-matching entity as a template.

Movement Speed ​

The first thing your entity needs is a speed component. This sets how quickly your entity will move through the world.

ComponentNote
minecraft:movementSet movement speed (required)
minecraft:underwater_movementSet movement speed in the water.
minecraft:flying_speedSet the speed in the air.

You should always include minecraft:movement. Add the other two as needed.

All vanilla "swimming" entities like Dolphin include underwater_movement. Only some flying entities have flying_speed. It is not known why this is the case.

Movement Type ​

Your entity will also need a movement type. Movement types set hard-coded behavior for how your entity will move through the world.

You may only include one movement type in your entity. Select the component that most closely matches your needs. Generally basic, amphibious and fly are good ones to use.

ComponentNote
minecraft:movement.amphibiousThis move control allows the mob to swim in the water and walk on land.
minecraft:movement.basicThis component accents the movement of an entity.
minecraft:movement.flyThis move control causes the mob to fly.
minecraft:movement.genericThis move control allows a mob to fly, swim, climb, etc.
minecraft:movement.hoverThis move control causes the mob to hover.
minecraft:movement.jumpMove control causes the mob to jump as it moves with a specified delay between jumps.
minecraft:movement.skipThis move control causes the mob to hop as it moves.
minecraft:movement.swayThis move control causes the mob to sway side to side, giving the impression it is swimming.

Movement Modifiers ​

Movement modifiers provide additional information about how your entity will move through the world. These components are not required for normal entities, but you should be aware of them.

ComponentNote
minecraft:water_movementSets the friction the entity experiences in water.
minecraft:rail_movementSets that the entity can move on rails (only).
minecraft:friction_modifierSets the friction the entity experiences on land.

Navigation ​

The next thing your entity needs is a navigation component. Navigation components have quite a few fields, like whether the entity can open doors or avoid sunlight. How you set these fields is generally more important than the navigation component you pick!

The reason there are so many navigation components is that each one gives a slightly different hard-coded behavior. Pick the navigation component whose name/description best matches the kind of navigation your entity will be doing.

You can only have one navigation component at any given time.

TIP

This component is very important. You should check vanilla examples for inspiration on what fields and values to use.

ComponentNote
minecraft:navigation.climbAllows this entity to generate paths that include vertical walls like the vanilla Spiders do.
minecraft:navigation.floatAllows this entity to generate paths by flying around the air like the regular Ghast.
minecraft:navigation.genericAllows this entity to generate paths by walking, swimming, flying and climbing around, and jumping up and down a block.
minecraft:navigation.flyAllows this entity to generate paths in the air as the vanilla Parrots do.
minecraft:navigation.swimAllows this entity to generate paths that include water.
minecraft:navigation.walkAllows this entity to generate paths by walking around and jumping up and down a block like regular mobs.

Navigation Abilities ​

On top of the movement and the navigation component, there exist many additional components to augment the abilities of your entity as they move through the world.

ComponentNote
minecraft:annotation.break_doorAllows entity to break doors. It must also be turned on in the navigation component.
minecraft:annotation.open_doorAllows entity to open doors. It must also be turned on in the navigation component.
minecraft:buoyantSpecifies which liquids the entity can float in.
minecraft:can_climbAllows this entity to climb up ladders.
minecraft:can_flyMarks the entity as being able to fly. The pathfinder won't be restricted to paths where a solid block is required underneath it.
minecraft:can_power_jumpAllows the entity to power jump like the horse does in vanilla.
minecraft:floats_in_liquidSets that this entity can float in liquid blocks.
minecraft:jump.dynamicDefines a dynamic type jump control that will change jump properties based on the speed modifier of the mob.
minecraft:jump.staticGives the entity the ability to jump.

There are also components like minecraft:preferred_path, which will modify navigation based on block-based path-cost.

AI Goals ​

The navigation component tells the entity how to generate paths, but it doesn't say when or where to generate paths. This is what the AI components are for.

AI Goals are prefixed with behavior and follow a priority system to pick which behavior to run. The lower priorities will be picked first.

In general, you should usually add quite a few AI components, with different priorities. Layered together, these will create realistic movement and behavior for your entity. As always, vanilla entities provide a good template for which components to add, and with what properties/priorities.

There are too many AI components that generate paths to list in this document. A few will be provided as examples:

Component
minecraft:behavior.random_stroll
minecraft:behavior.follow_owner
minecraft:behavior.move_to_water
minecraft:behavior.stroll_towards_village

For a full list, visit bedrock.dev.

Pathfinding ​

Making entities go to specific places is one of the most common requests for Marketplace content. The best way to do pathfinding uses a second entity, which the first entity will be attracted to. I am going to call this secondary entity the marker. If you are confused on how to create a marker, visit the Dummy Entities page.

Idea ​

The way we are going to do pathfinding is actually fairly simple: Make our entity aggressive towards our marker, and then simply place our marker where we want our entity to path to. The hard part is knowing what components to add so we get really long-range pathing.

Components ​

These components can be edited as needed to create good pathing. Make sure to update the nearest_attackable_target to point to your marker entity. This takes a family_type, so you should set one of those on your marker.

Don't forget to add some basic movement and navigation components so your entity is able to move.

json
"minecraft:behavior.nearest_attackable_target": {
    "priority": 0,
    "reselect_targets": true,
    "target_search_height": 1000,
    "within_radius": 1000,
    "must_see": false,
    "entity_types": [
        {
            "filters": [
                {
                    "test": "is_family",
                    "subject": "other",
                    "value": "waypoint_1"
                }
            ],
            "max_dist": 1000
        }
    ]
},
"minecraft:attack": {
    "damage": 0
},
"minecraft:behavior.melee_attack": {
    "priority": 0,
    "require_complete_path": true,
    "track_target": true
},
"minecraft:follow_range": {
    "value": 1000,
    "max": 1000
}
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

Detecting a reached waypoint ​

You can use minecraft:target_nearby_sensor to detect when you have reached the marker entity:

json
"minecraft:target_nearby_sensor": {
    "inside_range": 2.0,
    "outside_range": 4.0,
    "must_see": true,
    "on_inside_range": {
        "event": "reached_waypoint"
    },
    "on_outside_range": {
        "event": "not_reached_waypoint"
    }
}
1
2
3
4
5
6
7
8
9
10
11

Other ​

TIP

You can trigger entity walking animation via command. /execute as @e[type=...] at @s run tp @s ^^^0.1 This way you can control where entity goes and make it look natural.

Contributors

Edit Entity Movement 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