跳到主要内容

Pet Definition

Configure a companion pet

字段

字段类型默认值描述
descriptionString——
textureString—Base64 encoded player head texture for head-display pets. Leave blank for default.
npcRef<EntityDefinitionEntry>—Optional NPC entity definition used when the pet walks beside the player.
skinsList<PetSkinEntry>emptyCollection of NPC definitions that players can choose from when the pet walks beside them.
defaultModePetDisplayModeHEAD—可选值:HEADGROUNDFLY
headOffsetVectorZEROOffset applied when the pet floats above the player in head mode.
swimModePetSwimModeAUTOHow this pet behaves in liquid while using ground mode. AUTO follows the configured entity capabilities.可选值:AUTOALWAYSNEVER
flightHeightDouble2.0Height above the owner used by flying pets.
xpPetXpSettings——
PetXpSettings(4)
字段类型默认值描述
formulaString—Optional arithmetic expression using {level} to calculate XP required per level.
levelsList<PetLevelRequirement>emptyExplicit XP requirements that override the formula when provided.
PetLevelRequirement(3)
字段类型默认值描述
levelInt1—
xpInt0—
damageDouble?—Damage dealt by the pet when retaliating at this level. Leave empty to use the default scaling.
maxLevelInt10Maximum level this pet can reach.
killRewardInt0Experience granted whenever the owner kills an entity.
combatPetCombatSettings——
PetCombatSettings(1)
字段类型默认值描述
enabledBooleanfalseEnable simple retaliation behaviours when the owner is attacked.
tokenPetTokenSettings——
PetTokenSettings(4)
字段类型默认值描述
itemItem—TypeWriter item captured or built to represent this pet when given to players.
loreList<String>—Lore of the token. Supports MiniMessage and the placeholder {name}.
glowBooleanfalseAdds a glowing enchantment effect to the token item.
noSlotMessageString<red>Ton menu des compagnons est plein.Message sent when the player has no available slot for this pet. Supports MiniMessage.

How to use it​

One Pet Definition describes one species. The entry name is the display name and its id is what commands, actions and placeholders use.

Display.

  • defaultMode: HEAD floats above the player (with headOffset), GROUND walks beside the player, FLY hovers flightHeight blocks above.
  • texture: a base64 skin texture for the floating head and the token item.
  • npc: an entity definition spawned for GROUND and FLY, and for HEAD when you want a model instead of a head. It is also the fallback when no skin matches.
  • skins: alternative NPC skins. Each needs an npc, and uses priority (higher first) and criteria to decide whether the player may wear it. icon is the item shown in the skin menu, where {skin} is replaced by the skin name.

Progression. In xp:

  • maxLevel is the top level.
  • levels lists, for each level, the total xp the pet must have. An optional damage sets the retaliation damage from that level on.
  • formula is used when a level is not in levels. It may contain {level} and + - * / with parentheses, for example {level} * 100.
  • killReward is the XP the pet earns each time its owner kills something while it is active.

Combat and token. combat.enabled turns on retaliation against mobs that hit the owner. token defines the item players receive: item, name and lore (MiniMessage, with {name} replaced by the pet name), glow, and noSlotMessage shown when the menu is full.

A pet with GROUND or FLY and no usable npc is never shown. swimMode only matters for ground pets.