# Furniture - simple

A furniture is a decorative object which can be solid, emit light, used as chair and can have other features.

## Creating a simple furniture

### Configuration file

The first step is to create a configuration file in your **namespace** folder.\
In this example I called it `furniture_example.yml`.

{% code title="furniture\_example.yml" %}

```yaml
info:
  namespace: myitems
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
```

{% endcode %}

As you can see I created the item with some special properties.

`behaviours` attribute has a special sub-attribute called `furniture`, this attribute tells ItemsAdder that this item is a placeable furniture model.

Let's add some more settings to it:

{% code title="furniture\_example.yml" %}

```yaml
  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
        placeable_on:
          floor: true
          ceiling: false
          walls: false
        hitbox:
          height: 1
        sound:
          place:
            name: block.metal.fall
          break:
            name: block.metal.break
```

{% endcode %}

I added some properties, in this case I specified where the furniture can be placed (only on the `floor`), the `hitbox` size and `place`/`break` sounds.

{% hint style="info" %}
By default the hitbox is 1x1x1, so it's not really needed to specify these options.

Specify them only if the model is bigger than 1x1x1.

For example if you have a furniture which is 1x2x1 you can set it like that:

```yaml
hitbox:
  height: 2
  length: 1
  width: 1
```

{% endhint %}

{% code title="furniture\_example.yml" %}

```yaml
info:
  namespace: myitems
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
        placeable_on:
          floor: true
          ceiling: false
          walls: false
        hitbox:
          height: 1
        sound:
          place:
            name: block.metal.fall
          break:
            name: block.metal.break
```

{% endcode %}

### Model file

Now open **BlockBench** and create a *"Java Block/Item"*.

![](https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-4b9f02e9613d12c05b62209d961b4e71cde7c05c%2Fimage%20\(49\)%20\(1\)%20\(1\)%20\(1\).png?alt=media)

Now create your model, in this example I'm modelling an ugly minimal modern lamp.

![](https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-36237f3251ee771333539dbe2d26370cc8631b49%2Fimage%20\(47\)%20\(1\)%20\(1\)%20\(1\).png?alt=media)

{% hint style="warning" %}
Important: make sure the north is opposite of where you want the model to face.

Or add the property to the YML configuration `opposite_direction: true`
{% endhint %}

Edit how the model is shown on player hand:

![](https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-691a2aa644f8dd95750e78f743ac57e083ecda68%2Fimage%20\(46\)%20\(1\)%20\(1\).png?alt=media)

![](https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-24c8c3e34fe8013461585146db3387d1814e0064%2Fimage%20\(48\)%20\(1\)%20\(1\)%20\(1\).png?alt=media)

### Configure how the model is shown ingame

#### Using `armor_stand`

You have to select the **head icon** and then **small armorstand:**

![](https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-224ae9e45a3888525e82a85a3815bf85f97e284f%2Fimage%20\(41\)%20\(1\)%20\(1\)%20\(1\).png?alt=media)

Then you have to shift your model down until it matches the armorstand base:

![](https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-4d7884bdc46afbf61ee7deaabc604b7ef41d7dcf%2Fimage%20\(42\)%20\(1\).png?alt=media)

#### Using `item_display`

You have to select the **Image icon** and then set the Z-offset to `-16`.\
This will display the model slighly of the block the Item Frame is attached to, but will be seamless when an invisible Item Frame is used. This is because of how items in invisible Item Frames are slightly lower than usual.

#### Using `item_frame`

Same thing of `item_display`.

### Export the model

Now let's save the model file into the correct folder, in this case I set this property in the yml configuration file: `model_path: lamp`, so you have to save the .json file inside this path: `contents/myitems/models/lamp.json`.

To achieve this, click on "File" followed by "Export Model" and finally "Export Block/Item Model". In the new window, head over to the path you want to save your model under, give it the right name and confirm the changes.

### Saving changes

Now run `/iazip` (and follow the [hosting tutorial](https://itemsadder.devs.beer/japanese/plugin-usage/resourcepack-hosting) if needed).

To obtain the item use this command: `/iaget myitems:lamp`.

![](https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-9042caf1980f36196bcb4bfa475179bb6a76020c%2Fimage%20\(50\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\).png?alt=media)

![](https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-014e8d7ed29e5804353b9f3fc30c6062d9683a5d%2Fimage%20\(44\)%20\(1\)%20\(1\).png?alt=media)

## Chair

To create a chair you just have to follow the furniture creation tutorial and add a simple attribute to the furniture to make it "sittable".

Just add the `furniture_sit` behaviour and specify the `sit_height`.

```yaml
behaviours:
  furniture:
    # .....
  furniture_sit:
    sit_height: 0.5
```

## Furniture entity types

### `item_display`

This type of furniture entity is useful for any type of furniture you want to create.

![](https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-24e0771226e03f42459ffff2b6e9290a90315534%2Fimage%20\(47\)%20\(1\)%20\(1\)%20\(1\)%20\(2\).png?alt=media)

```yaml
behaviours:
  furniture:
    entity: item_display
    solid: true
    fixed_rotation: true
    hitbox:
      length: 1
      width: 2
      height: 1
      width_offset: 0.5
    placeable_on:
      walls: false
      ceiling: false
      floor: true
  furniture_sit:
    sit_height: 0.5
```

#### Special properties

`item_display` allows you to do some special adjustments to your furniture model using the `display_transformation` property.\
You can resize it, rotate it and move it freely.\
This feature uses the native `item_display` feature of **Minecraft**, you can [read more here](https://www.youtube.com/watch?v=bwPWfUbcZxE) and online.\
You can also use [this tool](https://misode.github.io/transformation/) to preview your changes.

#### Example

```yaml
  lava_lamp_new:
    enabled: true
    display_name: display-name-lava_lamp
    permission: iadeco.decorations.lava_lamp
    lore:
      - lore-decorative-item
    resource:
      material: PAPER
      generate: false
      model_path: lava_lamp
    behaviours:
      furniture:
        entity: item_display
        light_level: 7
        display_transformation:
          transform: HEAD
          right_rotation:
            axis_angle:
              angle: 180
              axis:
                x: 0
                y: 1
                z: 0
          translation:
            x: 0
            y: 0.92
            z: 0
          scale:
            x: 0.45
            y: 0.45
            z: 0.45
```

### `armor_stand`

This type of furniture entity is useful when you want to create chairs, plants, columns, lamps and similar environment decorations which don't need to rotate based on the surface on which you place them.

![](https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-24e0771226e03f42459ffff2b6e9290a90315534%2Fimage%20\(47\)%20\(1\)%20\(1\)%20\(1\)%20\(2\).png?alt=media)

```yaml
behaviours:
  furniture:
    entity: armor_stand
    small: true
    solid: true
    fixed_rotation: true
    hitbox:
      length: 1
      width: 2
      height: 1
      width_offset: 0.5
    placeable_on:
      walls: false
      ceiling: false
      floor: true
  furniture_sit:
    sit_height: 0.5
```

### `item_frame`

This type of furniture entity is useful when you want to make the furniture rotate based on the surface on which you place it.

For example if you have a decorative lamp you can make it placeable on walls, ceiling and ground and and make it oriented automatically based on the surface inclination.

![](https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-0e79f8d6fcc01bdc6d01fd27f88660f103809153%2Fimage%20\(43\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(1\).png?alt=media)

```yaml
behaviours:
  furniture:
    entity: item_frame
    light_level: 15
    solid: false
    hitbox:
      length: 1
      width: 1
      height: 1.5
    placeable_on:
      walls: true
      ceiling: true
      floor: true
```

## Hitbox

You can make a furniture solid adding the "solid" attribute and specifying a hitbox (if you want > 1x1x1)

```yaml
  table:
    display_name: display-name-table
    permission: table
    lore:
      - 'lore-decorative-item'
    resource:
      material: OAK_WOOD
      generate: false
      model_path: item/table
    behaviours:
      furniture:
        small: true
        solid: true
        entity: armor_stand
        hitbox:
          length: 1
          width: 1
          height: 1
          length_offset: 0
          width_offset: 0
          height_offset: 0
```

![](https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-5d738d0e06c37c47cc0139a7761789a067e6625c%2Fimage%20\(15\)%20\(1\).png?alt=media)

### Hitbox has wrong location <a href="#show-the-hitbox" id="show-the-hitbox"></a>

{% hint style="warning" %}
Sometimes you need to also specify an "offset" to fix the hitbox location.\
This can happen if your furniture is 2x1x1 for example.
{% endhint %}

{% tabs %}
{% tab title="Wrong" %}
![](https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-2963867f2d0ff48f134e717d9f7df3b0a8bd65fb%2Fhtibox1.png?alt=media)
{% endtab %}

{% tab title="Correct" %}
![](https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-7b961c2acc39a102e2a6e8e848d362e5655b0d50%2Fhitbox2%20\(1\).png?alt=media)
{% endtab %}
{% endtabs %}

### Correct location <a href="#show-the-hitbox" id="show-the-hitbox"></a>

I had to set a width `offset` of `0.5`.\
You can also use negative values if needed.

```yaml
        hitbox:
          length: 1
          width: 2
          height: 1
          width_offset: 0.5
```

## Preview the hitbox <a href="#show-the-hitbox" id="show-the-hitbox"></a>

{% hint style="info" %}
You can use the command `/iahitbox` to see the hitbox when you pleace a furniture, it's very useful to detect mistakes in the hitbox configuration
{% endhint %}

![](https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-eb3c028c9a4d8dacbdf3df6a8b52a56011216b2c%2Fhitbox3%20\(1\)%20\(1\)%20\(1\)%20\(8\).png?alt=media)

![](https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-72af26481f26911d70a4901368cda87b2caacdcd%2Fimage_\(87\).png?alt=media)

{% hint style="warning" %}

### **Hitboxes limitations**

**`item_frame` limitations (doesn't affect `armor_stand`)**

**Furnitures** that use `entity` `item_frame` **only support hitboxes** with `width` and `length` of the **same value**.\
Example: `width: 2`, `length: 2`, `height: 1`.

If you want to have different `width` and `length` use `entity` `item_display` or `armor_stand`.
{% endhint %}

## Limitations

{% hint style="warning" %}
**Limitations of itemframes furnitures**

* solid itemframe furnitures are possible only on Server version >= 1.16 (client doesn't matter).
* invisible itemframe furnitures are possible only on Server and Client version >= 1.16.\
  If a user connects with viaversion using an old mc version they will see the itemframe.
  {% endhint %}

{% hint style="warning" %}
**Limitations of all furnitures**

* non solid furnitures can't receive interact events, they can only be removed using mouse left click but cannot be interacted with (only solid furnitures can get interact events)
* max size of the hitbox is 3x3x3 for performance reasons
  {% endhint %}
