EntityTameableComponent Class
Caution
This class is still in pre-release. Its signature may change or it may be removed in future releases.
Extends
Defines the rules for an entity to be tamed by the player.
Properties
getTameItems
read-only getTameItems: ItemStack[];
Returns a set of items that can be used to tame this entity.
Type: ItemStack[]
Warning
This property can throw errors when used.
isTamed
read-only isTamed: boolean;
Returns true if the entity is tamed by player.
Type: boolean
Warning
This property can throw errors when used.
probability
read-only probability: number;
The chance of taming the entity with each item use between 0.0 and 1.0, where 1.0 is 100%
Type: number
Warning
This property can throw errors when used.
tamedToPlayer
read-only tamedToPlayer?: Player;
Returns the player that has tamed the entity, or 'undefined' if entity is not tamed.
Type: Player
Warning
This property can throw errors when used.
tamedToPlayerId
read-only tamedToPlayerId?: string;
Returns the id of player that has tamed the entity, or 'undefined' if entity is not tamed.
Type: string
Warning
This property can throw errors when used.
Methods
tame
tame(player: Player): boolean
Set this entity as tamed by the given player.
Parameters
player: Player
The player that this entity should be tamed by.
Returns boolean - Returns true if the entity was tamed.
Important
This function can't be called in read-only mode.
Warning
This function can throw errors.
Constants
componentId
static read-only componentId = "minecraft:tameable";
Type: string
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for