How to create your own Mob in Minecraft Bedrock

Posted by Ragthor - Monday, March 29, 2021

In this video we are going to see how to create a mob for our add-ons, I also leave you the code so you can try it!

Behavior folder

Entities folder -> mob_name.json

 
                     
                    {
  "format_version": "1.13.0",
  "minecraft:entity": {
    "description": {
      "identifier": "tutorial:nombre_mob",
      "is_spawnable": true,
      "is_summonable": true,
      "is_experimental": false
    },

    "component_groups": {

      "attack_mode": {
        "minecraft:angry": {
          "duration": 1,
          "broadcast_anger": false,
          "broadcast_range": 0,
          "calm_event": {
            "event": "on_calm",
            "target": "self"
          }
        },
        "minecraft:experience_reward": {
          "on_death": "query.last_hit_by_player ? 5 + (query.equipment_count * Math.Random(1,3)) : 0"
        }
      }
      
    },

    "components": {
      "minecraft:boss": {
        "should_darken_sky": true,
        "hud_range": 150,
        "name": "§4nombre_mob"
      },
	"minecraft:behavior.look_at_target":{
	"look_distance": 100,
	"look_time": [0,0],
	"probability": 1
	},
	"minecraft:movement": {
          "value": 0.3
        },
      "minecraft:breathable": {
        "total_supply": 15,
        "suffocate_time": 0,
        "breathes_water": true
      },
      "minecraft:collision_box": {
        "width": 1,
        "height": 2
      },
	  "minecraft:scale":{
	  "value": 0.5
	  },
      "minecraft:nameable": {
      },

      "minecraft:type_family": {
        "family": [ "nombre_mob","monster", "mob" ]
      },
      "minecraft:loot": {
        "table": "loot_tables/entities/nombre_mob.json"
      },

      "minecraft:health": {
        "value": 30,
        "max": 30
      },
      "minecraft:hurt_on_condition": {
        "damage_conditions": [
          {
            "filters": { "test": "in_lava", "subject": "self", "operator": "==", "value": true },
            "cause": "lava",
            "damage_per_tick": 4
          }
        ]
      },
      "minecraft:attack": {
        "damage": 15
      },
      "minecraft:navigation.walk": {
        "is_amphibious": true,
        "can_pass_doors": true,
        "can_break_doors": true,
        "avoid_portals": false
      },
      "minecraft:movement.basic": {

      },
      "minecraft:jump.static": {
      },

      "minecraft:behavior.melee_attack": {
        "priority": 0,
		"reach_multiplier": 0.5,
		"attack_duration": 0.3,
        "speed_multiplier": 1,
        "track_target": true
      },
	  "minecraft:behavior.delayed_attack": {
        "priority": 0,
        "reach_multiplier": 1.2,
        "attack_duration": 0.4,
		"hit_delay_pct": 0.0,
        "track_target": true
      },
      "minecraft:behavior.move_towards_restriction": {
        "priority": 5,
        "speed_multiplier": 1
      },
      "minecraft:behavior.hurt_by_target": {
        "priority": 1
      },
      "minecraft:behavior.nearest_attackable_target": {
        "priority": 2,
        "within_radius": 30,
        "reselect_targets": true,
        "entity_types": [
          {
            "filters": {
              "any_of": [
                { "test": "is_family", "subject": "other", "value": "player" }
              ]
            },
            "max_dist": 30
          }
        ],
        "must_see": true
      },
      
        "minecraft:on_target_acquired": {
          "event": "attack_mode",
          "target":"self"
        },
      
      "minecraft:physics": {
      },
      "minecraft:pushable": {
        "is_pushable": true,
        "is_pushable_by_piston": true
      }
    },

    "events": {
      "attack_mode":{
          "add":{
              "component_groups":[
                  "attack_mode"
                  ]
          }
      },
      "on_calm":{
          "remove":{
              "component_groups":[
                 "attack_mode" 
                  ]
          }
      }
    }
  }
}

                     

Folder spawn_rules -> mob_name.json

 
                     
                    {
  "format_version": "1.8.0",
  "minecraft:spawn_rules": {
    "description": {
      "identifier": "tutorial:nombre_mob",
      "population_control": "monster"
    },
    "conditions": [
      {
        "minecraft:spawns_on_surface": {},
        "minecraft:spawns_underground": {},
        "minecraft:brightness_filter": {
          "min": 0,
          "max": 7,
          "adjust_for_weather": true
        },
        "minecraft:difficulty_filter": {
          "min": "easy",
          "max": "hard"
        },
        "minecraft:weight": {
          "default": 100
        },
        "minecraft:herd": {
          "min_size": 2,
          "max_size": 4
        },
        "minecraft:permute_type": [
          {
            "weight": 95
          },
          {
            "weight": 5,
            "entity_type": "minecraft:zombie_villager_v2"
          }
        ],
        "minecraft:biome_filter": {
          "test": "has_biome_tag", "operator": "==", "value": "monster"
        }
      }
    ]
  }
}
                     

Resource folder

Animation_controllers folder -> mob_name.animation_controllers.json

 
                     
                     {
	"format_version" : "1.10.0",
	"animation_controllers" : {
		"controller.animation.nombre_mob.idle" : {
			"initial_state" : "default",
			"states" : {
				"default" : {
					"animations" : [ "idle" ],
					"transitions" : [
						{
							"move" : "query.is_angry"
						}
					]
				},
				"move" : {
					"animations" : [ "move" ],
					"transitions" : [
						{
							"default" : "!query.is_angry"
						}
					]
				}
				
			}
		},
		"controller.animation.nombre_mob.attack" : {
		"initial_state" : "default",
			"states" : {
				"default" : {
					"transitions" : [
						{
							"attack" : "query.is_delayed_attacking"
						}
					]
				},
				"attack" : {
					"animations" : [ "attack" ],
					"transitions" : [
						{
							"default" : "!query.is_delayed_attacking"
						}
					]
				}
			}
		}
	}
}

                     

Character animations must go in: Animations folder -> mob_name.animation.json

Entity folder -> mob_name.entity.json

 
                     
                     {
  "format_version": "1.8.0",
  "minecraft:client_entity": {
    "description": {
      "identifier": "tutorial:nombre_mob",
      "materials": { "default": "entity" },
      "textures": {
        "default": "textures/entity/nombre_mob"
      },
      "geometry": {
        "default": "geometry.nombre_mob"
      },
      "animations": {
        "idle": "animation.nombre_mob.idle",
        "attack": "animation.nombre_mob.attack",
		    "move": "animation.nombre_mob.move"
      },
      "animation_controllers": [
        { "idle": "controller.animation.nombre_mob.idle" },
	  	{ "attack": "controller.animation.nombre_mob.attack" }
      ],
      "render_controllers": [ "controller.render.ragthor_render" ],
      "spawn_egg": {
        "texture": "spawn_egg",
        "texture_index": 18
      }
    }
  }
}

                     

The exported player model must be in: models -> entity -> mob_name.geo.json

Render_controllers folder -> ragthor_render.json

 
                     
                     {
	"format_version": "1.8.0",
	"render_controllers": {
		"controller.render.ragthor_render": {
			"geometry": "Geometry.default",
			"materials": [
				{
					"*": "Material.default"
				}
			],
			"textures": [
				"Texture.default"
			]
		}
	}
}
                     

Sounds folder -> sound_definitions.json

 
                     
                     {
   "format_version" : "1.14.0",
   "sound_definitions" : {
      "mob.nombre_mob.say" : {
         "__use_legacy_max_distance" : "true",
         "category" : "hostile",
         "sounds" : [
            "sounds/nombre_mob_say",
            {
               "load_on_low_memory" : true,
               "name" : "sounds/nombre_mob_say"
            },
            "sounds/nombre_mob_say"
         ]
      },
      "mob.nombre_mob.death" : {
         "__use_legacy_max_distance" : "true",
         "category" : "hostile",
         "sounds" : [ "sounds/nombre_mob_death" ]
      },
      "mob.nombre_mob.hurt" : {
         "__use_legacy_max_distance" : "true",
         "category" : "hostile",
         "sounds" : [ "sounds/nombre_mob_hurt" ]
      }
   }
}

                     

Texts folder -> en_US.lang

 
                     
                     item.spawn_egg.entity.tutorial:nombre_mob.name=§2Mi Mob
entity.tutorial:nombre_mob.name=§2Mi Mob
                     

Addon base folder -> sounds.json

 
                     
                     {
   "entity_sounds": {
      
    "entities": {
         "tutorial:nombre_mob" : {
            "events" : {
               "ambient" : "mob.nombre_mob.say",
               "death" : "mob.nombre_mob.death",
               "hurt" : "mob.nombre_mob.hurt",
               "step" : {
                  "pitch" : 1.0,
                  "sound" : "step.snow",
                  "volume" : 0.450
               }
            },
            "pitch" : [ 0.80, 1.20 ],
            "volume" : 1.0
         }
         
      } 
   
}
}

                     

The texture of the mob must be in: textures -> entity

Download code