// Observatory: round tower with copper dome + stone wing with library and hall
// ground
fill(6, 0, 6, 74, 0, 74, 'stone');
fill(6, 1, 6, 74, 1, 74, 'dirt');
fill(6, 2, 6, 74, 2, 74, 'grass_block');
var groundY = 2;
var floorY = 3;
// ---------- round tower ----------
var cx = 26;
var cz = 40;
var r = 8;
// tower wall
for (var y = floorY; y <= 30; y++) {
for (var x = cx - r; x <= cx + r; x++) {
for (var z = cz - r; z <= cz + r; z++) {
var dx = x - cx;
var dz = z - cz;
var dist = Math.sqrt(dx * dx + dz * dz);
if (dist <= r && dist > r - 1) {
pb(x, y, z, 'stone_bricks');
}
}
}
}
// tower floor + telescope floor
for (var x2 = cx - r; x2 <= cx + r; x2++) {
for (var z2 = cz - r; z2 <= cz + r; z2++) {
var dx2 = x2 - cx;
var dz2 = z2 - cz;
if (Math.sqrt(dx2 * dx2 + dz2 * dz2) <= r - 1) {
pb(x2, floorY, z2, 'stone_bricks');
pb(x2, 18, z2, 'oak_planks');
}
}
}
// windows in the tower
for (var wy = 6; wy <= 9; wy++) {
pb(cx - r, wy, cz, 'glass_pane');
pb(cx + r, wy, cz, 'glass_pane');
pb(cx, wy, cz - r, 'glass_pane');
pb(cx, wy, cz + r, 'glass_pane');
}
for (var wy2 = 21; wy2 <= 24; wy2++) {
pb(cx - r, wy2, cz, 'glass_pane');
pb(cx + r, wy2, cz, 'glass_pane');
pb(cx, wy2, cz - r, 'glass_pane');
pb(cx, wy2, cz + r, 'glass_pane');
}
// copper dome on top
makeSphere(cx, 31, cz, 'oxidized_copper', 8, false);
fill(cx - 9, 22, cz - 9, cx + 9, 30, cz + 9, 'air');
// re-place the tower wall that the clear removed
for (var y3 = 22; y3 <= 30; y3++) {
for (var x3 = cx - r; x3 <= cx + r; x3++) {
for (var z3 = cz - r; z3 <= cz + r; z3++) {
var dx3 = x3 - cx;
var dz3 = z3 - cz;
var d3 = Math.sqrt(dx3 * dx3 + dz3 * dz3);
if (d3 <= r && d3 > r - 1) {
pb(x3, y3, z3, 'stone_bricks');
}
}
}
}
for (var wy3 = 21; wy3 <= 24; wy3++) {
pb(cx - r, wy3, cz, 'glass_pane');
pb(cx + r, wy3, cz, 'glass_pane');
pb(cx, wy3, cz - r, 'glass_pane');
pb(cx, wy3, cz + r, 'glass_pane');
}
// observing slit
fill(cx - 1, 31, cz, cx + 1, 39, cz + 9, 'air');
// telescope
for (var t = 0; t <= 10; t++) {
pb(cx, 20 + t, cz - 3 + t, 'copper_block');
}
pb(cx, 19, cz - 3, 'stone_bricks');
// ---------- stone wing ----------
var x1 = 35, x2b = 55, z1 = 32, z2b = 48;
fill(x1, floorY, z1, x2b, floorY, z2b, 'stone_bricks');
// walls
fill(x1, floorY + 1, z1, x2b, 16, z1, 'stone_bricks');
fill(x1, floorY + 1, z2b, x2b, 16, z2b, 'stone_bricks');
fill(x1, floorY + 1, z1, x1, 16, z2b, 'stone_bricks');
fill(x2b, floorY + 1, z1, x2b, 16, z2b, 'stone_bricks');
// second floor
fill(x1 + 1, 10, z1 + 1, x2b - 1, 10, z2b - 1, 'oak_planks');
// windows
for (var wx = x1 + 3; wx < x2b; wx += 4) {
fill(wx, 6, z1, wx, 8, z1, 'glass_pane');
fill(wx, 6, z2b, wx, 8, z2b, 'glass_pane');
fill(wx, 13, z1, wx, 15, z1, 'glass_pane');
fill(wx, 13, z2b, wx, 15, z2b, 'glass_pane');
}
for (var wz = z1 + 3; wz < z2b; wz += 4) {
fill(x2b, 6, wz, x2b, 8, wz, 'glass_pane');
fill(x2b, 13, wz, x2b, 15, wz, 'glass_pane');
}
// door
fill(45, 4, z2b, 45, 5, z2b, 'air');
ps(45, 4, z2b, 'oak_door[facing=south,half=lower,hinge=left]');
ps(45, 5, z2b, 'oak_door[facing=south,half=upper,hinge=left]');
// slate roof
var halfW = 9;
for (var rz = z1; rz <= z2b; rz++) {
for (var st = 0; st < halfW; st++) {
ps(x1 + st, 17 + st, rz, 'deepslate_tile_stairs[facing=east,half=bottom]');
ps(x2b - st, 17 + st, rz, 'deepslate_tile_stairs[facing=west,half=bottom]');
}
}
for (var rz2 = z1; rz2 <= z2b; rz2++) {
pb(45, 25, rz2, 'deepslate_tiles');
}
// gable ends
for (var gs = 0; gs < halfW; gs++) {
for (var gx = x1 + gs; gx <= x2b - gs; gx++) {
pb(gx, 17 + gs, z1, 'stone_bricks');
pb(gx, 17 + gs, z2b, 'stone_bricks');
}
}
// connect the wing to the tower
fill(cx + r - 1, 4, cz - 1, x1, 5, cz + 1, 'air');
// ---------- stairs from the hall up to the telescope floor ----------
for (var s = 0; s < 15; s++) {
ps(37 + s, 4 + s, 45, 'stone_brick_stairs[facing=east,half=bottom]');
}
// ---------- interior ----------
// hall
pb(40, 4, 40, 'oak_fence');
pb(40, 5, 40, 'oak_pressure_plate');
pb(41, 4, 40, 'oak_stairs[facing=west,half=bottom]');
pb(39, 4, 40, 'oak_stairs[facing=east,half=bottom]');
pb(42, 4, 36, 'lantern');
pb(48, 4, 36, 'lantern');
// library
for (var lz = 34; lz <= 46; lz++) {
pb(54, 4, lz, 'bookshelf');
pb(54, 5, lz, 'bookshelf');
}
for (var lx = 48; lx <= 54; lx++) {
pb(lx, 4, 33, 'bookshelf');
pb(lx, 5, 33, 'bookshelf');
}
pb(50, 4, 40, 'lectern[facing=south]');
pb(50, 4, 42, 'oak_stairs[facing=north,half=bottom]');
pb(50, 9, 40, 'lantern');
// second floor
pb(44, 11, 40, 'oak_fence');
pb(44, 12, 40, 'oak_pressure_plate');
pb(48, 11, 38, 'bookshelf');
pb(48, 12, 38, 'bookshelf');
pb(40, 11, 44, 'chest[facing=south]');
pb(44, 16, 40, 'lantern');
// tower ground floor
pb(cx, 4, cz, 'chiseled_stone_bricks');
pb(cx, 5, cz, 'gold_block');
pb(cx - 4, 4, cz + 3, 'oak_stairs[facing=north,half=bottom]');
pb(cx + 4, 4, cz - 3, 'oak_stairs[facing=south,half=bottom]');
pb(cx - 5, 9, cz, 'lantern');
// telescope floor
pb(cx - 4, 19, cz + 2, 'chest[facing=east]');
pb(cx + 4, 19, cz + 2, 'lectern[facing=west]');
pb(cx - 4, 24, cz, 'lantern');
// ---------- outside ----------
for (var pz = 49, i = 0; pz <= 62; pz++, i++) {
fill(44, groundY, pz, 46, groundY, pz, 'gravel');
}
pb(40, 3, 52, 'oak_fence');
pb(40, 4, 52, 'oak_fence');
pb(40, 5, 52, 'lantern');
pb(50, 3, 52, 'oak_fence');
pb(50, 4, 52, 'lantern');
// a couple of trees
for (var tr = 0; tr < 3; tr++) {
var tx = [16, 62, 60][tr];
var tz = [58, 58, 26][tr];
fill(tx, 3, tz, tx, 7, tz, 'oak_log[axis=y]');
makeSphere(tx, 8, tz, 'oak_leaves[persistent=true]', 3, true);
}
// flowers
for (var fx = 12; fx <= 68; fx += 3) {
for (var fz = 12; fz <= 68; fz += 3) {
if ((fx + fz) % 7 === 0) {
pb(fx, 3, fz, 'poppy');
}
}
}