Home›Bedrock›Addons›Player Interact component
Player Interact component
AddonsBedrock

Player Interact component

Bedrock add-on listed for Minecraft 26.x (behavior pack only). File opened and checked on 5 Oct 2026; installs from the MC Bedrock Mods app on Android.

by Barred · on CurseForge

⬇ Download on CurseForge
Open in MCModsHubGet it on Google Play →

On iPhone or iPad: find it in Addonaut.

Player Interact component — screenshot 1

This is a script component designed to process all interactions when a player interacts with a block. It allows for the dynamic evaluation of complex conditions such as the item held, as well as the face and state of the block, to execute linked actions such as item spawn, sounds, commands, item decrement and changes to the block state.

"namespace:player_interact": [
  {
    "condition": "namespace:my_state == 1 && face == north && is_sneaking == true",
    "item": "namespace:my_item", //or "tag"
    "weight": 20,
    "decrement_stack": true,
    "replace_with": "namespace:my_item2",
    "convert_to": "namespace:my_item3",
    "spawn_item": "namespace:my_item4",
    "count": 1,
    "damage": 1,
    "spawn_loot": "namespace/my_loot",

    "sound": "random.orb",
    "particle": "minecraft:smoker_particle",
    "command": "give @a diamond 1",
    "target": "player", //or "block"
    "title": "My title",
    "subtitle": "My subtitle",
    "actionbar": "My actionbar",
    "send_message": "Hello world",

    "set_block": "namespace:my_block",
    "direction": "north",

    "namespace:my_state_1": 1, //"+1" or "-1"
    "namespace:my_state_2": "string",
    "namespace:my_state_3": true
  }
]

 


DOCUMENTATION:


condition - optional

weight - Optional (int)

item - Required if no "tag" is used

tag - Required if no "item" is used

decrement_stack – Optional (boolean, default: false)

replace_with – Optional (string)

convert_to – Optional  (string)

spawn_item – Optional (string)

count – Optional (int, default: 1)

damage – Optional (int)

spawn_loot -Optional (string)

sound – Optional (string)

particle – Optional (string)

command – Optional (string)

target – Optional (string, default: block)

title – Optional (string)

subtitle – Optional (string)

actionbar – Optional (string)

send_message – Optional (string)

set_block – Optional (string)

direction – Optional (string)

states – Optional (state: value)


EXAMPLE

Have a block change its state to 1 when interacting with a diamond, then make it return to the initial state and spawn wood :planks when interacting with a stick.

"barred:player_interact": [
  {
    "condition": "barred:state == 0",
    "item": "minecraft:diamond",
    "decrement_stack": true,
    "send_message": "The block change state",
    "barred:state": 1
  },
  {
    "condition": "barred:state == 1",
    "item": "minecraft:stick",
    "decrement_stack": true,
    "spawn_item": "minecraft:planks",
    "barred:state": 0
  }
]

 


INSTALLATION

To add this component to your own add-on:

  1. Copy the playerInteractComponent.js and utils.js files found in the "scripts" folder of this pack and paste them into the scripts folder of your add-on.
  2. Then, import playerInteractComponent into your main.js file and register the component.
  3. Done! You can now use the component in your blocks.


It should look like this:

BP 🗂️
|_scripts 🗂️
   |_main.js 📄
   |_playerInteractComponent.js 📄
   |_utils.js 📄

If you are new to scripting, I recommend you visit these pages:
Create Your first project

Registering custom components

Remember to change "namespace" to your own.


 

Terms of use

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Bedrock addons & mods walks through it step by step.

File checked by MCModsHub

These come from our own check of the pack file, not from the source page.

Explore more