# Ваш первый скрипт

В папке KubeJS откройте файл <mark style="color:blue;">**server\_script**</mark>, а затем - <mark style="color:blue;">**script.js**</mark>. Вы увидите следующий код, который мы рассмотрим далее:

```javascript
// priority: 0
settings.logAddedRecipes = true
settings.logRemovedRecipes = true
settings.logSkippedRecipes = false
settings.logErroringRecipes = true
console.info('Hello, World! (You will see this line every time server resources reload)')
onEvent('recipes', event => {
 // Change recipes here
})
onEvent('item.tags', event => {
 // Get the #forge:cobblestone tag collection and add Diamond Ore to it
 // event.get('forge:cobblestone').add('minecraft:diamond_ore')
 // Get the #forge:cobblestone tag collection and remove Mossy Cobblestone from it
 // event.get('forge:cobblestone').remove('minecraft:mossy_cobblestone')
})
```

**//priority** - устанавливает приоритет скрипта 0-∞.

За отображение информации в логах отвечают следующие параметры:

* **settings.logAddedRecipes** - Добавление рецепта.
* **settings.logRemovedRecipes** - Удаление рецепта.
* **settings.logSkippedRecipes** - Пропуск рецепта.
* **settings.logErroringRecipes** - Ошибки в рецепте.

**console.info** - выводит сообщение в logs. **onEvent('recipes', event => {** - регистрация Event. **'recipes'**, - имя Event.

Теперь создадим первый скрипт. Мы добавим рецепт для кремня из 3-х гравия.

У нас для таких целей есть **2 способа:**

1. Форменный рецепт (**shaped**)
2. Бесформенный рецепт (**shapeless**)

Мы воспользуемся 2 способом, так как нам не нужна строгая последовательность.

```javascript
// priority: 0
settings.logAddedRecipes = true
settings.logRemovedRecipes = true
settings.logSkippedRecipes = false
settings.logErroringRecipes = true
console.info('Hello, World! (You will see this line every time server resources reload)')
onEvent('recipes', event => {
 // Change recipes here
 event.shapeless("flint", ["gravel", "gravel", "gravel"])
})
onEvent('item.tags', event => {
 // Get the #forge:cobblestone tag collection and add Diamond Ore to it
 // event.get('forge:cobblestone').add('minecraft:diamond_ore')
 // Get the #forge:cobblestone tag collection and remove Mossy Cobblestone from it
 // event.get('forge:cobblestone').remove('minecraft:mossy_cobblestone')
})

```

Теперь сохраним и напишем в чате игры `/reload` для запуска изменений.

<div align="left"><figure><img src="/files/S8E8G6BLmQs80VJJWbKR" 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/vash-pervyi-skript.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.
