Grow a crop through its stages
A crop in Minecraft is not one texture but a sequence of them, one per growth stage. In this tutorial you work with a finished two-block corn plant, generate all eight of its stages from one file, change how it grows and look at the result next to vanilla wheat.
You should have finished Your first texture first.
Get the corn example
The authoring skill that ships with TextureScript contains a complete corn crop. Export it:
texturescript skill corn-skill
cd corn-skill/examples/crop
ls
corn.palette corn.stages corn.toml mature
mature/ holds the fully grown plant as two grids, lower.grid and upper.grid, because corn
is two blocks tall. Open mature/lower.grid to see the stalk on columns 7 and 8, the leaves and
the ear on the right.
Read the stages file
Open corn.stages. It starts by naming its inputs:
palette corn.palette
grid lower mature/lower.grid
grid upper mature/upper.grid
stages 8
Then four shift lines:
shift 0 +2
shift 1 +2
shift 2 +1
shift 3 +1
These draw the young stages two or one shades lighter within each material, the way young vanilla wheat is brighter than ripe wheat.
The rest is two maps, one per half. A map is a 16×16 grid in which every opaque pixel of the mature plant carries the digit of the first stage it appears in. Here is the lower half:
map lower
.......55.......
.......55.......
.......44.......
.......44..77...
..44...44.777...
.4444..44.666...
44..33333.666...
.....3333666....
.......3366.....
.......22.......
.......22...33..
.......11..233..
.33....11.123...
.332...00012....
..221..00.......
...210000.......
Read it from the bottom up: at stage 0 there is only the base of the stalk. The stalk climbs a
pair of rows per stage, leaves arrive at stages 2 and 3, the ear (the 6 and 7 block on the
right) at stages 6 and 7. The upper half's map starts at stage 5, so corn becomes two blocks tall
at stage 5.
Generate the stages
texturescript stages corn.stages out
stage0 lower: pass
stage1 lower: pass
stage2 lower: pass
stage3 lower: pass
stage4 lower: pass
stage5 lower: pass
stage5 upper: pass
stage6 lower: pass
stage6 upper: pass
stage7 lower: pass
stage7 upper: pass
strip: out/strip.png
Every half of every stage was rendered and linted, and the seam between the halves was checked.
Open out/strip.png to see all eight stages side by side. Each out/stageN/ folder holds that
stage's grids and PNGs.
Change how the corn grows
Say the ear should show one stage earlier. In the lower map, the ear's pixels are the 6s and
7s on rows 3 to 8. Change every 7 in those rows to 6:
.......44..66...
..44...44.666...
Run stages again into the same folder:
texturescript stages corn.stages out
Open out/strip.png again: the tip of the ear is now there at stage 6. You changed the growth
of the whole crop by editing digits, without drawing a single stage by hand.
See it in 3D, next to vanilla
corn.toml is a scene that plants every stage in a row, a small field of mature corn and, if
you have Minecraft installed, vanilla wheat and a sunflower for scale.
texturescript view corn.toml
The scene reads corn.stages directly, so you do not need to run stages before viewing.
Change a digit in a map and save: the view updates. Drag to orbit, scroll to zoom and press l
to hide the labels.
Without a browser, take screenshots from two angles instead:
texturescript shoot corn.toml shot.png --cam 30,22,7 --cam 210,25,9
Without Minecraft, add --no-jar: the vanilla blocks are then reported as missing and left out.
What you have learned
A crop's stages come from one mature drawing plus a map of when each pixel appears. Shifts make
young stages lighter, stages renders and lints them all, and a scene shows them on the real
block model. To go further:
- Hand-edit one stage when a pixel needs to move, not just appear.
- The stages file lists every directive, including
recolour. - Why growth stages are maps explains the design.