Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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

  • Author
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!

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.