Ancient Trees leaf colors: notes for resource pack authors
===========================================================

This folder holds the colormaps three species read their leaf colors from. Everything below can
be replaced by a resource pack; the paths are relative to assets/ancienttrees/textures/.


Which species take which color
------------------------------

  Acemus, Kulist, Lepidos   their own colormap in this folder: colormap/<species>.png
  Lata, Nucis, Pteris,      the biome's foliage color, as vanilla's oak leaves are
  Tuopa
  Cedrum, Delnas, Ewcaly,   no tint: the leaf texture shows exactly as drawn
  Kiparis, Porffor, Salyx

The color multiplies the leaf texture, as vanilla's leaf tint does. That is why the leaf
textures of the seven tinted species (block/<species>_leaves.png) are drawn in grays: the
color comes from the tint, and a colored texture would be tinted twice. The untinted
species' leaf textures carry their own colors.


How a leaf block picks its color from a colormap
------------------------------------------------

Each leaf block reads one texel, chosen by its position. X, Y, and Z are the block's
coordinates; column and row both wrap around the colormap's size, so any coordinate works,
negative ones included.

  Acemus            column = 8 * Z + day      row = 8 * X + day
  Kulist, Lepidos   column = Z + Y            row = X + Y

Acemus steps 8 texels for each block, so neighboring leaves differ, and slides one texel
along both axes each in-game day: the whole tree shifts color day by day. "Day" counts the
world's day clock, 24000 ticks to a day, so sleeping through a night or /time set moves it
too; it repeats after 256 days. Kulist and Lepidos run diagonally with height, giving streaks
across and up the tree, and do not change over time.

A leaf's color is fixed when its chunk section is built. A new day's Acemus color shows as
sections rebuild (when a block nearby changes, or the chunk reloads), not all at once.

Items of the colormapped leaves read the texel at column 128, row 128: the middle of the
shipped maps. Items of the biome-colored species use vanilla's default foliage color.


Making your own colormaps
-------------------------

- Any size works. The shipped maps are 256 by 256, like vanilla's colormaps. A smaller map
  repeats more often across a forest; a map of another size still gives every block a texel.
- Draw the map to tile in both directions. Columns and rows wrap, so a seam at an edge shows
  as a seam through the trees.
- Colors are read as RGB; alpha is ignored.
- The game reads the maps when resources load (startup, F3 + T, and changing resource packs).
  A missing or unreadable map gives every leaf of that species one fixed color, and the log
  names the file.
- If you recolor the leaf textures of a tinted species, keep them gray, or the colormap will
  tint your colors.


Seed leaves
-----------

A grown tree has one or more seed leaves, which drop the species' sapling. A seed leaf is the
species' leaves with a second layer drawn over them: block/<species>_seed_leaves.png. That layer
is never tinted, so the seed keeps its own colors on every species.

- Make the seed itself opaque and everything else in that texture transparent.
- Give the transparent texels the same RGB as the species' leaf texture
  (block/<species>_leaves.png), not black. With Fast graphics the game draws leaves solid and
  ignores alpha, so the whole overlay shows: transparent texels that hold the leaf texture's
  colors make a seed leaf look like a plain, untinted leaf with its seed, and black ones would
  show as a black block.
- Keep the seed small, in a saturated color set well apart from the leaves' color, so it is
  easy to tell from its leaves.
