> For the complete documentation index, see [llms.txt](https://thisistails.gitbook.io/tailslib/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://thisistails.gitbook.io/tailslib/tailslib-rus/custom-items/runtime-and-editor-objects.md).

# Runtime and editor objects

## CustomItemRuntime object

Object to store current item runtime state. It have:

* Binded item stack (bindedItemStack)
* Binded CustomItem to item stack (instanceItem)
* Editor (editor)

## ItemEditor object

Simple wrapper for ItemMeta with more simple ways to edit item and its nbt tags. Important thing that TailsLib using Persistent Data Container for containing any NBT Data.

### Creating ItemEditor

Use constructor for this.

```java
ItemEditor editor = new ItemEditor(itemStack);
```

### Setting NBT Tags

```java
ItemEditor editor = new ItemEditor(itemStack);
NamespacedKey key = new NamespacedKey("namespace", "keyId");
editor.setNBT(key, PersistentDataType.STRING, "data");
```

### Getting NBT Tags

```java
ItemEditor editor = new ItemEditor(itemStack);
NamespacedKey key = new NamespacedKey("namespace", "keyId");
String data = editor.setNBT(key, PersistentDataType.STRING); 
// Output: your string or null if not set
```

### Other methods

The remaining methods of the editor are self-explanatory and do not require description. Just ask your IDE for help and read JavaDoc.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://thisistails.gitbook.io/tailslib/tailslib-rus/custom-items/runtime-and-editor-objects.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.
