跳到正文

ScreenSpec

An easy way to build screens for your mod.

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

screenspec is a NeoForge library that turns a JSON screen definition into a working Minecraft Screen — no codegen, no hand-laid-out widgets.

Design your mod’s UI visually in the MC Screen Designer, export a ScreenSpec JSON, drop it in your mod’s resources, and open it in three lines of code:

ScreenSpec spec = ScreenSpecLoader.fromResource(rm, "your_modid", "settings_screen");
SpecScreen screen = new SpecScreen(Component.literal("Settings"), spec);
Minecraft.getInstance().setScreen(screen);

Wire up behavior with a fluent listener API — no subclassing required:

screen.on("save_btn",   (id, s, v) -> save())
      .on("volume",     (id, s, v) -> setVolume((Double) v))
      .on("hardcore",   (id, s, v) -> setHardcore((Boolean) v));

Features

  • Buttons, toggle buttons (with radio groups), sliders, text inputs, labels, panels, and icons
  • Live data bindings — push game state into widget text, enabled state, and visibility every frame
  • Declarative action ids for reusable cross-screen event handling
  • Custom widget types, panel textures, and icon resolvers via simple overrides

Targets: Minecraft 1.21.5 / NeoForge 21.5.x / Java 21

常见问题

ScreenSpec 支持哪些 Minecraft 版本?

ScreenSpec 支持 Minecraft Java 版 1.21.1–26.2,共 3 个版本,可用的加载器:NeoForge。下载时注意选择和你游戏版本一致的文件。

ScreenSpec 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 NeoForge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:仅客户端。

评论

登录后评论和评分