Json:block:texture: Difference between revisions

From Vintage Story Wiki
No edit summary
(Link to Modding:CompositeTexture)
Line 1: Line 1:
The dictionary contains multiple named textures. Different [[Modding:Block_Tessellator|tessellators]] expect different texture names. Most tessellators accept the special "all" alias to set all textures at once.
Default example (glass): <syntaxhighlight lang='json'>textures: {
Default example (glass): <syntaxhighlight lang='json'>textures: {
all: { base: "block/glass" },
all: { base: "block/glass" },
Line 5: Line 7:
all: {base: "block/stone/rock/{rock}" },
all: {base: "block/stone/rock/{rock}" },
}</syntaxhighlight>
}</syntaxhighlight>
Using directions - the texture codes "verticals", "horizontals", "sides", "westeast" and "northsouth" are specially handled as they get expanded into their respective n/e/s/w/u/d faces. Example hay block:
 
There are a few aliases that set multiple textures at the same time:
; all
: Sets all textures for tessellators that support the alias
; sides
: "west", "east", "north", "south", "up", and "down"
; horizontals
: "west", "east", "north", and "south"
; verticals
: "up" and "down"
; westeast
: "west" and "east"
; northsouth
: "north" and "south"
 
For example, hay block uses two aliases:
<syntaxhighlight lang='json'>textures: {
<syntaxhighlight lang='json'>textures: {
horizontals: { base: "block/hay/{type}-side" },
horizontals: { base: "block/hay/{type}-side" },
Line 11: Line 28:
},</syntaxhighlight>
},</syntaxhighlight>


Overlay and alternate textures combined (ore):
There are many [[Modding:CompositeTexture|options]] to rotate textures, combine them, and randomize the textures by block location.
<syntaxhighlight lang='json'>
textures: {
all: {
base: "block/stone/rock/{rock}",
overlays: [ "block/stone/ore/{ore}1" ],
alternates: [
{ base: "block/stone/rock/{rock}", overlays: [ "block/stone/ore/{ore}2" ] },
{ base: "block/stone/rock/{rock}", overlays: [ "block/stone/ore/{ore}3" ] }
]
}
},</syntaxhighlight>
 
Random textures:
<syntaxhighlight lang='json'>
textures: {
all: { base: "block/plant/waterlily/lily*" }
},</syntaxhighlight>

Revision as of 07:21, 4 November 2023

The dictionary contains multiple named textures. Different tessellators expect different texture names. Most tessellators accept the special "all" alias to set all textures at once.

Default example (glass):

textures: {
		all: { base: "block/glass" },
	}

Using variantgroups (rock):

textures: {
		all: {base: "block/stone/rock/{rock}" },
	}

There are a few aliases that set multiple textures at the same time:

all
Sets all textures for tessellators that support the alias
sides
"west", "east", "north", "south", "up", and "down"
horizontals
"west", "east", "north", and "south"
verticals
"up" and "down"
westeast
"west" and "east"
northsouth
"north" and "south"

For example, hay block uses two aliases:

textures: {
		horizontals: { base: "block/hay/{type}-side" },
		verticals: { base: "block/hay/{type}-top" },
	},

There are many options to rotate textures, combine them, and randomize the textures by block location.