模组简介
这是一个仅在客户端运行的轻量级模组,它为世界选择界面(MC 1.13 之前版本)添加了“搜索世界”框,并通过使用键值对参数来增强搜索功能。
如何使用此模组
此模组在世界选择界面(MC 1.13 之前版本)中添加了一个“搜索世界”框,现在的搜索行为如下:
worlddirname-=foo - 搜索目录名包含 foo 的世界,区分大小写
worldname/="^New World$" - 搜索名称恰好为 New World 的世界,不区分大小写
gamemode=S,commands=true - 搜索默认游戏模式为生存且命令已启用的世界
参数格式
每两个键值对之间用 , 分隔(这意味着 &&(与),允许末尾有一个 ,)。相反,一个键值对的格式如下:<key_name><relationship_symbol><value>。
对于正则表达式键,可用的关系符号有:
= - 左侧包含右侧,不区分大小写
!= - 左侧不包含右侧,不区分大小写
-= - 左侧包含右侧,区分大小写
!-= - 左侧不包含右侧,区分大小写
/= - 左侧匹配右侧,不区分大小写
!/= - 左侧不匹配右侧,不区分大小写
/-= - 左侧匹配右侧,区分大小写
!/-= - 左侧不匹配右侧,区分大小写
值的格式如下:
foo - 解析为 foo
"Foo Bar" - 解析为 Foo Bar
"One says \"\\s are useful\"" - 解析为 One says "\s are useful"
对于长整型键,可用的关系符号为:
= 和 == - 左等于右
< - 左小于右
<= - 左小于或等于右
> - 左大于右
>= - 左大于或等于右
!= - 左不等于右
值为类似以下格式的长整数:
0
1234567
-98765432109999
对于枚举键,可用的关系符号为:
值为枚举类定义的所有枚举值以及 null。
对于布尔键,仅有一个可用的关系符号 =(表示左等于右)。
值为类似以下格式:
true、t、yes、y、1 - 表示真
false、f、no、n、0 - 表示假
如果参数格式有效,将会显示预期的搜索结果。请注意,原始搜索行为的结果也会一并显示。例如,如果存在一个名为 gamemode=C 的世界,其默认游戏模式为生存模式,当你在输入框中输入 gamemode=C 时,这个世界仍会作为结果的一部分显示。如果你希望避免这种情况,可以在输入框中输入 worldname!="gamemode=C",gamemode=C。
本模组添加的所有键值对参数
worldname(正则表达式) - 匹配世界名称
worlddirname(正则表达式) - 匹配世界目录名称
lastplayed(长整型) - 匹配最后游玩时间
gamemode(枚举类型,由 S、C、A、SP 组成) - 匹配默认游戏模式
commands(布尔值) - 匹配命令启用状态
hardcore(布尔值) - 匹配世界是否为硬核模式
我想添加自己的键值对参数!
本模组中包含一个类 rege.rege.minecraftmod.searchworldenhance.util.SearchKeyRegistry,你可以使用该类的静态方法来注册你自己的参数。所有有效的键必须是除 -、 (空格)、=、!、>、<、,、/、"、\ 之外的非空字符串。示例代码位于 rege.rege.minecraftmod.searchworldenhance.SearchWorldEnhanceMain 源码的 static 块中。
Mod Synopsis
This is a lightweight mod run on client-side, which brings a “Search World” box to world selection screens(prior MC 1.13) and enhance the searching behaviour by using key-value pair arguments.
How to Use This Mod
This mod adds a “Search World” box to the world select screen(prior MC 1.13), and the searching behaviour is now like this:
worlddirname-=foo - Search for worlds whose directory names contain foo, case-sensitive
worldname/="^New World$" - Search for worlds whose names exactly are New World, case-insensitive
gamemode=S,commands=true - Search for worlds whose default game modes are Survival and commands are enabled
Format of Arguments
Each two key-value pairs are separated by ,(which means &&(and), and trailing , is allowed once). In contrast, a key-value pair is like this: <key_name><relationship_symbol><value>.
For regex keys, available relationship symbols are:
= - left contains right, case-insensitive
!= - left does not contain right, case-insensitive
-= - left contains right, case-sensitive
!-= - left does not contain right, case-sensitive
/= - left matches right, case-insensitive
!/= - left does not match right, case-insensitive
/-= - left matches right, case-sensitive
!/-= - left does not match right, case-sensitive
Values are strings like this:
foo - resolved as foo
"Foo Bar" - resolved as Foo Bar
"One says \"\\s are useful\"" - resolved as One says "\s are useful"
For long keys, available relationship symbols are:
= and == - left equals right
< - left is less than right
<= - left is less than or equal to right
> - left is greater than right
>= - left is greater than or equal to right
!= - left does not equal right
Values are long integers like this:
0
1234567
-98765432109999
For enum keys, available relationship symbols are:
= - left is right
!= - left is not right
Values are all enums defined by the enum class and null.
For boolean keys, there is only one available relationship symbol =(means left is right).
Values are like this:
true, t, yes, y, 1 - for true
false, f, no, n, 0 - for false
If the format of arguments is valid, expected search result will be shown. Note that results of original search behaviour will be shown together, e.g. if there is a world named gamemode=C whose default gamemode is Survival, when you type gamemode=C in the box, this world will still be shown as a part of the result. If you want to avoid this, you can type worldname!="gamemode=C",gamemode=C in the box.
All Key-value Pair Parameters Added by This Mod
worldname(Regex) - Match world names
worlddirname(Regex) - Match world directory names
lastplayed(Long) - Match last played time
gamemode(Enum made up by S, C, A, SP) - Match default game modes
commands(Boolean) - Match commands enabling statuses
hardcore(Boolean) - Match whether the worlds are hardcore
I Want to Add My Key-value Pair Parameters!
There is a class rege.rege.minecraftmod.searchworldenhance.util.SearchKeyRegistry in this mod, you should register yours using this class's static methods. All valid keys are non-empty strings without -, , =, !, >, <, ,, /, ", \. An example is in the static block of rege.rege.minecraftmod.searchworldenhance.SearchWorldEnhanceMain's source code.
评论 0
登录后参与评分
还没有评论,来抢沙发吧