Posted October 11, 201411 yr 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.
October 11, 201411 yr if I recall correctly it is set by the material of the pickaxe which determines how much damage it does.
October 11, 201411 yr 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 ?
October 13, 201411 yr 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.
October 13, 201411 yr 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... Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
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.