// === BUILD PLAN ===
// Subject: COLOSSAL stag beetle (Lucanus) gripping a mossy fallen log. ORGANIC build.
// Orientation: beetle faces NORTH (-Z). Mandible tips z=-32, abdomen tail z=+18. Length ~50.
// Scale: body width 17 (x-8..8), body height 11 (y10..20), legs span x+-13, antennae y23.
//
// SIDE SILHOUETTE (Y up, Z right = tail):
// ....##......................... antennae
// ..\\####...###################### mandibles / head / thorax / elytra dome
// ...\\###..#################### (elytra dome peaks over the abdomen)
// .....||..//..||....||....||.... legs (femur out+down, tibia down, tarsus grips)
// ===========LOG (r5, along Z)=======
// ~~~~~~~forest floor~~~~~~~~~~~~~~~
//
// FRONT SILHOUETTE (Y up, X right):
// ....\\....//.... mandibles spread wide
// ....######....
// ..##########.. head + eyes
// .############. thorax
// ##..........## legs gripping the log flanks
// ....LOG r5....
//
// MATERIALS PLAN (calm value contrast, NOT per-block confetti):
// chitin : noisePalette black_concrete40/blackstone25/blue_concrete15/dark_prismarine12/
// cyan_terracotta8 — WHY: iridescent blue-black reads dark but not flat
// elytra : same ramp + polished_blackstone SLAB ridges every 3 x — WHY: wing-case ribbing
// mandible : blackstone/polished_blackstone — WHY: harder, glossier than the body
// log : noisePalette spruce_log45/stripped_spruce20/moss20/brown_mushroom_block15
// ground : terrain() forest floor podzol/moss/grass + ferns, mushrooms, spruces
// (no interior — statue)
// === END PLAN ===
var padY = 2;
var logY = 6;
var logR = 5;
var chitin = noisePalette([
{ block: 'black_concrete', weight: 40 },
{ block: 'blackstone', weight: 25 },
{ block: 'blue_concrete', weight: 15 },
{ block: 'dark_prismarine', weight: 12 },
{ block: 'cyan_terracotta', weight: 8 }
], { seed: 77, freq: 0.11 });
var chitinDark = noisePalette([
{ block: 'black_concrete', weight: 60 },
{ block: 'polished_blackstone', weight: 25 },
{ block: 'blackstone', weight: 15 }
], { seed: 12, freq: 0.15 });
var logMat = noisePalette([
{ block: 'spruce_log[axis=z]', weight: 45 },
{ block: 'stripped_spruce_log[axis=z]', weight: 20 },
{ block: 'moss_block', weight: 20 },
{ block: 'brown_mushroom_block', weight: 15 }
], { seed: 33, freq: 0.13 });
function blob3(cx, cy, cz, rx, ry, rz, mat) {
var dx, dy, dz, v;
for (dy = -ry; dy <= ry; dy++) {
for (dz = -rz; dz <= rz; dz++) {
for (dx = -rx; dx <= rx; dx++) {
v = (dx * dx) / (rx * rx) + (dy * dy) / (ry * ry) + (dz * dz) / (rz * rz);
if (v <= 1.0) { pb(cx + dx, cy + dy, cz + dz, mat); }
}
}
}
}
// === TERRAIN === forest floor
var ground = null;
try {
ground = terrain({
cx: 0, cz: 0, radius: 34, baseY: -1, amp: 4, scale: 0.06, seed: 88, irregularity: 0.42,
surface: [
{ block: 'grass_block', w: 4 },
{ block: 'podzol', w: 4 },
{ block: 'moss_block', w: 2 },
{ block: 'coarse_dirt', w: 2 }
],
sub: 'dirt', deep: 'stone', depth: 4,
pads: [{ cx: 0, cz: 0, r: 20, y: padY, falloff: 10 }]
});
} catch (terrErr) {
fill(-24, padY - 3, -30, 24, padY, 30, 'dirt');
fill(-24, padY, -30, 24, padY, 30, 'podzol');
}
// === LOG === mossy fallen trunk running N-S, the beetle grips its flanks
drawLine(2, logY, -30, -2, logY, 30, 'spruce_log[axis=z]', logR);
// broken/splintered end + bark shelf fungi
makeSphere(-2, logY, 30, logMat, 4, true);
// bark weathering: moss / stripped patches over the trunk (palette via pb, drawLine cannot take one)
var bw, bx3, by3, bz3;
for (bw = 0; bw < 900; bw++) {
bx3 = -6 + Math.floor(noise2d('perlin', bw * 2.3, 1.7) * 13);
bz3 = -30 + Math.floor(noise2d('perlin', 5.1, bw * 1.9) * 61);
by3 = 2 + Math.floor(noise2d('perlin', bw * 3.1, bw * 0.7) * 9);
if ((bx3 * bx3) / 30.0 + ((by3 - logY) * (by3 - logY)) / 26.0 > 1.0) { continue; }
pb(bx3, by3, bz3, logMat);
}
var mi, mx, mz;
for (mi = 0; mi < 14; mi++) {
mx = (mi % 2 === 0) ? 5 : -5;
mz = -26 + mi * 4;
ps(mx, logY + 2 + (mi % 3), mz, 'brown_mushroom_block[down=false,up=true,north=true,south=true,east=true,west=true]');
pb(mx, logY + 3 + (mi % 3), mz, 'moss_carpet');
}
// moss cap along the top of the log
var lz2, lx2;
for (lz2 = -30; lz2 <= 30; lz2++) {
for (lx2 = -3; lx2 <= 3; lx2++) {
if ((lx2 + lz2) % 3 === 0) { pb(lx2, logY + logR, lz2, 'moss_block'); }
}
}
// === BODY: ABDOMEN / ELYTRA ===
blob3(0, 15, 7, 8, 5, 11, chitin);
// === BODY: THORAX (pronotum) — wider, shield-shaped ===
blob3(0, 15, -5, 7, 4, 6, chitin);
// neck plate
blob3(0, 15, -9, 5, 3, 2, chitinDark);
// === HEAD ===
blob3(0, 15, -13, 5, 4, 5, chitinDark);
// eyes on the head corners
pb(-5, 17, -15, 'redstone_lamp'); pb(5, 17, -15, 'redstone_lamp');
pb(-5, 16, -15, 'obsidian'); pb(5, 16, -15, 'obsidian');
// === ELYTRA: seam + longitudinal ridges (analytic top surface of the abdomen) ===
var ez, ex, topY, r2;
for (ez = -3; ez <= 17; ez++) {
for (ex = -8; ex <= 8; ex++) {
r2 = 1.0 - ((ex * ex) / 64.0) - (((ez - 7) * (ez - 7)) / 121.0);
if (r2 <= 0) { continue; }
topY = 15 + Math.floor(5 * Math.sqrt(r2));
if (ex === 0 && ez >= -2) {
// central seam: a dark groove
pb(ex, topY, ez, 'black_concrete');
pb(ex, topY + 1, ez, 'air');
} else if (Math.abs(ex) === 3 || Math.abs(ex) === 6) {
ps(ex, topY + 1, ez, 'polished_blackstone_slab[type=bottom]');
}
}
}
// pronotum ridge + shoulder bosses
var pz2;
for (pz2 = -10; pz2 <= -1; pz2++) {
ps(0, 19, pz2, 'polished_blackstone_slab[type=bottom]');
}
blob3(-6, 17, -2, 2, 2, 2, chitinDark);
blob3(6, 17, -2, 2, 2, 2, chitinDark);
// === MANDIBLES (the antlers) — curved, spread wide, with inner teeth ===
try {
drawSpline([
{ x: -4, y: 16, z: -17 }, { x: -8, y: 18, z: -22 },
{ x: -10, y: 19, z: -27 }, { x: -9, y: 21, z: -32 }, { x: -6, y: 23, z: -35 }
], 'black_concrete', 2);
drawSpline([
{ x: 4, y: 16, z: -17 }, { x: 8, y: 18, z: -22 },
{ x: 10, y: 19, z: -27 }, { x: 9, y: 21, z: -32 }, { x: 6, y: 23, z: -35 }
], 'black_concrete', 2);
} catch (splErr) {
drawLine(-4, 16, -17, -8, 18, -24, 'black_concrete', 2);
drawLine(-8, 18, -24, -1, 18, -33, 'black_concrete', 2);
drawLine(4, 16, -17, 8, 18, -24, 'black_concrete', 2);
drawLine(8, 18, -24, 1, 18, -33, 'black_concrete', 2);
}
// inner teeth of the mandibles
var ti2;
for (ti2 = 0; ti2 < 3; ti2++) {
drawLine(-8 + ti2, 19 + ti2, -24 - ti2 * 4, -4 + ti2, 19 + ti2, -25 - ti2 * 4, 'polished_blackstone', 1);
drawLine(8 - ti2, 19 + ti2, -24 - ti2 * 4, 4 - ti2, 19 + ti2, -25 - ti2 * 4, 'polished_blackstone', 1);
}
// mandible bases (thick knuckles)
blob3(-4, 16, -17, 3, 3, 3, chitinDark);
blob3(4, 16, -17, 3, 3, 3, chitinDark);
// === ANTENNAE (short, elbowed, clubbed tips) ===
drawLine(-3, 18, -16, -6, 21, -19, 'polished_blackstone', 1);
drawLine(-6, 21, -19, -9, 22, -21, 'polished_blackstone', 1);
pb(-10, 22, -22, 'black_concrete'); pb(-10, 23, -22, 'blackstone_wall');
drawLine(3, 18, -16, 6, 21, -19, 'polished_blackstone', 1);
drawLine(6, 21, -19, 9, 22, -21, 'polished_blackstone', 1);
pb(10, 22, -22, 'black_concrete'); pb(10, 23, -22, 'blackstone_wall');
// === SIX SEGMENTED LEGS gripping the bark ===
function beetleLeg(side, zAttach, spread) {
var s = side;
// femur: out and down from the thorax
drawLine(s * 6, 13, zAttach, s * 12, 10, zAttach + spread, 'black_concrete', 2);
// tibia: down the flank of the log
drawLine(s * 12, 10, zAttach + spread, s * 9, 4, zAttach + spread + 1, 'blackstone', 2);
// tarsus: curls in and grips under the bark
drawLine(s * 9, 4, zAttach + spread + 1, s * 5, 2, zAttach + spread + 2, 'polished_blackstone', 1);
pb(s * 4, 2, zAttach + spread + 3, 'polished_blackstone');
}
beetleLeg(-1, -10, -3); beetleLeg(1, -10, -3);
beetleLeg(-1, -5, 0); beetleLeg(1, -5, 0);
beetleLeg(-1, -1, 3); beetleLeg(1, -1, 3);
// === DETAIL: FOREST FLOOR === (scatter respects the terrain height fn)
var fi, fx, fz, fy;
for (fi = 0; fi < 150; fi++) {
fx = -30 + Math.floor(noise2d('perlin', fi * 4.7, 2.2) * 60);
fz = -34 + Math.floor(noise2d('perlin', 6.6, fi * 3.9) * 68);
if (Math.abs(fx) < 7 && Math.abs(fz) < 32) { continue; }
fy = padY;
if (ground) { fy = Math.round(ground(fx, fz)); }
if (fi % 7 === 0) { pb(fx, fy + 1, fz, 'red_mushroom'); }
else if (fi % 7 === 1) { pb(fx, fy + 1, fz, 'brown_mushroom'); }
else if (fi % 7 === 2) { ps(fx, fy + 1, fz, 'large_fern[half=lower]'); ps(fx, fy + 2, fz, 'large_fern[half=upper]'); }
else if (fi % 7 === 3) { pb(fx, fy + 1, fz, 'moss_carpet'); }
else { pb(fx, fy + 1, fz, 'fern'); }
}
// big mushrooms + spruces around the clearing
var trees = [[-20, -22], [22, -18], [-24, 8], [21, 14], [-18, 26], [17, 28]];
var tj, txx, tzz, tyy;
for (tj = 0; tj < trees.length; tj++) {
txx = trees[tj][0]; tzz = trees[tj][1];
tyy = padY;
if (ground) { tyy = Math.round(ground(txx, tzz)); }
try {
placeTree(txx, tyy + 1, tzz, 'spruce');
} catch (treeErr) {
fill(txx, tyy + 1, tzz, txx, tyy + 8, tzz, 'spruce_log[axis=y]');
makeSphere(txx, tyy + 8, tzz, 'spruce_leaves[persistent=true]', 3, true);
}
}
var caps = [[-13, -18], [14, 20], [-15, 15]];
var ci, cxx, czz, cyy;
for (ci = 0; ci < caps.length; ci++) {
cxx = caps[ci][0]; czz = caps[ci][1];
cyy = padY;
if (ground) { cyy = Math.round(ground(cxx, czz)); }
fill(cxx, cyy + 1, czz, cxx, cyy + 3, czz, 'mushroom_stem');
makeSphere(cxx, cyy + 4, czz, 'red_mushroom_block', 3, false);
fill(cxx - 3, cyy + 1, czz - 3, cxx + 3, cyy + 3, czz + 3, 'air');
fill(cxx, cyy + 1, czz, cxx, cyy + 3, czz, 'mushroom_stem');
}