Pocket Edition entity components
Περιεχόμενα
- 1 Attributes
- 2 Filters
- 3 Triggers
- 4 Components
- 4.1 minecraft:is_baby
- 4.2 minecraft:scale
- 4.3 minecraft:is_stackable
- 4.4 minecraft:collision_box
- 4.5 minecraft:identifier
- 4.6 minecraft:hurt_when_wet
- 4.7 minecraft:type_family
- 4.8 minecraft:ageable
- 4.9 minecraft:timer
- 4.10 minecraft:teleport
- 4.11 minecraft:breathable
- 4.12 minecraft:breedable
- 4.13 minecraft:foot_size
- 4.14 minecraft:height_offset
- 4.15 minecraft:inherit_rotation_when_riding
- 4.16 minecraft:boostable
- 4.17 minecraft:equippable
- 4.18 minecraft:interact
- 4.19 minecraft:leashable
- 4.20 minecraft:lookat
- 4.21 minecraft:nameable
- 4.22 minecraft:addrider
- 4.23 minecraft:tamemount
- 4.24 minecraft:damage_sensor
- 4.25 minecraft:environment_sensor
- 4.26 minecraft:tameable
- 4.27 minecraft:target_nearby_sensor
- 4.28 minecraft:transformation
- 4.29 minecraft:shooter
- 4.30 minecraft:projectile
- 4.31 minecraft:angry
- 4.32 minecraft:healable
- 4.33 minecraft:sittable
- 4.34 minecraft:rideable
- 4.35 minecraft:scale_by_age
- 4.36 minecraft:rail_movement
- 4.37 minecraft:rail_sensor
- 4.38 minecraft:item_hopper
- 4.39 minecraft:inventory
- 4.40 minecraft:explode
- 4.41 minecraft:item_controllable
- 5 Behaviors
- 5.1 All behaviors
- 5.2 minecraft:behavior.beg
- 5.3 minecraft:behavior.hurt_by_target
- 5.4 minecraft:behavior.nearest_attackable_target
- 5.5 minecraft:behavior.avoid_mob_type
- 5.6 minecraft:behavior.break_door
- 5.7 minecraft:behavior.breed
- 5.8 minecraft:behavior.controlled_by_player
- 5.9 minecraft:behavior.defend_village_target
- 5.10 minecraft:behavior.eat_block
- 5.11 minecraft:behavior.restrict_sun
- 5.12 minecraft:behavior.move_through_village
- 5.13 minecraft:behavior.stay_while_sitting
- 5.14 minecraft:behavior.find_mount
- 5.15 minecraft:behavior.flee_sun
- 5.16 minecraft:behavior.follow_owner
- 5.17 minecraft:behavior.follow_parent
- 5.18 minecraft:behavior.guardian_attack
- 5.19 minecraft:behavior.harvest_farm_block
- 5.20 minecraft:behavior.leap_at_target
- 5.21 minecraft:behavior.look_at_player
- 5.22 minecraft:behavior.make_love
- 5.23 minecraft:behavior.melee_attack
- 5.24 minecraft:behavior.mount_pathing
- 5.25 minecraft:behavior.move_indoors
- 5.26 minecraft:behavior.ocelot_sit_on_block
- 5.27 minecraft:behavior.offer_flower
- 5.28 minecraft:behavior.swell
- 5.29 minecraft:behavior.take_flower
- 5.30 minecraft:behavior.tempt
- 5.31 minecraft:behavior.move_towards_restriction
- 5.32 minecraft:behavior.ocelotattack
- 5.33 minecraft:behavior.play
- 5.34 minecraft:behavior.open_door
- 5.35 minecraft:behavior.owner_hurt_by_target
- 5.36 minecraft:behavior.panic
- 5.37 minecraft:behavior.owner_hurt_target
- 5.38 minecraft:behavior.random_stroll
- 5.39 minecraft:behavior.ranged_attack
- 5.40 minecraft:behavior.raid_garden
- 5.41 minecraft:behavior.random_look_around
- 5.42 minecraft:behavior.silverfish_wake_up_friends
- 5.43 minecraft:behavior.silverfish_merge_with_stone
- 6 Events
Attributes[επεξεργασία | επεξεργασία κώδικα]
minecraft:health[επεξεργασία | επεξεργασία κώδικα]
- Description
- How much health the mob starts with. Units are in # of half hearts.
- Parameters
Parameters Default Description min 0 Lowest value for attribute. Rarely needed. max MAX_FLOAT Upper value for attribute. Only really needed to clamp positive mob effects from going past this. value 20.0 Starting value of attribute
- Sample usage
"minecraft:health": { "value": 10.0 }
- Entities used in
- All mobs ( Attributes are always present, but will use default values if not specified )
minecraft:follow_range[επεξεργασία | επεξεργασία κώδικα]
- Description
- How far away the mob will stay from a target, in blocks,t that it is following (usually the owner).
- Limitations
- Can only be put on mobs
- Parameters
Parameters Default Description min 0 Lowest value for attribute. Rarely needed. max 2048 Upper value for attribute. Only really needed to clamp positive mob effects from going past this. Maximum value is 2048 value 16.0 Starting value of attribute.
- Sample usage
"minecraft:follow_range": { "value": 16.0 }
- Entities used in
- All mobs (Attributes are always present, but will use default values if not specified)
minecraft:knockback_resistance[επεξεργασία | επεξεργασία κώδικα]
- Description
- How much resistance is there against knockback effects. 0 mean no resistance, 1 means fully immune.
- Limitations
- Can only be put on mobs
- Parameters
Parameters Default Description min 0 Lowest value for attribute. Rarely needed. max 1.0 Upper value for attribute. Only really needed to clamp positive mob effects from going past this. value 0 Starting value of attribute
- Sample usage
"minecraft:knockback_resistance": { "value": 0.5 }
- Entities used in
- All mobs (Attributes are always present, but will use default values if not specified)
minecraft:movement[επεξεργασία | επεξεργασία κώδικα]
- Description
- How fast the mob moves in the world. Units are blocks per tick, 20 ticks in a second. This means that a mob with 0.25 movement speed will run 5 blocks every second (20 ticks * 0.25 blocks per tick ).
- Limitations
- Can only be put on mobs
- Parameters
Parameters Default Description min 0 Lowest value for attribute. Rarely needed. max MAX_FLOAT Upper value for attribute. Only really needed to clamp positive mob effects from going past this. value 0.7 Starting value of attribute
- Sample usage
"minecraft:movement": { "value": 0.3 }
- Entities used in
- All mobs (Attributes are always present, but will use default values if not specified)
minecraft:attack[επεξεργασία | επεξεργασία κώδικα]
- Description
- How much damage a melee attack will do, and controls status effects on hit
- Parameters
Parameters Default Description damage 2.0 How much damage melee attacks will do, in half hearts. effect_name The name of the status effect to apply to the mob that is hit effect_duration How long, in seconds, that the status effect lasts
Effect Name speed slowness haste mining_fatigue strength instant_heal instant_damage jump_boost nausea regeneration resistance fire_resistance water_breathing invisibility blindness night_vission hunger weakness poison wither health_boost absorption saturation
- Sample usage
"minecraft:attack": { "damage": 3.0, "effect_name": "hunger", "effect_duration": 30 }
- Entities used in
- All mobs (Attributes are always present, but will use default values if not specified)
minecraft:fall_damage[επεξεργασία | επεξεργασία κώδικα]
- Description
- Scales how much fall damage the mob takes when it falls. 0.5 is half damage, 2 is twice the amount of fall damage.
- Entities used in
Parameters Default Description min 0 Lowest value for attribute. Rarely needed. max MAX_FLOAT Upper value for attribute. Only really needed to clamp positive mob effects from going past this. value 1.0 Starting value of attribute
- Sample usage
"minecraft:fall_damage": { "value": 0.5 }
- Entities used in
- All mobs (Attributes are always present, but will use default values if not specified)
Filters[επεξεργασία | επεξεργασία κώδικα]
All filters[επεξεργασία | επεξεργασία κώδικα]
- Description
- Filters are used in many components, including all triggers and events, and are used to control what entities are applicable in those contexts.
- Parameters
Parameters Description all_of A JSON object that is of type filter. Returns true if all of the filters inside of it is true. any_of A JSON object that is of type filter. Returns true if at least one of the filters inside it is true player_with_instabuild Checks if the player is in creative mode. with_item Return true if any of the items listed is in the owning entity’s hands. without_item Return true if all of the items listed aren’t in the owning entity’s hands. with_armor Return true if any of the items listed are being worn by the owning entity without_armor Return true if all of the items listed aren’t being worn by the owning entity with_equipment Return true if all of the items listed are either in the hands or being worn by the owning entity. without_equipment Return true if all of the items listed aren't in the hands or being worn by the owning entity. with_components Returns true if the owning entity has all the components listed. without_components Returns true if the owning entity has none of the components listed. with_families Returns true if the owning entity has any of the families listed. without_families Returns true if the owning entity has none of the families listed. with_damage_cause Only valid in damage sensor trigger. Return true if damage is of type listed. without_damage_cause Only valid in damage sensor trigger. Return true if damage isn't of type listed. with_environment_any Return true if any of the environmental conditions listed exist in the owning entity’s surroundings without_environment_any Return true if any of the environmental conditions listed do not exist in the owning entity’s surroundings. with_environment_every Return true if all of the environmental conditions listed exist in the owning entity’s surroundings without_environment_every Return true if all of the environmental conditions listed do not exist in the owning entity’s surroundings. other_with_item Return true if any of the items listed is in the hands of the entity being filtered. other_without_item Return true if all of the items listed aren't in the hands of the entity being filtered. other_with_armor Return true if any of the items listed are being worn by entity being filtered. other_without_armor Return true if all of the items listed aren't being worn by the entity being filtered. other_with_equipment Return true if all of the items listed are either in the hands or being worn by the entity being filtered. other_without_equipment Return true if all of the items listed aren't in the hands or being worn by the entity being filtered. other_with_components Returns true if the entity being filtered has all the components listed. other_without_components Returns true if the entity being filtered has none of the components listed. other_with_families Returns true if the entity being filtered has any of the families listed. other_without_families Returns true if the entity being filtered has none of the families listed. target_with_item Return true if any of the items listed is in the owning entity's targets hands. target_without_item Return true if all of the items listed aren't in the owning entity's targets hands. target_with_armor Return true if any of the items listed are being worn by the owning entity's target. target_without_armor Return true if all of the items listed aren't being worn by the owning entity's target. target_with_equipment Return true if all of the items listed are either in the hands or being worn by the owning entity's target. target_without_equipment Return true if all of the items listed aren't in the hands or being worn by the owning entity's target. target_with_components Returns true if the owning entity's target has all the components listed. target_without_components Returns true if the owning entity's target has none of the components listed. target_with_families Returns true if the owning entity's target has any of the families listed. target_without_families Returns true if the owning entity's target has none of the families listed.
- Sample usage
"filters": {
"other_with_familes": ["player", "snowgolem", "irongolem"], "with_environment_any": [ "night", "underground" ]
}
- Entities used in
- All Mobs
Environment filter conditions[επεξεργασία | επεξεργασία κώδικα]
- Description
- Environment filters used by the environment sensor component
- Parameters
Conditions Description underground surface day night brightness_less brightness_greater altitude_less altitude_greater biome
;Biomes beach desert extreme_hills flat forest the_nether ice jungle mesa mushroom_island ocean plain river savanna stone_beach swamp taiga the_end
- Sample usage
"filters": { "with_environment_any": [ "night", "brightness_less:0.49", "biome:desert" ] }
Triggers[επεξεργασία | επεξεργασία κώδικα]
Generic triggers[επεξεργασία | επεξεργασία κώδικα]
- Description
- Triggers are used in several components and are how you can send events either to this entity or to other entities.
- Limitations
- Valid target values vary on what component has the trigger.
- Parameters
Parameters Default Description event "" Name of event to send target "self" Target of event. Valid values depend on context of trigger. filters None Conditions for when trigger can fire. See [ Filters]
- Sample usage
"minecraft:on_tamed": { "event": "convert_to_tamed", "target": "self" }
- Entities used in
- Almost all mobs use these
Standalone triggers[επεξεργασία | επεξεργασία κώδικα]
- Description
- These are triggers that aren’t embedded in any other component and are added to an entity just like any other component.
- Parameters
Parameters Description minecraft:on_target_acquired Fires whenever the entity gets a new valid target minecraft:on_target_escape Fires whenever the entity loses its current target minecraft:on_hurt_by_player Fires whenever the entity is hurt by a player minecraft:on_hurt Fires whenever the entity takes damage from any source, even if other triggers for hurt have already been triggered minecraft:on_ignite Fired when this entity takes burn damage
- Sample usage
"minecraft:on_ignite": { "event": "add_primed", "target": "self" }
- Entities used in
- Creeper along with various others
Components[επεξεργασία | επεξεργασία κώδικα]
minecraft:is_baby[επεξεργασία | επεξεργασία κώδικα]
- Description
- Makes the mob render with an extra-large head
- Limitations
- Currently only renders correctly if minecraft:scale is 0.5. Only has an effect on the mobs listed below.
- Sample usage
"minecraft:is_baby": { }
- Entities used in
- Zombie, Chicken, Sheep, Ocelot, Wolf, Cow, Mooshroom, Pig
minecraft:scale[επεξεργασία | επεξεργασία κώδικα]
- Description
- Scale the size of the entity. Will automatically adjust [ collision_box] and riding positions.
- Limitations
- Scale value must be positive.
- Parameters
Parameters Default Description value 1.0 Multiplier against the default size of the entity. 1.0 means no effect, 0.5 means half normal size, 2.0 means double normal size
- Sample usage
"minecraft:scale": { "value": 2.0 }
- Entities used in
- All mobs with is_baby component: Zombie, Chicken, Sheep, Ocelot, Wolf, Cow, Mooshroom, Pig
minecraft:is_stackable[επεξεργασία | επεξεργασία κώδικα]
- Description
- Controls whether this entity can stack with other entities of the same type.
- Parameters
Parameters Default Description value false If true, then this will collide with other entities of the same type
- Sample usage
"minecraft:can_stack": { "value": true }
- Entities used in
- Minecart
minecraft:collision_box[επεξεργασία | επεξεργασία κώδικα]
- Description
- Set the width and the height of the collision box of the entity. NOTE: The actual runtime scale is adjusted by the entities current scale set with either[ minecraft:scale] or minecraft:scale_with_age.
- Limitations
- Width and length are controlled by the same value which is currently an engine limitation.
- Parameters
Parameters Default Description width 1.0 Width and length of the collision box. 1.0 is the same size as a block height 1.0 Height of the collision box. 1.0 is the same size as a block
- Sample usage
"minecraft:collision_box": { "width": 0.8, "height": 1.8 }
- Entities used in
- All entities.
minecraft:identifier[επεξεργασία | επεξεργασία κώδικα]
- Description
- Set a string identifier for the entity. This is a required component on all entities and must be in the components section of the entity.
- Limitations
- Currently, the only valid values are those in use in the game already. Also, changing the identifier through the component groups is not supported.
- Parameters
Parameters Default Description id "" Name to identify this entity with
- Sample usage
"minecraft:identifier": { "id": "minecraft:wolf" }
- Entities used in
- All Entities
minecraft:hurt_when_wet[επεξεργασία | επεξεργασία κώδικα]
- Description
- The entity will take damage when touching water blocks, or being exposed to rain
- Parameters
Parameters Default Description value false When true, the entity will take damage from water blocks or when exposed to the rain.
- Sample usage
"minecraft:hurt_when_wet": { "value": true }
- Entities used in
- Blaze
- Enderman
minecraft:type_family[επεξεργασία | επεξεργασία κώδικα]
- Description
- Sets a list of tags that can be used for filtering from other components, events and triggers.
- Parameters
Parameters Default Description family empty List of strings
- Sample usage
"minecraft:type_family": { "family": ["zombie", "monster", "undead"] }
- Entities used in
- All entities.
minecraft:ageable[επεξεργασία | επεξεργασία κώδικα]
- Description
- Adds a timer to the entity that will fire a trigger at the end of it. The timer can be accelerated by giving it items the entity likes to eat.
- Parameters
Parameters Default Description duration 1.0 Time in seconds before trigger activates grow_up Trigger that is fired when duration is reached feedItems List item "" Name of item when if fed, it will remove growth seconds from duration growth 0.0 Amount of seconds removed from duration
- Sample usage
"minecraft:ageable": { "duration": 1200, "grow_up": { "event": "on_grow_up", "target": "self" }, "feedItems": [ { "item": "carrot", "growth": 30 } ] }
- Entities used in
- Chicken, Cow, Horse, Mule, Donkey, Mooshroom, Ocelot, Pig, Rabbit, Sheep, Villager, Wolf
minecraft:timer[επεξεργασία | επεξεργασία κώδικα]
- Description
- General purpose time down component that fires an event upon time elapse.
- Parameters
Parameters Default Description time [1.0, 3.0] Time in seconds before trigger activates. Can be a single number or range like in the default. looping true Will restart the timer when elapsed if set randomInterval true If true, the time will randomize between the min and max values of time time_down_event trigger Fired when time is fully elapsed
- Sample usage
"minecraft:timer": { "time": [1, 3], "looping": false, "time_down_event": { "event": "on_time_elapsed", "target": "self" } }
- Entities used in
- None.
minecraft:teleport[επεξεργασία | επεξεργασία κώδικα]
- minecraft
- teleport
- Description
- Makes a mob teleport depending on some condition, whether that be random or when chasing a target.
- Parameters
Parameters Default Description randomTeleports true Does the entity randomly teleport or not minRandomTeleportTime 0.0 Minimum time in seconds before next random teleport maxRandomTeleportTime 20.0 Maximum time in seconds before next random teleport randomTeleportCube [32.0, 16.0, 32.0] Area around entity where random teleport will go to targetDistance 16.0 When chasing a target, the distance at which the entity decides to teleport closer to the target lightTeleportChance 0.01 Additional chance of teleporting in daylight. Range of 0 to 1 darkTeleportChance 0.01 Additional chance of teleporting in darkness. Range of 0 to 1 generatesBubbles
- Sample usage
"minecraft:teleport": { "randomTeleports": true, "minRandomTeleportTime": 0, "maxRandomTeleportTime": 30, "randomTeleportCube": [32, 32, 32], "targetDistance": 16, "lightTeleportChance": 0.01, "darkTeleportChance": 0.0 }
- Entities used in
- Enderman
minecraft:breathable[επεξεργασία | επεξεργασία κώδικα]
- Description
- Allows the entity to take damage by suffocation. Able to define what blocks an entity can breathe in.
- Limitations
- Only works on mobs.
- Parameters
Parameters Default Description totalSupply 15 Time in seconds the entity can hold their breath suffocateTime -20 Number of seconds between suffocation damage breathesAir true If true, can breathe in blocks considered to be air breathesWater false If true, can breathe in water blocks breathesLava false If true, can breathe in lava blocks breathesSolids false If true, can breathe in solid blocks breatheBlocks [] List of blocks that can be breathed in, in addition to the above flags nonBreatheBlocks [] List of blocks that can’t be breathed in, in addition to the above flags generatesBubbles True If true, will display water bubbles
- Sample usage
"minecraft:breathable": { "totalSupply": 15.0, "suffocateTime": -1, "breathesAir": false, "breathesWater": true, "breathesLava": false, "breathesSolids" false, "breatheBlocks": ["glass", "cobblestone"], "nonBreatheBlocks": ["cobblestone"] }
- Entities used in
- Player, Squid
minecraft:breedable[επεξεργασία | επεξεργασία κώδικα]
- Description
- Allows interactions with a mob to enable its "love" state. Also, handles birth of child depending on breed type when engaged.
- Parameters
Parameters Default Description requireTame true Does the mob, and the mob it is going to breed with, need to be tamed before you can breed them extraBabyChance 0.0 0 to 1, chance that up to 16 babies can be spawned breedCooldown 60 Time in seconds before can be bred again breedItems List Items that will trigger "love" mode breedsWith List List of acceptable mates mateType "" Entity identifier of mate type babyType "" Entity identifier of baby to spawn breed_event Trigger Trigger fired when baby is born. Target can be baby if you want event sent to the baby instead inheritTamed true If true, the baby that is spawned, will be tamed if its parents are tamed.
- Sample usage
"minecraft:breedable": { "requireTame": true, "extraBabyChance": 0.0, "breedCooldown": 30, "breedItems": ["carrot"], "breedsWith": [ { "mateType": "minecraft:rabbit", "babyType": "minecraft:rabbit", "breed_event": { "event": "on_bred", "target": "self" } } ] }
- Entities used in
- Chicken, Cow, Mooshroom, Ocelot, Pig, Rabbit, Sheep, Wolf
minecraft:foot_size[επεξεργασία | επεξεργασία κώδικα]
- Description
- Sets how large of a step, in blocks, that something can step over.
- Parameters
Parameters Default Description value 0.5 Number of blocks you can step up onto without jumping
- Sample usage
"minecraft:foot_size": { "value": 0.5 }
- Entities used in
- Horse, Mule, Donkey, Enderman
minecraft:height_offset[επεξεργασία | επεξεργασία κώδικα]
- Description
- Sets a vertical offset, in blocks, for the entity position relative to origin of the entity.
- Parameters
Parameters Default Description value 0.5 The vertical offset amount, in blocks
- Sample usage
"minecraft:height_offset": { "value": 0.5 }
- Entities used in
- Player, Boat, TripodCamera
minecraft:inherit_rotation_when_riding[επεξεργασία | επεξεργασία κώδικα]
- Description
- Do the riders on this entity use the same rotation as this entity.
- Limitations
- Requires [ minecraft:rideable] component to have any effect.
- Parameters
Parameters Default Description value false If true, the rider will rotate to face the same direction as this entity
- Sample usage
"minecraft:inherit_rotation_when_riding": { "value": true }
- Entities used in
- Boat
minecraft:boostable[επεξεργασία | επεξεργασία κώδικα]
- Description
- Allows the player to briefly boost the movement speed of their ride with a specific item. The boost item can also specify a replacement item for when the item is depleted.
- Limitations
- Requires [ minecraft:rideable] component to have any effect.
- Parameters
Parameters Default Description duration 3.0 The duration of the boost in seconds speed_multiplier 1.0 A speed multiplier that can boost movement. A value of 2.0 will make this entity move twice as fast as normal boost_items [] An array of items that can be used to cause the boost item "" The name of the item that will cause the boost damage 1 The amount of damage to apply to an item when it is used replaceItem "" The name of the item that will replace the boost item with a new item when it is depleted
- Sample usage
"minecraft:boostable": { "speed_multiplier": 2.0, "duration": 3.0, "boost_items": [ { "item": "carrotOnAStick", "damage": 2, "replaceItem": "fishing_rod" } ] }
- Entities used in
- Pig
minecraft:equippable[επεξεργασία | επεξεργασία κώδικα]
- Description
- Allows for interaction and triggers to fire when an item is equipped or unequipped from an entity. Used for horses equipping and unequipping saddles
- Limitations
- Only works for Horse right now.
- Parameters
Parameters Default Description slots [] An array of items that can be equipped item "" The name of the item that can be equipped interact_text "" The text that will display for the equip action on_equip A trigger that will call the specified event when the item is equipped on_unequip A trigger that will call the specified event when the item is unequipped
- Sample usage
"minecraft:equippable": { "slots": [ { "item": "saddle", "interact_text": "action.interact.saddle", "on_equip": { "event": "minecraft:on_saddled", "target": "self" }, "on_unequip": { "event": "minecraft:on_unsaddled", "target": "self" } } ] }
- Entities used in
- Horses
minecraft:interact[επεξεργασία | επεξεργασία κώδικα]
- Description
- Defines interactions and responses that include changing the currently held item, spawning an entity, and invoking events on the interacting entity. This component can be defined as a single object interaction, or an array of interaction objects.
- Parameters
Parameters Default Description cooldown 0.0 The cooldown, in seconds, before the interaction may be used again use_item false If true, interacting with this item will use the item hurt_item 0 The damage value to apply to the item when it is used interact_text "" The text that displays for the interaction transform_to_item "" The name of the item to transform the item used to interact into. The format for this is "name of item:id" play_sounds "" Either a single string or an array of strings of the sounds to trigger when the interaction occurs spawn_entities "" Either a single entity or an array of entities to spawn when the interaction occurs on_interact An event called when the interaction occurs add_items An array of item names, or a specified loot table to place in the player’s inventory spawn_items An array of item names or a specified loot table of items to spawn in the world upon interaction
- Sample usage
"minecraft:interact": [ { "cooldown": 1.0, "use_item": "true", "hurt_item": 0, "interact_text": "action.interact.milk", "transform_to_item": "bucket:1", "play_sounds": [ "mob.sound.foo", "mob.sound.bar" ], "spawn_entities": { "minecraft:creeper" } "on_interact": { "event": "minecraft:do_a_thing", "target": "self" }, "add_items": { "table": "loot.tables.stuff" }, "spawn_items": [ "red_mushroom", "red_mushroom" ] } ]
- Entities used in
- Cow, Mooshroom, Sheep, Zombie Villager
minecraft:leashable[επεξεργασία | επεξεργασία κώδικα]
- Description
- Allows a mob to be leashed.
- Parameters
Parameters Default Description soft_distance 4.0 The distance at which the spring effect starts acting to keep the mob close hard_distance 6.0 The distance at which the spring stiffness constant increases max_distance 10.0 The distance at which the leash breaks on_leash A trigger that will call the specified event when the entity is leashed on_unleash A trigger that will call the specified event when the entity is unleashed
- Sample usage
"minecraft:leashable": { "soft_distance": 4.0, "hard_distance": 6.0, "max_distance": 10.0, "on_leash": { "event": "minecraft:on_leash", "target": "self" }, "on_unleash": { "event": "minecraft:on_unleash", "target": "self" } }
- Entities used in
- Chicken, Cow, Mooshroom, Iron Golem, Ocelot, Pig, Rabbit, Sheep, Snow Golem, Squid, Wolf
minecraft:lookat[επεξεργασία | επεξεργασία κώδικα]
- Description
- Handles triggers and target management for when any mob looks at this entity.
- Parameters
Parameters Default Description setTarget true If true, this entity will set its target to the player if there isn’t a target currently set searchRadius 10.0 The maximum search distance to look for a player target mAllowInvulnerable false If true, allows the entity to target players in creative mode look_event A trigger that will call the specified event when the player looks at this entity filters Controls what mobs can trigger this component
- Sample usage
"minecraft:lookat": { "setTarget": true, "searchRadius": 10.0, "mAllowInvulnerable": false, "look_event": { "event": "minecraft:entity_angry", "target": "self" } }
- Entities used in
- Enderman
minecraft:nameable[επεξεργασία | επεξεργασία κώδικα]
- Description
- Allows a mob to be named using a nametag and provides corresponding events to when a mob acquires a particular name.
- Parameters
Parameters Default Description name_filter "" A string or array of strings that specify names that will fire an event when an entity is named on_named A trigger that will call the specified event when this entity is named a name in the name_filter.
- Sample usage
"minecraft:nameable": { "name_actions": { "name_filter": "TheAdrian", "on_named": { "event": "minecraft:explode", "target": "self" } } }
- Entities used in
- Cave Spider, Chicken, Cow, Creeper, Enderman, Ghast, Guardian, Elder Guardian, Iron Golem, Magma Cube, Mooshroom, Ocelot, Pig, Rabbit, Sheep, Silverfish, Skeleton, Slime, Snow Golem, Spider, Squid, Wolf, Zombie, Zombie Husk, Zombie Pigman
minecraft:addrider[επεξεργασία | επεξεργασία κώδικα]
- Description
- Component that adds a rider to this entity.
- Limitations
- Requires minecraft:rideable to have any effect.
- Parameters
Parameters Default Description entity_type "" The minecraft:identifier of the entity type that will be added as a rider
- Sample usage
"minecraft:addrider": { "entity_type": "minecraft:skeleton" }
- Entities used in
- Spider, Cave Spider
minecraft:tamemount[επεξεργασία | επεξεργασία κώδικα]
- Description
- Used to tame a mob by "breaking it in" or mounting it.
- Parameters
Parameters Default Description minTemper 0 The minimum starting temper for this entity. The beginning entity temper is a random number between minTemper and maxTemper maxTemper 100 The maximum starting temper for this entity. The beginning entity temper is a random number between minTemper and maxTemper attemptTemperMod 5 The amount to increase this entity’s temper by when attempting to mount this entity feedItems [] An array of items that can be used to increase the temper of this entity item "" The name of the item that can be fed to this entity to increase temper temperMod The amount this food increases temper tame_event A trigger that calls the specified event when this entity’s temper is greater than a random chosen number between minTemper and maxTemper
- Sample usage
"minecraft:tamemount": { "minTemper": 0, "maxTemper": 100, "attemptTemperMod": 5, "feedItems": [ { "item": "wheat", "temperMod": 3 }, { "item": "golden_apple", "temperMod": 10 } ], "tame_event": { "event": "minecraft:on_tame", "target": "self" } }
- Entities used in
- Horse
minecraft:damage_sensor[επεξεργασία | επεξεργασία κώδικα]
- Description
- Used to call events when this entity is damaged by specific entities or items, as specified with filters.
- Parameters
Parameters Default Description on_damage Trigger or trigger array that specifies events to call when taking specific types of damage deals_damage true If false, the damage that triggers this event will not deal damage to this entity
- Sample usage
"minecraft:damage_sensor": { "on_damage": { "filters": { "other_with_families": "lightning" }, "event": "minecraft:become_charged" }, "deals_damage": false }
- Entities used in
- Pig, Creeper, Villager
minecraft:environment_sensor[επεξεργασία | επεξεργασία κώδικα]
- Description
- Used to create triggers that will call events depending on the environment conditions. See Environment Filter Conditions for details.
- Parameters
Parameters Default Description on_environment Trigger that is fired when the environment conditions match criteria filters List of filters to use to determine when to fire off an event event The event to call when the filter conditions are true
- Sample usage
"minecraft:environment_sensor": { "on_environment": { "filters": { "with_environment_any": "brightness_less:0.49" }, "event": "minecraft:become_hostile" } }
- Entities used in
- Spider, Cave Spider
minecraft:tameable[επεξεργασία | επεξεργασία κώδικα]
- Description
- Handles interactions between a player and a mob to become tame.
- Parameters
Parameters Default Description probability 1.0 The chance of taming for each use of the tame item. This number can be anything within the range of 0, to 1, where 0 is 0% chance and 1 is 100% chance. tameItems "" A string or a string array of the name of the item that can be used to tame this mob tame_event A trigger that calls the specified event when this entity becomes tame
- Sample usage
"minecraft:tameable": { "probability": 0.33, "tameItems": "bone", "tame_event": { "event": "minecraft:on_tame", "target": "self" } }
- Entities used in
- Ocelot, Wolf
minecraft:target_nearby_sensor[επεξεργασία | επεξεργασία κώδικα]
- Description
- Triggers depending on whether a target has entered or has left a specified range.
- Parameters
Parameters Default Description inside_range 1.0 The maximum number of blocks that a target can be from this entity and be considered in the inside_range outside_range 5.0 The minimum number of blocks that a target can be from this entity and be considered to be in the outside_range on_inside_range A trigger that calls the specified event when a target is closer that inside_range blocks on_outside_range A trigger that calls the specified event when a target is further than outside_range blocks
- Sample usage
"minecraft:target_nearby_sensor": { "inside_range": 5, "outside_range": 10, "on_inside_range": { "event": "start_swell", "target": "self" }, "on_outside_range": { "event": "stop_swell", "target": "self" } }
- Entities used in
- Creeper
minecraft:transformation[επεξεργασία | επεξεργασία κώδικα]
- Description
- Handles transformation of an entity into another entity.
- Parameters
Parameters Default Description into "" The minecraft:identifier of the entity to transform into delay 0 The time in seconds to wait before transforming block_assist_chance 0 The chance to check if there are any special blocks surrounding this entity that can speed up the transformation. Any number between 0 and 1 is valid. block_radius 0 The distance, in blocks, to search for blocks that can help speed up the transformation block_max 0 The maximum number of special blocks to use for speeding up the transformation block_chance 0 The chance that a special block will help speed up the transform block_types "" A string or array of strings of the blocks that can help speed up the transformation
- Sample usage
"minecraft:transformation": { "into": "minecraft:villager", "delay": { "value": 100, "block_assist_chance": 0.01, "block_radius": 4, "block_chance": 0.3, "block_types": [ "minecraft:bed", "minecraft:iron_bars" ] } }
- Entities used in
- Pig, Villager, Mooshroom, Zombie Villager
minecraft:shooter[επεξεργασία | επεξεργασία κώδικα]
- Description
- Handles launching a projectile at this entity’s target.
- Limitations
- Can only shoot predefined projectile types (arrows, large and small fireballs
- Parameters
Parameters Default Description count 1 The number of projectiles to spawn def "" The minecraft:identifier of the projectile to shoot auxVal 0 The id of the potion effect to apply on hit effects
Type arrow largefireball smallfireball
- Sample usage
"minecraft:shooter": { "type": "largefireball", "def": "minecraft:fireball.large" }
- Entities used in
- Skeletons, Ghasts, Blaze
minecraft:projectile[επεξεργασία | επεξεργασία κώδικα]
- Description
- Component to describe a projectile like an Arrow or Fireball.
- Parameters
Parameters Default Description gravity Acceleration due to gravity on this projectile damage The base damage from getting hit with this projectile semirandomdiffdamage If true, randomizes damage based on base damage and hit speed inertia Scalar that is multiplied with projectile’s velocity each frame liquid_inertia Scalar to multiply projectile’s velocity with each frame when in water knockback If true, on impact, the projectile will push back the entity it hit anchor The position to create the projectile at, relative to this entity’s position, eye level, or center of mass offset Offset form the anchor position to create the projectile at power The velocity of the projectile angleoffset Specifies an upward angle at which to launch the projectile. Used to create a parabolic trajectory uncertaintyBase The base number to adjust accuracy with using the function: uncertaintyBase – difficultyLevel * uncertaintyMultiplier uncertaintyMultiplier The number to multiply the difficultyLevel by when calculating accuracy shoottarget onHit A JSON object that specifies what to do when the projectile hits an entity commands An array of strings specifying events to call on hit. Used for things like impact damage, status effects, etc. event The event to call when this projectile hits an entity douse_fire {} If specified, this projectile will put out fires teleport_owner {} If specified, this projectile will teleport the owner to its location on hit remove_on_hit spawnChance A JSON object that will spawn an entity spawnMob "" Name of mob to spawn spawnDefinition "" The minecraft:identifier of the mob to spawn firstSpawnChance Used in formula for determining spawn chances secondSpawnChance Used in formula for determining spawn chances firstSpawnCount Used in formula for determining spawn chances secondSpawnCount Used in formula for determining spawn chances spawnBaby Spawn the mob as a baby. potionEffect A JSON object that defines a potion effect to apply potionEffect The effect index for potion to apply splashRange Range of splash effect in blocks splashPotion If True, triggers splash effect, otherwise the potion effect only applies to the hit mob durationeasy The amount of time in seconds that the potion effect is applied for with the game set to easy durationnormal The amount of time in seconds that the potion effect is applied for with the game set to normal durationhard The amount of time in seconds that the potion effect is applied for with the game set to hard impactDamage A JSON object that specifies damage and effects upon impact filters Filter used to specify entities that can’t be damaged by the impact catchFire If true, the entity will be set on fire onFireTime The amount of time, in seconds, that the entity will be on fire for grant_xp JSON Object used to grant experience with a projectile minXP The minimum amount of experience to give maxXP The maximum amount of experience to give
- Formula for spawn chance
if(nextInt(firstSpawnChance) === 0) { spawnCount == nextInt(secondSpawnChance) === 0 ? secondSpawnCount : firstSpawnCount; }
- Assuming firstSpawnChance == 100, secondSpawnChance == 200, secondSpawnCount == 4, firstSpawnCount == 1 the following is true:
- There is a 1 in 100 chance to spawn a mob, when we do, there is an additional 1 in 200 chance to spawn 4 mobs. If that 1 in 200 chance fails, we will only spawn 1.
- Sample usage
"minecraft:projectile": { "onHit": { "definition_event": { "affectProjectile": true, "eventTrigger": { "event": "minecraft:explode", "target": "self" } }, "potion_effect": { "effect": 36, "durationeasy": 0, "durationnormal": 200, "durationhard": 800 } }, "power": 1.2, "gravity": 0.00, "uncertaintyBase": 7.5, "uncertaintyMultiplier": 1, "shootSound": "bow", "hitSound": "bow.hit", "anchor": 1, "offset": [ 0, -0.1, 0 ], "inertia": 1.0, "liquid_inertia": 1.0, "shoottarget": false }
- Entities used in
- Arrow, Large Fireball, Small Fireball, FishingHook, Thrown Egg, Thrown Ender Pearl, Thrown Potion, Wither Skull, Wither Skull Dangerous, XP Potion
minecraft:angry[επεξεργασία | επεξεργασία κώδικα]
- Description
- Component that manages a mob’s anger state. Anger will reset anger time upon a successful attack or when hurt by target.
- Parameters
Parameters Default Description duration 25 The time, in seconds, that the entity will remain angry after damaging the target. If negative, the entity will remain angry until it loses its target broadcastAnger false If true, other untamed entities of the same type within broadcastRange blocks, will also become angry when this entity becomes angry broadcastRange 20 The distance around this entity, in blocks, to broadcast this entity’s anger to other entities calm_event Triggers the specified event after duration seconds since becoming angry
- Sample usage
"minecraft:angry": { "duration": 25, "broadcastAnger": true, "broadcastRange": 20, "calm_event": { "event": "minecraft:on_calm", "target": "self" } }
- Entities used in
- Cave Spider, Enderman, Silverfish, Spider, Wolf
minecraft:healable[επεξεργασία | επεξεργασία κώδικα]
- Description
- Manages interactions between mob and player for the purpose of healing the mob.
- Limitations
- Only usable on entities that have health
- Parameters
Parameters Default Description items Array of items that can be given to heal this entity item "" Name of item that can be used heal_amount 1.0 The amount that this item will heal when used
- Sample usage
"minecraft:healable": { "items": [ { "item": "porkchop", "heal_amount": 5.0 }, { "item": "cooked_rabbit", "heal_amount": -2.0 } ] }
- Entities used in
- Wolf
minecraft:sittable[επεξεργασία | επεξεργασία κώδικα]
- Description
- Handles interaction with the player to toggle the sit state on a mob.
- Limitations
- Currently sitting animation only works with Ocelot and Wolf mobs.
- Parameters
Parameters Default Description sit_event Triggers the specified event when this entity sits stand_event Triggers the specified event when this entity stands up from sitting
- Sample usage
"minecraft:sittable": { "sit_event": { "event": "minecraft:on_sit", "target": "self" }, "stand_event": { "event": "minecraft:on_stand", "target": "self" } }
- Entities used in
- Ocelot, Wolf
minecraft:rideable[επεξεργασία | επεξεργασία κώδικα]
- Description
- Determines whether or not an entity can mount the owning entity as a rider. It is possible to specify different seat positions depending on the number of entities riding this entity.
- Parameters
Parameters Default Description seat_count 1 The number of entities that can ride on this entity at a time interact_text "" The text that will display when an interaction is possible family_types An array of minecraft:identifiers that specify what types of entities can ride this entity seats An array of seat positions position [0.0, 0.5, 0.0] The position of the seat relative to this entity’s position. Values are given in blocks in each direction: x, y, then z min_rider_count The minimum amount of riders for this seat to be used max_rider_count The maximum amount of riders for this seat to be used rotate_rider_by An offset to rotate the riders by lock_rider_rotation The amount, in degrees that a rider can rotate
- Sample usage
"minecraft:rideable": { "seat_count": 2, "interact_text": "action.interact.ride.boat", "seats": [ { "position": [0.0, 0.0, 0.0], "min_rider_count": 0, "max_rider_count": 1, "rotate_rider_by": -90, "lock_rider_rotation": 90 }, { "position": [0.2, 0.0, 0.0], "min_rider_count": 2, "max_rider_count": 2, "rotate_rider_by": -90, "lock_rider_rotation": 90 }, { "position": [ -0.6, 0.0, 0.0], "min_rider_count": 2, "max_rider_count": 2, "lock_rider_rotation": 90 } ] }
- Entities used in
- Boat, Cave Spider, Minecart, Pig, Spider, Zombie
minecraft:scale_by_age[επεξεργασία | επεξεργασία κώδικα]
- Description
- Interpolates an entity’s scale based on age.
- Limitations
- Requires minecraft:ageable component to have an effect
- Parameters
Parameters Default Description start_scale 1.0 The initial scale of the entity end_scale 1.0 The end scale of the entity
- Sample usage
"minecraft:scale_by_age": { "start_scale": 1.0, "end_scale": 1.5 }
- Entities used in
- Horse, Mule, Donkey
minecraft:rail_movement[επεξεργασία | επεξεργασία κώδικα]
- Description
- Restricts an entity's movement to rails.
- Parameters
Parameters Default Description max_speed 0.4 The maximum speed of this entity while riding a rail
- Sample usage
"minecraft:rail_movement": { "max_speed": 20.0f }
- Entities used in
- Minecart, Minecart Chest, Minecart Hopper, Minecart TNT
minecraft:rail_sensor[επεξεργασία | επεξεργασία κώδικα]
- Description
- Responds with events when sliding over a rail sensor.
- Parameters
Parameters Default Description on_activate Triggers the specified event when the rail sensor is activated on_deactivate Triggers the specified event when the rail sensor is deactivated eject_on_activate false If true, when this entity passes over an activated rail it will eject any riders eject_on_deactivate false If true, when this entity passes over a deactivated rail it will eject any riders
- Sample usage
"minecraft:rail_sensor": { "on_activate": { "event": "minecraft:hopper_activate", "target": "self" }, "on_deactivate": { "event": "minecraft:hopper_deactivate", "target": "self" } }
- Entities used in
- Minecart, Minecart Chest, Minecart Hopper, Minecart TNT
minecraft:item_hopper[επεξεργασία | επεξεργασία κώδικα]
- Description
- This component makes an entity an item hopper
- Sample usage
"minecraft:item_hopper": { }
- Entities used in
- Minecart Hopper
minecraft:inventory[επεξεργασία | επεξεργασία κώδικα]
- Description
- This component allows an entity to have an inventory container, such as a horse or chest.
- Limitations
- Can only specify specific container types
- Parameters
Parameters Default Description container_type "" The type of container to create inventory_size How many slots this container has for items can_be_siphoned_from If true, this container can have items taken from it by a hopper
Container types horse minecart_chest minecart_hopper inventory container hopper
- Sample usage
"minecraft:inventory": { "container_type": "minecart_hopper", "inventory_size": 5, "can_be_siphoned_from": true }
- Entities used in
- Minecart Chest, Minecart Hopper, Villager, Horse, Mule, Donkey
minecraft:explode[επεξεργασία | επεξεργασία κώδικα]
- Description
- This component handles causing an entity to explode
- Parameters
Parameters Default Description fuseLength -1.0 The time of the fuse, in seconds. When less than zero, the explosion will be triggered fuseLit false Whether the fuse is initially triggered when the component is created power 3.0 The radius of the explosion in blocks. This also determines the damage done. causesFire false Whether the explosion will cause nearby blocks to catch on fire breaks_blocks true If true, the explosion will break the blocks in the radius determined by power maxResistance MAX FLOAT The explosion will break any block that has less resistance than this number
- Sample usage
"minecraft:explode": { "fuseLength": 1, "fuseLit": true, "power": 3, "causesFire": false, "breaks_blocks": false }
- Entities used in
- Creeper, Fireball Large, Minecart TNT, TNT
minecraft:item_controllable[επεξεργασία | επεξεργασία κώδικα]
- Description
- Sets what items can be used to control this entity
- Limitations
- Requires [ minecraft:behavior.controlled_by_player] to have an effect.
- Parameters
Parameters Default Description control_items 0.0f A string or string array of items that can be used to control this entity
- Sample usage
"minecraft:behavior.controlled_by_player": { "priority": 0 }
- Entities used in
- Pig
Behaviors[επεξεργασία | επεξεργασία κώδικα]
Behaviors act like normal components, except that all behaviors can take a "priority" parameter which is used for the in game Artificial Intelligence system. Higher priority behaviors can stop lower priority behaviors from running if they both need to access the same system (like movement for example).
All behaviors[επεξεργασία | επεξεργασία κώδικα]
- Parameters
Parameters Default Description priority Determines how often a behavior is run. A smaller number means higher priority and it can be negative. A larger number means that it has less chance of being run
minecraft:behavior.beg[επεξεργασία | επεξεργασία κώδικα]
- Description
- Manages a mob’s interested state when the player is holding an item worth begging for.
- Parameters
Parameters Default Description look_distance 8 The distance, in blocks, to search for a player to beg look_time [2, 4] A random amount of time to look at the player while begging items [] An array of item types to be interested in begging for
- Sample usage
"minecraft:behavior.beg": { "look_distance": 8, "look_time": [2, 4], "items": ["bone"] }
- Entities used in
- Wolf
minecraft:behavior.hurt_by_target[επεξεργασία | επεξεργασία κώδικα]
- Description
- If this entity is hurt by an entity, it will set that entity as its target.
- Sample usage
"minecraft:behavior.hurt_by_target": { "priority": 1 }
- Entities used in
- Cave Spider, Creeper, Enderman, Ghast, Iron Golem, Silverfish, Skeleton, Spider, Stray, Witch, Wither, Wolf, Zombie, Zombie Husk, Zombie Pigman, Zombie Villager
minecraft:behavior.nearest_attackable_target[επεξεργασία | επεξεργασία κώδικα]
- Description
- This component actively searches nearby entities to find a new target given the specified filters.
- Parameters
Parameters Default Description entity_types An array of entity descriptions that can be targeted max_dist 0.0 The maximum distance, in blocks, to search for a target filters List of filters for what entities can be targeted. must_see false If true, this entity can only target entities it had direct line of sight to must_reach false If true, this entity must be able to path to the entity to target it attack_interval_min 0 The chance that this component will check for a target. The higher the value, the lower the chance to check. reselect_targets false If true, the mob will search for a new target, even if it already has one, depending on priority
- Sample usage
"minecraft:behavior.nearest_attackable_target": { "priority": 1, "entity_types": [ { "filters": { "other_with_families": "player" }, "max_dist": 16 }, { "filters": { "other_with_families": "villager" }, "max_dist": 8 }, "must_see": false, "must_reach": false ], "attack_interval_min": 10 }
- Entities used in
- Blaze, Cave Spider, Creeper, Ghast, Guardian, Guardian Elder, Iron Golem, Magma Cube, Ocelot, Silverfish, Skeleton, Slime, Snow Golem, Spider, Stray, Witch, Wither, Wolf, Zombie, Zombie Husk, Zombie Villager
minecraft:behavior.avoid_mob_type[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add to an entity in order to have it flee from certain mobs.
- Parameters
Parameters Default Description entity_types An array of mob descriptions that can be avoided filters List of filters for what entities can be targeted. max_dist 0.0 The maximum distance, in blocks, to search for a target walk_speed_multiplier 1.0 A multiplier to normal movement speed for how fast this entity will walk away sprint_speed_multiplier 1.0 A multiplier for how fast the entity will run away
- Sample usage
"minecraft:behavior.avoid_mob_type": { "priority": 3, "entity_types": [ { "entity_filter": ["ocelot"], "max_dist": 6, "walk_speed_multiplier": 1, "sprint_speed_multiplier": 1.2 } ] }
- Entities used in
- Creeper, Ocelot, Rabbits
minecraft:behavior.break_door[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add this behavior to an entity to allow it to break through doors when pathing towards a target.
- Sample usage
"minecraft:behavior.break_door": { "priority": 1 }
- Entities used in
- Zombie, Zombie Husk, Zombie Pigman, Zombie Villager
minecraft:behavior.breed[επεξεργασία | επεξεργασία κώδικα]
- Description
- Allows a mob to breed.
- Limitations
- Requires minecraft:breedable to have an effect.
- Parameters
Parameters Default Description speed_multiplier 0.0f A multiplier on how fast to move towards the breed target.
- Sample usage
"minecraft:behavior.breed": { "priority": 4, "speed_multiplier": 1.6 }
- Entities used in
- Chicken, Cow, Mooshroom, Ocelot, Pig, Rabbits, Sheep, Wolf
minecraft:behavior.controlled_by_player[επεξεργασία | επεξεργασία κώδικα]
- Description
- Causes this entity to follow the movement of the rider who holds a control item
- Limitations
- Requires minecraft:rideable to have an effect.
- Sample usage
"minecraft:item_controllable": { "control_items": "carrotOnAStick" }
- Entities used in
- Pig
minecraft:behavior.defend_village_target[επεξεργασία | επεξεργασία κώδικα]
- Description
- Entities that hurt villagers are set as this entity’s target.
- Sample usage
"minecraft:behavior.defend_village_target": { "priority": 1 }
- Entities used in
- Iron Golem
minecraft:behavior.eat_block[επεξεργασία | επεξεργασία κώδικα]
- Description
- This behavior causes this entity to eat grass or tall grass and trigger "on_eat".
- Parameters
Parameters Default Description on_eat Trigger that calls the specified event when a mob eats grass or tall grass
- Sample usage
"minecraft:behavior.eat_block": { "priority": 6, "on_eat": { "event": "minecraft:on_eat_block", "target": "self" } }
- Entities used in
- Sheep
minecraft:behavior.restrict_sun[επεξεργασία | επεξεργασία κώδικα]
- Description
- This behavior causes entities to try and avoid the sun
- Sample usage
"minecraft:behavior.restrict_sun": { "priority": 1 }
- Entities used in
- Skeleton, Stray
minecraft:behavior.move_through_village[επεξεργασία | επεξεργασία κώδικα]
- Description
- With this behavior, this entity will move towards the closest village and move through it.
- Parameters
Parameters Default Description speed_multiplier 1.0 A multiplier on movement speed when this behavior is active only_at_night If true, this entity will only run this behavior when it is night time
- Sample usage
"minecraft:behavior.move_through_village": { "priority": 3, "speed_multiplier": 0.6, "only_at_night": true }
- Entities used in
- Iron Golem
minecraft:behavior.stay_while_sitting[επεξεργασία | επεξεργασία κώδικα]
- Description
- Blocks other behaviors from executing while this entity is sitting
- Limitations
- Requires minecraft:sittable to have an effect.
- Sample usage
"minecraft:behavior.stay_while_sitting": { "priority": 3 }
- Entities used in
- Ocelot, Wolf
minecraft:behavior.find_mount[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add to an entity to have it attempt to ride an entity within a certain distance.
- Parameters
Parameters Default Description within_radius 0.0 How close a rideable entity must be before this entity attempts to approach and ride it
- Sample usage
"minecraft:behavior.find_mount": { "priority": 1, "within_radius": 16 }
- Entities used in
- Zombie, Zombie Husk, Zombie Villager
minecraft:behavior.flee_sun[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add to an entity to have it flee from sunlight if it is on fire
- Parameters
Parameters Default Description speed_multiplier 1.0 A multiplier applied to movement speed when fleeing
- Sample usage
"minecraft:behavior.flee_sun": { "priority": 2, "speed_multiplier": 1 }
- Entities used in
- Skeleton, Stray, Wither
minecraft:behavior.follow_owner[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add this behavior to an entity to have it follow its owner around if it has been tamed.
- Limitations
- Requires minecraft:tameable to have an effect
- Parameters
Parameters Default Description speed_multiplier 1.0 A multiplier on movement speed when this behavior is active start_distance 10.0 The distance, in blocks, where this entity will start walking towards the owner stop_distance 2.0 Once following, the distance in blocks from the owner that this entity will stop following
- Sample usage
"minecraft:behavior.follow_owner": { "priority": 6, "speed_multiplier": 1.0, "start_distance": 10, "stop_distance": 2 }
- Entities used in
- Ocelot, Wolf
minecraft:behavior.follow_parent[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add this behavior to an entity to have it follow its parent around.
- Limitations
- Requires this entity to have been spawned from another entity, through breeding for example
- Parameters
Parameters Default Description speed_multiplier 1.0 A multiplier on movement speed when this behavior is active
- Sample usage
"minecraft:behavior.follow_parent": { "priority": 6, "speed_multiplier": 1.1 }
- Entities used in
- Chicken, Cow, Mooshroom, Pig, Rabbits, Sheep
minecraft:behavior.guardian_attack[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add this behavior to an entity to have it attack targets using the guardian’s laser attack.
- Sample usage
"minecraft:behavior.guardian_attack": { "priority": 4 }
- Entities used in
- Guardian, Guardian Elder
minecraft:behavior.harvest_farm_block[επεξεργασία | επεξεργασία κώδικα]
- Description
- Give this behavior to an entity in order to have it harvest and plant wheat, potatoes, carrots, and beetroots.
- Limitations
- Currently this only works for Villagers
- Parameters
Parameters Default Description speed_multiplier 1.0 A multiplier on movement speed when this behavior is active
- Sample usage
"minecraft:behavior.harvest_farm_block": { "priority": 5, "speed_multiplier": 0.32 }
- Entities used in
- Villager
minecraft:behavior.leap_at_target[επεξεργασία | επεξεργασία κώδικα]
- Description
- Give this behavior to an entity to enable it to leap at its target
- Limitations
- Parameters
Parameters Default Description yd 0.0 How high the entity will jump, in blocks must_be_on_ground true If true, the entity must be on the ground to leap at its target
- Sample usage
"minecraft:behavior.leap_at_target": { "priority": 4, "yd": 0.4, "must_be_on_ground": false }
- Entities used in
- Cave Spider, Ocelot, Spider, Wolf
minecraft:behavior.look_at_player[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add this behavior to an entity to have it look at players.
- Parameters
Parameters Default Description look_distance The distance, in blocks, within which this entity will look at the player probability The chance that this behavior will activate, from 0 to 1 look_time [2,2] A minimum, maximum range for the time in seconds to look at the player
- Sample usage
"minecraft:behavior.look_at_player": { "priority": 7, "look_distance": 6.0, "probability": 0.02, "look_time": [2.0f, 4.0f] }
- Entities used in
- Cave Spider, Chicken, Cow, Creeper, Enderman, Guardian, Guardian Elder, Iron Golem, Mooshroom, Ocelot, Pig, Rabbits, Sheep, Skeleton, Snow Golem, Spider, Stray, Villager, Witch, Wither, Zombie, Zombie Husk, Zombie Pigman, Zombie Villager
minecraft:behavior.make_love[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add this behavior to a villager to make villager babies. The reason this is separate from breedable is because this component handles upkeep for the village and some other special logic.
- Sample usage
"minecraft:behavior.make_love": { "priority": 6 }
- Entities used in
- Villager
minecraft:behavior.melee_attack[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add this behavior to an entity to let it make melee attacks against its target
- Limitations
- This requires [ minecraft:attack] component.
- Parameters
Parameters Default Description speed_multiplier 1.0 A multiplier on movement when this behavior is active track_target false If true, this entity must see its target in order to attack it random_stop_interval 0 A random chance to stop attacking. The higher this value, the less likely it is to take effect reach_multiplier 2.0 A multiplier on entity reach to tweak melee attack range
- Sample usage
"minecraft:behavior.melee_attack": { "priority": 3, "speed_multiplier": 1.0, "track_target": false, "random_stop_interval": 100 }
- Entities used in
- Blaze, Cave Spider, Creeper, Enderman, Iron Golem, Silverfish, Spider, Wither, Wolf, Zombie, Zombie Husk, Zombie Pigman, Zombie Villager
minecraft:behavior.mount_pathing[επεξεργασία | επεξεργασία κώδικα]
- Description
- The owning mob of this goal will set its target to the target of its rider.
- Limitations
- Requires minecraft:rideable to have any effect
- Parameters
Parameters Default Description speed_multiplier 1.0 A multiplier on movement when this behavior is active target_dist 0.0 When tracking a target, the distance at which we are close enough track_target false Whether the entity needs to see the target in order to path to it
- Sample usage
"minecraft:behavior.mount_pathing": { "priority": 1, "speed_multiplier": 1.25, "target_dist": 0.0, "track_target": true }
- Entities used in
- Cave Spider, Chicken, Cow, Mooshroom, Ocelot, Pig, Sheep, Spider, Wolf, Zombie Pigman
minecraft:behavior.move_indoors[επεξεργασία | επεξεργασία κώδικα]
- Description
- Adding this behavior to an entity will make it move indoors if it is night or raining outside and they do not have a roof over their heads.
- Limitations
- Currently this only works for villagers
- Parameters
Parameters Default Description speed_multiplier 1.0 A multiplier on movement when this behavior is active
- Sample usage
"minecraft:behavior.move_indoors": { "priority": 2, "speed_multiplier": 0.8 }
- Entities used in
- Villager
minecraft:behavior.ocelot_sit_on_block[επεξεργασία | επεξεργασία κώδικα]
- Description
- Adding to an entity makes it path above a lit furnace or bed and sit down if it has a sit component.
- Limitations
- Requires minecraft:sittable to have an effect. Also requires that the entity be tamed
- Parameters
Parameters Default Description speed_multiplier 1.0 A multiplier on movement when this behavior is active
- Sample usage
"minecraft:behavior.ocelot_sit_on_block": { "priority": 6, "speed_multiplier": 1.0 }
- Entities used in
- Ocelot
minecraft:behavior.offer_flower[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add this behavior to have an entity offer a flower to an entity.
- Limitations
- Currently this only works for Iron Golems.
- Sample usage
"minecraft:behavior.offer_flower": { "priority": 3 }
- Entities used in
- Iron Golem
minecraft:behavior.swell[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add this behavior to an entity to have it swell above its normal size.
- Limitations
- Currently this only works for the Creeper.
- Sample usage
"minecraft:behavior.swell": { "priority": 2 }
- Entities used in
- Creeper
minecraft:behavior.take_flower[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add this behavior to have an entity accept a flower from another entity.
- Limitations
- Currently this only works for Villagers.
- Sample usage
"minecraft:behavior.take_flower": { "priority": 7 }
- Entities used in
- Villager
minecraft:behavior.tempt[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add this behavior to an entity to have it follow the player when an item is in hand.
- Parameters
Parameters Default Description speed_multiplier 1.0 A multiplier on movement when this behavior is active items String array of item names that this entity can be tempted by can_get_scared false Whether this entity should run away if the player approaches too quickly within_radius 0.0 The distance, in blocks, within which this entity will be tempted by a player with one of the specified items
- Sample usage
"minecraft:behavior.tempt": { "priority": 5, "speed_multiplier": 1.2, "items": [ "potato", "carrot", "beetroot", "carrotOnAStick" ] }
- Entities used in
- Chicken, Cow, Mooshroom, Ocelot, Pig, Rabbit, Sheep
minecraft:behavior.move_towards_restriction[επεξεργασία | επεξεργασία κώδικα]
- Description
- With this goal, the entity will move towards its restriction area. This is used for things like keeping mobs close to their leash point
- Parameters
Parameters Default Description speed_multiplier 1.0 A multiplier on movement when this behavior is active
- Sample usage
"minecraft:behavior.move_towards_restriction": { "priority": 5, "speed_multiplier": 1.0 }
- Entities used in
- chicken, cow, guardian, guardian_elder, irongolem, mushroom_cow, ocelet, pig, rabbit, sheep, snowgolem, squid, villager, wolf, zombie
minecraft:behavior.ocelotattack[επεξεργασία | επεξεργασία κώδικα]
- Description
- With this goal, the entity will move toward, sneaking, and hurt a target.
- Parameters
Parameters Default Description walk_speed_multiplier 1.0 Move speed multiplier when target is farther than 15 blocks away sprint_speed_multiplier 1.0 Move speed when target is less than 4 blocks away sneak_speed_multiplier 1.0 Move speed when target is less than 15 and more than 4 blocks away
- Sample usage
"minecraft:behavior.ocelotattack": { "priority": 4, "walk_speed_multiplier": 0.8, "sprint_speed_multiplier": 1.33, "sneak_speed_multiplier": 0.6 }
- Entities used in
- Ocelot
minecraft:behavior.play[επεξεργασία | επεξεργασία κώδικα]
- Description
- With this goal, a baby villager once a while will play with another baby villager nearby
- Limitations
- Only works with Villagers
- Parameters
Parameters Default Description speed_multiplier 1.0 A multiplier on movement when this behavior is active
- Sample usage
"minecraft:behavior.play": { "priority": 8, "speed_multiplier": 0.32 }
- Entities used in
- Villager
minecraft:behavior.open_door[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add to an entity to have it open a door and maybe close it again after.
- Parameters
Parameters Default Description close_door_after false Whether the entity will close the door after it has been opened
- Sample usage
"minecraft:behavior.open_door": { "priority": 4, "close_door_after": true }
- Entities used in
- Villager
minecraft:behavior.owner_hurt_by_target[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add this behavior to an entity to have it target an entity that attacks its owner.
- Limitations
- Requires mob to be tame to have an effect. This can be done through minecraft:tameable or being born to parents that are tamed.
- Sample usage
"minecraft:behavior.owner_hurt_by_target": { "priority": 1 }
- Entities used in
- Wolf
minecraft:behavior.panic[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add this behavior to an entity to have it run randomly.
- Parameters
Parameters Default Description speed_multiplier 1.0 A multiplier on movement speed when this behavior is active force false If false, this behavior will only run if the entity is attacked or on fire. If true, this goal will always attempt to run, forcing the mob to be in a constant panic state
- Sample usage
"minecraft:behavior.panic": { "priority": 1, "speed_multiplier": 1.25 }
- Entities used in
- Chicken, Cow, Mooshroom, Pig, Rabbits, Sheep
minecraft:behavior.owner_hurt_target[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add this behavior to an entity to have it target the entity last attacked by its owner. It will not attack creepers.
- Limitations
- Requires mob to be tame to have an effect. This can be done through minecraft:tameable or being born to parents that are tamed.
- Sample usage
"minecraft:behavior.owner_hurt_target": { "priority": 1 }
- Entities used in
- Wolf
minecraft:behavior.random_stroll[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add this behavior to an entity to have it wander randomly.
- Parameters
Parameters Default Description speed_multiplier 1.0 A multiplier on movement speed when this behavior is active xz_dist 10 The maximum number of blocks horizontally where a stroll location may be chosen y_dist 7 The maximum number of blocks vertically where a stroll location may be chosen
- Sample usage
"minecraft:behavior.random_stroll": { "priority": 6, "speed_multiplier": 0.6, "xz_dist": 2, "y_dist": 1 }
- Entities used in
- Cave Spider, Chicken, Cow, Creeper, Enderman, Guardian, Elder Guardian, Iron Golem, Mooshroom, Ocelot, Pig, Rabbits, Sheep, Skeleton, Snow Golem, Spider, Stray, Villager, Witch, Wither, Wolf, Zombie, Zombie Husk, Zombie Pigman, Zombie, Villager
minecraft:behavior.ranged_attack[επεξεργασία | επεξεργασία κώδικα]
- Description
- Add this behavior to an entity and it can make ranged attacks against its target.
- Parameters
Parameters Default Description speed_multiplier 1.0 A multiplier on movement when this behavior is active attack_interval_min 0 The minimum time in seconds between attacks attack_interval_max 0 The maximum time in seconds between attacks attack_radius 0.0 The maximum distance from the target that this entity can shoot from charge_charged_trigger 0 The time in seconds before a charge is charged charge_shoot_trigger 0 The time in seconds it takes to shoot burst_shots The number of shots to take when burst shotting burst_interval The time in seconds between bursts
- Sample usage
"minecraft:behavior.ranged_attack": { "attack_interval_min": 20, "attack_interval_max": 60, "attack_radius": 15 }
- Entities used in
- Ghast, Skeleton, Snow Golem, Stray, Witch, Blaze
minecraft:behavior.raid_garden[επεξεργασία | επεξεργασία κώδικα]
- Description
- With this goal, a mob will move toward target blocks and eat them.
- Limitations
- This component will only eat farmland blocks
- Parameters
Parameters Default Description speed_multiplier 1.0 A multiplier on movement speed when this behavior is active search_range 0.0 The radius in blocks to search for target goal_radius 0.5 The entity is considered to have reached the target once the distance between them is less than this value max_to_eat 6 Number of bites per eating session eat_delay 2 Time interval between each bite in one eating session full_delay 100 Time interval between each eating session blocks "" String or string array of the name of blocks that this entity can eat
- Sample usage
"minecraft:behavior.raid_garden": { "priority": 5, "blocks": [ "minecraft:carrot_block" ], "search_range": 16, "goal_radius": 0.8 }
- Entities used in
- Rabbit
minecraft:behavior.random_look_around[επεξεργασία | επεξεργασία κώδικα]
- Description
- With this goal, a mob will randomly look around
- Parameters
Parameters Default Description look_time [1, 2] A range, in seconds, of how long to look around for
- Sample usage
"minecraft:behavior.random_look_around": { "priority": 7, "look_time": [1, 2] }
- Entities used in
- All Mobs
minecraft:behavior.silverfish_wake_up_friends[επεξεργασία | επεξεργασία κώδικα]
- Description
- With this goal, the Silverfish mob will spawn silverfish from nearby monster egg blocks when they are hurt.
- Limitations
- This only works with silverfish
- Sample usage
"minecraft:behavior.silverfish_wake_up_friends": { "priority": 1 }
- Entities used in
- Silverfish
minecraft:behavior.silverfish_merge_with_stone[επεξεργασία | επεξεργασία κώδικα]
- Description
- With this goal, the Silverfish mob will turn into a monster stone egg.
- Limitations
- This only works with silverfish
- Sample usage
"minecraft:behavior.silverfish_merge_with_stone": { "priority": 1 }
- Entities used in
- Silverfish
Events[επεξεργασία | επεξεργασία κώδικα]
Events get called by various triggers, either set up in components, or called directly from built in game events.
Built in events[επεξεργασία | επεξεργασία κώδικα]
- Parameters
Event name Description minecraft:entity_born An event that is triggered when an entity is born from breeding minecraft:entity_spawned An event that is triggered when an entity is spawned minecraft:entity_transformed An event that is triggered when an entity is created from being transformed into minecraft:from_player An event that is triggered when an iron golem is created with a pumpkin block minecraft:from_explosion An event that is triggered when a TNT explodes more TNT blocks
- Parameters
Name Description sequence A list of JSON objects to run one after another randomize A list of JSON objects to choose randomly between. Choices can be individually weighted add Used to add component groups component_groups An array of component groups to add remove Used to remove component groups component_groups An array of component groups to remove
- Sample usage
"minecraft:entity_born": { "sequence": [ { "add": { "component_groups": [ "baby" ] } }, { "randomize": [ { "weight": 5, "add": { "component_groups": [ "farmer", "behavior_peasant" ] } }, { "weight": 5, "add": {"component_groups": [ "fisherman", "behavior_peasant"]} } ] } ] }
- Entities used in
- Most Entities
Versions | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Development | |||||||||||||||||
Technical | |||||||||||||||||
Exclusive features |
|