Execute actions

Execute commands on interact

You can do it by using the placed_furniture -> interact event.

items:
  lamp:
    display_name: "Lamp"
    permission: myitems.decorative.lamp
    lore:
    - lore-decorative-item
    resource:
      material: PAPER
      generate: false
      model_path: lamp
    behaviours:
      furniture:
        light_level: 13
        solid: true
    events:
      placed_furniture:
        interact:
          execute_commands:
            the_first_command:
              command: help
              as_console: false

In this example you can see a furniture which will make the player execute the command /help when they interact with the furniture.

You can add more actions to the placed_furniture interaction event, not only execute_commands.

Open a trading menu on interact

In this example you can see how to attach a trading GUI to your furniture. This is useful to create custom machinery.

Make furniture consumable

In this example you can see how to make furniture go through a list of models, and fill the players hunger bar.

With this behaviour you can immitate things such as the vanilla cake.

When it has gone through the whole list, the furniture will disappear, so it's fully consumed.

strawberry_pie is used to show the 2D icon both in hand and in the inventory.

If you want to show the 3D model in hand and the 2D icon in the inventory, you can just use strawberry_pie_full to place your furniture.

Last updated

Was this helpful?