# Furniture - complex

{% hint style="warning" %}

#### Requires **ItemsAdder 4.0.9** or greater.

{% endhint %}

To create advanced furniture you have to use the custom entities feature of ItemsAdder.\
Please read the tutorial on how to create custom entities before:

{% content-ref url="mobs" %}
[mobs](https://itemsadder.devs.beer/japanese/plugin-usage/adding-content/mobs)
{% endcontent-ref %}

{% hint style="danger" %}
Custom entities were developed with performance in mind, but they might cause high CPU usage if abused.\
It's advised to limit the amount of complex furnitures using the `max_per_chunk` property and the `config.yml` option `max_per_chunk`.
{% endhint %}

## Furniture item settings

In this example I will create a simple Ceiling Fan furniture.\
This will be used to spawn the furniture on interaction.

```yaml
  ceiling_fan:
    name: Ceiling Fan
    resource:
      material: PAPER
      generate: true
      texture: item/ceiling_fan
    behaviours:
      complex_furniture:
        entity: ceiling_fan
        light_level: 10 # Emits light
        solid: true # Hitbox made of BARRIER blocks
        drop_when_mined: true # Will be dropped when attacked by player
        max_per_chunk: 2 # Max amount of furnitures in chunk
        placement_offset: # Used to adjust the spawn location
          ceiling: -0.5
          wall: 0
          floor: 0
```

Create a file `my_furniture/textures/item/ceiling_fan.png`.

## Furniture custom entity settings

```yaml
entities:
  ceiling_fan:
    model_folder: entity/ceiling_fan
    type: ARMOR_STAND
    gravity: false
```

## Furniture model

Create a new `ItemsAdder Entity Model`.

<figure><img src="https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-9ac240dfadb49ff446a5805fe79d3469f487a76f%2Fimage%20(3)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

In this example I called it `ceiling_fan`.

<figure><img src="https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-dde9109e2c8e40abd3105c4c64080a25e84cb275%2Fimage%20(1)%20(1)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

Create your model.

<figure><img src="https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-4a2e4c967d637cf72bd68f050719641ffa3df180%2Fimage%20(13).png?alt=media" alt=""><figcaption></figcaption></figure>

Switch to the animation panel.

<figure><img src="https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-7cb4f4d3356ee06ae3a1661af1b86398bc1cd957%2Fimage%20(14).png?alt=media" alt=""><figcaption></figcaption></figure>

Create a new `idle` animation.

<figure><img src="https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-6a3d3d45af5b860786aa1ed13cbce02a5d0422e7%2Fimage%20(15).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-81a04f63072dfabe4891131ade43314eecb51e23%2Fimage%20(5)%20(1).png?alt=media" alt=""><figcaption></figcaption></figure>

Animate the entity as you wish.

<figure><img src="https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-fc68c5316ae268a4314b8d68444d3434002906f6%2Fimage%20(16).png?alt=media" alt=""><figcaption></figcaption></figure>

Open the entity settings and set the correct namespace. In my example I use `my_furniture`.

<figure><img src="https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-5c861e76e91abef18663711a878017596983cb64%2Fimage%20(7).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-5757629e820c9bd4700133c8a0d2a353774f528a%2Fimage%20(12).png?alt=media" alt=""><figcaption></figcaption></figure>

Save the project as `ceiling_fan.iaentity` (for example) inside your namespace folder root.\
You will be able to edit it anytime you want in the future.

<figure><img src="https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-b4096c3143ec9f1ab77ebc7d0fe1ea7372e6076c%2Fimage%20(9).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-5fa606a023dd0d555fb16ce335dfced06cb12c2b%2Fimage%20(10).png?alt=media" alt=""><figcaption></figcaption></figure>

Export the model. This is the model file that will be loaded by ItemsAdder.

<figure><img src="https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-556f9ce80f625cf893cacc060b34e72758c31a6a%2Fimage%20(11).png?alt=media" alt=""><figcaption></figcaption></figure>

Get the item ingame using `/iaget my_furniture:ceiling_fan`.

<figure><img src="https://2228257718-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Faipc4QQKwVS0w1Q604ya%2Fuploads%2Fgit-blob-5065220d340d1d2f9ed9c5fd99a0177e6e68d595%2Fezgif-4f55fae1f8968a%20(1).gif?alt=media" alt=""><figcaption></figcaption></figure>
