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

Hi,

Sorry for asking such a silly question, but how can I dynamically set the "mining speed" and "mining level" for my custom pickaxe ?

What are the methods for setting them ?

 

Thanks.

  • Author

Thanks for the reply.

However, I can't seem to find any methods that sets the 'material' of an item.

 

I figured out the setHarvestLevel, but that only sets if the block broken will drop an item...

How do I set the actual mining speed of the pickaxe ?

  • Author

Alright, so after digging through the minecraft source code, I found out you can modify the tool's mining speed by overriding the function func_150893_a and returning a float value. That does work if I hard-code a value into the return line. Seems like minecraft only checks the function once so even if I'm doing some logic checking and returning a different value during runtime doesn't affect the mining speed....

 

Anyone have any idea on how to change the mining speed during runtime ? Thanks in advance.

just add in yours main mod class:

public static ToolMaterial material = EnumHelper.addToolMaterial("materialName", harvestLevel, maxUses, digSpeed, damage, enchantability);

and in registering pickaxe

= new MyPickaxe(material)

in MyPickaxe

public MyPickaxe(ToolMaterial material) {
	super(material);
}

and if you haven't, add after class MyPickaxe

extends ItemPickaxe

 

so total code:

main mod class

@Mod(modid = "mymod" ,name="My mod",version = "alpha 1.1", )
public class BaseMyMod
{   
public static Item pickaxe;
@EventHandler
public void init(FMLInitializationEvent event)
{ 
	pickaxe = new Pickaxe(material);
GameRegistry.registerItem(pickaxe, "pickaxe");
}
public static ToolMaterial material = EnumHelper.addToolMaterial("material", 2, 500, 20, 15, ;
}

pickaxe class:

public class MyPickaxe extends ItemPickaxe{

public MyPickaxe(ToolMaterial material) {
	super(material);
}
}

after in this class you can register more pickaxe with different tool materials and not whoring about creating more classes and fixing dig speed...

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.