iT邦幫忙

2024 iThome 鐵人賽

DAY 22
0

工具

昨天我們講到工具製作,我們接著講下去

    public static final Item StaffofNature = registerItem("staff_of_nature", new StaffofNature(new FabricItemSettings()));
    public static final Item SIDERITE_PICKAXE = registerItem("siderite_pickaxe", new PickaxeItem(ModToolMaterial.SIDERITE,2,2f,new FabricItemSettings()));
    public static final Item SIDERITE_AXE = registerItem("siderite_axe", new AxeItem(ModToolMaterial.SIDERITE,2,2f,new FabricItemSettings()));
    public static final Item SIDERITE_SHOVEL = registerItem("siderite_shovel", new ShovelItem(ModToolMaterial.SIDERITE,2,2f,new FabricItemSettings()));
    public static final Item SIDERITE_SWORD = registerItem("siderite_sword", new SwordItem(ModToolMaterial.SIDERITE,7,3f,new FabricItemSettings()));
    public static final Item SIDERITE_HOE = registerItem("siderite_hoe", new HoeItem(ModToolMaterial.SIDERITE,2,2f,new FabricItemSettings()));

昨天我們定義了我們工具要使用的材料,現在我們要使用這個材料來製作這個工具了,我們在Moditems中這樣寫。
我們註冊一個新的物品,以斧頭為例,我們註冊的時候使用AxeItem,並且我們在
new AxeItem(ModToolMaterial.SIDERITE, 2, 2f, new FabricItemSettings())
中,定義了這個工具使用的材料、攻擊力、攻擊速度,並且給這把斧頭默認的設定。

如果你對工具的材料設定並不清楚的話可以在ToolMaterial裡看看其他材料的設定
https://ithelp.ithome.com.tw/upload/images/20240921/20161797qDTwzhjPj0.png


上一篇
Minecraft Fabric Mod 模組製作 DAY21
下一篇
Minecraft Fabric Mod 模組製作 DAY23
系列文
Minecraft JAVA Fabric 模組製作 : 成為真正的創世神28
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言