Jump to content

Recommended Posts

Posted

So in my recent playing around with json files, I have come to understand that I have no idea how textures work in this game, and I'm hoping someone can explain it to me.

Take, for example, mushrooms. As far as I can tell, the mushroom json files have no textures referenced anywhere within them - just a shape file. Despite this, different mushrooms clearly have different textures. There are also different mushroom textures in the game files. So where is the texture being applied to the mushroom?

And then we have the various crops. While I haven't checked all of them, the files for carrots and onions both contain something like the following:

textures: {
		"s": { base: "block/plant/crop/carrot/s{stage}" },
		"e": { base: "block/plant/crop/carrot/e{stage}" },
	},

So I looked and found the e and s files for carrots and onions, but why does it need two of them? What does e and s even stand for here? Also, there is a "bulb" texture in the carrot files which doesn't seem to appear anywhere in the json file? I don't get it.

Posted (edited)
2 hours ago, Lucas Alexander said:

So where is the texture being applied to the mushroom?

You can define textures in two places.

  1. The shape
  2. The xtype

Generally textures are applied via shapes (this is the case for mushrooms). If you apply a texture via xtype, this definition will take priority and overwrite the shape textures.

A perfect example for this is the door.

shapes/block/wood/door/solid.json

	"textures": {
		"iron": "block/metal/ingot/iron",
		"wood": "block/wood/door/plain/acacia"
	},

Even if you define textures in xtype it's never a bad idea to have them in the shape file as well. For one, it makes editing the shapes in the VSMC much easier.

Defining your textures in xtype has some advantages, though. You can use variant codes in them. The variant code in this case is {wood}. It's defined in the same door.json file and includes all wood types (birch, oak, pine, etc). With this information at hand, you now can simply create one configuration (block/wood/debarked/{wood}) that's automatically adjusted by the game, instead of having to define either a dozen or so texture variations (block/wood/debarked/birch, block/wood/debarked/oak, block/wood/debarked/pine, ...) or create a dozen different shapes (solid-birch, solid-oak, solid-pine, ...) to include all wooden doors.

blocktype/door.json

"texturesByType": {
		"door-solid-*": {
			"wood": { "base": "block/wood/debarked/{wood}", "rotation": 90, "blendedOverlays": [{ "base": "block/wood/door/overlay-solid", "blendMode": "Overlay" }] }
		},
	},

(abridged for readability reasons)

2 hours ago, Lucas Alexander said:

So I looked and found the e and s files for carrots and onions, but why does it need two of them? What does e and s even stand for here?

I venture a guess and assume that e stands for East and s for South. Both of these elements are the greens on top of the carrot. The growth of the greens is "simulated" by simply exchanging the textures on different growth stages via

s{stage} and e{stage}

where {stage} is a wildcard for a number, resulting in s1 till s7 (or whatever the highest growth stage for that particular crop is).

2 hours ago, Lucas Alexander said:

Also, there is a "bulb" texture in the carrot files which doesn't seem to appear anywhere in the json file?

Bulb is the body of the carrot. It doesn't need to be defined in the blocktype file, because it has been applied via the shape.

Edited by Brady_The
  • Thanks 1
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.