最新版 |
編集中の文章 |
35行目: |
35行目: |
| | | |
| //ツール作成 | | //ツール作成 |
− | public static ToolItem EMERALD_SWORD = new SwordItem(CustomToolMaterial.INSTANCE, 3, -2F, new Item.Settings().group(ItemGroup.TOOLS));//剣を作成 | + | public static ToolItem EMERALD_SWORD = new SwordItem(RubyToolMaterial.INSTANCE, 3, -2F, new Item.Settings().group(ItemGroup.TOOLS)); |
− | public static ToolItem EMERALD_PICKAXE = new CustomPickaxeItem(CustomToolMaterial.INSTANCE, 1, -3.0F, new Item.Settings().group(ItemGroup.TOOLS));//ツルハシを作成 | + | public static ToolItem EMERALD_PICKAXE = new CustomPickaxeItem(RubyToolMaterial.INSTANCE, 1, -3.0F, new Item.Settings().group(ItemGroup.TOOLS)); |
− | public static ToolItem EMERALD_AXE = new CustomAxeItem(CustomToolMaterial.INSTANCE, 2, -3.0F, new Item.Settings().group(ItemGroup.TOOLS));//オノを作成 | + | public static ToolItem EMERALD_AXE = new CustomAxeItem(RubyToolMaterial.INSTANCE, 2, -3.0F, new Item.Settings().group(ItemGroup.TOOLS)); |
− | public static ToolItem EMERALD_SHOVEL = new ShovelItem(CustomToolMaterial.INSTANCE, 1.5F, -3.0F, new Item.Settings().group(ItemGroup.TOOLS));//シャベルを作成 | + | public static ToolItem EMERALD_SHOVEL = new ShovelItem(RubyToolMaterial.INSTANCE, 1.5F, -3.0F, new Item.Settings().group(ItemGroup.TOOLS)); |
− | public static ToolItem EMERALD_HOE = new CustomHoeItem(CustomToolMaterial.INSTANCE, -1, -3.0F, new Item.Settings().group(ItemGroup.TOOLS));//クワを作成 | + | public static ToolItem EMERALD_HOE = new CustomHoeItem(RubyToolMaterial.INSTANCE, -1, -3.0F, new Item.Settings().group(ItemGroup.TOOLS)); |
| | | |
| @Override | | @Override |
| public void onInitialize() | | public void onInitialize() |
| { | | { |
− | //ツールを登録
| |
| Registry.register(Registry.ITEM, new Identifier(MOD_ID, "emerald_sword"), EMERALD_SWORD); | | Registry.register(Registry.ITEM, new Identifier(MOD_ID, "emerald_sword"), EMERALD_SWORD); |
| Registry.register(Registry.ITEM, new Identifier(MOD_ID, "emerald_shovel"), EMERALD_SHOVEL); | | Registry.register(Registry.ITEM, new Identifier(MOD_ID, "emerald_shovel"), EMERALD_SHOVEL); |
51行目: |
50行目: |
| Registry.register(Registry.ITEM, new Identifier(MOD_ID, "emerald_hoe"), EMERALD_HOE); | | Registry.register(Registry.ITEM, new Identifier(MOD_ID, "emerald_hoe"), EMERALD_HOE); |
| } | | } |
− | }
| |
− | }
| |
− | </source>
| |
− | *CustomToolMaterial.java
| |
− | <source lang = "java">
| |
− | package com.example.tool;
| |
− |
| |
− | import net.minecraft.item.Items;
| |
− | import net.minecraft.item.ToolMaterial;
| |
− | import net.minecraft.recipe.Ingredient;
| |
− |
| |
− | public class CustomToolMaterial implements ToolMaterial {
| |
− |
| |
− | public static final CustomToolMaterial INSTANCE = new CustomToolMaterial(); //インスタンス化
| |
− |
| |
− | @Override
| |
− | public int getDurability() {
| |
− | return 2000; //耐久値の設定
| |
− | }
| |
− |
| |
− | @Override
| |
− | public float getMiningSpeedMultiplier() {
| |
− | return 9F; //破壊速度
| |
− | }
| |
− |
| |
− | @Override
| |
− | public float getAttackDamage() {
| |
− | return 5F; //攻撃速度
| |
− | }
| |
− |
| |
− | @Override
| |
− | public int getMiningLevel() {
| |
− | return 3; //採掘レベル(ダイヤモンドの採掘レベルは3です。黒曜石を採掘するには3以上にしてください。)
| |
− | }
| |
− |
| |
− | @Override
| |
− | public int getEnchantability() {
| |
− | return 15; //エンチャント性
| |
− | }
| |
− |
| |
− | @Override
| |
− | //金床の修理
| |
− | public Ingredient getRepairIngredient() {
| |
− | return Ingredient.ofItems(Items.EMERALD);//エメラルドを指定(modid.アイテム) 使わない場合はnull
| |
− | }
| |
− | }
| |
− |
| |
− | </source>
| |
− | 「PickaxeItem」と「HoeItem」、「AxeItem」はプライベートコンストラクターなので新しくパブリックコンストラクターを作成してください。<br>
| |
− | 下記のソースコードをコピペしてください。
| |
− | *CustomAxeItem.java
| |
− | <source lang = "java">
| |
− | package com.example.tool;
| |
− |
| |
− | import net.minecraft.item.AxeItem;
| |
− | import net.minecraft.item.ToolMaterial;
| |
− |
| |
− | public class CustomAxeItem extends AxeItem {
| |
− | public CustomAxeItem(ToolMaterial material, int attackDamage, float attackSpeed, Settings settings) {
| |
− | super(material, attackDamage, attackSpeed, settings);
| |
− | }
| |
− | }
| |
− | </source>
| |
− | *CustomHoeItem.java
| |
− | <source lang = "java">
| |
− | package com.example.tool;
| |
− |
| |
− | import net.minecraft.item.HoeItem;
| |
− | import net.minecraft.item.ToolMaterial;
| |
− |
| |
− | public class CustomHoeItem extends HoeItem {
| |
− | public CustomHoeItem(ToolMaterial material, int attackDamage, float attackSpeed, Settings settings) {
| |
− | super(material, attackDamage, attackSpeed, settings);
| |
− | }
| |
− | }
| |
− | </source>
| |
− | *CustomPickaxeItem.java
| |
− | <source lang = "java">
| |
− | package com.example.tool;
| |
− |
| |
− | import net.minecraft.item.PickaxeItem;
| |
− | import net.minecraft.item.ToolMaterial;
| |
− |
| |
− | public class CustomPickaxeItem extends PickaxeItem {
| |
− | public CustomPickaxeItem (ToolMaterial material, int attackDamage, float attackSpeed, Settings settings) {
| |
− | super(material, attackDamage, attackSpeed, settings);
| |
| } | | } |
| } | | } |
| </source> | | </source> |