// === BUILD PLAN ===
// Subject: crewed deep-submergence vehicle (DSV) parked on a pale abyssal shelf. Bow faces +Z (camera).
// Footprint: 50 long (z12..z62) x 13 wide x 22 tall. Hull axis along Z at (cx=24, cy=17).
// Y levels: seabed top Y6 | skid runners Y8 | hull belly Y11 | hull axis Y17 | sail top Y27 | mast Y31
// CABIN floor Y15, walk Y16, cabin ceiling ~Y20 (4 blocks of air)
//
// SIDE ELEVATION (z increases to the right = toward the bow / camera):
// mast| ___ floodlight bar
// ####sail#### /oo\
// ()==#####################____( POD )--arm--<claw>
// ()==##################### \__/ [basket]
// skid=====strut=====skid
// ~~~~~~~~ pale sand, rocks, glass sponges ~~~~~~~~
//
// CROSS SECTION at z=36 (looking forward):
// ##### <- sail fairing
// YYYYYYYYY <- yellow upper hull
// YYYY___YYYY <- cabin cavity (r 3.4)
// KKKK KKKK <- black waterline stripe at Y17
// WWWW___WWWW <- white lower hull
// WWWWWWWWW
// [] [] <- sled skids
//
// MATERIALS PLAN (livery by VOLUME, not random):
// upper hull : yellow_concrete(60)+yellow_terracotta(22)+honeycomb_block(18) WHY: the hi-vis yellow a DSV really wears
// stripe Y17 : black_concrete WHY: crisp value break = the hull reads cigar-shaped, not a blob
// lower hull : white_concrete(58)+light_gray_concrete(27)+iron_block(15) WHY: cold white belly, contrast against the sand
// ribs : light_gray_concrete bands at z26/32/38/44 WHY: surface relief so the hull is not a smooth sausage
// pod : light_gray_concrete/iron_block shell + light_blue_stained_glass acrylic viewport
// machinery : polished_deepslate + gray_concrete + iron_bars (Metal/Engine palettes)
// arms/basket : orange_concrete + orange_terracotta (the one saturated accent), iron_bars basket
// seabed : sand(58)/gravel(22)/clay(12)/white_terracotta(8) patches, deepslate+basalt rocks,
// bone_block + sea_lantern glass sponges
// Cabin: pilot seat at the viewport, instrument bank, sample barrels, brewing rig, hanging sea lanterns,
// iron ladder up the sail trunk to a top hatch (navigable from outside)
// PROCESS: DIRECT (organic swept shape) - swept radius profile + sphere pod, then carve the cabin, then detail.
// === END PLAN ===
var cx = 24, cy = 17;
var SEA = 6;
function mat(p, x, y, z) { return (typeof p === 'function') ? p(x, y, z) : p; }
function discZ(ax, ay, z, r, pat) {
var dx, dy, rr = r * r, ri = Math.ceil(r);
for (dx = -ri; dx <= ri; dx++) for (dy = -ri; dy <= ri; dy++) {
if (dx * dx + dy * dy <= rr) pb(ax + dx, ay + dy, z, mat(pat, ax + dx, ay + dy, z));
}
}
function ringZ(ax, ay, z, r, thick, pat) {
var dx, dy, ri = Math.ceil(r), d;
for (dx = -ri; dx <= ri; dx++) for (dy = -ri; dy <= ri; dy++) {
d = Math.sqrt(dx * dx + dy * dy);
if (d <= r && d >= r - thick) pb(ax + dx, ay + dy, z, mat(pat, ax + dx, ay + dy, z));
}
}
function sphere(ax, ay, az, r, pat) {
var dx, dy, dz, rr = r * r, ri = Math.ceil(r);
for (dx = -ri; dx <= ri; dx++) for (dy = -ri; dy <= ri; dy++) for (dz = -ri; dz <= ri; dz++) {
if (dx * dx + dy * dy + dz * dz <= rr) pb(ax + dx, ay + dy, az + dz, mat(pat, ax + dx, ay + dy, az + dz));
}
}
function seg(x1, y1, z1, x2, y2, z2, pat) {
var n = Math.max(Math.abs(x2 - x1), Math.abs(y2 - y1), Math.abs(z2 - z1)), i, t, x, y, z;
for (i = 0; i <= n; i++) {
t = (n === 0) ? 0 : i / n;
x = Math.round(x1 + (x2 - x1) * t); y = Math.round(y1 + (y2 - y1) * t); z = Math.round(z1 + (z2 - z1) * t);
pb(x, y, z, mat(pat, x, y, z));
}
}
// ---- palettes ----
var yellowPal = noisePalette([{ block: 'yellow_concrete', weight: 60 }, { block: 'yellow_terracotta', weight: 22 }, { block: 'honeycomb_block', weight: 18 }], { freq: 0.18 });
var whitePal = noisePalette([{ block: 'white_concrete', weight: 58 }, { block: 'light_gray_concrete', weight: 27 }, { block: 'iron_block', weight: 15 }], { freq: 0.18 });
var podPal = noisePalette([{ block: 'light_gray_concrete', weight: 52 }, { block: 'iron_block', weight: 30 }, { block: 'polished_deepslate', weight: 18 }], { freq: 0.2 });
var machPal = noisePalette([{ block: 'polished_deepslate', weight: 45 }, { block: 'gray_concrete', weight: 35 }, { block: 'deepslate_tiles', weight: 20 }], { freq: 0.22 });
var armPal = noisePalette([{ block: 'orange_concrete', weight: 64 }, { block: 'orange_terracotta', weight: 36 }], { freq: 0.25 });
var rockPal = noisePalette([{ block: 'deepslate', weight: 38 }, { block: 'cobbled_deepslate', weight: 26 }, { block: 'basalt', weight: 22 }, { block: 'tuff', weight: 14 }], { freq: 0.2 });
// livery: yellow above the stripe, black stripe on the axis, white below
function livery(x, y, z) {
if (y === cy) return 'black_concrete';
if (y > cy) return yellowPal(x, y, z);
return whitePal(x, y, z);
}
// ---- 1. SEABED (terrain superpowers, flatten's return captured) ----
var sea = zoneRect(0, 0, 47, 71);
var hb = hills({ base: SEA, amp: 2, scale: 0.055, seed: 21 });
var pad = flatten(hb, { x0: 12, z0: 10, x1: 36, z1: 64 }, SEA, 9);
var smat = patches([{ block: 'sand', w: 58 }, { block: 'gravel', w: 22 }, { block: 'clay', w: 12 }, { block: 'white_terracotta', w: 8 }], 0.07, 6);
fill(0, 0, 0, 47, SEA - 3, 71, 'stone');
surface(sea, pad, smat, { sub: 'sand', deep: 'stone', depth: 5 });
// ---- 2. HULL: swept radius profile along Z ----
var prof = [[14, 2.2], [18, 3.3], [22, 4.7], [26, 5.7], [30, 6.0], [42, 6.0], [46, 5.6], [49, 5.0]];
function hullR(z) {
var i, t;
if (z < prof[0][0] || z > prof[prof.length - 1][0]) return -1;
for (i = 0; i < prof.length - 1; i++) {
if (z >= prof[i][0] && z <= prof[i + 1][0]) {
t = (z - prof[i][0]) / (prof[i + 1][0] - prof[i][0]);
return prof[i][1] + t * (prof[i + 1][1] - prof[i][1]);
}
}
return -1;
}
var z, r, x, y, i;
for (z = 14; z <= 49; z++) { r = hullR(z); if (r > 0) discZ(cx, cy, z, r, livery); }
// bow observation pod (steel sphere)
sphere(cx, cy, 53, 5.2, podPal);
// pod collar where it meets the hull
ringZ(cx, cy, 49, 5.4, 1.2, machPal);
ringZ(cx, cy, 50, 5.0, 1.2, machPal);
// ---- 3. CARVE THE CABIN (continuous hull -> pod) ----
function outerR(zz) {
if (zz >= 48) { var d = zz - 53; var q = 5.2 * 5.2 - d * d; return q > 0 ? Math.sqrt(q) : -1; }
return hullR(zz);
}
for (z = 30; z <= 56; z++) {
var orr = outerR(z);
if (orr < 0) continue;
var ir = Math.min(3.4, orr - 1.3);
if (ir >= 1) discZ(cx, cy, z, ir, 'air');
}
// cabin deck + ceiling trim
for (z = 30; z <= 55; z++) fill(cx - 2, 15, z, cx + 2, 15, z, 'smooth_stone');
for (z = 31; z <= 54; z += 4) fill(cx - 2, 20, z, cx + 2, 20, z, 'deepslate_tiles');
// ---- 4. ACRYLIC VIEWPORT at the bow ----
ringZ(cx, cy, 56, 3.5, 1.0, 'iron_block');
discZ(cx, cy, 56, 2.6, 'light_blue_stained_glass');
discZ(cx, cy, 57, 1.6, 'light_blue_stained_glass');
// small side portholes on the pod
ps(cx - 5, cy, 53, 'light_blue_stained_glass'); ps(cx + 5, cy, 53, 'light_blue_stained_glass');
ps(cx, cy + 5, 53, 'light_blue_stained_glass');
// ---- 5. HULL RIBS + HATCH RINGS (surface relief, not a smooth sausage) ----
var ribz = [26, 32, 38, 44];
for (i = 0; i < ribz.length; i++) ringZ(cx, cy, ribz[i], hullR(ribz[i]), 1.0, 'light_gray_concrete');
// ballast tank blisters on the flanks
for (z = 28; z <= 44; z += 8) {
seg(cx - 6, cy - 2, z, cx - 6, cy - 2, z + 4, machPal);
seg(cx + 6, cy - 2, z, cx + 6, cy - 2, z + 4, machPal);
}
// ---- 6. SAIL / CONNING FAIRING + MAST ----
fill(cx - 2, 22, 32, cx + 2, 26, 38, yellowPal);
for (x = cx - 2; x <= cx + 2; x++) { roofStair(x, 27, 32, 'yellow_terracotta_stairs', 'north'); roofStair(x, 27, 38, 'yellow_terracotta_stairs', 'south'); }
fill(cx - 1, 27, 33, cx + 1, 27, 37, 'yellow_concrete');
ringZ(cx, 24, 32, 2.0, 1.0, 'light_gray_concrete');
// mast + strobe + antennae
fill(cx, 28, 35, cx, 31, 35, 'iron_bars');
pb(cx, 32, 35, 'red_concrete'); ps(cx, 33, 35, 'redstone_lamp[lit=true]');
ps(cx - 1, 29, 35, 'lightning_rod[facing=up]'); ps(cx + 1, 29, 35, 'lightning_rod[facing=up]');
// ---- 7. LADDER TRUNK from the sail hatch into the cabin ----
fill(cx, 16, 35, cx, 26, 35, 'iron_block'); // ladder backing column
fill(cx, 16, 36, cx, 26, 36, 'air'); // the trunk itself
for (y = 16; y <= 26; y++) ps(cx, y, 36, 'ladder[facing=south]');
ps(cx, 27, 36, 'iron_trapdoor[facing=north,half=bottom,open=true]');
pb(cx, 28, 36, 'iron_bars');
// ---- 8. STERN: twin ducted thrusters, fins, dive planes ----
function duct(dx) {
var zz;
for (zz = 14; zz <= 17; zz++) ringZ(cx + dx, cy, zz, 3.2, 1.1, machPal);
ringZ(cx + dx, cy, 13, 3.4, 1.4, 'polished_deepslate');
// hub + blades
fill(cx + dx, cy, 15, cx + dx, cy, 17, 'iron_block');
for (zz = 15; zz <= 16; zz++) {
seg(cx + dx - 2, cy, zz, cx + dx + 2, cy, zz, 'iron_bars');
seg(cx + dx, cy - 2, zz, cx + dx, cy + 2, zz, 'iron_bars');
}
// pylon back to the hull
seg(cx + dx, cy, 18, cx + (dx > 0 ? 3 : -3), cy, 21, machPal);
}
duct(-6); duct(6);
// horizontal dive planes + vertical stabiliser
fill(cx - 11, cy + 1, 18, cx - 7, cy + 1, 22, 'yellow_concrete');
fill(cx + 7, cy + 1, 18, cx + 11, cy + 1, 22, 'yellow_concrete');
for (x = cx - 11; x <= cx - 7; x++) roofStair(x, cy + 2, 18, 'yellow_terracotta_stairs', 'north');
for (x = cx + 7; x <= cx + 11; x++) roofStair(x, cy + 2, 18, 'yellow_terracotta_stairs', 'north');
fill(cx, cy + 6, 16, cx, 26, 22, 'yellow_concrete');
fill(cx, 27, 19, cx, 27, 22, 'yellow_terracotta');
ps(cx, cy + 6, 15, 'yellow_terracotta_stairs[facing=south,half=bottom]');
// ---- 9. SLED SKIDS + STRUTS ----
for (z = 18; z <= 52; z++) {
pb(cx - 7, 8, z, 'polished_deepslate'); pb(cx + 7, 8, z, 'polished_deepslate');
if (z === 18 || z === 52) { pb(cx - 7, 9, z, 'polished_deepslate'); pb(cx + 7, 9, z, 'polished_deepslate'); }
}
ps(cx - 7, 9, 53, 'deepslate_tile_stairs[facing=south,half=bottom]');
ps(cx + 7, 9, 53, 'deepslate_tile_stairs[facing=south,half=bottom]');
ps(cx - 7, 9, 17, 'deepslate_tile_stairs[facing=north,half=bottom]');
ps(cx + 7, 9, 17, 'deepslate_tile_stairs[facing=north,half=bottom]');
var strutz = [22, 30, 38, 46];
for (i = 0; i < strutz.length; i++) {
seg(cx - 7, 9, strutz[i], cx - 4, 12, strutz[i], machPal);
seg(cx + 7, 9, strutz[i], cx + 4, 12, strutz[i], machPal);
}
// ---- 10. MANIPULATOR ARMS (orange, articulated) + SAMPLE BASKET ----
function arm(sx) {
var s = (sx < 0) ? -1 : 1;
seg(cx + 4 * s, 13, 50, cx + 7 * s, 12, 54, armPal); // shoulder -> elbow
pb(cx + 7 * s, 12, 54, 'orange_terracotta');
seg(cx + 7 * s, 12, 54, cx + 5 * s, 10, 59, armPal); // forearm
pb(cx + 5 * s, 10, 59, 'polished_deepslate'); // wrist
// claw
ps(cx + 5 * s, 10, 60, 'iron_bars');
ps(cx + 4 * s, 10, 61, 'polished_deepslate_slab[type=bottom]');
ps(cx + 6 * s, 10, 61, 'polished_deepslate_slab[type=bottom]');
// hydraulic rams
seg(cx + 5 * s, 14, 51, cx + 7 * s, 13, 54, 'iron_bars');
}
arm(-1); arm(1);
// sample basket slung under the bow
fill(cx - 2, 8, 59, cx + 2, 8, 62, 'iron_bars');
fill(cx - 2, 9, 59, cx + 2, 9, 59, 'iron_bars');
fill(cx - 2, 9, 62, cx + 2, 9, 62, 'iron_bars');
fill(cx - 2, 9, 60, cx - 2, 9, 61, 'iron_bars');
fill(cx + 2, 9, 60, cx + 2, 9, 61, 'iron_bars');
pb(cx - 1, 9, 60, 'brain_coral_block'); pb(cx + 1, 9, 61, 'tube_coral_block');
pb(cx, 9, 61, 'sponge');
seg(cx - 2, 10, 59, cx - 3, 11, 57, machPal); seg(cx + 2, 10, 59, cx + 3, 11, 57, machPal);
// ---- 11. FLOODLIGHT ARRAY over the pod ----
fill(cx - 4, 23, 55, cx + 4, 23, 55, 'polished_deepslate');
seg(cx - 4, 23, 55, cx - 3, 21, 52, machPal); seg(cx + 4, 23, 55, cx + 3, 21, 52, machPal);
pb(cx - 3, 22, 55, 'sea_lantern'); pb(cx, 22, 55, 'sea_lantern'); pb(cx + 3, 22, 55, 'sea_lantern');
ps(cx - 3, 23, 55, 'deepslate_tile_slab[type=bottom]'); ps(cx, 23, 55, 'deepslate_tile_slab[type=bottom]');
ps(cx + 3, 23, 55, 'deepslate_tile_slab[type=bottom]');
// lower bow lamps
pb(cx - 4, 12, 56, 'sea_lantern'); pb(cx + 4, 12, 56, 'sea_lantern');
// ---- 12. CABIN INTERIOR ----
chairStair(cx, 16, 54, 'polished_blackstone_stairs', 'south'); // pilot seat facing the viewport
pb(cx - 2, 16, 55, 'observer'); pb(cx + 2, 16, 55, 'observer');
ps(cx - 1, 16, 55, 'daylight_detector'); ps(cx + 1, 16, 55, 'daylight_detector');
ps(cx - 2, 17, 55, 'iron_trapdoor[facing=north,half=top,open=false]');
ps(cx + 2, 17, 55, 'iron_trapdoor[facing=north,half=top,open=false]');
ps(cx - 1, 17, 55, 'lever[face=wall,facing=south]');
ps(cx + 1, 17, 55, 'stone_button[face=wall,facing=south]');
rug(cx - 1, 16, 49, 3, 4, 'light_blue', 'blue');
// science bay
pb(cx - 2, 16, 45, 'barrel[facing=up]'); pb(cx + 2, 16, 45, 'barrel[facing=up]');
pb(cx - 2, 17, 45, 'barrel[facing=up]');
ps(cx + 2, 16, 43, 'brewing_stand');
pb(cx - 2, 16, 41, 'chest[facing=east,type=single]');
pb(cx + 2, 16, 41, 'cartography_table');
ps(cx - 2, 16, 39, 'cauldron[level=1]');
chairStair(cx + 2, 16, 33, 'polished_blackstone_stairs', 'west');
pb(cx - 2, 16, 33, 'crafting_table');
pb(cx - 2, 16, 31, 'furnace[facing=east]');
// cabin lighting
for (z = 33; z <= 53; z += 5) { pb(cx, 20, z, 'deepslate_tiles'); ps(cx, 19, z, 'lantern[hanging=true]'); }
pb(cx + 2, 16, 51, 'sea_lantern');
// ---- 13. SEABED SCENE: rocks, glass sponges, sediment ----
function rock(rx, rz, rr) { sphere(rx, SEA - 1, rz, rr, rockPal); }
rock(8, 16, 4); rock(40, 24, 3.5); rock(10, 46, 3); rock(41, 56, 4);
rock(16, 64, 2.5); rock(34, 8, 3); rock(6, 34, 2.5); rock(44, 40, 2.5);
function sponge(sx, sz, hgt) {
var yy;
for (yy = 0; yy < hgt; yy++) pb(sx, SEA + 1 + yy, sz, 'bone_block[axis=y]');
pb(sx, SEA + 1 + hgt, sz, 'sea_lantern');
ps(sx, SEA + 2 + hgt, sz, 'white_stained_glass');
ps(sx + 1, SEA + 1 + hgt, sz, 'white_stained_glass_pane');
ps(sx - 1, SEA + hgt, sz, 'white_stained_glass_pane');
}
sponge(12, 20, 3); sponge(38, 18, 2); sponge(9, 52, 4); sponge(39, 50, 3);
sponge(14, 66, 2); sponge(33, 64, 3); sponge(43, 34, 2); sponge(5, 40, 3);
// coral colour accents on the rocks
pb(8, SEA + 3, 16, 'horn_coral_block'); pb(40, SEA + 2, 24, 'brain_coral_block');
pb(41, SEA + 3, 56, 'bubble_coral_block'); pb(10, SEA + 2, 46, 'fire_coral_block');
// sea pickles + sediment
noisyScatter(2, SEA + 1, 2, 45, SEA + 1, 69, 'sea_pickle', 0.035, 12);
noisyScatter(2, SEA + 1, 2, 45, SEA + 1, 69, 'dead_bush', 0.02, 31);
noisyScatter(0, SEA, 0, 47, SEA, 71, 'gravel', 0.14, 8);
// disturbed sediment trail the skids ploughed in
fill(cx - 8, SEA, 54, cx - 6, SEA, 68, 'gravel');
fill(cx + 6, SEA, 54, cx + 8, SEA, 68, 'gravel');
// marker beacon + tether buoy line at the stern
fill(cx - 9, SEA + 1, 12, cx - 9, SEA + 4, 12, 'iron_bars');
pb(cx - 9, SEA + 5, 12, 'sea_lantern');
// ---- FIX PASS ----
// FIX 1: the acrylic nose was buried behind the pod's own front blocks -> build the whole cap in glass
ringZ(cx, cy, 56, 4.3, 1.1, 'iron_block');
discZ(cx, cy, 56, 3.2, 'light_blue_stained_glass');
discZ(cx, cy, 57, 3.2, 'light_blue_stained_glass');
discZ(cx, cy, 58, 1.6, 'light_blue_stained_glass');
ringZ(cx, cy, 55, 4.8, 1.0, 'iron_block');
// FIX 2: the ladder trunk's backing column stood on the cabin centreline and split the walkway.
// Restore the hull/sail where it passed, then rebuild the trunk one block to starboard.
var fy;
for (fy = 16; fy <= 20; fy++) { pb(cx, fy, 35, 'air'); pb(cx, fy, 36, 'air'); }
for (fy = 21; fy <= 26; fy++) { pb(cx, fy, 35, yellowPal(cx, fy, 35)); pb(cx, fy, 36, yellowPal(cx, fy, 36)); }
pb(cx, 27, 36, 'yellow_concrete');
pb(cx, 28, 36, 'air');
fill(cx + 1, 16, 35, cx + 1, 26, 35, 'iron_block');
fill(cx + 1, 16, 36, cx + 1, 26, 36, 'air');
for (fy = 16; fy <= 26; fy++) ps(cx + 1, fy, 36, 'ladder[facing=south]');
ps(cx + 1, 27, 36, 'iron_trapdoor[facing=north,half=bottom,open=true]');