# Создание предмета

Теперь мы попробуем создать свой собственный предмет. Добавим осколок, который будет называться *Теневой кусочек.* Первым делом переместите свою текстуру предмета в **KubeJS —> assets —> kubejs —> textures —> item**. Название текстуры должно быть с маленькой буквы и на английском языке *(shadow\_piece)*.

Откройте папку **KubeJS —> startup\_scripts —> script.js**

```javascript
// priority: 0
console.info('Hello, World! (You will only see this line once in console, during startup)')
onEvent('item.registry', event => {
// Register new items here
// event.create('example_item').displayName('Example Item')
})
onEvent('block.registry', event => {
 // Register new blocks here
 // event.create('example_block').material('wood').hardness(1.0).displayName('Example Block')
})
```

Здесь нам нужен **item.registry** Для добавления предмета нам необходимо написать `event.create('имя вашего предмета')`

**Список методов:**

* **maxStackSize(size)** - Максимальное количество в стаке 1-64.
* **displayName(name)** - Отображаемое имя предмета.
* **unstackable()** - Установка предмета, невозможного к стаку.
* **maxDamage(damage)** - Максимальная прочность предмета.
* **burnTime(ticks)** - Время горения.
* **glow(bool)** - Заставляет предмет светиться (как зачарованный).
* **rarity('rarity')** - Редкость предмета.
* **group('group\_id')** - Группа предметов.
* **color(index, colorHex)** - Цвет предмета.
* **texture(customTexturePath)** - Собственное расположение текстуры.
* **parentModel(customParentModel)** - Модель предмета.
* **food(foodBuilder => ...)** - Создание еды.
* **tier('toolTier')** - Уровень инструмента.
* **modifyTier(tier => ...)** - Тот же синтаксис, что и у пользовательского уровня инструментов.
* **attackDamageBaseline(damage)** - Урон предмета.
* **attackDamageBonus** - Дополнительный урон.
* **speedBaseline**
* **speed**

Для примера, создадим предмет, который будет храниться по 32 шт., а также сможет гореть 340 тиков (17 секунд).

```javascript
event.create('shadow_piece').maxStackSize(32).burnTime(340)
```

После добавления собственного ресурсы нужно добавить к нему перевод. Перемещаемся: **kubejs —> assets —> kubejs**. Создаём папку **lang**, а в ней файл `en_us.json` и `ru_ru.json`

```javascript
{
 "item.kubejs.shadow_piece": "Shadow Piece"
}
```

Тоже самое делаем для `ru_ru.json`.

```javascript
{
 "item.kubejs.shadow_piece": "Теневой кусочек"
}
```

**Создадим свою кирку и меч:**

```javascript
//Мечь
event.create('custom_sword','sword').tier('diamond').attackDamageBaseline(10.0)
//Кирка
event.create('custom_pickaxe','pickaxe').tier('diamond').maxDamage(5)
```

**Допустимые типы предметов:**

* `"basic"` – Базовый.
* `"sword"` – Меч.
* `"pickaxe"` – Кирка.
* `"axe"` – Топор.
* `"shovel"` – Лопата.
* `"hoe"` – Мотыга.
* `"helmet"` – Шлем.
* `"chestplate"` – Нагрудник.
* `"leggings"` – Поножи.
* `"boots"` – Ботинки.

**Методы, доступные, если вы используете тип `"sword"`, `"pickaxe"`, `"axe"`, `"shovel"` или `"hoe"`:**

* `"wood"` – Дерево.
* `"stone"` – Камень.
* `"iron"` – Железо.
* `"gold"` – Золото.
* `"diamond"` – Алмаз.
* `"netherite"` – Незерит.

**Методы, доступные, если Вы используете тип `"helmet"`, `"chestplate"`, `"leggings"` или `"boots"`:**

* `"leather"` – Кожа.
* `"chainmail"` – Кольчуга.
* `"iron"` – Железо.
* `"gold"` – Золото.
* `"diamond"` – Алмаз.
* `"turtle"` - Черепаший панцирь.
* `"netherite"` – Незерит.

<div align="left"><figure><img src="/files/ZGlj8duKMJ0YMFl05PhZ" alt=""><figcaption></figcaption></figure></div>


---

# 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://wiki.aegis-mine.ru/modifications/sozdanie-kontenta/kubejs/sozdanie-predmeta.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.
