# 家具基础

方块本身由 **6** 个面堆叠而成，我们虽然可以部分巧妙的使用透明像素来实现非正方体方块，但对于像椅子、桌子这样需要大量方向的装饰品来说，还是太限制了，所以我们需要使用 **ItemsAdder** 家具功能。

虽然称之为家具，但实际上是在 **Minecraft** 中放置我们前文在 **物品** 一章已经提及的 **3D** 模型，只不过这次不是只在手上看，而是实实在在的放在地上了。

家具通过盔甲架或者物品展示框的方式显示，而不是方块的不同的唱片机、刷怪笼原版材质修改（这意味着有数量上的上限）。

### 家具材质

与方块近乎一样，但是这里要用的是模型：

```
    resource:
      material: PAPER
      generate: false
      model_path: lamp
```

其中：

* material：见 **方块基础** 一节。
* generate：见 **方块基础** 一节，此处请保持 `false`。
* model\_path：模型文件路径，其填写规则与贴图的 `path` 一致，请见 **贴图** 一节。

### 家具行为属性

不同于方块需要添加特殊属性，家具需要给这个物品添加一个行为属性。不止对于家具本身，行为属性还可以为物品带来其他丰富多彩的内容，例如饰品、售卖机、枪等，具体的内容请见下一节。

在你需要设置为家具的物品的配置下添加如下内容：

```
behaviours:
  furniture:
    entity: armor_stand
    small: true
    gravity: true
    fixed_rotation: false
    light_level: 7  
    solid: false
    opposite_direction: false #makes the model rotate 180 when placed
    hitbox:
      length: 2
      width: 2.3
      height: 1
      length_offset: 0.5
      width_offset: 0.5
      height_offset: 0.5
    placeable_on:
      walls: false
      ceiling: false
      floor: true

```

其中：

* entity：该家具的实体类型，家具可以通过盔甲架或者物品展示框显示，两者的区别将在下文指出。
* small：是否为小型盔甲架。
* solid：是否具有像方块那样的固态。如果是，那么玩家将可以“踩在”家具上，如果不是，那么玩家可以穿透家具。
* fixed\_rotation：是否固定朝向，如果不是，那么家具每次朝玩家所在的朝向设&#x7F6E;**（你可以理解为 Citizen 每次创建 NPC 后，NPC 都是朝着玩家创建时候方向看，很难做到两个 NPC 朝向一模一样）**。建议如果你是椅子等装饰品，请修改为 `true`，否则玩家放置每把椅子朝向不一致将会非常影响美观，如果是收音机这种小装饰品，可以修改为 `false`。

![这是一个没有固定朝向的家具](https://1341925849-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M28TcKgSDvuFN510qye-887967055%2Fuploads%2F5506uokIEO7CxQAj59ZT%2Fimage.png?alt=media\&token=6f9bef2c-6c2d-45d2-8155-ffa49bda3c54)

* hitbox：家具的 `hitbox`。每个 **Minecraft**  的实体都有 `hitbox`，玩家只有在命中这个实体的 `hitbox` 后才会使其受到伤害，在家具中即破坏它。你可以在客户端按住 **F3 + B** 键以查看各个实体的 `hitbox` 范围。其分别为长宽高和长宽高的偏移。
* placed\_on：可以放置的位置，分布为墙上、地上、天花板。

### 家具实体

家具可以由 **2** 种实体显示，我们可以将这个物品套在盔甲架的头上以将其显示，或者放在物品展示框上以将其显示。盔甲架和物品展示框实际上都会隐形，所以就实现了家具的效果。

#### 盔甲架

* 可以无限朝向，而不是物品展示框的 **8** 个朝向。
* 只能放在地上，不能是墙上和天花板。
* 可以实现椅子坐上去的效果。

它的标准配置是（未列出的选项代表该选项对于盔甲架无效，下同）：

```
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
```

`furniture_sit` 为另外一个行为属性，将在下节提及。

#### 物品展示框

* 只能 **8** 个朝向。
* 什么地方都可以放。
* 不能很好实现椅子坐上去的效果。

它的标准配置是：

```
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
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.superiormc.cn/itemsadder-doc/jia-ju/jia-ju-ji-chu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
