Readonly
Beta
dimensionDimension that the entity is currently within.
Readonly
idUnique identifier of the entity. This identifier is intended to be consistent across loads of a world instance. No meaning should be inferred from the value and structure of this unique identifier - do not parse or interpret it.
Beta
isWhether the entity is sneaking - that is, moving more slowly and more quietly.
Readonly
Beta
locationCurrent location of the entity.
Beta
nameGiven name of the entity.
Readonly
Beta
scoreboardReturns a scoreboard identity that represents this entity.
Readonly
Beta
targetRetrieves or sets an entity that is used as the target of AI-related behaviors, like attacking.
Readonly
typeUnique identifier of the type of the entity - for example, 'minecraft:skeleton'.
Beta
Type of effect to add to the entity.
Amount of time, in ticks, for the effect to apply.
Optional
amplifier: numberOptional amplification of the effect to apply.
Optional
showParticles: booleanconst villagerId = "minecraft:villager_v2<minecraft:ageable_grow_up>";
const villagerLoc: mc.Vector3 = { x: 1, y: 2, z: 1 };
const villager = test.spawn(villagerId, villagerLoc);
const duration = 20;
villager.addEffect(MinecraftEffectTypes.poison, duration, 1);
const fox = overworld.spawnEntity("minecraft:fox", {
x: targetLocation.x + 1,
y: targetLocation.y + 2,
z: targetLocation.z + 3,
});
fox.addEffect(mc.MinecraftEffectTypes.speed, 10, 20);
log("Created a fox.");
const wolf = overworld.spawnEntity("minecraft:wolf", {
x: targetLocation.x + 4,
y: targetLocation.y + 2,
z: targetLocation.z + 3,
});
wolf.addEffect(mc.MinecraftEffectTypes.slowness, 10, 20);
wolf.isSneaking = true;
log("Created a sneaking wolf.", 1);
Beta
Amount of damage to apply.
Optional
source: EntityDamageSourceAdditional option about the source of damage, which may add additional effects or spur additional behaviors on this entity.
Beta
Optional
useEffects: booleanWhether to show any visual effects connected to the extinguishing.
Beta
The identifier of the component (e.g., 'minecraft:rideable') to retrieve. If no namespace prefix is specified, 'minecraft:' is assumed. If the component is not present on the entity, undefined is returned.
Beta
Beta
Effect object for the specified effect, or undefined if the effect is not present.
Optional
options: PlayAnimationOptionsCommand to run. Note that command strings should not start with slash.
For commands that return data, returns a JSON structure with command response values.
Beta
Length of time to set the entity on fire.
Optional
useEffects: booleanBeta
Name of the entity type event to trigger. If a namespace is not specified, minecraft: is assumed.
Represents the state of an entity (a mob, the player, or other moving objects like minecarts) in the world.