Jump to content

Create Shovel Item


Koque

Recommended Posts

Hey,

I'm trying to write some forge mods. I have experience with the Spigot API, but due , at my opinion, the bad documentation and tutorials, I have some problems.

I started with the tutorial by tcode2k16 and the forge documentation.

 

Now I want to create an Custom Shovel having the same stats like the iron shovel, just with other texture, name and recipe.

 

At first, I tried the following, but this didn't work, because I don't know which arguments are missing:

public static final RegistryObject<Item> MY_SHOVEL = ITEMS.register("my_shovel", () ->

            new ShovelItem(new Item.Properties().group(ItemGroup.TOOLS).addToolType(ToolType.SHOVEL, 2))

            );

 

I searched a lot, but didn't find anything beginner friendly helping me (my english  is not the best too xD ).

 

I would appreciate it, if someone could help with this problem or link some guides or a detailed documentation being up to date!

Link to comment
Share on other sites

You're missing an IItemTier, float attackDamage and a float attackSpeed, all of these things are basic Java and you do not need to ask about them. Please look at the constructor, unless you're blind it has everything you need, your IDE should even give you a warning and tell you what you didn't put into the constructor. In short, please learn basic Java before modding.

Edited by Novârch

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

Link to comment
Share on other sites

4 minutes ago, Koque said:

this didn't work

What exactly happened?

You can find all possible methods at net.minecraft.item.Item, in Properties inner class. Just looking through them bring me idea, that you need to specify maxStackSize or defaultMaxDamage.

Anyway, describe your problem

Everything said above may be absolutely wrong. No rights reserved.

Link to comment
Share on other sites

24 minutes ago, Novârch said:

please learn basic Java before modding.

I used Java over a year ago, but changed to Python, in addition  due to better Gradle support I changed from NetBeans to IntelliJ, so my Java knowledge is at the time only bit more than the basics.

 

23 minutes ago, Dzuchun said:

Anyway, describe your problem

The IDE tells me, there are 3 arguments missing, but nothing more. I couldn't find the Java Docs of the Forge API.

 

Quote

IItemTier, float attackDamage and a float attackSpeed

Thank you for the missing arguments.

Edited by Koque
Link to comment
Share on other sites

54 minutes ago, Koque said:

The IDE tells me, there are 3 arguments missing, but nothing more. I couldn't find the Java Docs of the Forge API.

So.... go open the class definition for the class you're trying to instantiate.

  • Thanks 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

5 hours ago, Draco18s said:

So.... go open the class definition for the class you're trying to instantiate.

Thank you for the tip, didn't know this is possible!

 

The thread is now closed for me.

Edited by Koque
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.