# DynamicHolder

A `DynamicHolder` typically holds config setting data. It can be thought of a supplier that caches its own value upon being queried for the first time. They also support serialization/deserialization via NBT.

The value of a DynamicHolder is obtained via the following methods:

```java
get()
```

### Registry Access

Some holders that rely on Minecraft registries (biomes, dimensions, structures, etc.) require an instance of <mark style="color:blue;">`RegistryAccess`</mark> in order to be retrieved, and will throw an error if one is not supplied:

```java
get(RegistryAccess registryAccess)
```

An instance of `RegistryAccess` can be retrieved from any <mark style="color:blue;">`MinecraftServer`</mark>, <mark style="color:blue;">`Entity`</mark>, or <mark style="color:blue;">`Level`</mark> object (if it is not on the client-side). In the event that none of these sources are available, Cold Sweat provides a method for obtaining an instance of `RegistryAccess`:&#x20;

```java
RegistryHelper.getRegistryAccess()
```

Using this method is generally discouraged, as it uses potentially unreliable methods of retrieving an instance of  `RegistryAccess` from a static context. Only use this if there is no alternative and you know what you are doing.

{% hint style="warning" %}
`RegistryAccess` is only reliably present after the integrated server has loaded. Attempting to retrieve it before this point could result in `null`.
{% endhint %}


---

# 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://mikul.gitbook.io/cold-sweat/utility-classes/dynamicholder.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.
