Item properties

Discussion in 'Coding' started by Poseidon_22, May 28, 2017.

  1. Poseidon_22

    Poseidon_22 Member

    Hello, I'm making a mod for 1.11.2 (newest version of minecraft) and I have some trouble with
    the item properties. I've searched on google on how to add it but for some reason it doesn't work.
    I've added a tool into the game and I would like it to be a shovel. How can I let the game recognize the item
    as a shovel? And how can I set the durability, attack damage, how fast it breaks blocks, etc..?
    Btw. I've never coded in Java before.

    So this is what I have already:

    package items;

    import com.Poseidon_22.Testmod.Reference;
    import com.Poseidon_22.Testmod.Testmod;

    import net.minecraft.item.Item;

    public class ItemSupershovel extends Item {

    public ItemSupershovel() {





    Thanks in advance!
  2. destrotroop

    destrotroop Developer Staff Member Developer

    Learning how do code Java is a good idea, before you start making a mod. Anyhooo, I know Python, and only a mediocre amount of Java.

    @ThatAbstractWolf might be able to help.
  3. Poseidon_22

    Poseidon_22 Member

    Ok, thanks for replying!
  4. MCSGaming

    MCSGaming Well-Known Member

    Try extending the class by ItemSpade(Maybe ItemShovel can't quite remember) instead of Item.
  5. Poseidon_22

    Poseidon_22 Member

    Yep, I've found it. But one more question; how to make a tool that can break dirt, stone and wood? Like the tool is a pickaxe, shovel and axe at the same time. Also how to spawn a lightingbolt on right click? There are many tutorials on it but I always get errors. And thanks for replying @MCSGaming :)
  6. ScottehBoeh

    ScottehBoeh Member

    To spawn a lightning bolt, you'll have to use the given function in the item class (onItemRightClick)

    From there you can fetch the player and world. Get the players lookVec, spawn a lightening bolt at the given location.
    Poseidon_22 and MCSGaming like this.
  7. Poseidon_22

    Poseidon_22 Member

    Wait.. could you type that in code? And thanks for helping me :)
  8. ScottehBoeh

    ScottehBoeh Member

    ... Learn Java before you start modding.
  9. destrotroop

    destrotroop Developer Staff Member Developer

    Isn't there a MultiTool class?
  10. ScottehBoeh

    ScottehBoeh Member

    Nope :p

Share This Page