User Tools

Site Tools


zh_cn:tutorial:tools

Differences

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

Link to this comparison view

Next revisionBoth sides next revision
zh_cn:tutorial:tools [2021/07/25 01:29] – created solidblockzh_cn:tutorial:tools [2021/07/25 01:36] – [创建工具材料] solidblock
Line 78: Line 78:
 </code> </code>
  
-''ToolMaterial''//不需要//注册。A good way to pass them out to tools that require them is by keeping an instance somewhere (and then referencing it when you need it). In this case, we will put our instance at the top of the Tool Material class:+''ToolMaterial''//不需要//注册。将其传递给需要的工具的一种较好的方法,是将实例保存在某个地方(然后在需要时引用它)。在本例中,我们把实例放在ToolMaterial类的顶部:
 <code java [enable_line_numbers=true]> <code java [enable_line_numbers=true]>
 public class PotatoToolMaterial implements ToolMaterial { public class PotatoToolMaterial implements ToolMaterial {
Line 88: Line 88:
 </code> </code>
  
-''PotatoToolMaterial'' can now be referenced with ''PotatoToolMaterial.INSTANCE''.+''PotatoToolMaterial''可以使用''PotatoToolMaterial.INSTANCE''引用。
  
 ==== 创建工具 ==== ==== 创建工具 ====
zh_cn/tutorial/tools.txt · Last modified: 2022/12/16 00:33 by solidblock