Skip to main content
The texture system manages all game textures, texture packs, and dynamic texture loading. It consists of several key classes working together.

Textures Class

The main Textures class handles texture loading, binding, and management.

Constructor

Creates a new texture manager.
TexturePackRepository*
Texture pack repository
Options*
Game options for anaglyph mode, etc.

Texture Loading

loadTexture (by name)

Loads a texture from the texture pack.
TEXTURE_NAME
Texture ID enum value
const wstring&
Resource path (e.g., “terrain/sun”)
Returns the OpenGL texture ID.

loadTexture (by index)

Loads a pre-indexed texture.
int
Pre-loaded texture index

getTexture

Creates an OpenGL texture from an image.
BufferedImage*
Source image
C4JRender::eTextureFormat
default:"TEXTURE_FORMAT_RxGyBzAw"
Texture format
bool
default:"true"
Generate mipmaps

Texture Binding

bindTexture (by name)

Binds a texture by resource name, loading it if necessary.
const wstring&
Resource path

bindTexture (by ID)

Binds a pre-loaded texture by ID.
int
Texture ID

bind

Binds an OpenGL texture directly.
int
OpenGL texture ID

clearLastBoundId

Clears the last bound texture ID, forcing a rebind on next use.

Dynamic Textures

loadHttpTexture

Loads a texture from an HTTP URL with a fallback.
const wstring&
HTTP URL to load texture from
const wstring& or int
Fallback texture (resource name or ID)

addHttpTexture

Adds an HTTP texture with a custom processor.
const wstring&
HTTP URL
HttpTextureProcessor*
Custom texture processor

removeHttpTexture

Removes an HTTP texture from the cache.

hasHttpTexture

Checks if an HTTP texture is loaded.

Memory Textures (Console-specific)

loadMemTexture

Loads a texture from memory (for console features like Game Trophy System).

addMemTexture

Adds a memory texture with processor.

removeMemTexture

Removes a memory texture.

Texture Updates

replaceTexture

Replaces a texture’s pixel data (with anaglyph processing).
intArray
Raw ARGB pixel data
int
Texture width
int
Texture height
int
OpenGL texture ID

replaceTextureDirect

Replaces a texture’s pixel data directly without processing.

releaseTexture

Releases an OpenGL texture.
int
OpenGL texture ID to release

Texture Pack Management

reloadAll

Reloads all textures (called when changing texture packs).

stitch

Stitches terrain and item textures into texture atlases.

tick

Updates animated textures and dynamic textures.
bool
Whether to update texture data
bool
default:"true"
Whether to tick dynamic textures (water, lava)

Utility Methods

readImage

Reads an image from the texture pack.
TEXTURE_NAME
Texture ID
const wstring&
Resource name

getMissingIcon

Gets the missing texture icon.
int
Icon type (0 = block, 1 = item)

IsTUImage / IsOriginalImage

Checks if a texture is from a Title Update or original game.

Static Settings

Global texture settings for mipmapping and format.

TexturePackRepository Class

Manages available texture packs and texture pack selection.

Constructor

Creates the texture pack repository.
File
Directory containing texture packs
Minecraft*
Minecraft instance

Texture Pack Selection

selectSkin

Selects a texture pack.
TexturePack*
Texture pack to select
Returns true if successful.

selectTexturePackById

Selects a texture pack by ID.
DWORD
Texture pack ID

getSelected

Returns the currently selected texture pack.

isUsingDefaultSkin

Returns whether the default texture pack is selected.

Texture Pack Management

updateList

Scans for available texture packs and updates the list.

getAll

Returns all available texture packs.

getTexturePackById

Gets a texture pack by its ID.
DWORD
Texture pack ID

getTexturePackCount

Returns the number of available texture packs.

getTexturePackByIndex

Gets a texture pack by index.

addTexturePackFromDLC

Adds a texture pack from DLC.
DLCPack*
DLC pack containing texture pack
DWORD
Texture pack ID

Constants

AbstractTexturePack Class

Base class for texture pack implementations.

Constructor

DWORD
Unique texture pack ID
File*
Texture pack file or directory
const wstring&
Texture pack name
TexturePack*
Fallback texture pack for missing resources

Resource Access

getResource

Gets a resource from the texture pack.
const wstring&
Resource path (e.g., “terrain.png”)
bool
Whether to use fallback pack if resource not found

hasFile

Checks if the texture pack contains a file.

getImageResource

Loads an image from the texture pack.

Pack Information

getId

Returns the texture pack ID.

getName

Returns the texture pack name.

getDesc1 / getDesc2

Returns texture pack description lines.

getWorldName

Returns the associated world name (for world-specific packs).

Loading/Unloading

load

Loads the texture pack.

unload

Unloads the texture pack.

loadUI / unloadUI

Loads/unloads UI-specific resources.

loadColourTable

Loads the color table for UI theming.

getColourTable

Returns the loaded color table.

Pack Icon

getPackIcon

Gets the texture pack icon image data.
DWORD&
Output: size of image data in bytes
Returns pointer to image data.

Texture Name Enum

Pre-defined texture IDs:

Example Usage

Basic Texture Loading

Changing Texture Packs

Loading Player Skins

Animated Textures

Custom Texture Replacement

Texture Pack Information

Performance Considerations

  • Texture atlases (stitched terrain/items) reduce draw calls
  • Mipmaps improve rendering quality but use more VRAM
  • HTTP textures are cached to avoid repeated downloads
  • Anaglyph processing is expensive; only enable when needed
Calling reloadAll() is expensive as it reloads all textures. Only call when changing texture packs or when absolutely necessary.