Jump to content

Recommended Posts

Posted (edited)

The answer is probably super obvious but how do I make a custom sword for Minecraft 1.15.2? I have most the code written out but I need help with one part of it. Here's my code: 

 

public static final RegistryObject<Item> KNIFE = ITEMS.register("knife", () -> new SwordItem(ItemTier.IRON, 4, 1.3F, ));

 

It tells me I need to put an Item.Properties builder but I don't know how to do that, and yes I did try and learn some Java (it was a Codecademy course). So what am I meant to put after 1.3F (which is the sword attack speed)?

Edited by ihavenoidea
Posted

Pro tip: if someone else already did it, go look at their code. All of vanilla is there for you to examine. There are only a couple of systems that Forge provides that aren't vanilla (such as capabilities) but for the most part the advice holds true. 

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.

Posted (edited)
Quote

Have you tried looking at vanilla items?

Since that didn't help, I decided to put Item.Properties() and the Item properties and my IDE doesn't give me any errors so I'll see if it works when I run Minecraft.

Edited by ihavenoidea
Posted
2 minutes ago, Draco18s said:

Pro tip: if someone else already did it, go look at their code. All of vanilla is there for you to examine. There are only a couple of systems that Forge provides that aren't vanilla (such as capabilities) but for the most part the advice holds true. 

Thanks for the tip, I also just tried looking at vanilla code and looking at Patty's More Stuff mod, but they used some custom features that they made themselves.

Posted
2 minutes ago, Beethoven92 said:

It was enough to look at the vanilla "Items" class, there you can find all the vanilla items and see how they are initialized.

Oh ok, I missed that class so many times and now I see how you are meant to initialize swords, thanks for telling me that.

Posted (edited)

Right click on (almost) anything -> References -> Find in Project

 

So if you did that on the SwordItem class, you'd find everywhere that the class itself was referenced....such as the Items class.

Edited by Draco18s

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.

Posted
2 minutes ago, Draco18s said:

Right click on (almost) anything -> References -> Find in Project

 

So if you did that on the SwordItem class, you'd find everywhere that the class itself was referenced....such as the Items class.

Thanks!

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.