User Tools

Site Tools


zh_cn:tutorial:itemgroup

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
zh_cn:tutorial:itemgroup [2020/11/11 14:56] – [创建简单物品组] 拒绝机翻,从我做起! solidblockzh_cn:tutorial:itemgroup [2020/11/11 15:00] – [使物品组按特定顺序显示特定项目] solidblock
Line 26: Line 26:
 </code> </code>
  
-==== 使物品组按特定顺序显示特定项目 ==== +==== 使物品组按特定顺序显示特定物品 ==== 
-调用''FabricItemGroupBuilder#appendItems'',并传递任何''Consumer<List<ItemStack//>//>''。然后,您可以按顺序将任何堆栈添加到定列表中ItemStack.EMPTY“”可用于在组中放置空格。 +调用''FabricItemGroupBuilder#appendItems'',并传递任何''Consumer<List<ItemStack//>//>''。然后,您可以按顺序将将你想要添加的堆栈添加到定列表中。''ItemStack.EMPTY''可用于在组中放置空格。 
-<code java [enable_line_numbers="true",highlight_lines_extra="11,12,13,14,15,16,17,18"]> +<code java [enable_line_numbers="true",highlight_lines_extra="11,12,13,14,15"]> 
-public class ExampleMod implements ModInitializer +public class ExampleMod implements ModInitializer { 
-+
- // ...+
  public static final ItemGroup ITEM_GROUP = FabricItemGroupBuilder.build(  public static final ItemGroup ITEM_GROUP = FabricItemGroupBuilder.build(
  new Identifier("tutorial", "general"),  new Identifier("tutorial", "general"),
Line 39: Line 38:
  new Identifier("tutorial", "other"))  new Identifier("tutorial", "other"))
  .icon(() -> new ItemStack(Items.BOWL))  .icon(() -> new ItemStack(Items.BOWL))
- .appendItems(stacks -> + .appendItems(stacks -> {
- {+
  stacks.add(new ItemStack(Blocks.BONE_BLOCK));  stacks.add(new ItemStack(Blocks.BONE_BLOCK));
  stacks.add(new ItemStack(Items.APPLE));  stacks.add(new ItemStack(Items.APPLE));
zh_cn/tutorial/itemgroup.txt · Last modified: 2023/11/18 08:09 by solidblock