跳到正文

Selenium

作者:thegwimweeper

A simple mod that allows the player to create and customise their own gui. Mainly useful for other mod developers who don't want to spend the time and energy in creating a gui

收藏

截图

介绍

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

Selenium

A simple mod that allows YOU to make your own gui complete with editable hud.
This mod aims at easing the lives of developers who don’t wish to spend the excessive time needed to create a gui.
They can directly use this mod’s api to easily add buttons that control their functions.

This includes:

  • creating main tabs
  • creating settings
  • creating child settings
  • choosing type (CHECK, NUMBER, TEXT)
  • setting default value
  • marking them as HUD
  • reading/writing your values later

The current api includes the following features

Ensures a main tab exists in Selenium.

SeleniumApi.ensureMainTab(name)

Registers a top-level setting with default locked API permissions.

SeleniumApi.registerSetting(ownerModId, key, mainTab, label, type, renderType, defaultValue, hud, subSettings)

Registers a top-level setting with explicit player-edit permissions.

SeleniumApi.registerSetting(ownerModId, key, mainTab, label, type, renderType, defaultValue, hud, subSettings, permissions)

Registers a child setting under an existing parent with default locked API permissions.

SeleniumApi.registerChildSetting(ownerModId, key, mainTab, parentId, label, type, renderType, defaultValue, hud, subSettings)

Registers a child setting under an existing parent with explicit player-edit permissions.

SeleniumApi.registerChildSetting(ownerModId, key, mainTab, parentId, label, type, renderType, defaultValue, hud, subSettings, permissions)

Checks whether a Selenium setting with that id exists.

SeleniumApi.hasSetting(id)

Reads a check/toggle setting as a boolean.

SeleniumApi.getToggle(id)

Sets a check/toggle setting value.

SeleniumApi.setToggle(id, enabled)

Reads a number setting as a double.

SeleniumApi.getNumber(id)

Sets a number setting value.

SeleniumApi.setNumber(id, value)

Reads a text setting value.

SeleniumApi.getText(id)

Sets a text setting value.

SeleniumApi.setText(id, value)

Declares a boolean on/off setting type

SeleniumApi.SettingType.CHECK

Declares a numeric setting type.

SeleniumApi.SettingType.NUMBER

Declares a text/string setting type.

SeleniumApi.SettingType.TEXT

Defines what the player is allowed to do to an API-created setting.

SeleniumApi.Permissions(allowHudEdits, allowGuiAdd, allowGuiEdit, allowHiding)

Returns the default API permissions: locked editing, hiding allowed.

SeleniumApi.Permissions.defaults()

Returns permissions that let the player fully edit the setting and HUD.

SeleniumApi.Permissions.fullyEditable()

Add a color setting type (stores the color as hex #RRGGBB)

SeleniumApi.registerSetting(ownerModId, key, mainTab, label, SeleniumApi.SettingType.COLOR, renderType, "#FFFFFF", hud, subSettings, permissions)

Add a bounded slider setting type (min/max/step)

SeleniumApi.registerSetting(ownerModId, key, mainTab, label, 
    SeleniumApi.SettingType.SLIDER, renderType, "50", 
    Map.of("min", "0", "max", "100", "step", "1"), 
    hud, subSettings, permissions)

You can pass metadata via a “Map<String, String>“ parameter to set the min/max/steps.

The default value is set by “50” by hardcoding it (This is where the slider starts by default)

Add a selectable choice setting type (comma separated options)

    SeleniumApi.SettingType.CHOICE, renderType, "Medium", 
    Map.of("options", "Low, Medium, High"), 
    hud, subSettings, permissions)

Same as slider, the metadata can be passed via a “Map<String, String>“ parameter to set the choices. The default chocie is set by hardcoding it

Commands

Selenium adds a few commands, namely:

  
>   Opens the main gui, listing all the options allowing enabling/disabling options

  

Allows the editing of the hud, by dragging and resizing the elements

  
 >  Allows the creation/deletion of new buttons

>  Editing is disbaled by default, unless the develpoer chooses to enable it.
  

Opens the tutorial screen

Hud rendering

A simple example of how the hud renders

The main UI

The main UI

Editing main tab

Editing main tab

Editing an existing setting

Editing an existing setting

Creating a main tab (shown on the left side of the ui)

Creating a main tab (shown on the left side of the ui)

Easily hide settings and access them

Easily hide settings and access them

The tutorial screen

The tutorial screen

常见问题

Selenium 支持哪些 Minecraft 版本?

Selenium 支持 Minecraft Java 版 1.21.11,可用的加载器:Fabric。下载时注意选择和你游戏版本一致的文件。

Selenium 怎么安装?

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

评论

登录后评论和评分

thegwimweeper 的其他作品

查看全部 →