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
+12 -7
View File
@@ -20,6 +20,7 @@
## Шрифт і манера ## Шрифт і манера
- Лого й написи на картинках — піксельний шрифт Minecraft, жирне накреслення, літери залито текстурою латунного блоку Create. - Лого й написи на картинках — піксельний шрифт Minecraft, жирне накреслення, літери залито текстурою латунного блоку Create.
Саме лого (`logo/`, меню) намальоване вдесятеро дрібніше: ті самі блочні літери й кольори, але з зерном металу й тонкою фаскою.
- Піксельні картинки збільшуємо лише в ціле число разів, без згладжування. - Піксельні картинки збільшуємо лише в ціле число разів, без згладжування.
- Тон текстів: спокійний і діловий, трохи старосвітський — «громадянин», «держава», «скарбниця», «спури». Без канцеляриту й без зайвих англіцизмів. - Тон текстів: спокійний і діловий, трохи старосвітський — «громадянин», «держава», «скарбниця», «спури». Без канцеляриту й без зайвих англіцизмів.
@@ -40,7 +41,7 @@
| `banners/invite.png` | картинка-запрошення, 1200×630 | | `banners/invite.png` | картинка-запрошення, 1200×630 |
| `banners/wiki-cover.png` | обкладинка вікі й README, 1280×320 | | `banners/wiki-cover.png` | обкладинка вікі й README, 1280×320 |
| `menu/` | картинки меню гри для FancyMenu: тло (звичайне й затемнене), лого, іконки кнопок і стану сервера | | `menu/` | картинки меню гри для FancyMenu: тло (звичайне й затемнене), лого, іконки кнопок і стану сервера |
| `ui/` | текстури кнопок для всієї гри: андезитовий корпус Create, латунний під курсором, темний для неактивних | | `resources/` | текстури для всієї гри (у гру йдуть як `kubejs/assets/…`): кнопки й повзунки — андезитовий корпус Create, під курсором латунний; роздільники, поле вводу, смуга прокрутки, іконка мови; панелі EMI |
| `art/keyart.png` | головний кадр: нічна вулиця з ліхтарями й вежею ратуші; з нього зроблено банери й тло меню | | `art/keyart.png` | головний кадр: нічна вулиця з ліхтарями й вежею ратуші; з нього зроблено банери й тло меню |
| `art/street-lamps.png`, `art/street-tower.png`, `art/night-aerial.png`, `art/factory-hall.png` | інші нічні кадри столиці — запасні | | `art/street-lamps.png`, `art/street-tower.png`, `art/night-aerial.png`, `art/factory-hall.png` | інші нічні кадри столиці — запасні |
| `art/keyart-dawn.png`, `art/keyart-sunset.png` | міст і завод на світанку й на заході сонця | | `art/keyart-dawn.png`, `art/keyart-sunset.png` | міст і завод на світанку й на заході сонця |
@@ -49,7 +50,7 @@
## Як перебудувати ## Як перебудувати
``` ```
python tools/branding/build.py <1.21.1.jar> <create-1.21.1-6.0.10.jar> branding/art/keyart.png [emblem_raw.png] python tools/branding/build.py <1.21.1.jar> <create-1.21.1-6.0.10.jar> branding/art/keyart.png branding/art/emblem_raw.png [emi.jar]
python tools/branding/fancymenu.py <тека config гри або збірки> <1.21.1.jar> [версія збірки] python tools/branding/fancymenu.py <тека config гри або збірки> <1.21.1.jar> [версія збірки]
``` ```
@@ -64,19 +65,23 @@ python tools/branding/fancymenu.py <тека config гри або збірки>
## Меню гри ## Меню гри
**Кнопки** в усій грі — текстури корпусів Create: звичайна андезитова, під курсором латунна. Це заміна **Кнопки й повзунки** в усій грі — текстури корпусів Create: звичайні андезитові, під курсором латунні. Це заміна
спрайтів Minecraft через `kubejs/assets`, тож діє на всі екрани, не лише на наші. спрайтів Minecraft через `kubejs/assets`, тож діє на всі екрани, не лише на наші. Панелі EMI — кремові, його
кнопки — латунні.
**Головне меню.** Під лого — відступ заввишки з кнопку, далі «Грати» з іконкою стану сервера праворуч і ряд **Головне меню.** Під лого — відступ заввишки з кнопку, далі «Грати» з іконкою стану сервера праворуч і ряд
«Гра наодинці» / «Сервери». У правому нижньому куті — іконки: мова, налаштування, вихід. У лівому — версія «Гра наодинці» / «Сервери». У правому нижньому куті — іконки: мова, налаштування, вихід. У лівому — версія
збірки й чи вийшла новіша (порівнює з останнім релізом у Gitea; «є оновлення» відкриває сторінку релізу). збірки й чи вийшла новіша (порівнює з останнім релізом у Gitea; «є оновлення» відкриває сторінку релізу).
Сховано: кнопки Create, спеціальних можливостей і «Моди», рядки Minecraft / NeoForge. Сховано: кнопки Create, спеціальних можливостей і «Моди», рядки Minecraft / NeoForge.
**Підключення, завантаження світу, розрив з'єднання** — затемнений головний кадр і лого вгорі. **Підключення, завантаження світу, розрив з'єднання** — затемнений головний кадр і лого вгорі. **Список серверів,
світів** і решта меню поза грою — той самий затемнений кадр.
**Ігрове меню** — наш власний екран, що підміняє екран паузи Minecraft (тому кнопки, які туди додають інші **Ігрове меню** — наш власний екран, що підміняє екран паузи Minecraft (тому кнопки, які туди додають інші
моди, у нього не потрапляють): «Назад до гри»; «Залишити відгук» (поки неактивна) і «Знайшов баг?» — відкриває моди, у нього не потрапляють): «Назад до гри»; «Залишити відгук» (поки неактивна) і «Знайшов баг?» — на нашому сервері відкриває чат
створення задачі в нашому Git; «Налаштування» і «Скарги на гравців» (поки неактивна); «Від'єднатися». З нашого із набраним `/bug `: гравець пише, що сталося, і бекенд створює задачу в Gitea з його ніком і місцем у світі
(обліковий запис не потрібен; токен — змінна `GITEA_TOKEN` функції бекенду, без неї звіти чекають у базі);
на інших серверах — сторінка створення задачі; «Налаштування» і «Скарги на гравців» (поки неактивна); «Від'єднатися». З нашого
сервера вона веде одразу в головне меню, з інших — у список серверів, як завжди. сервера вона веде одразу в головне меню, з інших — у список серверів, як завжди.
Стан сервера меню бере зі звичайного пінгу `create.fulldroper.ks.ua` (раз на 30 секунд): Стан сервера меню бере зі звичайного пінгу `create.fulldroper.ks.ua` (раз на 30 секунд):
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

Before

Width:  |  Height:  |  Size: 810 B

After

Width:  |  Height:  |  Size: 810 B

Before

Width:  |  Height:  |  Size: 761 B

After

Width:  |  Height:  |  Size: 761 B

Before

Width:  |  Height:  |  Size: 832 B

After

Width:  |  Height:  |  Size: 832 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

@@ -0,0 +1,10 @@
{
"gui": {
"scaling": {
"type": "nine_slice",
"width": 6,
"height": 32,
"border": 1
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

@@ -0,0 +1 @@
{"gui": {"scaling": {"type": "nine_slice", "width": 200, "height": 20, "border": 4}}}
Binary file not shown.

After

Width:  |  Height:  |  Size: 350 B

@@ -0,0 +1,15 @@
{
"gui": {
"scaling": {
"type": "nine_slice",
"width": 8,
"height": 20,
"border": {
"left": 2,
"top": 2,
"right": 2,
"bottom": 3
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

@@ -0,0 +1,15 @@
{
"gui": {
"scaling": {
"type": "nine_slice",
"width": 8,
"height": 20,
"border": {
"left": 2,
"top": 2,
"right": 2,
"bottom": 3
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 785 B

@@ -0,0 +1 @@
{"gui": {"scaling": {"type": "nine_slice", "width": 200, "height": 20, "border": 4}}}
Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

@@ -0,0 +1,10 @@
{
"gui": {
"scaling": {
"type": "nine_slice",
"width": 200,
"height": 20,
"border": 1
}
}
}
+162 -43
View File
@@ -198,37 +198,42 @@ ICON_COLOURS = {
} }
QUIT_ICON = ''' QUIT_ICON = '''
#######...... #####.....
#++++++...... #.........
#+........... #.....#...
#+.......#... #.....##..
#+.......##.. #..#######
#+..########. #..#######
#+..######### #.....##..
#+..+++++##+. #.....#...
#+.......#+.. #.........
#+.......+... +++++.....
#+...........
#######......
+++++++......
''' # sign-out: a door frame with an arrow going out ''' # sign-out: a door frame with an arrow going out
SETTINGS_ICON = ''' SETTINGS_ICON = '''
.....###..... ....#....
..#..###..#.. .#.###.#.
.###########. ..#####..
..#########.. .###.###.
..###+++###.. ###...###
#####...##### .###.###.
#####...##### ..#####..
#####...##### .+.###.+.
++###...###++ ....+....
..#########..
.###########.
.+#++###++#+.
.....+++.....
''' # settings: a gear ''' # settings: a gear
LANGUAGE_ICON = '''
..#####..
.#..#..#.
#...#...#
#...#...#
#########
#...#...#
#...#...#
.+..#..+.
..+++++..
''' # globe; replaces Minecraft's own language icon, which is too big for the frame
ONLINE_ICON = ''' ONLINE_ICON = '''
....GGGGG.... ....GGGGG....
..GGGGGGGGG.. ..GGGGGGGGG..
@@ -278,14 +283,16 @@ AAAa.........
''' # wrench ''' # wrench
def button_icon(rows: str, outline: bool = False) -> Image.Image: def button_icon(rows: str, outline: bool = False, canvas: int = 20, at: int = -1) -> Image.Image:
"""A 20x20 picture for a 20x20 button; the drawing starts at (4, 4), where Minecraft puts its own icons. """A picture for a square button: the drawing is centred (or starts at `at`). An icon shown without a button
An icon shown without a button behind it gets a dark outline, so it reads on any background.""" behind it gets a dark outline, so it reads on any background."""
im = Image.new('RGBA', (20, 20), (0, 0, 0, 0)) grid = rows.split()
for y, row in enumerate(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): for x, c in enumerate(row):
if c != '.': if c != '.':
im.putpixel((4 + x, 4 + y), ICON_COLOURS[c] + (255,)) im.putpixel((at + x, at + y), ICON_COLOURS[c] + (255,))
if outline: if outline:
solid = np.asarray(im)[..., 3] > 0 solid = np.asarray(im)[..., 3] > 0
near = np.zeros_like(solid) near = np.zeros_like(solid)
@@ -298,6 +305,80 @@ def button_icon(rows: str, outline: bool = False) -> Image.Image:
return im 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: 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 """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, 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: def main() -> None:
mc_jar, create_jar, key_art = sys.argv[1], sys.argv[2], Path(sys.argv[3]) 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 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: with zipfile.ZipFile(mc_jar) as mc, zipfile.ZipFile(create_jar) as cr:
font = Font(mc) font = Font(mc)
brass = texture(cr, 'assets/create/textures/block/brass_block.png') brass = texture(cr, 'assets/create/textures/block/brass_block.png')
buttons = {'button': casing_button(cr, 'andesite_casing', tone=0.82), # sprites of Minecraft's widgets, by their path under assets/minecraft/textures/gui/
'button_highlighted': casing_button(cr, 'brass_casing', tone=1.12), vanilla = lambda path: Image.open(io.BytesIO(mc.read('assets/minecraft/textures/gui/' + path))).convert('RGBA')
'button_disabled': casing_button(cr, 'andesite_casing', tone=0.42, grey=0.6)} 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) (OUT / d).mkdir(parents=True, exist_ok=True)
# --- wordmark: CREATE in brass, RP in brick red, the motto underneath ------------------------- # --- 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: def mono(s: int, colour) -> Image.Image:
return lettering(mask_of(font, NAME, True), colour, s, depth=0, outline=False) return lettering(mask_of(font, NAME, True), colour, s, depth=0, outline=False)
wordmark(12).save(OUT / 'logo' / 'wordmark.png') # the logo itself: the same letters as `wordmark`, drawn ten times finer (see detailed_lettering)
stack([wordmark(12), motto(4)], gap=20).save(OUT / 'logo' / 'logo.png') 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, (255, 255, 255)).save(OUT / 'logo' / 'wordmark-white.png')
mono(12, INK).save(OUT / 'logo' / 'wordmark-dark.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 ------------------------- # --- 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.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…" 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 --------------------------------- # --- every button of the game: andesite casing, brass casing under the cursor ---------------------------------
for name, sprite in buttons.items(): # EMI: its grey recipe panels and slots in cream, its small buttons in brass
sprite.save(OUT / 'ui' / f'{name}.png') if emi_jar:
(OUT / 'ui' / f'{name}.png.mcmeta').write_text(BUTTON_META, encoding='utf-8', newline='\n') 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(QUIT_ICON).save(OUT / 'menu' / 'quit.png')
button_icon(SETTINGS_ICON).save(OUT / 'menu' / 'settings.png') button_icon(SETTINGS_ICON).save(OUT / 'menu' / 'settings.png')
for name, rows in (('online', ONLINE_ICON), ('offline', OFFLINE_ICON), ('maintenance', MAINTENANCE_ICON)): 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')))) print('done:', ', '.join(sorted(str(p.relative_to(OUT)).replace('\\', '/') for p in OUT.rglob('*.png'))))
+42 -15
View File
@@ -10,11 +10,13 @@ What it writes:
config/fancymenu/customization/ layouts, built here from fancymenu_template.txt: config/fancymenu/customization/ layouts, built here from fancymenu_template.txt:
createrp_title.txt the title screen createrp_title.txt the title screen
createrp_screens.txt connecting / loading / disconnected screens: our background and logo createrp_screens.txt connecting / loading / disconnected screens: our background and logo
createrp_lists.txt server list, world list and their dialogs: our background
createrp_pause.txt the game menu createrp_pause.txt the game menu
config/fancymenu/custom_gui_screens.txt the game menu is our own screen that replaces Minecraft's one, so that config/fancymenu/custom_gui_screens.txt the game menu is our own screen that replaces Minecraft's one, so that
buttons other mods add to the pause screen (Mods, Create) never get into it buttons other mods add to the pause screen (Mods, Create) never get into it
config/fancymenu/customizablemenus.txt, options.txt which screens are customised; window title and icon config/fancymenu/customizablemenus.txt, options.txt which screens are customised; window title and icon
kubejs/assets/minecraft/…/widget/ button sprites for the whole game: andesite casing, brass under the cursor kubejs/assets/… branding/resources/…: sprites for the whole game (buttons, sliders, separators,
the language icon, EMI's panels) — andesite casing, brass under the cursor
config/create-client.toml Create's own button is taken out of the title screen and the game menu config/create-client.toml Create's own button is taken out of the title screen and the game menu
""" """
import re import re
@@ -31,7 +33,7 @@ ROOT = Path(__file__).resolve().parent.parent.parent
sys.path.insert(0, str(ROOT / 'tools' / 'signs')) sys.path.insert(0, str(ROOT / 'tools' / 'signs'))
from render import BASELINE, LINE_H, Font # noqa: E402 (the pixel font reader made for the building signs) from render import BASELINE, LINE_H, Font # noqa: E402 (the pixel font reader made for the building signs)
MENU, ICONS, UI = ROOT / 'branding' / 'menu', ROOT / 'branding' / 'icons', ROOT / 'branding' / 'ui' MENU, ICONS, RESOURCES = ROOT / 'branding' / 'menu', ROOT / 'branding' / 'icons', ROOT / 'branding' / 'resources'
WINDOW_TITLE = 'Create RP' WINDOW_TITLE = 'Create RP'
HOST = 'create.fulldroper.ks.ua' HOST = 'create.fulldroper.ks.ua'
GIT = 'https://git.fulldroper.ks.ua/Pinecraft-CreateRP/client' GIT = 'https://git.fulldroper.ks.ua/Pinecraft-CreateRP/client'
@@ -39,9 +41,15 @@ LATEST_RELEASE = 'https://git.fulldroper.ks.ua/api/v1/repos/Pinecraft-CreateRP/c
ASSET = '[source:local]/config/fancymenu/assets/' ASSET = '[source:local]/config/fancymenu/assets/'
SCREENS = 'net.minecraft.client.gui.screens.' SCREENS = 'net.minecraft.client.gui.screens.'
# screens that get our background and logo: (FancyMenu's name, class) # screens that get our background and logo: (FancyMenu's name, class)
PLAIN_SCREENS = [('connect_screen', 'ConnectScreen'), ('disconnected_screen', 'DisconnectedScreen'), PLAIN_SCREENS = [('connect_screen', SCREENS + 'ConnectScreen'), ('disconnected_screen', SCREENS + 'DisconnectedScreen'),
('generic_dirt_message_screen', 'GenericMessageScreen'), ('receiving_level_screen', 'ReceivingLevelScreen'), ('generic_dirt_message_screen', SCREENS + 'GenericMessageScreen'),
('progress_screen', 'ProgressScreen'), ('level_loading_screen', 'LevelLoadingScreen')] ('receiving_level_screen', SCREENS + 'ReceivingLevelScreen'),
('progress_screen', SCREENS + 'ProgressScreen'), ('level_loading_screen', SCREENS + 'LevelLoadingScreen')]
# screens with lists, a title and a search box: only our background, the logo would cover them
LIST_SCREENS = [('join_multiplayer_screen', SCREENS + 'multiplayer.JoinMultiplayerScreen'),
('select_world_screen', SCREENS + 'worldselection.SelectWorldScreen'),
('direct_join_server_screen', SCREENS + 'DirectJoinServerScreen'),
('edit_server_screen', SCREENS + 'EditServerScreen')]
PAUSE_GUI = 'createrp_pause' PAUSE_GUI = 'createrp_pause'
@@ -185,9 +193,15 @@ class Layout:
# --- the screens ------------------------------------------------------------------------------------------------------ # --- the screens ------------------------------------------------------------------------------------------------------
def logo_size() -> tuple:
w, h = Image.open(MENU / 'logo.png').size
return w // 3, h // 3
def title_screen(version: str, labels: dict) -> Layout: def title_screen(version: str, labels: dict) -> Layout:
lay = Layout('title', 'title_screen', background='background.png', fireflies=True) lay = Layout('title', 'title_screen', background='background.png', fireflies=True)
lay.image('logo.png', 'mid-centered', -110, -104, 221, 60) lw, lh = logo_size()
lay.image('logo.png', 'mid-centered', -(lw // 2), -44 - lh, lw, lh)
# a button-high gap under the logo, then rows 24 apart # a button-high gap under the logo, then rows 24 apart
lay.button('mid-centered', -100, -24, 200, label='Грати', action=('joinserver', HOST), active=server('online')) lay.button('mid-centered', -100, -24, 200, label='Грати', action=('joinserver', HOST), active=server('online'))
for state, tip in (('online', 'Сервер онлайн'), ('maintenance', 'Технічні роботи'), ('offline', 'Сервер офлайн')): for state, tip in (('online', 'Сервер онлайн'), ('maintenance', 'Технічні роботи'), ('offline', 'Сервер офлайн')):
@@ -225,17 +239,27 @@ def plain_screens() -> Layout:
"""Connecting, loading terrain, disconnected and the like: the dimmed key art and the logo at the top.""" """Connecting, loading terrain, disconnected and the like: the dimmed key art and the logo at the top."""
lay = Layout('screens', '%fancymenu:universal_layout%', background='background_dim.png', lay = Layout('screens', '%fancymenu:universal_layout%', background='background_dim.png',
whitelist=[name for name, _ in PLAIN_SCREENS]) whitelist=[name for name, _ in PLAIN_SCREENS])
lay.image('logo.png', 'top-centered', -110, 16, 221, 60) lw, lh = logo_size()
lay.image('logo.png', 'top-centered', -(lw // 2), 16, lw, lh)
return lay return lay
def list_screens() -> Layout:
return Layout('lists', '%fancymenu:universal_layout%', background='background_dim.png',
whitelist=[name for name, _ in LIST_SCREENS])
def game_menu() -> Layout: def game_menu() -> Layout:
lay = Layout('pause', PAUSE_GUI) lay = Layout('pause', PAUSE_GUI)
lay.image('logo.png', 'mid-centered', -110, -112, 221, 60) lw, lh = logo_size()
lay.image('logo.png', 'mid-centered', -(lw // 2), -52 - lh, lw, lh)
lay.button('mid-centered', -102, -28, 204, label='Назад до гри', action=('closegui', '')) lay.button('mid-centered', -102, -28, 204, label='Назад до гри', action=('closegui', ''))
lay.button('mid-centered', -102, -4, 100, label='Залишити відгук', active=NEVER) lay.button('mid-centered', -102, -4, 100, label='Залишити відгук', active=NEVER)
lay.button('mid-centered', 2, -4, 100, label='Знайшов баг?', action=('paste_to_chat', 'false:/bug '),
tooltip='Опиши, що сталося, і натисни Enter — розробники отримають задачу з твоїм ніком і місцем у світі',
visible=[(SERVER_IP, 'if', HOST)])
lay.button('mid-centered', 2, -4, 100, label='Знайшов баг?', action=('openlink', GIT + '/issues/new'), lay.button('mid-centered', 2, -4, 100, label='Знайшов баг?', action=('openlink', GIT + '/issues/new'),
tooltip='Відкриє в браузері сторінку створення задачі в нашому Git') tooltip='Відкриє в браузері сторінку створення задачі в нашому Git', visible=[(SERVER_IP, 'if_not', HOST)])
lay.button('mid-centered', -102, 20, 100, label='Налаштування...', action=('opengui', SCREENS + 'options.OptionsScreen')) lay.button('mid-centered', -102, 20, 100, label='Налаштування...', action=('opengui', SCREENS + 'options.OptionsScreen'))
lay.button('mid-centered', 2, 20, 100, label='Скарги на гравців', active=NEVER) lay.button('mid-centered', 2, 20, 100, label='Скарги на гравців', active=NEVER)
# leaving: from our server straight to the title screen, from another one to the server list as usual # leaving: from our server straight to the title screen, from another one to the server list as usual
@@ -297,11 +321,12 @@ def main() -> None:
shutil.copyfile(ICONS / icon, fm / 'assets' / icon) shutil.copyfile(ICONS / icon, fm / 'assets' / icon)
(fm / 'customization' / 'title_screen_layout.txt').unlink(missing_ok=True) # the name used before the generator (fm / 'customization' / 'title_screen_layout.txt').unlink(missing_ok=True) # the name used before the generator
for name, layout in (('title', title_screen(version, labels)), ('screens', plain_screens()), ('pause', game_menu())): for name, layout in (('title', title_screen(version, labels)), ('screens', plain_screens()), ('lists', list_screens()),
('pause', game_menu())):
(fm / 'customization' / f'createrp_{name}.txt').write_text(layout.text(), encoding='utf-8', newline='\n') (fm / 'customization' / f'createrp_{name}.txt').write_text(layout.text(), encoding='utf-8', newline='\n')
(fm / 'custom_gui_screens.txt').write_text(CUSTOM_GUIS, encoding='utf-8', newline='\n') (fm / 'custom_gui_screens.txt').write_text(CUSTOM_GUIS, encoding='utf-8', newline='\n')
(fm / 'customizablemenus.txt').write_text( (fm / 'customizablemenus.txt').write_text(
'type = customizablemenus\n\n' + ''.join(f'{SCREENS}{c} {{\n}}\n\n' for c in ['TitleScreen'] + [c for _, c in PLAIN_SCREENS]), 'type = customizablemenus\n\n' + ''.join(f'{c} {{\n}}\n\n' for c in [SCREENS + 'TitleScreen'] + [c for _, c in PLAIN_SCREENS + LIST_SCREENS]),
encoding='utf-8', newline='\n') encoding='utf-8', newline='\n')
options = (fm / 'options.txt').read_text(encoding='utf-8') options = (fm / 'options.txt').read_text(encoding='utf-8')
@@ -311,12 +336,14 @@ def main() -> None:
options = option(options, 'custom_window_icon_32', '/config/fancymenu/assets/favicon-32x32.png') options = option(options, 'custom_window_icon_32', '/config/fancymenu/assets/favicon-32x32.png')
options = option(options, 'custom_window_icon_macos', '') options = option(options, 'custom_window_icon_macos', '')
options = option(options, 'global_background_panorama', '') options = option(options, 'global_background_panorama', '')
options = option(options, 'global_menu_background_texture', ASSET + 'background_dim.png') # every other menu screen
(fm / 'options.txt').write_text(options, encoding='utf-8') (fm / 'options.txt').write_text(options, encoding='utf-8')
sprites = config.parent / 'kubejs' / 'assets' / 'minecraft' / 'textures' / 'gui' / 'sprites' / 'widget' for source in RESOURCES.rglob('*'): # branding/resources/<namespace>/… → kubejs/assets/<namespace>/…
sprites.mkdir(parents=True, exist_ok=True) if source.is_file():
for sprite in UI.iterdir(): # button.png, button_highlighted.png, button_disabled.png and their .mcmeta target = config.parent / 'kubejs' / 'assets' / source.relative_to(RESOURCES)
shutil.copyfile(sprite, sprites / sprite.name) target.parent.mkdir(parents=True, exist_ok=True)
shutil.copyfile(source, target)
create = config / 'create-client.toml' # Create draws its button itself; row 0 switches it off create = config / 'create-client.toml' # Create draws its button itself; row 0 switches it off
if create.is_file(): if create.is_file():