āϧāĻžāĻĒ ā§§: BP entity â fly behavior
behavior_pack/entities/dragon.json
1{2"format_version": "1.21.0",3"minecraft:entity": {4"description": {5"identifier": "myaddon:dragon",6"is_spawnable": true,7"is_summonable": true8},9"components": {10"minecraft:type_family": { "family": ["dragon", "monster"] },11"minecraft:health": { "value": 60, "max": 60 },12"minecraft:movement": { "value": 0.4 },13"minecraft:flying_speed": { "value": 0.6 },â14"minecraft:navigation.fly": { "can_path_over_water": true },â15"minecraft:movement.fly": {},16"minecraft:physics": {},17"minecraft:collision_box": { "width": 1.5, "height": 1.5 },18"minecraft:attack": { "damage": 8 },1920"minecraft:behavior.float": { "priority": 0 },21"minecraft:behavior.nearest_attackable_target": {22"priority": 2,23"entity_types": [24{25"filters": { "test": "is_family", "subject": "other", "value": "player" },26"max_dist": 2427}28]29},30"minecraft:behavior.melee_attack": { "priority": 3 },â31"minecraft:behavior.random_fly": { "priority": 6 }32}33}34}
- L13flying_speed: āĻāĻĄāĻŧāĻžāϰ āĻāϤāĻŋ (āĻšāĻžāĻāĻāĻžāϰ movement āĻĨā§āĻā§ āĻāϞāĻžāĻĻāĻž)āĨ¤
- L14navigation.fly + movement.fly â āĻĻā§āĻā§āĻ āϞāĻžāĻā§, āύāĻž āĻšāϞ⧠āĻŽāĻŦ āĻāĻĄāĻŧāĻŦā§ āύāĻž, āĻšāĻžāĻāĻāĻŦā§āĨ¤
- L30random_fly: āĻāĻŋāĻā§ āύāĻž āĻĨāĻžāĻāϞ⧠āĻāĻāĻžāĻļā§ āĻāϞā§āĻŽā§āϞ⧠āĻāĻĄāĻŧāĻŦā§āĨ¤
āϧāĻžāĻĒ ā§¨: Model āĻ Animation (Blockbench)
- Blockbench-āĻ āĻāĻāĻāĻž āĻĄā§āϰāĻžāĻāύ model āĻŦāĻžāύāĻžāĻ â āĻ
āύā§āϤāϤ
body,left_wing,right_wingbone āϰāĻžāĻā§āĨ¤ - āĻāĻāĻāĻž
animation.dragon.flyāĻŦāĻžāύāĻžāĻ āϝā§āĻāĻžāύ⧠āĻĻā§āĻ āĻĄāĻžāύāĻž āĻāĻĒāϰ-āύāĻŋāĻ āĻāĻžāĻĒāĻāĻžāϝāĻŧ (loop on)āĨ¤ - āĻāĻāĻāĻž
animation.dragon.idleāĻŦāĻžāύāĻžāĻ â āĻšāĻžāϞāĻāĻž āĻļā§āĻŦāĻžāϏ/āĻĻā§āϞāĻžāĨ¤ - geometry
.geo.jsonāĻāϰ animation.animation.jsonRP-āϤ⧠export āĻāϰā§āĨ¤
āϧāĻžāĻĒ ā§Š: Animation Controller
resource_pack/animation_controllers/dragon.ac.json
1{2"format_version": "1.10.0",3"animation_controllers": {4"controller.animation.dragon.move": {5"initial_state": "idle",6"states": {7"idle": {8"animations": ["idle"],9"transitions": [{ "fly": "query.modified_move_speed > 0.1" }]10},11"fly": {12"animations": ["fly"],13"transitions": [{ "idle": "query.modified_move_speed <= 0.1" }]14}15}16}17}18}
āϧāĻžāĻĒ ā§Ē: RP client entity â āϏāĻŦ āĻā§āĻĄāĻŧāĻž āϞāĻžāĻāĻžāĻ
resource_pack/entity/dragon.json
1{2"format_version": "1.10.0",3"minecraft:client_entity": {4"description": {5"identifier": "myaddon:dragon",â6"materials": { "default": "entity_alphatest" },7"textures": { "default": "textures/entity/dragon" },8"geometry": { "default": "geometry.dragon" },9"animations": {10"idle": "animation.dragon.idle",11"fly": "animation.dragon.fly",12"move_ctrl": "controller.animation.dragon.move"13},14"scripts": { "animate": ["move_ctrl"] },â15"render_controllers": ["controller.render.default"]16}17}18}
- L5identifier: BP entity-āϰ āϏāĻžāĻĨā§ āĻšā§āĻŦāĻšā§ āĻāĻāĨ¤
- L14animate-āĻ controller āĻāĻžāϞāĻžāĻā§āĻāĻŋ â āϏ⧠āύāĻŋāĻā§ idle/fly āĻŦā§āĻā§ āύā§āĻŦā§āĨ¤
āϧāĻžāĻĒ ā§Ģ: āĻā§āϏā§āĻ āĻāϰā§
- 1āϏāĻŦ āĻĢāĻžāĻāϞ addon āĻĢā§āϞā§āĻĄāĻžāϰ⧠āϰā§āĻā§
.mcaddonāĻŦāĻžāύāĻŋāϝāĻŧā§ import āĻāϰā§, world-āĻ activate āĻāϰā§āĨ¤ - 2
/summon myaddon:dragon ~ ~10 ~āĻĻāĻŋāϝāĻŧā§ āĻŽāĻžāĻĨāĻžāϰ āĻāĻĒāϰ⧠āĻāĻāĻāĻž āĻĄā§āϰāĻžāĻāύ āĻāύā§āĨ¤ - 3āĻĻā§āĻā§ āϏ⧠āĻāĻĄāĻŧāĻā§ āĻāϰ āĻĄāĻžāύāĻž āĻāĻžāĻĒāĻāĻžāĻā§āĻā§ â āĻĨāĻžāĻŽāϞ⧠idle, āύāĻĄāĻŧāϞ⧠fly animationāĨ¤
- 4āĻāĻžāĻā§ āĻā§āϞ⧠āϏ⧠āϤā§āĻŽāĻžāĻā§ āĻāĻā§āϰāĻŽāĻŖ āĻāϰāϤ⧠āĻāϏāĻŦā§! đ˛