Table of Contents

Class CompositeTexture

Namespace
Vintagestory.API.Client
Assembly
VintagestoryAPI.dll

Holds data about a texture. Also allows textures to be overlayed on top of one another.

public class CompositeTexture
Inheritance
CompositeTexture
Inherited Members
Extension Methods

Examples

"textures": {
	"charcoal": { "base": "block/coal/charcoal" },
	"coke": { "base": "block/coal/coke" },
	"ore-anthracite": { "base": "block/coal/anthracite" },
	"ore-lignite": { "base": "block/coal/lignite" },
	"ore-bituminouscoal": { "base": "block/coal/bituminous" },
	"ember": { "base": "block/coal/ember" }
},
"textures": {
	"ore": {
		"base": "block/stone/rock/{rock}1",
		"overlays": [ "block/stone/ore/{ore}1" ]
	}
},

Connected textures example (See https://discord.com/channels/302152934249070593/479736466453561345/1134187385501007962)

"textures": {
 	"all": {
 		"base": "block/stone/cobblestone/tiling/1",
 		"tiles": [
 			{ "base": "block/stone/cobblestone/tiling/*" }
 		],
 		"tilesWidth": 4
 	}
 }

Constructors

CompositeTexture()

Creates a new empty composite texture

public CompositeTexture()

CompositeTexture(AssetLocation)

Creates a new empty composite texture with given base texture

public CompositeTexture(AssetLocation Base)

Parameters

Base AssetLocation

Fields

Alpha

Can be used to modify the opacity of the texture. 255 is fully opaque, 0 is fully transparent.

public int Alpha

Field Value

int

AlphaSeparator

public const char AlphaSeparator = 'å'

Field Value

char

AlphaSeparatorRegexSearch

public const string AlphaSeparatorRegexSearch = "å\\d+"

Field Value

string

Alternates

The texture may consists of any amount of alternatives, one of which will be randomly chosen when the block is placed in the world.

public CompositeTexture[] Alternates

Field Value

CompositeTexture[]

Baked

BakedCompositeTexture is an expanded, atlas friendly version of CompositeTexture. Required during texture atlas generation.

public BakedCompositeTexture Baked

Field Value

BakedCompositeTexture

Base

The basic texture for this composite texture

public AssetLocation Base

Field Value

AssetLocation

BlendedOverlays

A set of textures to overlay above this texture. The base texture may be overlayed with any quantity of textures. These are baked together during texture atlas creation.

public BlendedOverlayTexture[] BlendedOverlays

Field Value

BlendedOverlayTexture[]

BlendmodeSeparator

public const char BlendmodeSeparator = '~'

Field Value

char

OverlaysSeparator

public const string OverlaysSeparator = "++"

Field Value

string

Rotation

Rotation of the texture may only be a multiple of 90

public int Rotation

Field Value

int

Tiles

A way of basic support for connected textures. Textures should be named numerically from 1 to TilesWidth squared.
E.g., if TilesWidth is 3, the order follows the pattern of:
1 2 3
4 5 6
7 8 9

public CompositeTexture[] Tiles

Field Value

CompositeTexture[]

TilesWidth

The number of tiles in one direction that make up the full connected textures defined in Tiles.

public int TilesWidth

Field Value

int

WildCardNoFiles

public AssetLocation WildCardNoFiles

Field Value

AssetLocation

basicTexturesCache

[ThreadStatic]
public static Dictionary<AssetLocation, CompositeTexture> basicTexturesCache

Field Value

Dictionary<AssetLocation, CompositeTexture>

wildcardsCache

[ThreadStatic]
public static Dictionary<AssetLocation, List<IAsset>> wildcardsCache

Field Value

Dictionary<AssetLocation, List<IAsset>>

Properties

AnyWildCardNoFiles

public AssetLocation AnyWildCardNoFiles { get; }

Property Value

AssetLocation

Overlays

Obsolete. Use BlendedOverlays instead.

public AssetLocation[] Overlays { set; }

Property Value

AssetLocation[]

Methods

Bake(IAssetManager)

Expands the Composite Texture to a texture atlas friendly version and populates the Baked field. This method is called by the texture atlas managers. Won't have any effect if called after the texture atlasses have been created.

public void Bake(IAssetManager assetManager)

Parameters

assetManager IAssetManager

Clone()

Creates a deep copy of the texture

public CompositeTexture Clone()

Returns

CompositeTexture

FillPlaceholder(string, string)

public void FillPlaceholder(string search, string replace)

Parameters

search string
replace string

IsBasic()

Tests whether this is a basic CompositeTexture with an asset location only, no rotation, alpha, alternates or overlays

public bool IsBasic()

Returns

bool

RuntimeBake(ICoreClientAPI, ITextureAtlasAPI)

Expands the Composite Texture to a texture atlas friendly version and populates the Baked field. This method can be called after the game world has loaded.

public void RuntimeBake(ICoreClientAPI capi, ITextureAtlasAPI intoAtlas)

Parameters

capi ICoreClientAPI

The Client API

intoAtlas ITextureAtlasAPI

The atlas to insert the baked texture.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.