User Tools

Site Tools


zh_cn:tutorial:terms

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
zh_cn:tutorial:terms [2019/12/18 10:22] lightcolourzh_cn:tutorial:terms [2024/08/25 12:10] (current) solidblock
Line 1: Line 1:
-====== 惯用词和术语 ======+====== 基本约定和术语 ======
  
 +开始用 Fabric 写模组前,应当先了解以后的教程页面中使用的一些关键术语和短语,这很重要。最好也了解诸如包结构和 modid 命名之类的基本约定。尽早了解这些内容将有助于你更好地理解教程,并使你在需要时能提出更好的问题。
  
-Before starting with Fabric modding, it's important to understand some of the key terms and phrases used in future tutorial pages. It's also good to know basic conventions for things such as package structure and modid naming. Knowing these early will help you to understand tutorials better and enable you to ask better questions when needed.+===== 模组 ID =====
  
-==== Mod ID ==== +在整个 wiki 中,我们经常会提到模组 ID 或代码中的 modid。 模组 ID 代表模组的标识符(Mod Identifier),是一个字符串,应该唯一地标识你的模组。模组 ID 通常与同名的标识符命名空间相关联,因此遵循与之相同的限制。模组 ID 只能由小写字母 ''a-z'',数字 ''0-9'' 和符号 ''_-'' 组成。例如,Minecraft 使用 ''minecraft'' 命名空间。此外,Mod ID 必须至少包含两个字符。
-Throughout the documentation, we'll often refer to a Mod ID, or modid in code. Mod ID stands for "Mod Identifier," and it is a string that should uniquely identify your mod. Mod IDs are commonly associated with identifier namespaces of the same name, and as such, follow the same restrictions. Mod IDs can consist only of lowercase characters ''a-z'', numbers ''0-9'', and the symbols ''_-''. For example, Minecraft uses the ''minecraft'' namespace. Additionally, a mod ID must consist of at least two characters.+
  
-A mod ID is often a compact version of the name of the mod which makes it short but recognizeable and prevents naming conflicts. Conventionally, a project named "My Project--" could be called ''myproject''''my_project'', or in some cases, ''my-project'' also works, but dashes in modids can be a slight pain to deal with at times [citation needed]. This mod would register items and blocks using this mod ID as a registry namespace.+模组 ID 通常是模组名称的紧凑版本,使其简短但可识别并防止命名冲突。按照惯例,名为 “My Project” 的项目可以称为 ''myproject''''my_project'' 或者 ''my-project''。注册物品和方块(或其他任何东西)时,应该使用此模组 ID 作为 ID 的命名空间。
  
-Some of the starter tutorials will use a placeholder mod ID and register items and blocks under a placeholder namespace, and you can think of it as a starter template-- while leaving this unchanged is not dangerous for testing, remember to change it if you intend to release your project.+一些入门教程将使用占位符模组 ID 并在占位符命名空间下注册物品和方块,你可以将其视为入门模板。Fabric Wiki 统一使用 ''tutorial'' 作为命名空间。尽管保持使用占位符对测试影响不大,但请记住发布项目之前要更改它。
  
-==== Tags ==== +===== 标签 =====
-Draft. Edit it.+
  
-Convention namespace for tags is ''c''.+**标签**是方块、物品、流体等的组。例如,方块标签 ''minecraft:saplings'' 包含游戏里面的所有树苗。在 Minecraft 中,所有有注册表的东西的类型都有标签。
  
-==== Maven Group Package Names ==== +Minecraft 使用标签决定许多东西,例如,有标签 ''minecraft:mineable/pickaxe'' 的方块可以被镐快速挖掘。Fabric API 也提供了一些常规标签。关于标签的更多信息,请见 [[tags|tags]] 和 [[https://zh.minecraft.wiki/标签|Minecraft Wiki 的“标签”页面]]. 
-According to Oracle'Java documentation, they are written in all lower case to avoid conflict with the names of classes or interfaces. The reverse of your domain name is used to start the names. Read more at [[https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html]].+ 
 +==== 入口点和初始化器 ==== 
 + 
 +Fabric Loader 使用 ''fabric.mod.json'' 来检测和加载你的模组。一个模组通常包含至少一个**初始化器**类,这个类应该实现了 ''ModInitializer''、''ClientModInitializer'' 和 ''DedicatedServerModInitializer'' 这三个接口中的一个。这三个接口都在 ''net.fabricmc.api'' 包内。在 Fabric Wiki 教程中,我们通常使用 ''ExampleMod'' 作为模组初始化器,就像 Fabric Example Mod 做的那样。 
 + 
 +如果要修改或者添加初始化器,需要找到 ''fabric.mod.json'' 里的 ''entrypoints'' 字段,然后跟据实际情况修改。''main'' 块用于 Mod Initializers,''client'' 块用于 Client Mod Initializers,而 ''server'' 块用于 Server Mod Initializers。 
 + 
 +<code java> 
 +
 +  [...] 
 +  "entrypoints":
 +    "main":
 +      "net.fabricmc.ExampleMod" 
 +    ], 
 +    "client":
 +      "net.fabricmc.ExampleClientMod" 
 +    ] 
 +  } 
 +  [...] 
 +
 +</code> 
 + 
 +为了实现 ''ModInitializer''、''ClientModInitializer'' 或 ''DedicatedServerModInitializer'',你必须实现 ''onInitialize()''(或者对于 Client 是 ''onInitializeClient()'',对于 Server 是 ''onInitializeServer()'')函数,然后在里面写上你的代码。 
 + 
 +入口点的更多信息,请看 [[zh_cn:documentation:entrypoint]]。 
 + 
 +==== Maven Group 和 Package 的名称 ==== 
 + 
 +根据 Oracle 的 Java 文档,它们以小写形式编写,以避免与类或接口的名称冲突。这些名称使用域名反写作为前缀。前往这个链接阅读更多:[[https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html]]
zh_cn/tutorial/terms.1576664549.txt.gz · Last modified: 2019/12/18 10:22 by lightcolour