// === BUILD PLAN ===
// Subject: GIANT CHAMELEON gripping a thick jungle branch (organic statue, colossal)
// Axis: nose at +X (x~64), tail spiral at -X (x~13). Branch = horizontal log at y20, z40.
//
// SIDE SILHOUETTE (X horizontal, Y vertical):
// casque
// /\ ___
// ___ / \ ____/ \__ back crest (S-curve)
// (spiral) \/ / \
// tail ||/ body \ head + turret eye
// ==========BRANCH=========== legs clamp over/under the log
//
// CROSS-SECTION (chameleons are LATERALLY FLATTENED: ry > rz):
// .##. ry = 3 + 4*sin(pi*t) (tall)
// #### rz = 2.5 + 3.5*sin(pi*t) (narrow)
// .##.
//
// MATERIALS PLAN (gradient by HEIGHT + vertical BANDING every 7 blocks — WHY: reads as reptile skin):
// back (y>=32): warped_planks / warped_stem / cyan_terracotta — deep teal
// flank (28-31): moss_block / green_concrete / lime_terracotta — lime
// belly (y<28) : yellow_terracotta / honeycomb_block / yellow_concrete — warm yellow
// bands : green_terracotta / dried_kelp_block — darker stripes
// crest : lime stairs+slabs; eye = yellow turret + black pupil; branch = jungle_log
// Scene: jungle floor (terrain), two trunks holding the branch, vines, ferns, leaves
// === END PLAN ===
var i, x, y, z, dy, dz, t, a;
var CZ = 40; // body centre line
var BRANCH_Y = 20;
// ============ TERRAIN ============
var gh = terrain({
cx: 42, cz: 32, radius: 38, baseY: 8, amp: 2.5, scale: 0.05, seed: 9, irregularity: 0.4,
surface: [{ block: "grass_block", w: 55 }, { block: "moss_block", w: 25 }, { block: "podzol", w: 20 }],
sub: "dirt", deep: "stone", depth: 4
});
// ============ PALETTES ============
function skin(x, y, z) {
var band = ((x % 7) + 7) % 7;
var dark = (band < 2);
if (y >= 33) {
if (dark) return (((x + z) % 2) === 0) ? "green_terracotta" : "dried_kelp_block";
return (((x * 3 + z * 5 + y) % 3) === 0) ? "warped_stem" : ((((x + y) % 4) === 0) ? "cyan_terracotta" : "warped_planks");
}
if (y >= 28) {
if (dark) return (((x + z) % 2) === 0) ? "green_terracotta" : "moss_block";
return (((x * 5 + z * 3 + y) % 3) === 0) ? "green_concrete" : ((((x + z) % 4) === 0) ? "lime_terracotta" : "moss_block");
}
if (dark) return (((x + z) % 2) === 0) ? "green_terracotta" : "lime_terracotta";
return (((x * 7 + z + y) % 3) === 0) ? "honeycomb_block" : ((((x + z) % 5) === 0) ? "yellow_concrete" : "yellow_terracotta");
}
function tailSkin(idx, y) {
if ((idx % 6) < 2) return "green_terracotta";
if ((idx % 6) < 3) return "moss_block";
return (((idx + y) % 3) === 0) ? "honeycomb_block" : "yellow_terracotta";
}
// ellipse slice in the (Y,Z) plane at a given x — ry vertical, rz horizontal (flattened body)
function slice(sx, cy, cz, ry, rz, matFn) {
var ddy, ddz, v;
for (ddy = -Math.ceil(ry); ddy <= Math.ceil(ry); ddy++) {
for (ddz = -Math.ceil(rz); ddz <= Math.ceil(rz); ddz++) {
v = (ddy * ddy) / (ry * ry) + (ddz * ddz) / (rz * rz);
if (v <= 1.04) pb(sx, cy + ddy, cz + ddz, matFn(sx, cy + ddy, cz + ddz));
}
}
}
// ============ BRANCH ============
var bark = noisePalette([{ block: "jungle_log[axis=x]", weight: 55 }, { block: "stripped_jungle_log[axis=x]", weight: 20 }, { block: "brown_mushroom_block", weight: 12 }, { block: "moss_block", weight: 13 }]);
drawLine(2, BRANCH_Y, CZ, 81, BRANCH_Y, CZ, "jungle_log[axis=x]", 3.2);
drawLine(24, BRANCH_Y - 1, CZ - 1, 60, BRANCH_Y - 2, CZ + 1, "stripped_jungle_log[axis=x]", 1.6);
// bark texture pass (drawLine only takes a plain block id, so mottle it afterwards)
var bx, by, bz;
for (bx = 2; bx <= 81; bx++) {
for (by = BRANCH_Y - 3; by <= BRANCH_Y + 3; by++) {
for (bz = CZ - 3; bz <= CZ + 3; bz++) {
if (((bx * 5 + by * 3 + bz * 7) % 9) === 0) pb(bx, by, bz, bark(bx, by, bz));
}
}
}
// two trunks that carry the branch
makeCylinder(8, 6, CZ, noisePalette([{ block: "jungle_log[axis=y]", weight: 65 }, { block: "stripped_jungle_log[axis=y]", weight: 15 }, { block: "moss_block", weight: 20 }]), 3, 16, true);
makeCylinder(74, 6, CZ, noisePalette([{ block: "jungle_log[axis=y]", weight: 65 }, { block: "stripped_jungle_log[axis=y]", weight: 15 }, { block: "moss_block", weight: 20 }]), 3, 16, true);
// ============ BODY ============
var ry, rz, cy;
for (x = 24; x <= 50; x++) {
t = (x - 24) / 26.0;
ry = 3.0 + 4.0 * Math.sin(Math.PI * t);
rz = 2.4 + 3.4 * Math.sin(Math.PI * t);
cy = 24.5 + ry * 0.92;
slice(x, Math.round(cy), CZ, ry, rz, skin);
// dorsal crest — saw-tooth ridge along the spine
if ((x % 2) === 0) {
ps(x, Math.round(cy + ry) + 1, CZ, "lime_terracotta");
if (ry > 5.5) ps(x, Math.round(cy + ry) + 2, CZ, "green_terracotta");
}
// belly keel (yellow, darker underline)
pb(x, Math.round(cy - ry) - 1, CZ, "honeycomb_block");
}
// ============ NECK_HEAD ============
for (x = 51; x <= 63; x++) {
t = (x - 51) / 12.0;
ry = 6.4 - 3.4 * t - 1.6 * t * t;
rz = 5.4 - 2.2 * t - 1.4 * t * t;
if (ry < 1.4) ry = 1.4;
if (rz < 1.2) rz = 1.2;
cy = 30.4 + 0.6 * t;
slice(x, Math.round(cy), CZ, ry, rz, skin);
}
// casque (the helmet crest at the back of the skull) — a raised triangular fin
for (x = 49; x <= 57; x++) {
var hgt = 5 - Math.abs(x - 52);
if (hgt > 0) {
for (y = 0; y < hgt + 2; y++) {
pb(x, 36 + y, CZ, (y > hgt - 1) ? "green_terracotta" : "warped_planks");
if (y < hgt - 1) { pb(x, 36 + y, CZ - 1, "warped_stem"); pb(x, 36 + y, CZ + 1, "warped_stem"); }
}
}
}
// jaw line + closed mouth
for (x = 56; x <= 63; x++) {
ps(x, 28, CZ + 3, "green_terracotta");
ps(x, 28, CZ - 3, "green_terracotta");
pb(x, 27, CZ, "yellow_terracotta");
}
// snout tip
slice(64, 30, CZ, 1.6, 1.4, skin);
pb(65, 30, CZ, "yellow_terracotta");
ps(65, 29, CZ, "honeycomb_block");
// TURRET EYES (independently swivelling cones) both sides
function eye(ez) {
var sgn = (ez > CZ) ? 1 : -1;
makeSphere(57, 32, ez, "yellow_terracotta", 2, true);
makeSphere(57, 32, ez + sgn, "honeycomb_block", 1, true);
pb(57, 32, ez + sgn * 2, "black_concrete");
pb(57, 33, ez + sgn * 2, "green_terracotta");
pb(57, 31, ez + sgn * 2, "green_terracotta");
pb(56, 34, ez + sgn, "lime_terracotta");
pb(58, 34, ez + sgn, "lime_terracotta");
}
eye(CZ + 4); eye(CZ - 4);
// ============ TAIL ============
for (x = 23; x >= 19; x--) {
t = (23 - x) / 5.0;
ry = 3.2 - 1.1 * t; rz = 2.6 - 0.9 * t;
cy = 27.5 - 2.0 * t;
slice(x, Math.round(cy), CZ, ry, rz, skin);
}
// coiled spiral at the tip (flat spiral in the X/Y plane)
var sc_x = 14.5, sc_y = 29.5, rr, px, py, idx = 0;
for (a = 0; a <= 5.4 * Math.PI; a += 0.10) {
var rad = 6.6 - a * 0.355;
if (rad < 0.6) rad = 0.6;
px = sc_x + rad * Math.cos(a);
py = sc_y + rad * Math.sin(a);
rr = 2.3 - a * 0.10;
if (rr < 0.7) rr = 0.7;
idx = Math.round(a * 3);
for (dy = -Math.ceil(rr); dy <= Math.ceil(rr); dy++) {
for (dz = -Math.ceil(rr); dz <= Math.ceil(rr); dz++) {
for (var ddx = -Math.ceil(rr); ddx <= Math.ceil(rr); ddx++) {
if (dy * dy + dz * dz + ddx * ddx <= rr * rr + 0.4) {
pb(Math.round(px) + ddx, Math.round(py) + dy, CZ + dz, tailSkin(idx, Math.round(py) + dy));
}
}
}
}
}
// connect body tail-base to the start of the coil
drawLine(19, 25, CZ, Math.round(sc_x + 6.6), Math.round(sc_y), CZ, "moss_block", 2.2);
drawLine(20, 26, CZ, 21, 28, CZ, "lime_terracotta", 1.8);
// ============ LEGS_FEET ============
function leg(lx, side) {
var sz = CZ + side * 4;
drawLine(lx, 28, sz, lx + side * 0, 24, CZ + side * 8, "moss_block", 1.7); // upper limb out to the elbow
drawLine(lx, 24, CZ + side * 8, lx, 21, CZ + side * 4, "green_concrete", 1.5); // forearm back in to the branch
// zygodactyl foot: two toes OVER the log, two UNDER — a real clamp
pb(lx, 23, CZ + side * 3, "green_terracotta");
pb(lx + 1, 23, CZ + side * 2, "green_terracotta");
pb(lx, 22, CZ + side * 2, "lime_terracotta");
pb(lx, 17, CZ + side * 3, "green_terracotta");
pb(lx + 1, 18, CZ + side * 2, "green_terracotta");
pb(lx, 19, CZ + side * 4, "moss_block");
pb(lx - 1, 20, CZ + side * 4, "moss_block");
}
leg(29, 1); leg(29, -1); leg(45, 1); leg(45, -1);
// ============ SCENE ============
// hanging vines from the branch + foliage at the two trunks
for (x = 4; x <= 78; x += 3) {
if (x < 22 || x > 50) {
var vl = 3 + ((x * 7) % 5);
for (y = 0; y < vl; y++) ps(x, BRANCH_Y - 3 - y, CZ + 3, "vine[south=true]");
for (y = 0; y < vl - 1; y++) ps(x, BRANCH_Y - 3 - y, CZ - 3, "vine[north=true]");
}
}
var canopy = noisePalette([{ block: "jungle_leaves[persistent=true]", weight: 70 }, { block: "azalea_leaves[persistent=true]", weight: 18 }, { block: "flowering_azalea_leaves[persistent=true]", weight: 12 }]);
makeSphere(8, 46, CZ, canopy, 9, true);
makeSphere(74, 46, CZ, canopy, 9, true);
makeSphere(6, 40, CZ + 7, canopy, 5, true);
makeSphere(76, 41, CZ - 7, canopy, 5, true);
fill(8, 22, CZ, 8, 45, CZ, "jungle_log[axis=y]");
fill(74, 22, CZ, 74, 45, CZ, "jungle_log[axis=y]");
// jungle floor: ferns, bushes, a fallen log, a small pool
var undergrowth = ["fern", "short_grass", "jungle_sapling", "bamboo", "poppy"];
for (x = 4; x <= 80; x++) {
for (z = 8; z <= 60; z++) {
if (((x * 13 + z * 7) % 11) === 0) pb(x, Math.round(gh(x, z)) + 1, z, undergrowth[(x + z) % 5]);
}
}
for (x = 20; x <= 34; x++) pb(x, Math.round(gh(x, 18)) + 1, 18, "moss_block");
drawLine(20, 9, 17, 36, 9, 20, "jungle_log[axis=x]", 1.8);
makeSphere(56, 8, 20, "water", 4, true);
makeSphere(56, 10, 20, "air", 4, true);
for (i = 0; i < 6; i++) {
makeSphere(50 + i * 3, 9, 54 + (i % 3), noisePalette([{ block: "moss_block", weight: 60 }, { block: "mossy_cobblestone", weight: 40 }]), 2, true);
}