Title screen: icon-only quit, no Create/accessibility/Mods buttons, pack version instead of the Minecraft lines

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Fulldroper
2026-10-14 05:58:03 +03:00
co-authored by Claude Opus 5.5
parent 6ec630bf47
commit 1dcefc772c
5 changed files with 235 additions and 19 deletions
+12 -3
View File
@@ -39,7 +39,7 @@
| `banners/launch.png` | анонс відкриття, 1280×720 | | `banners/launch.png` | анонс відкриття, 1280×720 |
| `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: тло, лого, іконка кнопки виходу, макет |
| `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,12 +49,21 @@
``` ```
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 [emblem_raw.png]
python tools/branding/fancymenu.py <тека config гри або збірки> python tools/branding/fancymenu.py <тека config гри або збірки> <1.21.1.jar> [версія збірки]
``` ```
Перший скрипт малює лого, іконки й банери: шрифт і текстури бере з jar-ів Minecraft і Create (у репозиторії їх Перший скрипт малює лого, іконки й банери: шрифт і текстури бере з jar-ів Minecraft і Create (у репозиторії їх
немає), тло — з `art/keyart.png`. Заміниш ілюстрацію на свій кадр із гри — перезапусти, і всі банери й тло меню немає), тло — з `art/keyart.png`. Заміниш ілюстрацію на свій кадр із гри — перезапусти, і всі банери й тло меню
оновляться. Другий ставить головне меню в теку `config/fancymenu`. оновляться. Другий ставить головне меню в теку `config/fancymenu` і малює напис із версією збірки в лівому
нижньому куті; версію бере з `pack.toml` поруч із текою `config`, якщо її не вказано. Після кожної зміни версії
збірки його треба запустити знову.
## Головне меню
Три ряди кнопок: «Увійти на сервер»; «Гра наодинці» й «Гра в мережі»; мова, «Налаштування» й вихід іконкою.
Сховано: кнопку Create, кнопку спеціальних можливостей (вона є в налаштуваннях), кнопку «Моди» та рядки
Minecraft / NeoForge в лівому нижньому куті — замість них версія збірки. Іконка виходу — `sign-out` із
бібліотеки FD Icons, перемальована на піксельну сітку іконок Minecraft.
## Прапор держави ## Прапор держави
Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

+152 -10
View File
@@ -482,6 +482,148 @@ element {
nine_slice_slider_handle_border_y = 5 nine_slice_slider_handle_border_y = 5
} }
element {
iconnormal = [source:local]/config/fancymenu/assets/quit.png
iconhovered = [source:local]/config/fancymenu/assets/quit.png
description = Вийти з гри
button_element_executable_block_identifier = c0ffee00-0000-4000-8000-000000000000-1791950000000
[executable_action_instance:c0ffee00-0000-4000-8000-0000000000ff-1791950000000][action_type:quitgame] =
[executable_block:c0ffee00-0000-4000-8000-000000000000-1791950000000][type:generic] = [executables:c0ffee00-0000-4000-8000-0000000000ff-1791950000000;]
underline_label_on_hover = false
transparent_background = false
restartbackgroundanimations = true
nine_slice_custom_background = false
navigatable = true
widget_active_state_requirement_container_identifier = c0ffee00-0000-4000-8000-000000000002-1791950000000
[loading_requirement_container_meta:c0ffee00-0000-4000-8000-000000000002-1791950000000] = [groups:][instances:]
is_template = false
template_apply_width = false
template_apply_height = false
template_apply_posx = false
template_apply_posy = false
template_apply_opacity = false
template_apply_visibility = false
template_apply_label = false
template_share_with = buttons
nine_slice_slider_handle = false
element_type = custom_button
instance_identifier = c0ffee00-0000-4000-8000-000000000003-1791950000000
appearance_delay = no_delay
disappearance_delay = no_delay
fade_in_v2 = no_fading
fade_out = no_fading
auto_sizing = false
auto_sizing_base_screen_width = 2560
auto_sizing_base_screen_height = 1355
sticky_anchor = false
anchor_point = mid-centered
x = 80
y = 12
width = 20
height = 20
stay_on_screen = true
element_loading_requirement_container_identifier = c0ffee00-0000-4000-8000-000000000004-1791950000000
[loading_requirement_container_meta:c0ffee00-0000-4000-8000-000000000004-1791950000000] = [groups:][instances:]
enable_parallax = false
invert_parallax = false
animated_offset_x = 0
animated_offset_y = 0
load_once_per_session = false
layer_hidden_in_editor = false
advanced_rotation_mode = false
advanced_vertical_tilt_mode = false
advanced_horizontal_tilt_mode = false
should_be_affected_by_decoration_overlays = true
in_editor_color = #FFC800FF
advanced_posx = -2147483648
advanced_posy = -2147483648
advanced_width = -2147483648
advanced_height = -2147483648
stretch_x = false
stretch_y = false
appearance_delay_seconds = 1.0
disappearance_delay_seconds = 1.0
fade_in_speed = 1.0
fade_out_speed = 1.0
base_opacity = 1.0
parallax_intensity_x = 0.5
parallax_intensity_y = 0.5
rotation_degrees = 0.0
advanced_rotation_degrees = 0.0
vertical_tilt_degrees = 0.0
advanced_vertical_tilt_degrees = 0.0
horizontal_tilt_degrees = 0.0
advanced_horizontal_tilt_degrees = 0.0
label_scale = 1.0
label_shadow = true
nine_slice_border_x = 5
nine_slice_border_y = 5
nine_slice_slider_handle_border_x = 5
nine_slice_slider_handle_border_y = 5
}
element {
element_type = image
instance_identifier = c0ffee01-0000-4000-8000-000000000000-1791950000000
appearance_delay = no_delay
disappearance_delay = no_delay
fade_in_v2 = no_fading
fade_out = no_fading
auto_sizing = false
auto_sizing_base_screen_width = 2560
auto_sizing_base_screen_height = 1355
sticky_anchor = false
anchor_point = bottom-left
x = 2
y = -2
width = {version_width}
height = {version_height}
stay_on_screen = true
element_loading_requirement_container_identifier = c0ffee01-0000-4000-8000-000000000001-1791950000000
[loading_requirement_container_meta:c0ffee01-0000-4000-8000-000000000001-1791950000000] = [groups:][instances:]
enable_parallax = false
invert_parallax = false
animated_offset_x = 0
animated_offset_y = 0
load_once_per_session = false
layer_hidden_in_editor = false
advanced_rotation_mode = false
advanced_vertical_tilt_mode = false
advanced_horizontal_tilt_mode = false
should_be_affected_by_decoration_overlays = false
in_editor_color = #FFC800FF
advanced_posx = -2147483648
advanced_posy = -2147483648
advanced_width = -2147483648
advanced_height = -2147483648
stretch_x = false
stretch_y = false
appearance_delay_seconds = 1.0
disappearance_delay_seconds = 1.0
fade_in_speed = 1.0
fade_out_speed = 1.0
base_opacity = 1.0
parallax_intensity_x = 0.5
parallax_intensity_y = 0.5
rotation_degrees = 0.0
advanced_rotation_degrees = 0.0
vertical_tilt_degrees = 0.0
advanced_vertical_tilt_degrees = 0.0
horizontal_tilt_degrees = 0.0
advanced_horizontal_tilt_degrees = 0.0
source = [source:local]/config/fancymenu/assets/version.png
repeat_texture = false
nine_slice_texture = false
nine_slice_texture_border_x = 5
nine_slice_texture_border_y = 5
restart_animated_on_menu_load = false
image_tint = #FFFFFF
rounding_radius_top_left = 0.0
rounding_radius_top_right = 0.0
rounding_radius_bottom_right = 0.0
rounding_radius_bottom_left = 0.0
}
vanilla_button { vanilla_button {
button_element_executable_block_identifier = 16b09226-06a9-4fee-8c35-74c0dd5d812c-1778341927602 button_element_executable_block_identifier = 16b09226-06a9-4fee-8c35-74c0dd5d812c-1778341927602
[executable_block:16b09226-06a9-4fee-8c35-74c0dd5d812c-1778341927602][type:generic] = [executables:] [executable_block:16b09226-06a9-4fee-8c35-74c0dd5d812c-1778341927602][type:generic] = [executables:]
@@ -557,7 +699,7 @@ vanilla_button {
nine_slice_slider_handle_border_x = 5 nine_slice_slider_handle_border_x = 5
nine_slice_slider_handle_border_y = 5 nine_slice_slider_handle_border_y = 5
automated_button_clicks = 0 automated_button_clicks = 0
is_hidden = false is_hidden = true
} }
vanilla_button { vanilla_button {
@@ -713,7 +855,7 @@ vanilla_button {
nine_slice_slider_handle_border_x = 5 nine_slice_slider_handle_border_x = 5
nine_slice_slider_handle_border_y = 5 nine_slice_slider_handle_border_y = 5
automated_button_clicks = 0 automated_button_clicks = 0
is_hidden = false is_hidden = true
} }
vanilla_button { vanilla_button {
@@ -747,8 +889,8 @@ vanilla_button {
auto_sizing_base_screen_height = 1355 auto_sizing_base_screen_height = 1355
sticky_anchor = false sticky_anchor = false
anchor_point = mid-centered anchor_point = mid-centered
x = -124 x = -100
y = 36 y = 12
width = 20 width = 20
height = 20 height = 20
stay_on_screen = true stay_on_screen = true
@@ -947,7 +1089,7 @@ vanilla_button {
nine_slice_slider_handle_border_x = 5 nine_slice_slider_handle_border_x = 5
nine_slice_slider_handle_border_y = 5 nine_slice_slider_handle_border_y = 5
automated_button_clicks = 0 automated_button_clicks = 0
is_hidden = false is_hidden = true
} }
vanilla_button { vanilla_button {
@@ -981,9 +1123,9 @@ vanilla_button {
auto_sizing_base_screen_height = 1355 auto_sizing_base_screen_height = 1355
sticky_anchor = false sticky_anchor = false
anchor_point = mid-centered anchor_point = mid-centered
x = -100 x = -76
y = 36 y = 12
width = 98 width = 152
height = 20 height = 20
stay_on_screen = true stay_on_screen = true
element_loading_requirement_container_identifier = 5c271f02-4570-4fc1-99ab-19ea32d7804f-1778341927602 element_loading_requirement_container_identifier = 5c271f02-4570-4fc1-99ab-19ea32d7804f-1778341927602
@@ -1337,7 +1479,7 @@ vanilla_button {
nine_slice_slider_handle_border_x = 5 nine_slice_slider_handle_border_x = 5
nine_slice_slider_handle_border_y = 5 nine_slice_slider_handle_border_y = 5
automated_button_clicks = 0 automated_button_clicks = 0
is_hidden = false is_hidden = true
} }
vanilla_button { vanilla_button {
@@ -1493,7 +1635,7 @@ vanilla_button {
nine_slice_slider_handle_border_x = 5 nine_slice_slider_handle_border_x = 5
nine_slice_slider_handle_border_y = 5 nine_slice_slider_handle_border_y = 5
automated_button_clicks = 0 automated_button_clicks = 0
is_hidden = false is_hidden = true
} }
vanilla_button { vanilla_button {
+30
View File
@@ -188,6 +188,35 @@ def fit(im: Image.Image, max_w: int, max_h: int) -> Image.Image:
return im.resize((im.width * k, im.height * k), Image.NEAREST) return im.resize((im.width * k, im.height * k), Image.NEAREST)
# The quit button of the title screen: a door frame with an arrow going out — the library's "sign-out" icon redrawn
# on the 13 px grid of Minecraft's own button icons. '#' is white, '+' the light grey Minecraft shades them with.
QUIT_ICON = '''
#######......
#++++++......
#+...........
#+.......#...
#+.......##..
#+..########.
#+..#########
#+..+++++##+.
#+.......#+..
#+.......+...
#+...........
#######......
+++++++......
'''
def button_icon(rows: str) -> Image.Image:
"""A 20x20 picture for a 20x20 button; the drawing starts at (4, 4), where Minecraft puts its own icons."""
im = Image.new('RGBA', (20, 20), (0, 0, 0, 0))
for y, row in enumerate(rows.split()):
for x, c in enumerate(row):
if c != '.':
im.putpixel((4 + x, 4 + y), (255, 255, 255, 255) if c == '#' else (208, 208, 208, 255))
return im
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
@@ -250,6 +279,7 @@ 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')
stack([wordmark(8), motto(3)], gap=12).save(OUT / 'menu' / 'logo.png') stack([wordmark(8), motto(3)], gap=12).save(OUT / 'menu' / 'logo.png')
button_icon(QUIT_ICON).save(OUT / 'menu' / 'quit.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'))))
+41 -6
View File
@@ -1,17 +1,29 @@
"""Writes the FancyMenu configuration of the Create RP title screen into a game's config folder. """Writes the FancyMenu configuration of the Create RP title screen into a game's config folder.
python tools/branding/fancymenu.py <config dir> e.g. the client pack's config/ or a profile's config/ python tools/branding/fancymenu.py <config dir> <1.21.1.jar> [pack version]
<config dir> is the client pack's config/ or a profile's config/. The version is read from pack.toml next to the
config dir when it is not given.
Layout: the key art as the background, our logo instead of Minecraft's, one wide button that joins the server, Layout: the key art as the background, our logo instead of Minecraft's, one wide button that joins the server,
then the usual buttons. The layout file itself is branding/menu/title_screen_layout.txt; this script only copies it single player and multiplayer, then language, options and an icon-only quit button in one row. Minecraft's own
with the pictures and switches the window title, the window icon and the title-screen customisation on. lines in the bottom left corner are replaced with the pack version. The layout file itself is
branding/menu/title_screen_layout.txt; this script copies it with the pictures, draws the version label and
switches the window title, the window icon and the title-screen customisation on.
""" """
import re import re
import shutil import shutil
import sys import sys
import zipfile
from pathlib import Path from pathlib import Path
import numpy as np
from PIL import Image
ROOT = Path(__file__).resolve().parent.parent.parent ROOT = Path(__file__).resolve().parent.parent.parent
sys.path.insert(0, str(ROOT / 'tools' / 'signs'))
from render import Font # noqa: E402 (the pixel font reader made for the building signs)
MENU, ICONS = ROOT / 'branding' / 'menu', ROOT / 'branding' / 'icons' MENU, ICONS = ROOT / 'branding' / 'menu', ROOT / 'branding' / 'icons'
WINDOW_TITLE = 'Create RP' WINDOW_TITLE = 'Create RP'
@@ -23,15 +35,38 @@ def option(text: str, key: str, value: str) -> str:
return pattern.sub(lambda m: m.group(1) + value + m.group(2), text) return pattern.sub(lambda m: m.group(1) + value + m.group(2), text)
def label(font: Font, text: str) -> Image.Image:
"""A line of text exactly as the game draws it: white, with the dark shadow one pixel down and right."""
mask = font.line(text)
rows = np.nonzero(mask.any(axis=1))[0]
mask = mask[rows.min():rows.max() + 1]
h, w = mask.shape
px = np.zeros((h + 1, w + 1, 4), np.uint8)
px[1:, 1:][mask] = (63, 63, 63, 255)
px[:-1, :-1][mask] = (255, 255, 255, 255)
return Image.fromarray(px, 'RGBA')
def main() -> None: def main() -> None:
fm = Path(sys.argv[1]) / 'fancymenu' config = Path(sys.argv[1])
fm = config / 'fancymenu'
if len(sys.argv) > 3:
version = sys.argv[3]
else:
version = re.search(r'^version = "([^"]+)"', (config.parent / 'pack.toml').read_text(encoding='utf-8'), re.M).group(1)
with zipfile.ZipFile(sys.argv[2]) as jar:
version_label = label(Font(jar), f'{WINDOW_TITLE} {version}')
(fm / 'assets').mkdir(parents=True, exist_ok=True) (fm / 'assets').mkdir(parents=True, exist_ok=True)
(fm / 'customization').mkdir(parents=True, exist_ok=True) (fm / 'customization').mkdir(parents=True, exist_ok=True)
shutil.copyfile(MENU / 'logo.png', fm / 'assets' / 'logo.png') shutil.copyfile(MENU / 'logo.png', fm / 'assets' / 'logo.png')
shutil.copyfile(MENU / 'background.png', fm / 'assets' / 'background.png') shutil.copyfile(MENU / 'background.png', fm / 'assets' / 'background.png')
shutil.copyfile(MENU / 'quit.png', fm / 'assets' / 'quit.png')
version_label.save(fm / 'assets' / 'version.png')
for icon in ('favicon-16x16.png', 'favicon-32x32.png'): for icon in ('favicon-16x16.png', 'favicon-32x32.png'):
shutil.copyfile(ICONS / icon, fm / 'assets' / icon) shutil.copyfile(ICONS / icon, fm / 'assets' / icon)
shutil.copyfile(MENU / 'title_screen_layout.txt', fm / 'customization' / 'title_screen_layout.txt') layout = (MENU / 'title_screen_layout.txt').read_text(encoding='utf-8')
layout = layout.replace('{version_width}', str(version_label.width)).replace('{version_height}', str(version_label.height))
(fm / 'customization' / 'title_screen_layout.txt').write_text(layout, encoding='utf-8', newline='\n')
(fm / 'customizablemenus.txt').write_text( (fm / 'customizablemenus.txt').write_text(
'type = customizablemenus\n\nnet.minecraft.client.gui.screens.TitleScreen {\n}\n\n', encoding='utf-8') 'type = customizablemenus\n\nnet.minecraft.client.gui.screens.TitleScreen {\n}\n\n', encoding='utf-8')
@@ -43,7 +78,7 @@ def main() -> None:
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', '')
(fm / 'options.txt').write_text(options, encoding='utf-8') (fm / 'options.txt').write_text(options, encoding='utf-8')
print('title screen installed into', fm) print('title screen installed into', fm, '| version label:', version, version_label.size)
if __name__ == '__main__': if __name__ == '__main__':