Interaction

From Minecraft Wiki
Jump to navigation Jump to search
This article is a work in progress.
 
Please help expand and improve it. The talk page may contain suggestions.
This feature is exclusive to Java Edition.
 
Interaction
Blank.png: Infobox image for Interaction the entity in Minecraft
Health points None
Behavior None
Hitbox size Customizable

Interaction entities are a technical entity, useful for map or data pack creators to see who the last player to click on a certain spot is. They can only be created with the /summon or /execute summon commands. Interaction entities are invisible, invincible and of a custom size. Their bounding box can be viewed via the F3 + B debug shortcut.

Behavior

[edit | edit source]

Interaction entities record the UUID of the last player that left-clicked and right-clicked them, and the time at which the interaction happened. If response is set to true, left-clicking an interaction entity plays a punching sound, and right-clicking it makes the player's arm swing.

Usage

[edit | edit source]

You can check information on who last left-clicked and right-clicked on the interaction entity with the /data get entity command. This information can be useful in datapack and map creation. You can also change their size to match the area you want to be checked.

Advancement triggers

[edit | edit source]

Commands

[edit | edit source]

The interaction entity targets the player who last interacted with it. That makes the following possible:

  • /execute on attacker execute as the last player who attacked (left-clicked) the entity.
  • /execute on target execute as the last player who interacted with (right-clicked) the entity.

Data values

[edit | edit source]
EntityIdentifier Translation key
BlockSprite air.png: Sprite image for air in Minecraft Interactioninteraction entity.minecraft.interaction

Entity data

[edit | edit source]
See also: Entity format

Interaction entities have entity data associated with them that contain various properties of the entity.

  • [NBT Compound / JSON Object] Entity data
    • Tags common to all entities see Template:Nbt inherit/entity/template
    • [Float] width: The width of the entity's bounding box. Defaults to 1.
    • [Float] height: The height of the entity's bounding box. Defaults to 1.
    • [Byte] response: 1 or 0 (true/false). Specifies whether an interaction should trigger a response (hand animation). Defaults to 0 (false).
    • [NBT Compound / JSON Object] attack: The last attack (left click) to hit the entity.
      • [Int Array] player: The UUID of the player that attacked the entity. The 128-bit UUID is stored as four 32-bit integers, ordered from most to least significant.
      • [Long] timestamp: When the attack took place.
    • [NBT Compound / JSON Object] interaction: The last interaction (right click) to hit the entity.
      • [Int Array] player: The UUID of the player that interacted with the entity. The 128-bit UUID is stored as four 32-bit integers, ordered from most to least significant.
      • [Long] timestamp: When the interaction took place.

History

[edit | edit source]
Java Edition
1.19.423w07aAdded interaction entities.
[edit | edit source]