Headpat

The Headpat is a tool that can be used to pet any mob.

Requirements

Contents

Items:

item loot table
headpat Headpat headpat:headpat

Advancements:

title description
headpat Headpats! Headpat any mob.
headpat Ain't She a Beaut Headpat a mob that wants to kill you.
headpat Friend of all Living Things Headpat one mob of every type.

Usage

The Headpat can be used on any entity to pet them; they will emit heart particles and make an entity-dependant sound.

Using the Headpat on a player will show a message to that player about being patted on the head by you.

Overhead

Uses an advancement to detect if a player has used the headpat item on a nameable mob.

Uses a different advancement to detect if a player has used the headpat item on something that's not a nameable mob, and if so, raycasts to check if there's an actual player under the cursor.

Known Issues

Headpatting a player (or the Ender Dragon) is slightly fiddlier than headpatting a regular mob, and it can be done through solid blocks.

Renaming a Headpat item breaks it, because the game searches for the entity that was just renamed {"translate":"item.wishlist,headpat"} as its target. The problem is moot if Headpat is used via Hand, though.