# Custom Textures

First we need to choose a name for the texture, we'll just go by Test Texture.

Now you just have to take some image and save it as a PNG file in the mod directory. Let's say our file is named `test.png`. We'll do this:

```lua
-- ... previous code

function register(registerType)
    if registerType == "textures" then
        exdilin.register_and_load_texture("Test Texture", "test.png", "Normal", "OneSideTo1x1")
    end
end
```

Let's analyze it, we created a register function (more info in [Initialization orders](https://zenith391.gitbook.io/exdilin/concepts/initialization-orders)), then using an if "block", we check if we are currently registering textures (if we're not, we do nothing, you don't want to make textures while the game is making blocks?).

Then, the `exdilin.register_and_load_texture` function (which has a long name) has 4 arguments: The first is the name of the texture, as we said above it is Test Texture.\
The second is the file of the texture, we saved the image as `test.png`, so that's what we put here.\
The third is the texture type, it's a `Normal` texture.\
The fourth and final is the texture thing, which here is `OneSideTo1x1` (which means the texture only shows to one side of a block).

The last step is to make the texture available in the build panel:

```lua
-- ... previous code

function pre_init()
    -- whatever code you had in here too
    exdilin.texture_item("Test Texture").register()
end
```

Nothing complex here, `exdilin.texture_item` takes the name of the texture, and then we use the `register()` function. This is like we do for block items except here it is texture items.


---

# 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://zenith391.gitbook.io/exdilin/lua-mods/custom-textures.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.
