// Create RP state quarter — the house style, taken from the user's own warehouse / import office and corrected // by him on 2026-10-11: // - red brick walls; the wall corner itself is brick; // - columns are Copycats+ vertical steps (dark oak) standing IN FRONT of the wall at the corners, not logs in the wall; // - the "foundation" is a facade strip: a thin copycat slice of stone bricks along the foot of the wall; // - window sills and the beam under the gable window are copycat steps in dark oak; // - windows are Create tiled glass panes; // - the roof is spruce STAIRS with dark oak barge boards and ribs — no smooth slopes; // - stone means plain stone / stone bricks. // One chunk per building: x 0..15, z 0..15, front toward +z, pavement y 0, platform/floor y 1. const { World } = require('../../lib/world') const { roofs } = require('../../lib/roof') const C = (n) => 'create:' + n const P = { wall: 'bricks', pave: 'stone_bricks', plinth: 'stone_bricks', pier: 'stone_bricks', floor: 'bamboo_mosaic', upper: 'spruce_planks', pane: C('tiled_glass_pane'), fence: 'dark_oak_fence', iron: C('industrial_iron_block'), girder: C('metal_girder'), casing: C('andesite_casing'), brass: C('brass_casing'), wood: 'dark_oak_planks', column: 'dark_oak_log' } const post = ['dark_oak_log', { axis: 'y' }] const beam = (axis) => ['stripped_dark_oak_log', { axis }] const OUT = { south: [0, 1], north: [0, -1], east: [1, 0], west: [-1, 0] } const TOWARD = { south: 'north', north: 'south', east: 'west', west: 'east' } // from the facade cell toward the wall const STEP = 5 // storey height: floor block + 4 clear // ---- copycat pieces (the material goes into the block entity; `_mat` is read by the renderer and the exporter) ---- // thin strip against the wall: 8 high, 4 deep const strip = (side, mat = P.plinth) => ['copycats:copycat_slice', { facing: TOWARD[side], half: 'bottom', layers: 1, _mat: mat }] // sill / beam: 8 high, 8 deep, in the top half of the cell const sill = (side, mat = P.wood) => ['create:copycat_step', { facing: TOWARD[side], half: 'top', _mat: mat }] // column: 8 x 8 pillar in the quarter of the cell that touches the wall at its outer end. // Copycats+ vertical step: `facing` F fills the quarter between F and counter-clockwise(F). const QUARTER = { 'north,west': 'north', 'west,south': 'west', 'south,east': 'south', 'east,north': 'east' } const column = (toWall, toEnd, mat = P.column) => ['copycats:copycat_vertical_step', { facing: QUARTER[`${toWall},${toEnd}`] || QUARTER[`${toEnd},${toWall}`], _mat: mat }] function start () { const w = new World() w.box(0, -1, 0, 15, -1, 15, 'dirt'); w.box(0, 0, 0, 15, 0, 15, P.pave) const R = roofs(w, { body: P.wall, ceiling: P.upper }) return { w, R, interiors: [], rooms: [] } } const air = (w, x, y, z) => w.get(x, y, z).name === 'air' // A brick block of `storeys` on a stone platform. `facade` = the sides that are outside walls. function body (ctx, { x1, z1, x2, z2, storeys = 1, y0 = 1, name = 'hall', floor = P.floor, facade = ['south', 'north', 'east', 'west'] }) { const { w } = ctx const top = y0 + STEP * storeys // wall top row for (let x = x1; x <= x2; x++) for (let z = z1; z <= z2; z++) { const edge = x === x1 || x === x2 || z === z1 || z === z2 w.set(x, y0, z, edge ? P.plinth : floor) for (let s = 1; s < storeys; s++) if (!edge) w.set(x, y0 + STEP * s, z, P.upper) if (!edge) continue for (let y = y0 + 1; y <= top; y++) { const belt = (y - y0) % STEP === 0 && y < top const corner = (x === x1 || x === x2) && (z === z1 || z === z2) if (belt && !corner) w.set(x, y, z, ...beam(z === z1 || z === z2 ? 'x' : 'z')) else w.set(x, y, z, P.wall) } } for (let s = 0; s < storeys; s++) { ctx.interiors.push([x1 + 1, y0 + STEP * s + 1, z1 + 1, x2 - 1, y0 + STEP * s + 4, z2 - 1]) ctx.rooms.push({ name: name + s, x: [x1 + 1, x2 - 1], z: [z1 + 1, z2 - 1], y: y0 + STEP * s + 1 }) // y = where the feet are } const wallCell = (side, a) => side === 'south' ? [a, z2] : side === 'north' ? [a, z1] : side === 'east' ? [x2, a] : [x1, a] const span = (side) => side === 'south' || side === 'north' ? [x1, x2] : [z1, z2] const base = (s) => y0 + STEP * s const B = { x1, z1, x2, z2, top, y0, storeys, base } // facade layer: the stone strip along the foot of every outside wall, columns at the corners of front and back for (const side of facade) { const [dx, dz] = OUT[side]; const [a1, a2] = span(side) for (let a = a1; a <= a2; a++) { const [x, z] = wallCell(side, a); if (air(w, x + dx, y0 + 1, z + dz)) w.set(x + dx, y0 + 1, z + dz, ...strip(side)) } if (side === 'east' || side === 'west') continue for (const [a, end] of [[a1, 'west'], [a2, 'east']]) { const [x, z] = wallCell(side, a) for (let y = y0 + 1; y < top; y++) if (air(w, x + dx, y, z + dz) || w.get(x + dx, y, z + dz).name.includes('copycat_slice')) w.set(x + dx, y, z + dz, ...column(TOWARD[side], end)) } } // window `width` wide, two high, with a copycat sill outside; `a` = first cell along the wall B.window = (side, a, s = 0, { width = 2, pane = P.pane, sill: withSill = true } = {}) => { const [dx, dz] = OUT[side] for (let i = 0; i < width; i++) { const [x, z] = wallCell(side, a + i) w.set(x, base(s) + 2, z, pane); w.set(x, base(s) + 3, z, pane) if (withSill) w.set(x + dx, base(s) + 1, z + dz, ...sill(side)) } } // lantern hanging from the eave, outside the wall (needs the roof overhang above it) B.lantern = (side, a) => { const [x, z] = wallCell(side, a); const [dx, dz] = OUT[side]; w.set(x + dx, top - 1, z + dz, 'lantern', { hanging: true }) } // double door centred on cells a, a+1; the strip in front of it is removed B.door = (side, a, s = 0, name = 'spruce_door') => { const [dx, dz] = OUT[side] ;[a, a + 1].forEach((c, i) => { const [x, z] = wallCell(side, c); const hinge = (i === 0) === (side === 'south' || side === 'west') ? 'left' : 'right' w.set(x, base(s) + 1, z, name, { half: 'lower', facing: TOWARD[side], hinge }); w.set(x, base(s) + 2, z, name, { half: 'upper', facing: TOWARD[side], hinge }) w.set(x, base(s) + 3, z, ...beam(side === 'south' || side === 'north' ? 'x' : 'z')) if (w.get(x + dx, base(s) + 1, z + dz).name.includes('copycat')) w.clear(x + dx, base(s) + 1, z + dz) }) } // big window in the gable with a copycat beam under it across the facade (call after R.finish()) B.gable = (side, { width = 4, rows = 3, pane = P.pane } = {}) => { const [dx, dz] = OUT[side]; const [a1, a2] = span(side) const c = Math.floor((a1 + a2 + 1) / 2) - width / 2 for (let a = c - 1; a <= c + width; a++) { const [x, z] = wallCell(side, a); if (air(w, x + dx, top, z + dz)) w.set(x + dx, top, z + dz, ...sill(side)) } for (let i = 0; i < width; i++) for (let r = 1; r <= rows; r++) { const [x, z] = wallCell(side, c + i) if (w.get(x, top + r, z).name === P.wall) w.set(x, top + r, z, pane) } } // straight stair along a wall from storey s to s+1: `x` fixed, starting at z = zFrom, rising toward -z or +z B.stair = (s, x, zFrom, dir = -1) => { const facing = dir < 0 ? 'north' : 'south' for (let i = 0; i < STEP; i++) { const z = zFrom + dir * i w.set(x, base(s) + 1 + i, z, 'spruce_stairs', { facing, half: 'bottom', shape: 'straight' }) if (i > 0 && i < STEP - 1) w.clear(x, base(s + 1), z) // headroom; the top step itself sits in the floor plane } w.set(x, base(s + 1), zFrom + dir * STEP, P.upper) } return B } // spruce roof → dark oak barge boards at both ends and a rib every `step` blocks (the look of the user's roof) function trimRoof (w, roofCells, { axis, from, to, step = 4 }) { for (const k of roofCells) { const [x, y, z] = k.split(',').map(Number); const r = axis === 'x' ? x : z if (r < from || r > to) continue if (r !== from && r !== to && (r - from) % step !== 0) continue const b = w.get(x, y, z) if (b.name.startsWith('spruce_')) w.set(x, y, z, b.name.replace('spruce_', 'dark_oak_'), b.props) } } // steep (2:1) pyramid spire over the footprint, eaves one block out function spire (w, x1, z1, x2, z2, top, { mat = 'spruce', edge = 'dark_oak' } = {}) { const n = Math.floor((Math.min(x2 - x1, z2 - z1) + 3) / 2) for (let k = 0; k < n; k++) { const [a1, a2, c1, c2] = [x1 - 1 + k, x2 + 1 - k, z1 - 1 + k, z2 + 1 - k] for (let x = a1; x <= a2; x++) for (let z = c1; z <= c2; z++) { const nn = z === c1; const so = z === c2; const wd = x === a1; const e = x === a2 if (!(nn || so || wd || e)) continue const m = (nn || so) && (wd || e) ? edge : mat // dark hips if (k > 0) w.set(x, top + 2 * k - 1, z, m + '_planks') w.set(x, top + 2 * k, z, m + '_stairs', { facing: nn ? 'south' : so ? 'north' : wd ? 'east' : 'west', half: 'bottom', shape: 'straight' }) } } return top + 2 * n - 1 } // steps up to the platform in front of a door: cells a..b at z (south side) function steps (w, a, b, z) { for (let x = a; x <= b; x++) w.set(x, 1, z, 'stone_brick_stairs', { facing: 'north', half: 'bottom', shape: 'straight' }) } function finish (ctx, meta) { ctx.w.connect() return { world: ctx.w, meta: { groundY: 0, interiors: ctx.interiors, rooms: ctx.rooms, ...meta, views: [{ tag: 'front', rot: 0, elev: true, scale: 18 }, { tag: 'se', rot: 0, scale: 16 }, { tag: 'sw', rot: 1, scale: 16 }, { tag: 'nw', rot: 2, scale: 12 }] } } } module.exports = { C, P, post, beam, strip, sill, column, STEP, OUT, TOWARD, start, body, trimRoof, spire, steps, finish }