Mobs
Mobs are beings, or entities, in a Minecraft world. They are the players, the monsters, the villagers, etc… Mobs can be spanwed, killed, teleported, enchanted, and given items.
Types
A mob type is identifed by a unique number.
Various helpers like ||mobs:animal||
or
||mobs:monster||
are there to help you craft the mob you want.
Selectors
Selectors allow you to describe and select a group of mobs at once. For example, you can decide to
select all players
or select all chickens
. Selection can be made by mob type, distance
and other criterias. Various helpers like ||mobs:add rule||
help with crafting advanced selectors.
Reference
mobs.spawn(PIG, pos(0, 0, 0));
mobs.onMobKilled(CHICKEN, () => {
});
mobs.kill(
mobs.target(ALL_ENTITIES)
);
PIG;
mobs.monster(MonsterMob.Creeper);
LIGHTNING_BOLT;
Selectors
mobs.target(LOCAL_PLAYER);
mobs.near(
mobs.target(LOCAL_PLAYER),
pos(0, 0, 0),
5
);
mobs.entitiesByType(CHICKEN);
mobs.playerByName("");
mobs.playersInGameMode(SURVIVAL);
mobs.target(ALL_ENTITIES).atCoordinate(pos(0, 0, 0));
mobs.target(ALL_ENTITIES).withinRadius(0);
mobs.target(ALL_ENTITIES).outsideRadius(0);
mobs.target(ALL_ENTITIES).addRule("type", "chicken");
mobs.target(ALL_ENTITIES).toString();
Advanced
mobs.teleportToPosition(
mobs.target(LOCAL_PLAYER),
pos(0, 0, 0)
);
mobs.teleportToPlayer(
mobs.target(LOCAL_PLAYER),
mobs.target(LOCAL_PLAYER)
);
mobs.enchant(mobs.target(LOCAL_PLAYER), "infinity", 1);
mobs.give(
mobs.target(LOCAL_PLAYER),
GRASS,
1
);
mobs.execute(
mobs.target(LOCAL_PLAYER),
pos(0, 0, 0),
""
);
mobs.executeDetect(
GRASS,
pos(0, 0, 0),
"say Hi!"
);
mobs.applyEffect(Effect.Speed, mobs.target(NEAREST_PLAYER), 10, 1)
mobs.clearEffect(mobs.target(NEAREST_PLAYER))