Detailed logo, smaller icons inside the casing frame, sliders and other widgets, EMI panels, list screens, in-game bug reports

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Fulldroper
2026-10-14 06:54:26 +03:00
co-authored by Claude Opus 5.5
parent 4051a18f24
commit ba4dbd1052
34 changed files with 268 additions and 65 deletions
+162 -43
View File
@@ -198,37 +198,42 @@ ICON_COLOURS = {
}
QUIT_ICON = '''
#######......
#++++++......
#+...........
#+.......#...
#+.......##..
#+..########.
#+..#########
#+..+++++##+.
#+.......#+..
#+.......+...
#+...........
#######......
+++++++......
#####.....
#.........
#.....#...
#.....##..
#..#######
#..#######
#.....##..
#.....#...
#.........
+++++.....
''' # sign-out: a door frame with an arrow going out
SETTINGS_ICON = '''
.....###.....
..#..###..#..
.###########.
..#########..
..###+++###..
#####...#####
#####...#####
#####...#####
++###...###++
..#########..
.###########.
.+#++###++#+.
.....+++.....
....#....
.#.###.#.
..#####..
.###.###.
###...###
.###.###.
..#####..
.+.###.+.
....+....
''' # settings: a gear
LANGUAGE_ICON = '''
..#####..
.#..#..#.
#...#...#
#...#...#
#########
#...#...#
#...#...#
.+..#..+.
..+++++..
''' # globe; replaces Minecraft's own language icon, which is too big for the frame
ONLINE_ICON = '''
....GGGGG....
..GGGGGGGGG..
@@ -278,14 +283,16 @@ AAAa.........
''' # wrench
def button_icon(rows: str, outline: bool = False) -> Image.Image:
"""A 20x20 picture for a 20x20 button; the drawing starts at (4, 4), where Minecraft puts its own icons.
An icon shown without a button behind it gets a dark outline, so it reads on any background."""
im = Image.new('RGBA', (20, 20), (0, 0, 0, 0))
for y, row in enumerate(rows.split()):
def button_icon(rows: str, outline: bool = False, canvas: int = 20, at: int = -1) -> Image.Image:
"""A picture for a square button: the drawing is centred (or starts at `at`). An icon shown without a button
behind it gets a dark outline, so it reads on any background."""
grid = rows.split()
at = (canvas - len(grid[0])) // 2 if at < 0 else at
im = Image.new('RGBA', (canvas, canvas), (0, 0, 0, 0))
for y, row in enumerate(grid):
for x, c in enumerate(row):
if c != '.':
im.putpixel((4 + x, 4 + y), ICON_COLOURS[c] + (255,))
im.putpixel((at + x, at + y), ICON_COLOURS[c] + (255,))
if outline:
solid = np.asarray(im)[..., 3] > 0
near = np.zeros_like(solid)
@@ -298,6 +305,80 @@ def button_icon(rows: str, outline: bool = False) -> Image.Image:
return im
def detailed_lettering(mask: np.ndarray, fill, grain: np.ndarray, k: int = 10, depth: int = 1) -> Image.Image:
"""The logo's lettering: the same blocky letters, colours, dark side and ink outline as `lettering`, but drawn
`k` times finer. Every font pixel keeps the colour `lettering` gives it; inside it the metal's grain shows, and
the bevel is two fine pixels wide instead of a whole font pixel."""
pad = 1 + depth
m = np.pad(mask, pad)
h, w = m.shape
yy, xx = np.mgrid[0:h, 0:w]
if isinstance(fill, np.ndarray):
base = fill[yy % fill.shape[0], xx % fill.shape[1]].astype(np.float32)
dark = fill.reshape(-1, 3).mean(axis=0) * 0.45
else:
base = np.broadcast_to(np.array(fill, np.float32), (h, w, 3)).copy()
dark = np.array(fill, np.float32) * 0.45
side = np.zeros_like(m)
for d in range(1, depth + 1):
side |= shift(m, d, d)
side &= ~m
body = m | side
edge = np.zeros_like(m)
for dy in (-1, 0, 1):
for dx in (-1, 0, 1):
edge |= shift(body, dy, dx)
edge &= ~body
up = lambda a: np.repeat(np.repeat(a, k, 0), k, 1)
M, S, E = up(m), up(side), up(edge)
H, W = M.shape
# the grain: the inside of the block's texture, mirrored so it tiles without a seam, as a gentle brightness map
g = grain[2:14, 2:14].astype(np.float32).mean(axis=2)
g = np.concatenate([np.concatenate([g, g[:, ::-1]], 1), np.concatenate([g[::-1], g[::-1, ::-1]], 1)], 0)
g = (g / g.mean()) ** 0.8
YY, XX = np.mgrid[0:H, 0:W]
colour = up(base) * g[YY % g.shape[0], XX % g.shape[1]][..., None]
for width, lit, shade in ((1, 1.30, 0.62), (2, 1.15, 0.78), (3, 1.06, 0.90)): # the bevel, strongest at the rim
colour[M & ~shift(M, 0, -width)] *= (shade + 1) / 2 # right
colour[M & ~shift(M, 0, width)] *= (lit + 1) / 2 # left
colour[M & ~shift(M, -width, 0)] *= shade # bottom in shade
colour[M & ~shift(M, width, 0)] *= lit # top catches the light
out = np.zeros((H, W, 4), np.float32)
out[..., :3] = INK
out[S, :3] = dark * (0.85 + 0.15 * g[YY % g.shape[0], XX % g.shape[1]])[S][..., None]
out[M, :3] = colour[M]
out[M | S | E, 3] = 255
return Image.fromarray(np.clip(out, 0, 255).astype(np.uint8), 'RGBA')
def tint(sprite: Image.Image, colour) -> Image.Image:
"""A grey Minecraft sprite in another colour: brightness and transparency kept."""
px = np.asarray(sprite.convert('RGBA')).astype(np.float32)
px[..., :3] = px[..., :3].mean(axis=2, keepdims=True) / 255 * np.array(colour, np.float32)
return Image.fromarray(np.clip(px, 0, 255).astype(np.uint8), 'RGBA')
def greys_to(sprite: Image.Image, colour) -> Image.Image:
"""Only the grey pixels of a sprite take the colour (their brightness kept); coloured details stay as they are."""
px = np.asarray(sprite.convert('RGBA')).astype(np.float32)
grey = (px[..., :3].max(axis=2) - px[..., :3].min(axis=2)) < 24
px[grey, :3] = px[grey, :3].mean(axis=1, keepdims=True) / 255 * np.array(colour, np.float32)
return Image.fromarray(np.clip(px, 0, 255).astype(np.uint8), 'RGBA')
def plate(tile: np.ndarray, w: int, h: int, tone: float = 1.0) -> Image.Image:
"""A small metal plate with a black outline: the slider's handle."""
px = np.zeros((h, w, 3), np.float32)
inner = np.tile(tile, (2, 2, 1))[:h - 2, :w - 2].astype(np.float32) * tone
inner[0] *= 1.2
inner[:, 0] *= 1.1
inner[-1] *= 0.7
inner[:, -1] *= 0.8
px[1:-1, 1:-1] = inner
return Image.fromarray(np.clip(px, 0, 255).astype(np.uint8), 'RGB').convert('RGBA')
def casing_button(jar: zipfile.ZipFile, casing: str, tone: float = 1.0, grey: float = 0.0) -> Image.Image:
"""A 200x20 button sprite built from a Create casing: black outline, the casing's 3 px metal frame, its wood
inside. The wood is tiled with the block's own 16 px period and the sprite is nine-sliced with a 4 px border,
@@ -329,14 +410,32 @@ BUTTON_META = '{"gui": {"scaling": {"type": "nine_slice", "width": 200, "height"
def main() -> None:
mc_jar, create_jar, key_art = sys.argv[1], sys.argv[2], Path(sys.argv[3])
emblem_raw = Path(sys.argv[4]) if len(sys.argv) > 4 else None
emi_jar = sys.argv[5] if len(sys.argv) > 5 else None # EMI's panels are recoloured when its jar is given
with zipfile.ZipFile(mc_jar) as mc, zipfile.ZipFile(create_jar) as cr:
font = Font(mc)
brass = texture(cr, 'assets/create/textures/block/brass_block.png')
buttons = {'button': casing_button(cr, 'andesite_casing', tone=0.82),
'button_highlighted': casing_button(cr, 'brass_casing', tone=1.12),
'button_disabled': casing_button(cr, 'andesite_casing', tone=0.42, grey=0.6)}
# sprites of Minecraft's widgets, by their path under assets/minecraft/textures/gui/
vanilla = lambda path: Image.open(io.BytesIO(mc.read('assets/minecraft/textures/gui/' + path))).convert('RGBA')
gui = {'sprites/widget/button.png': casing_button(cr, 'andesite_casing', tone=0.82),
'sprites/widget/button_highlighted.png': casing_button(cr, 'brass_casing', tone=1.12),
'sprites/widget/button_disabled.png': casing_button(cr, 'andesite_casing', tone=0.42, grey=0.6),
'sprites/widget/slider.png': casing_button(cr, 'andesite_casing', tone=0.45, grey=0.3),
'sprites/widget/slider_highlighted.png': casing_button(cr, 'brass_casing', tone=0.6),
'sprites/widget/slider_handle.png': plate(brass, 8, 20, 0.92),
'sprites/widget/slider_handle_highlighted.png': plate(brass, 8, 20, 1.15),
'sprites/widget/text_field_highlighted.png': tint(vanilla('sprites/widget/text_field_highlighted.png'), BRASS[3]),
'sprites/widget/scroller.png': tint(vanilla('sprites/widget/scroller.png'), BRASS[3]),
'sprites/icon/language.png': button_icon(LANGUAGE_ICON, canvas=15)}
for name, (top, bottom) in (('header', (BRASS[0], BRASS[2])), ('footer', (BRASS[2], BRASS[0]))):
line = Image.new('RGBA', (32, 2), top + (255,))
line.paste(bottom + (255,), (0, 1, 32, 2))
gui[f'{name}_separator.png'] = gui[f'inworld_{name}_separator.png'] = line
casing = [p for p in gui if 'casing' in p or p.endswith(('button.png', 'button_highlighted.png', 'button_disabled.png',
'slider.png', 'slider_highlighted.png'))]
meta = {p: (BUTTON_META if p in casing else mc.read('assets/minecraft/textures/gui/' + p + '.mcmeta').decode())
for p in gui if p in casing or 'assets/minecraft/textures/gui/' + p + '.mcmeta' in mc.namelist()}
for d in ('logo', 'icons', 'banners', 'menu', 'ui'):
for d in ('logo', 'icons', 'banners', 'menu'):
(OUT / d).mkdir(parents=True, exist_ok=True)
# --- wordmark: CREATE in brass, RP in brick red, the motto underneath -------------------------
@@ -350,8 +449,15 @@ def main() -> None:
def mono(s: int, colour) -> Image.Image:
return lettering(mask_of(font, NAME, True), colour, s, depth=0, outline=False)
wordmark(12).save(OUT / 'logo' / 'wordmark.png')
stack([wordmark(12), motto(4)], gap=20).save(OUT / 'logo' / 'logo.png')
# the logo itself: the same letters as `wordmark`, drawn ten times finer (see detailed_lettering)
fine = beside([detailed_lettering(mask_of(font, 'CREATE', True), brass, brass),
detailed_lettering(mask_of(font, 'RP', True), BRICK, brass)], gap=20)
logo = stack([fine, motto(4)], gap=15)
canvas = Image.new('RGBA', (-(-logo.width // 3) * 3, -(-logo.height // 3) * 3)) # sides multiples of 3: the menus
canvas.alpha_composite(logo, ((canvas.width - logo.width) // 2, 0)) # show it at a third, pixel for pixel
logo = canvas
fine.save(OUT / 'logo' / 'wordmark.png')
logo.save(OUT / 'logo' / 'logo.png')
mono(12, (255, 255, 255)).save(OUT / 'logo' / 'wordmark-white.png')
mono(12, INK).save(OUT / 'logo' / 'wordmark-dark.png')
@@ -391,16 +497,29 @@ def main() -> None:
# --- FancyMenu: title screen background, the logo it shows, window icons -------------------------
shade(cover(art, 1920, 1080), *((0.95, 1.0) if night else (0.80, 0.92))).convert('RGB').save(OUT / 'menu' / 'background.png')
shade(cover(art, 1920, 1080), 0.42, 0.42).convert('RGB').save(OUT / 'menu' / 'background_dim.png') # behind "Connecting…"
stack([wordmark(8), motto(3)], gap=12).save(OUT / 'menu' / 'logo.png')
logo.save(OUT / 'menu' / 'logo.png') # shown at a third of its size: one screen pixel per texel at GUI scale 3
# --- every button of the game: andesite casing, brass casing under the cursor ---------------------------------
for name, sprite in buttons.items():
sprite.save(OUT / 'ui' / f'{name}.png')
(OUT / 'ui' / f'{name}.png.mcmeta').write_text(BUTTON_META, encoding='utf-8', newline='\n')
# EMI: its grey recipe panels and slots in cream, its small buttons in brass
if emi_jar:
with zipfile.ZipFile(emi_jar) as emi:
for name, colour in (('background', CREAM), ('widgets', CREAM), ('buttons', BRASS[3])):
sprite = Image.open(io.BytesIO(emi.read(f'assets/emi/textures/gui/{name}.png')))
target = OUT / 'resources' / 'emi' / 'textures' / 'gui' / f'{name}.png'
target.parent.mkdir(parents=True, exist_ok=True)
greys_to(sprite, colour).save(target)
# branding/resources/<namespace>/… goes into the game as kubejs/assets/<namespace>/…
for path, sprite in gui.items():
target = OUT / 'resources' / 'minecraft' / 'textures' / 'gui' / path
target.parent.mkdir(parents=True, exist_ok=True)
sprite.save(target)
if path in meta:
target.with_name(target.name + '.mcmeta').write_text(meta[path], encoding='utf-8', newline='\n')
button_icon(QUIT_ICON).save(OUT / 'menu' / 'quit.png')
button_icon(SETTINGS_ICON).save(OUT / 'menu' / 'settings.png')
for name, rows in (('online', ONLINE_ICON), ('offline', OFFLINE_ICON), ('maintenance', MAINTENANCE_ICON)):
button_icon(rows, outline=True).save(OUT / 'menu' / f'status-{name}.png')
button_icon(rows, outline=True, at=4).save(OUT / 'menu' / f'status-{name}.png')
print('done:', ', '.join(sorted(str(p.relative_to(OUT)).replace('\\', '/') for p in OUT.rglob('*.png'))))