Jump to content

[1.14.3] [Solved] Some help with creating custom tools


Ahndrek Li'Cyri

Recommended Posts

Hello there.
I was trying to work on some custom tools, for starters a pickaxe, and i stumbled upon a... strange issue.
Hovering over it in my inventory shows a Attack Value of 76, and a Use Speed of 4.

Here's the code i'm using currently:
ModToolPickaxe.java

Spoiler

package ahndreklicyri.bsm.items;

import net.minecraft.item.IItemTier;
        import net.minecraft.item.ItemGroup;
        import net.minecraft.item.PickaxeItem;

public class ModToolPickaxe extends PickaxeItem {
    public ModToolPickaxe(String Name, IItemTier Tier,ItemGroup Group){
        super(Tier, Tier.getMaxUses(), 0, new Properties().group(Group));
        this.setRegistryName("bsm",Name);
    }
}

 

ItemStore.java

Spoiler

Setting up the Tier


public static IItemTier CopperTier = new IItemTier() {
        @Override
        public int getMaxUses() {
            return 75;
        }

        @Override
        public float getEfficiency() {
            return 5;
        }

        @Override
        public float getAttackDamage() {
            return 0;
        }

        @Override
        public int getHarvestLevel() {
            return 1;
        }

        @Override
        public int getEnchantability() {
            return 0;
        }

        @Override
        public Ingredient getRepairMaterial() {
            return null;
        }
    };

Creating the Item


//Tab is just my custom creative tab
public static ModToolPickaxe c_pickaxe = new ModToolPickaxe("copper_pickaxe",CopperTier,Tab);

 

Some help figuring out why it has a attack value of 76 would be nice, also how to set up the getRepairMaterial() part as well.

Unrelated issue, when held in the hand, it renders as normal item (see attached screenshot). In the Model JSON, is there a "item/pickaxe" or something?

 

 

 

Screenshot_2.png

Edited by Ahndrek Li'Cyri
Issue solved, Updated Title
Link to comment
Share on other sites

26 minutes ago, Ahndrek Li'Cyri said:

In the Model JSON, is there a "item/pickaxe" or something?

If you change the parent it should be fixed.

"parent": "item/handheld",

 

26 minutes ago, Ahndrek Li'Cyri said:

Hovering over it in my inventory shows a Attack Value of 76, and a Use Speed of 4.

You have set the attack value to maximum usage and the default attack speed of a diamond pickaxe is -2.8F i guess.

super(Tier, Tier.getMaxUses(), 0, new Properties().group(Group));
protected PickaxeItem(IItemTier tier, int attackDamageIn, float attackSpeedIn, Item.Properties builder){...}

 

I also would recommend you to create a toolmaterial enum which implements IItemTier for custom tool materials.

Edited by Skyriis
  • Thanks 1
Link to comment
Share on other sites

1 hour ago, Skyriis said:

If you change the parent it should be fixed.


"parent": "item/handheld",

 

You have set the attack value to maximum usage and the default attack speed of a diamond pickaxe is -2.8F i guess.


super(Tier, Tier.getMaxUses(), 0, new Properties().group(Group));

protected PickaxeItem(IItemTier tier, int attackDamageIn, float attackSpeedIn, Item.Properties builder){...}

 

I also would recommend you to create a toolmaterial enum which implements IItemTier for custom tool materials.

That fixed it, thanks! I couldn't accurately see what each field was because InteliJ was only showing each as "p_xXXXXXX_X_" instead of the correct names.
Anyways, thanks for the help!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.