> For the complete documentation index, see [llms.txt](https://3504743864.gitbook.io/oraxen-wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://3504743864.gitbook.io/oraxen-wiki/pei-fang-she-zhi/oraxen-fang-kuai.md).

# Oraxen 方块

如何在游戏中添加自己的方块

## 它是如何运作的？

与物品不同的是，方块不能用模型的办法去添加到游戏中去，其实并不能真意义上的添加新的方块...... 因为Mojang做的机制现在还实现不了自定义方块

但无论如何还是有一些技术可以做到这一点!

Oraxen 正在使用方块的面的属性方块模型 (json 文件，其中包含着 Minecraft 所需的所有信息，它可以来渲染方块) 取决于基础方块的|方块的面基本上它使用方块的属性，可以实现有方块的每一面都不一样.比如:蘑菇块

在 Minecraft地形中,这个方块只使用了一种变化，一个区块上有6个面，所以我们有2^6 - 1 = 63种可能的变化

## 如何创建一个简单的方块？

### Oraxen项目和材质配置

Oraxen项目配置和任何项目一样（你可以使用任何材料，比如钻石）,并设置一个displayname

对于材质的部分,你可以使用你自己的模型或者生成一个模型

要生成一个方块状模型,只需告诉Oraxen模型是 "block/cube\_all"，然后在oraxen/pack/textures文件夹内添加你的方块的材质（方块的一个面）

```yaml
my_block:
  displayname: "&My block"
  material: DIAMOND
  Pack:
    generate_model: true
    parent_model: "block/cube_all"
    textures:
      - my_block_texture.png
```

### 方块机制配置

如果要使用这个机制，你需要提醒Oraxen要使用哪个模型（要使用生成的模型，只需输入你的物品名称id）

然后你需要使用custom\_variation，它还没有被其他方块占用（如果，caveblock使用1，其他的物品你可以使用2,3....）

这个物品配置的掉落配置可以让你在用**石镐**挖矿的时候获得**caveblock**掉落物

```yaml
  Mechanics:
    block:
      custom_variation: 2
      model: my_block
      drop:
        silktouch: false 
        minimal_tool: STONE_PICKAXE
        loots:
          - {oraxen_item: caveblock, probability: 1.0}
```

### 矿石

这个物品配置展示了如何创建矿石

```yaml
amethyst_ore:
  displayname: "&dAmethyst Ore"
  material: DIAMOND
  Pack:
    generate_model: true
    parent_model: "block/cube_all"
    textures:
      - amethyst_ore
  Mechanics:
    block:
      custom_variation: 2
      model: amethyst_ore
      drop:
        silktouch: true
        fortune: true
        minimal_tool: IRON_PICKAXE
        loots:
          - {oraxen_item: amethyst, probability: 1.0}
```
