-
Notifications
You must be signed in to change notification settings - Fork 0
Spawning and NBT
Everything you can configure on a PlayerMob from commands, command blocks, or
datapacks — no Java required. The entity id is playermob:player_mob.
# A fully-random PlayerMob
/summon playermob:player_mob ~ ~ ~
# A passive-to-players, shy-of-zombies mob wearing a fixed bundled skin
/summon playermob:player_mob ~ ~ ~ {PlayerPersonality:2, HostilePersonality:4, SkinIndex:3}All keys are written at the top level of the entity tag (alongside vanilla mob
NBT like Health, HandItems, etc.).
| Key | Type | Range / values | Meaning |
|---|---|---|---|
PlayerPersonality |
int |
0–4
|
Disposition toward players (and other PlayerMobs). |
HostilePersonality |
int |
0–4
|
Disposition toward hostile mobs (zombies, skeletons…). |
AnimalPersonality |
int |
0–4
|
Disposition toward passive animals. |
VillagerPersonality |
int |
0–4
|
Disposition toward villagers & wandering traders. |
SkinIndex |
int |
0–8
|
Which of the 9 bundled vanilla skins to wear. Out-of-range → 0. |
SkinTextureUrl |
string | Mojang texture URL | Pin a specific URL skin (overrides SkinIndex visually). |
SkinSlim |
bool |
0 / 1
|
Marks the URL skin as slim. (Renders wide in v0.15.0 — see Custom Skins.) |
ClosesDoors |
bool |
0 / 1
|
1 = closes wooden doors behind itself; 0 = leaves them open. |
Standard vanilla mob NBT works too — HandItems, ArmorItems, Health,
CustomName, NoAI, and so on.
The four personality keys take a Personality ordinal:
| Ordinal | Personality | Behaviour |
|---|---|---|
0 |
AGGRESSIVE |
Targets and attacks (weapon-aware). |
1 |
FRIENDLY |
Approaches, looks, crouch-greets, tosses gifts. |
2 |
PASSIVE |
Ignores. |
3 |
SKEPTICAL |
Stops and stares; readies a weapon/shield if approached. |
4 |
SHY |
Flees and hides near cover. |
⚠️ These ordinals are a save contract. They're referenced by NBT, spawn-eggentity_data, and saved worlds — the enum order is frozen (AGGRESSIVE=0 … SHY=4). Don't expect it to change; if you store them, store the number.
Not every personality is valid for every category (you can't be "skeptical of a cow"). A value outside a category's allowed set is silently clamped to that category's default — so a bad combination degrades gracefully rather than crashing.
| Category (key) | Allowed personalities | Default |
|---|---|---|
Players (PlayerPersonality) |
Aggressive, Friendly, Passive, Skeptical, Shy |
Passive (2) |
Hostile mobs (HostilePersonality) |
Aggressive, Passive, Skeptical, Shy (no Friendly) |
Aggressive (0) |
Animals (AnimalPersonality) |
Aggressive, Friendly, Passive (no Skeptical/Shy) |
Passive (2) |
Villagers (VillagerPersonality) |
Aggressive, Friendly, Passive (no Skeptical/Shy) |
Passive (2) |
Those defaults reproduce the original single-stance behaviour: fights hostile mobs, ignores everything else.
Whether an unspecified field is randomised or left at its default depends on the spawn path:
-
Bare
/summon playermob:player_mob(no NBT tag) → the mob randomises everything: a skin (~70 % bundled / ~30 % URL — see Custom Skins), every personality category (uniformly over its allowed set), and a 50/50 door-closing habit. -
/summon … {…}with an NBT tag → only the keys you provide are applied. Anything you omit takes the default shown above (skin index0, no URL skin, doors left open) rather than a random roll. - Spawn eggs → see below.
Want a fully deterministic mob? Set all four personality keys (plus a skin and
ClosesDoorsif you care). Then the spawn path doesn't matter — there's nothing left to roll.
Six spawn eggs are registered, all in the Spawn Eggs creative tab:
| Item id | Effect |
|---|---|
playermob:player_mob_spawn_egg |
Fully random (every category rolled). |
playermob:player_mob_aggressive_spawn_egg |
Pins players → Aggressive; rolls the rest. |
playermob:player_mob_friendly_spawn_egg |
Pins players → Friendly; rolls the rest. |
playermob:player_mob_passive_spawn_egg |
Pins players → Passive; rolls the rest. |
playermob:player_mob_skeptical_spawn_egg |
Pins players → Skeptical; rolls the rest. |
playermob:player_mob_shy_spawn_egg |
Pins players → Shy; rolls the rest. |
The archetype eggs work by stamping a minecraft:entity_data component containing
{PlayerPersonality:N} onto the spawned mob; the mob's spawn logic marks that
category as deliberately-set and randomises only the other three. So a Shy egg
gives you a mob that's shy of you but random toward zombies, animals, and
villagers.
You can build the same thing yourself by giving any player a spawn egg with an
entity_data component — e.g. a mob that's friendly to villagers:
/give @s playermob:player_mob_spawn_egg[entity_data={id:"playermob:player_mob",VillagerPersonality:1}]PlayerMob's combat is weapon-aware: hand it a crossbow or bow and it fires from
range; a sword/axe (or empty hands) and it closes in (see AI Goals). The
repo-documented way to equip an already-spawned mob is /item replace:
/item replace entity @e[type=playermob:player_mob,limit=1] weapon.mainhand with minecraft:crossbow
/item replace entity @e[type=playermob:player_mob,limit=1] armor.chest with minecraft:iron_chestplateOr equip at summon time with vanilla HandItems / ArmorItems:
/summon playermob:player_mob ~ ~ ~ {HandItems:[{id:"minecraft:bow",count:1},{}], HostilePersonality:0}PlayerMob spawns unarmoured by default and has 20 HP (lower than a Pillager's 24), so equipping armor noticeably changes its survivability. Full attribute defaults are in Entity API Reference.
- Add the skins these mobs can roll → Custom Skins
- Read/set this state from Java → Personality System · Entity API Reference
Getting started
No-code (datapacks)
Java API
Patterns