User Tools

Site Tools


zh_cn:tutorial:commands

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
zh_cn:tutorial:commands [2023/11/19 02:01] – [子命令] solidblockzh_cn:tutorial:commands [2023/11/19 02:02] (current) – [可以注册客户端命令吗?] solidblock
Line 294: Line 294:
 ===== 可以注册客户端命令吗? ===== ===== 可以注册客户端命令吗? =====
  
-Fabric 有个 ClientCommandManager,可以注册客户端命令。代码应该仅存在于客户端的代码中。例子:+Fabric API 有个 ''ClientCommandManager'',可以注册客户端命令。代码应该仅存在于客户端的代码中。例子:
  
 <code java> <code java>
Line 305: Line 305:
 </code> </code>
  
-如果你需要在客户端命令执行劳教中打开屏幕,不要直接调用 ''client.setScreen(...)'',你应该调用 ''%%client.execute(() -> client.setScreen(...))%%'',其中变量 ''client'' 可以通过 ''context.getSource().getClient()'' 获得。+如果你需要在客户端命令执行过程中打开屏幕,不要直接调用 ''client.setScreen(...)'',你应该调用 ''%%client.execute(() -> client.setScreen(...))%%'',其中变量 ''client'' 可以通过 ''context.getSource().getClient()'' 获得。
  
 ===== 可以运行时注册命令吗? ===== ===== 可以运行时注册命令吗? =====
zh_cn/tutorial/commands.txt · Last modified: 2023/11/19 02:02 by solidblock