Files
generate_lobby.py
README.md
Code
2 294
generate_lobby.py
#!/usr/bin/env python3
"""Generate the 200x200 Frogspawn lobby as a Sponge schematic.
Run with Python 3.10+; no external packages are required.
The output is compatible with WorldEdit 7 and Minecraft 1.21.8.
"""
import gzip
import math
import random
import struct
WIDTH = 200
LENGTH = 200
HEIGHT = 90
OUTPUT = "frogspawn_lobby_1.21.8.schem"
blocks = {}
palette = {"minecraft:air": 0}
def block_id(name):
name = "minecraft:" + name if ":" not in name else name
if name not in palette:
palette[name] = len(palette)
return palette[name]
def put(x, y, z, name):
if 0 <= x < WIDTH and 0 <= y < HEIGHT and 0 <= z < LENGTH:
index = (y * LENGTH + z) * WIDTH + x
blocks[index] = block_id(name)
def disc(cx, y, cz, radius, name):
r2 = radius * radius
for x in range(max(0, cx - radius), min(WIDTH, cx + radius + 1)):
for z in range(max(0, cz - radius), min(LENGTH, cz + radius + 1)):
if (x - cx) ** 2 + (z - cz) ** 2 <= r2:
put(x, y, z, name)
def ring(cx, y, cz, inner, outer, name):
inner2, outer2 = inner * inner, outer * outer
for x in range(max(0, cx - outer), min(WIDTH, cx + outer + 1)):
for z in range(max(0, cz - outer), min(LENGTH, cz + outer + 1)):
distance2 = (x - cx) ** 2 + (z - cz) ** 2
if inner2 <= distance2 <= outer2:
put(x, y, z, name)
def ellipsoid(cx, cy, cz, rx, ry, rz, name):
for x in range(cx - rx, cx + rx + 1):
for y in range(cy - ry, cy + ry + 1):
for z in range(cz - rz, cz + rz + 1):
value = ((x - cx) / rx) ** 2 + ((y - cy) / ry) ** 2 + ((z - cz) / rz) ** 2
if value <= 1.0:
put(x, y, z, name)
def mountain(cx, cz, radius, peak):
for y in range(5, peak + 1):
progress = (y - 5) / max(1, peak - 5)
current_radius = max(1, int(radius * (1.0 - progress) ** 0.58))
material = "deepslate" if y < 16 else "stone"
if y > peak - 5:
material = "snow_block"
for x in range(cx - current_radius, cx + current_radius + 1):
for z in range(cz - current_radius, cz + current_radius + 1):
if (x - cx) ** 2 + (z - cz) ** 2 <= current_radius ** 2:
put(x, y, z, material)
ring(cx, 5, cz, max(1, radius - 3), radius + 2, "moss_block")
def pine(x, z, base, height):
for y in range(base, base + height):
put(x, y, z, "spruce_log")
top = base + height - 1
for y in range(top - 9, top + 2):
level = top - y
radius = min(4, 1 + (9 - level) // 2) if level >= 0 else 1
for dx in range(-radius, radius + 1):
for dz in range(-radius, radius + 1):
if abs(dx) + abs(dz) <= radius + 1:
put(x + dx, y, z + dz, "spruce_leaves")
def rune_line(x1, z1, x2, z2):
length = max(abs(x2 - x1), abs(z2 - z1))
for step in range(length + 1):
t = step / max(1, length)
x, z = round(x1 + (x2 - x1) * t), round(z1 + (z2 - z1) * t)
put(x, 8, z, "amethyst_block")
if step % 4 == 0:
put(x, 9, z, "sea_lantern")
def waterfall(x, z, top, width=2):
for y in range(6, top + 1):
for dx in range(-width // 2, width - width // 2):
put(x + dx, y, z, "water")
disc(x, 5, z, width + 3, "water")
ring(x, 5, z, width + 3, width + 5, "mossy_cobblestone")
def build_lobby():
random.seed(2108)
cx, cz = 100, 100
# Low natural ground leaves the circular spawn platform readable from above.
for x in range(WIDTH):
for z in range(LENGTH):
if (x - cx) ** 2 + (z - cz) ** 2 <= 96 ** 2:
for y in range(0, 4):
put(x, y, z, "stone" if y < 3 else "dirt")
put(x, 4, z, "grass_block")
# Central platform and its glowing rune bands.
disc(cx, 5, cz, 43, "stone_bricks")
disc(cx, 6, cz, 40, "polished_deepslate")
disc(cx, 7, cz, 38, "stone_bricks")
ring(cx, 8, cz, 34, 38, "mossy_stone_bricks")
ring(cx, 8, cz, 27, 29, "crying_obsidian")
ring(cx, 8, cz, 18, 20, "amethyst_block")
ring(cx, 8, cz, 4, 5, "sea_lantern")
for angle in range(0, 360, 45):
radians = math.radians(angle)
rune_line(cx + round(math.cos(radians) * 7), cz + round(math.sin(radians) * 7),
cx + round(math.cos(radians) * 25), cz + round(math.sin(radians) * 25))
for angle in range(22, 360, 45):
radians = math.radians(angle)
x, z = cx + round(math.cos(radians) * 33), cz + round(math.sin(radians) * 33)
put(x, 9, z, "sea_lantern")
# A huge seated frog: stone core, moss shell, raised eyes and a visible mouth.
ellipsoid(cx, 25, 111, 20, 20, 18, "mossy_stone_bricks")
ellipsoid(cx, 25, 108, 16, 16, 15, "moss_block")
ellipsoid(82, 14, 103, 13, 8, 15, "mossy_cobblestone")
ellipsoid(118, 14, 103, 13, 8, 15, "mossy_cobblestone")
ellipsoid(cx, 42, 98, 25, 14, 16, "mossy_stone_bricks")
ellipsoid(cx, 43, 96, 21, 11, 14, "moss_block")
# Eye turrets and pupils point toward the player entrance at the front.
for eye_x in (87, 113):
ellipsoid(eye_x, 54, 87, 7, 7, 6, "mossy_cobblestone")
ellipsoid(eye_x, 55, 83, 5, 5, 4, "calcite")
ellipsoid(eye_x, 55, 79, 2, 3, 2, "black_concrete")
put(eye_x, 56, 77, "sea_lantern")
# Wide smiling mouth, belly plate, toes and moss accents.
for x in range(82, 119):
put(x, 38, 81, "deepslate_tiles")
if x in (83, 90, 110, 117):
put(x, 39, 81, "moss_carpet")
ellipsoid(cx, 25, 91, 11, 13, 3, "stone_bricks")
ellipsoid(cx, 25, 88, 8, 10, 2, "moss_block")
for x, y, z in ((78, 29, 96), (122, 31, 96), (92, 19, 91), (108, 22, 91),
(84, 44, 91), (116, 45, 91)):
ellipsoid(x, y, z, 3, 2, 2, "moss_carpet")
for x in range(75, 86, 3):
ellipsoid(x, 9, 91, 3, 2, 5, "mossy_cobblestone")
for x in range(115, 126, 3):
ellipsoid(x, 9, 91, 3, 2, 5, "mossy_cobblestone")
# Mountain ring, pine forest and three readable waterfalls.
mountains = [
(20, 25, 27, 48), (66, 9, 24, 37), (133, 9, 26, 52),
(180, 29, 29, 59), (181, 102, 25, 44), (170, 171, 30, 55),
(119, 188, 27, 47), (54, 182, 31, 62), (13, 130, 26, 45),
]
for mountain_data in mountains:
mountain(*mountain_data)
tree_positions = [
(28, 54, 5, 17), (47, 40, 5, 21), (71, 29, 5, 16),
(130, 31, 5, 20), (153, 44, 5, 17), (174, 62, 5, 22),
(176, 139, 5, 19), (151, 161, 5, 23), (128, 176, 5, 16),
(91, 181, 5, 20), (63, 168, 5, 18), (35, 153, 5, 22),
(25, 116, 5, 16), (31, 82, 5, 20), (187, 83, 5, 18),
(186, 158, 5, 17),
]
for tree_data in tree_positions:
pine(*tree_data)
waterfall(43, 43, 30, 2)
waterfall(157, 43, 39, 3)
waterfall(161, 164, 35, 2)
# Small lantern pillars frame the four approach paths.
for x, z in ((57, 100), (143, 100), (100, 57), (100, 143)):
for y in range(8, 14):
put(x, y, z, "mossy_stone_bricks")
put(x, 14, z, "sea_lantern")
put(x - 1, 13, z, "chain")
put(x + 1, 13, z, "chain")
def write_string(value):
encoded = value.encode("utf-8")